2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-28 08:54:51 +00:00

fhemweb.js/svg.js: add contentDocument (Forum )

git-svn-id: https://svn.fhem.de/fhem/trunk@13303 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-02-01 20:55:00 +00:00
parent bc355ee19e
commit 6cf0621f7d
2 changed files with 20 additions and 8 deletions
fhem/www/pgm2

@ -842,13 +842,14 @@ FW_longpoll()
var retry;
if(filter == "") {
$("embed").each(function() {
if($(this.getSVGDocument()).length == 0 && !retry &&
filter != ".*" && --embedLoadRetry > 0) {
if(FW_getSVG(this) == undefined && !retry &&
filter != ".*" && --embedLoadRetry > 0) {
retry = 1;
setTimeout(FW_longpoll, 100);
return;
}
if($(this.getSVGDocument()).find("svg[flog]").attr("flog"))
if($(FW_getSVG(this)).find("svg[flog]").attr("flog"))
filter=".*";
});
if(retry)
@ -1510,9 +1511,19 @@ scriptAttribute(sname)
}
/*************** SCRIPT LOAD FUNCTIONS END **************/
function print_call_stack() {
function
print_call_stack() {
var stack = new Error().stack;
console.log("PRINTING CALL STACK");
console.log( stack );
}
function
FW_getSVG(emb)
{
if(emb.contentDocument)
return emb.contentDocument;
if(typeof emb.getSVGDocument == "function")
return emb.getSVGDocument();
return undefined;
}

@ -350,7 +350,7 @@ svg_init(par) // also called directly from perl, in race condition
$("embed").each(function(){
var e = this;
var src = $(e).attr("src");
var ed = e.getSVGDocument();
var ed = FW_getSVG(e);
if(src.indexOf("SVG_showLog") < 0 || !ed)
return;
var sTag = $("svg", ed)[0]; // "not well-formed" warning in FireFox
@ -380,11 +380,12 @@ 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++) {
if(typeof embArr[i].getSVGDocument != "function")
continue;
var svg = embArr[i].getSVGDocument();
var svg = FW_getSVG(embArr[i]);
if(!svg || !svg.firstChild || !svg.firstChild.nextSibling)
continue;
if(svg.contentType != "image/svg+xml" &&
typeof embArr[i].getSVGDocument != "function")
continue;
svg = svg.firstChild.nextSibling;
var flog = svg.getAttribute("flog");
if(!flog)