mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
01_FHEMWEB.pm/console.js: add htmlInEventMonitor attribute (Forum #139453)
git-svn-id: https://svn.fhem.de/fhem/trunk@29254 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
93c11129d1
commit
1b63fdf0c6
@ -177,6 +177,7 @@ FHEMWEB_Initialize($)
|
||||
hiddengroupRegexp
|
||||
hiddenroom
|
||||
hiddenroomRegexp
|
||||
htmlInEventMonitor:1,0
|
||||
httpHeader
|
||||
iconPath
|
||||
jsLog:1,0
|
||||
@ -1256,6 +1257,7 @@ FW_dataAttr()
|
||||
addParam($FW_wname, "addHtmlTitle", 1).
|
||||
addParam($FW_wname, "styleData", "").
|
||||
addParam($FW_wname, "hiddenroom", "").
|
||||
addParam($FW_wname, "htmlInEventMonitor", 0). #139453
|
||||
addParam("global", "language", "EN").
|
||||
"data-availableJs='$FW_fhemwebjs' ".
|
||||
"data-webName='$FW_wname' ";
|
||||
@ -4126,6 +4128,12 @@ FW_log($$)
|
||||
</li>
|
||||
<br>
|
||||
|
||||
<a id="FHEMWEB-attr-htmlInEventMonitor"></a>
|
||||
<li>htmlInEventMonitor<br>
|
||||
if set to 1, text enclosed in <html>...</html> will not be
|
||||
escaped in the event monitor.
|
||||
</li>
|
||||
<br>
|
||||
|
||||
<a id="FHEMWEB-attr-HTTPS"></a>
|
||||
<li>HTTPS<br>
|
||||
@ -4988,6 +4996,13 @@ FW_log($$)
|
||||
</li>
|
||||
<br>
|
||||
|
||||
<a id="FHEMWEB-attr-htmlInEventMonitor"></a>
|
||||
<li>htmlInEventMonitor<br>
|
||||
falls 1, Text in <html>...</html> wird im Event Monitor als
|
||||
HTML interpretiert.
|
||||
</li>
|
||||
<br>
|
||||
|
||||
<a id="FHEMWEB-attr-HTTPS"></a>
|
||||
<li>HTTPS<br>
|
||||
Ermöglicht HTTPS Verbindungen. Es werden die Perl Module
|
||||
|
@ -3,13 +3,14 @@ FW_version["console.js"] = "$Id$";
|
||||
|
||||
var consConn;
|
||||
var consName="#console";
|
||||
var htmlInEventMonitor;
|
||||
|
||||
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()
|
||||
@ -26,22 +27,32 @@ cons_closeConn()
|
||||
function
|
||||
consAppender(new_content)
|
||||
{
|
||||
var isHtml = htmlInEventMonitor && new_content.match(/<html>[\s\S]*<\/html>/);
|
||||
|
||||
// Extract the FHEM-Log, to avoid escaping its formatting (Forum #104842)
|
||||
var logContent = "";
|
||||
var rTab = {'<':'<', '>':'>',' ':' ', '\n':'<br>' };
|
||||
new_content = new_content.replace(
|
||||
/(<div class='fhemlog'>)([\s\S]*?)(<\/div>)/gm,
|
||||
|
||||
function
|
||||
doEscape(inStr)
|
||||
{
|
||||
let r = isHtml ? inStr :
|
||||
inStr.replace(/[<> \n]/g, function(a){return rTab[a]});
|
||||
return isHtml ? inStr :
|
||||
inStr.replace(/[<> \n]/g, function(a){return rTab[a]});
|
||||
}
|
||||
|
||||
new_content = new_content
|
||||
.replace(/(<div class='fhemlog'>)([\s\S]*?)(<\/div>)/gm,
|
||||
function(all, div1, msg, div2) {
|
||||
logContent += div1+
|
||||
msg.replace(/[<> \n]/g, function(a){return rTab[a]})+
|
||||
div2;
|
||||
logContent += div1+msg+div2; // msg is already escaped
|
||||
return "";
|
||||
});
|
||||
|
||||
var isTa = $(consName).is("textarea"); // 102773
|
||||
var ncA = new_content.split(/<br>[\r\n]/);
|
||||
for(var i1=0; i1<ncA.length; i1++)
|
||||
ncA[i1] = ncA[i1].replace(/[<> ]/g, function(a){return rTab[a]});
|
||||
ncA[i1] = doEscape(ncA[i1]);
|
||||
$(consName).append(logContent+ncA.join(isTa?"\n":"<br>"));
|
||||
}
|
||||
|
||||
@ -217,6 +228,8 @@ consStart()
|
||||
}
|
||||
});
|
||||
consAddRegexpPart();
|
||||
|
||||
htmlInEventMonitor = $("body").attr("data-htmlineventmonitor") == 1;
|
||||
}
|
||||
|
||||
function
|
||||
|
Loading…
Reference in New Issue
Block a user