2
0
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:
rudolfkoenig 2014-02-10 20:37:16 +00:00
parent 04ad32dbf2
commit d676669d36

View File

@ -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 **************/