fhemweb.js: make #FHEMWEB: eval more flexible (Forum #87583)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@16697 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-05-07 15:41:00 +00:00
parent 45936a80d5
commit 6ea22cf1ca

View File

@ -989,10 +989,9 @@ FW_doUpdate(evt)
if(d.length != 3) if(d.length != 3)
continue; continue;
if( d[0].match(/^#FHEMWEB:/) ) { function
eval(d[1]); setValue(d) // is Callable from eval below
{
} else {
$("[informId='"+d[0]+"']").each(function(){ $("[informId='"+d[0]+"']").each(function(){
if(this.setValueFn) { // change the select/etc value if(this.setValueFn) { // change the select/etc value
this.setValueFn(d[1].replace(/\n/g, '\u2424')); this.setValueFn(d[1].replace(/\n/g, '\u2424'));
@ -1016,6 +1015,13 @@ FW_doUpdate(evt)
}); });
} }
if( d[0].match(/^#FHEMWEB:/) ) {
eval(d[1]);
} else {
setValue(d);
}
// updateLine is deprecated, use setValueFn // updateLine is deprecated, use setValueFn
for(var w in FW_widgets) for(var w in FW_widgets)
if(FW_widgets[w].updateLine && !FW_widgets[w].second) if(FW_widgets[w].updateLine && !FW_widgets[w].second)