mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-29 17:37:09 +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 consLastIndex = 0;
|
||||
var withLog = 0;
|
||||
var mustScroll = 1;
|
||||
|
||||
log("Console is opening");
|
||||
|
||||
function
|
||||
@ -27,9 +29,11 @@ consUpdate()
|
||||
log("Console Rcvd: "+new_content);
|
||||
if(new_content.indexOf('<') != 0)
|
||||
new_content = new_content.replace(/ /g, " ");
|
||||
$("#console")
|
||||
.append(new_content)
|
||||
.scrollTop($("#console")[0].scrollHeight);
|
||||
|
||||
$("#console").append(new_content);
|
||||
|
||||
if(mustScroll)
|
||||
$("#console").scrollTop($("#console")[0].scrollHeight);
|
||||
}
|
||||
|
||||
function
|
||||
@ -105,6 +109,22 @@ consStart()
|
||||
withLog = ($("#eventWithLog").is(':checked') ? 1 : 0);
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user