mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-28 15:04:51 +00:00
fhemweb.js/svg.js: add contentDocument (Forum #66122)
git-svn-id: https://svn.fhem.de/fhem/trunk@13303 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
bc355ee19e
commit
6cf0621f7d
@ -842,13 +842,14 @@ FW_longpoll()
|
|||||||
var retry;
|
var retry;
|
||||||
if(filter == "") {
|
if(filter == "") {
|
||||||
$("embed").each(function() {
|
$("embed").each(function() {
|
||||||
if($(this.getSVGDocument()).length == 0 && !retry &&
|
if(FW_getSVG(this) == undefined && !retry &&
|
||||||
filter != ".*" && --embedLoadRetry > 0) {
|
filter != ".*" && --embedLoadRetry > 0) {
|
||||||
retry = 1;
|
retry = 1;
|
||||||
setTimeout(FW_longpoll, 100);
|
setTimeout(FW_longpoll, 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if($(this.getSVGDocument()).find("svg[flog]").attr("flog"))
|
|
||||||
|
if($(FW_getSVG(this)).find("svg[flog]").attr("flog"))
|
||||||
filter=".*";
|
filter=".*";
|
||||||
});
|
});
|
||||||
if(retry)
|
if(retry)
|
||||||
@ -1510,9 +1511,19 @@ scriptAttribute(sname)
|
|||||||
}
|
}
|
||||||
/*************** SCRIPT LOAD FUNCTIONS END **************/
|
/*************** SCRIPT LOAD FUNCTIONS END **************/
|
||||||
|
|
||||||
function print_call_stack() {
|
function
|
||||||
|
print_call_stack() {
|
||||||
var stack = new Error().stack;
|
var stack = new Error().stack;
|
||||||
console.log("PRINTING CALL STACK");
|
console.log("PRINTING CALL STACK");
|
||||||
console.log( 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(){
|
$("embed").each(function(){
|
||||||
var e = this;
|
var e = this;
|
||||||
var src = $(e).attr("src");
|
var src = $(e).attr("src");
|
||||||
var ed = e.getSVGDocument();
|
var ed = FW_getSVG(e);
|
||||||
if(src.indexOf("SVG_showLog") < 0 || !ed)
|
if(src.indexOf("SVG_showLog") < 0 || !ed)
|
||||||
return;
|
return;
|
||||||
var sTag = $("svg", ed)[0]; // "not well-formed" warning in FireFox
|
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
|
// if matches, refresh the SVG by removing and readding the embed tag
|
||||||
var embArr = document.getElementsByTagName("embed");
|
var embArr = document.getElementsByTagName("embed");
|
||||||
for(var i = 0; i < embArr.length; i++) {
|
for(var i = 0; i < embArr.length; i++) {
|
||||||
if(typeof embArr[i].getSVGDocument != "function")
|
var svg = FW_getSVG(embArr[i]);
|
||||||
continue;
|
|
||||||
var svg = embArr[i].getSVGDocument();
|
|
||||||
if(!svg || !svg.firstChild || !svg.firstChild.nextSibling)
|
if(!svg || !svg.firstChild || !svg.firstChild.nextSibling)
|
||||||
continue;
|
continue;
|
||||||
|
if(svg.contentType != "image/svg+xml" &&
|
||||||
|
typeof embArr[i].getSVGDocument != "function")
|
||||||
|
continue;
|
||||||
svg = svg.firstChild.nextSibling;
|
svg = svg.firstChild.nextSibling;
|
||||||
var flog = svg.getAttribute("flog");
|
var flog = svg.getAttribute("flog");
|
||||||
if(!flog)
|
if(!flog)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user