2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

console.js: quote html text (Forum #102595)

git-svn-id: https://svn.fhem.de/fhem/trunk@19907 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-07-28 18:22:09 +00:00
parent e982da7de1
commit 5753e8a6ae

View File

@ -2,13 +2,14 @@
FW_version["console.js"] = "$Id$";
var consConn;
var debug;
var consFilter, oldFilter, consFType="";
var consLastIndex = 0;
var withLog = 0;
var mustScroll = 1;
log("Event monitor is starting");
log("Event monitor is starting!");
function
cons_closeConn()
@ -59,8 +60,15 @@ consUpdate(evt)
if(new_content == undefined || new_content.length == 0)
return;
log("Console Rcvd: "+new_content);
if(new_content.indexOf('<') != 0)
new_content = new_content.replace(/ /g, "&nbsp;");
var ma = new_content.match(/(.*)<br>[\r\n]+$/); // Strange stuff.
if(ma) {
new_content = ma[1];
if(new_content.indexOf('<') != 0) {
var rTab = {'<':'&lt;', '>':'&gt;',' ':'&nbsp;'};
new_content = new_content.replace(/[<> ]/g, function(a){return rTab[a]});
}
new_content += '<br>';
}
$("#console").append(new_content);