2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-28 11:01:59 +00:00

fhemweb.js: call FW_replaceWidget for HTML in status-change (Forum #126680)

git-svn-id: https://svn.fhem.de/fhem/trunk@25807 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2022-03-10 17:51:45 +00:00
parent b320766827
commit a037878b9e

View File

@ -1112,6 +1112,10 @@ FW_doUpdate(evt)
var retryTime = 5000; var retryTime = 5000;
var now = new Date()/1000; var now = new Date()/1000;
// d: array
// d[0]: informid
// d[1]: if the informid Widget has setValueFn, arg for this
// d[2]: else replace the html with this
function function
setValue(d) // is Callable from eval below setValue(d) // is Callable from eval below
{ {
@ -1124,13 +1128,19 @@ FW_doUpdate(evt)
d[2] = '<html><pre>'+d[2]+'</pre></html>'; d[2] = '<html><pre>'+d[2]+'</pre></html>';
var ma = /^<html>([\s\S]*)<\/html>/.exec(d[2]); var ma = /^<html>([\s\S]*)<\/html>/.exec(d[2]);
if(!d[0].match("-")) // not a reading if(!d[0].match("-")) { // not a reading
$(this).html(d[2]); $(this).html(d[2]);
else if(ma) FW_replaceWidgets($(this));
} else if(ma) {
$(this).html(ma[1]); $(this).html(ma[1]);
else FW_replaceWidgets($(this));
} else {
$(this).text(d[2]); $(this).text(d[2]);
}
if(d[0].match(/-ts$/)) // timestamps if(d[0].match(/-ts$/)) // timestamps
$(this).addClass('changed'); $(this).addClass('changed');
$(this).find("a").each(function() { FW_replaceLink(this) }); $(this).find("a").each(function() { FW_replaceLink(this) });
@ -1206,6 +1216,7 @@ FW_doUpdate(evt)
} else { } else {
setValue(d); setValue(d);
} }
// updateLine is deprecated, use setValueFn // updateLine is deprecated, use setValueFn