mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-13 17:26:34 +00:00
fhemweb.js: replace webCmd a/href links in longpoll mode with XHR calls.
git-svn-id: https://svn.fhem.de/fhem/trunk@4878 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
04ad32dbf2
commit
d676669d36
@ -124,10 +124,26 @@ FW_longpoll()
|
||||
FW_pollConn.send(null);
|
||||
}
|
||||
|
||||
function
|
||||
FW_replaceLinks()
|
||||
{
|
||||
var elArr = document.querySelectorAll("a[href]");
|
||||
for(var i1=0; i1< elArr.length; i1++) {
|
||||
var a = elArr[i1];
|
||||
var ma = a.getAttribute("href").match(/^(.*\?)(cmd[^=]*=.*)$/);
|
||||
if(ma == null || ma.length == 0 || ma[2].match(/=style/))
|
||||
continue;
|
||||
a.removeAttribute("href");
|
||||
a.setAttribute("onclick", "FW_cmd('"+ma[1]+"XHR=1&"+ma[2]+"')");
|
||||
a.setAttribute("style", "cursor:pointer");
|
||||
}
|
||||
}
|
||||
|
||||
function
|
||||
FW_delayedStart()
|
||||
{
|
||||
setTimeout("FW_longpoll()", 100);
|
||||
FW_replaceLinks();
|
||||
}
|
||||
/*************** LONGPOLL END **************/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user