mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-13 23:36:37 +00:00
fhemweb.js: moved setValue, hope is iPad1 friendly, could not test it. (Forum #87687)
git-svn-id: https://svn.fhem.de/fhem/trunk@16727 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
bb26710882
commit
4a5f443cba
@ -928,6 +928,32 @@ FW_doUpdate(evt)
|
||||
var retryTime = 5000;
|
||||
var now = new Date()/1000;
|
||||
|
||||
function
|
||||
setValue(d) // is Callable from eval below
|
||||
{
|
||||
$("[informId='"+d[0]+"']").each(function(){
|
||||
if(this.setValueFn) { // change the select/etc value
|
||||
this.setValueFn(d[1].replace(/\n/g, '\u2424'));
|
||||
|
||||
} else {
|
||||
if(d[2].match(/\n/) && !d[2].match(/<.*>/)) // format multiline
|
||||
d[2] = '<html><pre>'+d[2]+'</pre></html>';
|
||||
|
||||
var ma = /^<html>([\s\S]*)<\/html>$/.exec(d[2]);
|
||||
if(!d[0].match("-")) // not a reading
|
||||
$(this).html(d[2]);
|
||||
else if(ma)
|
||||
$(this).html(ma[1]);
|
||||
else
|
||||
$(this).text(d[2]);
|
||||
|
||||
if(d[0].match(/-ts$/)) // timestamps
|
||||
$(this).addClass('changed');
|
||||
$(this).find("a").each(function() { FW_replaceLink(this) });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// iOS closes HTTP after 60s idle, websocket after 240s idle
|
||||
if(now-FW_lastDataTime > 59) {
|
||||
errstr="";
|
||||
@ -989,32 +1015,6 @@ FW_doUpdate(evt)
|
||||
if(d.length != 3)
|
||||
continue;
|
||||
|
||||
function
|
||||
setValue(d) // is Callable from eval below
|
||||
{
|
||||
$("[informId='"+d[0]+"']").each(function(){
|
||||
if(this.setValueFn) { // change the select/etc value
|
||||
this.setValueFn(d[1].replace(/\n/g, '\u2424'));
|
||||
|
||||
} else {
|
||||
if(d[2].match(/\n/) && !d[2].match(/<.*>/)) // format multiline
|
||||
d[2] = '<html><pre>'+d[2]+'</pre></html>';
|
||||
|
||||
var ma = /^<html>([\s\S]*)<\/html>$/.exec(d[2]);
|
||||
if(!d[0].match("-")) // not a reading
|
||||
$(this).html(d[2]);
|
||||
else if(ma)
|
||||
$(this).html(ma[1]);
|
||||
else
|
||||
$(this).text(d[2]);
|
||||
|
||||
if(d[0].match(/-ts$/)) // timestamps
|
||||
$(this).addClass('changed');
|
||||
$(this).find("a").each(function() { FW_replaceLink(this) });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if( d[0].match(/^#FHEMWEB:/) ) {
|
||||
eval(d[1]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user