mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-30 05:57:08 +00:00
console.js: autoscroll patch by Markus (Forum #51897)
git-svn-id: https://svn.fhem.de/fhem/trunk@11200 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a492851539
commit
34e089ff43
@ -3,6 +3,8 @@ var consConn;
|
|||||||
var consFilter, oldFilter;
|
var consFilter, oldFilter;
|
||||||
var consLastIndex = 0;
|
var consLastIndex = 0;
|
||||||
var withLog = 0;
|
var withLog = 0;
|
||||||
|
var mustScroll = 1;
|
||||||
|
|
||||||
log("Console is opening");
|
log("Console is opening");
|
||||||
|
|
||||||
function
|
function
|
||||||
@ -27,9 +29,11 @@ consUpdate()
|
|||||||
log("Console Rcvd: "+new_content);
|
log("Console Rcvd: "+new_content);
|
||||||
if(new_content.indexOf('<') != 0)
|
if(new_content.indexOf('<') != 0)
|
||||||
new_content = new_content.replace(/ /g, " ");
|
new_content = new_content.replace(/ /g, " ");
|
||||||
$("#console")
|
|
||||||
.append(new_content)
|
$("#console").append(new_content);
|
||||||
.scrollTop($("#console")[0].scrollHeight);
|
|
||||||
|
if(mustScroll)
|
||||||
|
$("#console").scrollTop($("#console")[0].scrollHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
function
|
function
|
||||||
@ -105,6 +109,22 @@ consStart()
|
|||||||
withLog = ($("#eventWithLog").is(':checked') ? 1 : 0);
|
withLog = ($("#eventWithLog").is(':checked') ? 1 : 0);
|
||||||
consFill();
|
consFill();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#console").scroll(function() { // autoscroll check
|
||||||
|
if($("#console")[0].scrollHeight - $("#console").scrollTop() ==
|
||||||
|
$("#console").outerHeight()) {
|
||||||
|
if(!mustScroll) {
|
||||||
|
mustScroll = 1;
|
||||||
|
log("Console autoscroll restarted");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(mustScroll) {
|
||||||
|
mustScroll = 0;
|
||||||
|
log("Console autoscroll stopped");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = consStart;
|
window.onload = consStart;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user