2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00
fhem-mirror/fhem/www/pgm2/fhemweb_svg.js
2014-01-10 14:33:50 +00:00

28 lines
862 B
JavaScript

function
FW_svgUpdateDevs(devs)
{
// if matches, refresh the SVG by removing and readding the embed tag
var embArr = document.getElementsByTagName("embed");
for(var i = 0; i < embArr.length; i++) {
var svg = embArr[i].getSVGDocument();
if(!svg || !svg.firstChild || !svg.firstChild.nextSibling)
continue;
var flog = svg.firstChild.nextSibling.getAttribute("flog");
for(var j=0; j < devs.length; j++) {
if(flog !== null && flog.match(" "+devs[j]+" ")) {
var e = embArr[i];
var newE = document.createElement("embed");
for(var k=0; k<e.attributes.length; k++)
newE.setAttribute(e.attributes[k].name, e.attributes[k].value);
e.parentNode.insertBefore(newE, e);
e.parentNode.removeChild(e);
break;
}
}
}
}
FW_widgets['SVG'] = {
updateDevs:FW_svgUpdateDevs,
};