From 7de9a742aca856df16c8e029659b2bc50d20fa02 Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Sun, 28 Jul 2019 18:22:09 +0000 Subject: [PATCH] console.js: quote html text (Forum #102595) git-svn-id: https://svn.fhem.de/fhem/trunk@19907 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/www/pgm2/console.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fhem/www/pgm2/console.js b/fhem/www/pgm2/console.js index 77d569f27..dc7bb703f 100644 --- a/fhem/www/pgm2/console.js +++ b/fhem/www/pgm2/console.js @@ -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, " "); + var ma = new_content.match(/(.*)
[\r\n]+$/); // Strange stuff. + if(ma) { + new_content = ma[1]; + if(new_content.indexOf('<') != 0) { + var rTab = {'<':'<', '>':'>',' ':' '}; + new_content = new_content.replace(/[<> ]/g, function(a){return rTab[a]}); + } + new_content += '
'; + } $("#console").append(new_content);