mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 10:46:53 +00:00
console.js: some changes (Forum #42258)
git-svn-id: https://svn.fhem.de/fhem/trunk@9694 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d4ddb81a98
commit
949d511755
@ -1929,7 +1929,8 @@ FW_style($$)
|
||||
"</script>";
|
||||
FW_pO "<div id=\"content\">";
|
||||
my $filter = ($a[2] && $a[2] ne "1") ? $a[2] : ".*";
|
||||
FW_pO "Events (Filter:<a href=\"#\" id=\"eventFilter\">$filter</a>):<br>\n";
|
||||
FW_pO "Events (Filter:<a href=\"#\" id=\"eventFilter\">$filter</a>)".
|
||||
" <a href=\"#\" id=\"eventReset\">[Reset]</a>:<br>\n";
|
||||
FW_pO "<div id=\"console\"></div>";
|
||||
FW_pO "</div>";
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
var consConn;
|
||||
|
||||
var isFF = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1);
|
||||
var consFilter, consTxt;
|
||||
|
||||
var consFilter, oldFilter;
|
||||
var consLastIndex = 0;
|
||||
log("Console is opening");
|
||||
|
||||
function
|
||||
@ -16,9 +15,17 @@ consUpdate()
|
||||
|
||||
if(consConn.readyState != 3)
|
||||
return;
|
||||
|
||||
var len = consConn.responseText.length;
|
||||
|
||||
if (consLastIndex == len) // No new data
|
||||
return;
|
||||
|
||||
var new_content = consConn.responseText.substring(consLastIndex, len);
|
||||
consLastIndex = len;
|
||||
|
||||
log("Console Rcvd: "+new_content);
|
||||
$("#console")
|
||||
.html(consTxt+consConn.responseText)
|
||||
.append(new_content.replace(/ /g, " "))
|
||||
.scrollTop($("#console")[0].scrollHeight);
|
||||
}
|
||||
|
||||
@ -39,6 +46,11 @@ consFill()
|
||||
consConn.open("GET", query, true);
|
||||
consConn.onreadystatechange = consUpdate;
|
||||
consConn.send(null);
|
||||
consLastIndex = 0;
|
||||
if(oldFilter != consFilter) // only clear, when filter changes
|
||||
$("#console").html("");
|
||||
|
||||
oldFilter = consFilter;
|
||||
}
|
||||
|
||||
function
|
||||
@ -49,9 +61,14 @@ consStart()
|
||||
consFilter = $("a#eventFilter").html();
|
||||
if(consFilter == undefined)
|
||||
consFilter = ".*";
|
||||
consTxt = el.innerHTML;
|
||||
oldFilter = consFilter;
|
||||
setTimeout("consFill()", 1000);
|
||||
|
||||
$("a#eventReset").click(function(evt){ // Event Monitor Reset
|
||||
log("Console resetted by user");
|
||||
$("#console").html("");
|
||||
});
|
||||
|
||||
$("a#eventFilter").click(function(evt){ // Event-Filter Dialog
|
||||
$('body').append(
|
||||
'<div id="evtfilterdlg">'+
|
||||
@ -70,7 +87,6 @@ consStart()
|
||||
consFilter = val ? val : ".*";
|
||||
$(this).dialog('close');
|
||||
$("a#eventFilter").html(consFilter);
|
||||
$("#console").html(consTxt);
|
||||
consFill();
|
||||
}}]
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user