diff options
Diffstat (limited to 'itjs')
-rw-r--r-- | itjs/boot.js | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/itjs/boot.js b/itjs/boot.js index 78d1fd1..a0ec24f 100644 --- a/itjs/boot.js +++ b/itjs/boot.js @@ -1,6 +1,6 @@ // $Id$ -var it_boot_status = ""; +var it_boot_status = "boot"; var it_panictimer = window.setTimeout("it_panic(it_boot_status)", 31337); var it_catcherrstart = new Date().getTime(); @@ -34,7 +34,9 @@ function it_boot_addparam(url, param) function it_panic(msg) { - window.setTimeout("document.location.href = it_boot_addparam(document.location.href, 'static=" + msg + "')", 500); + if (!document.location.href.match(/[?&]static=/)) // Avoid loop + window.setTimeout("document.location.href = it_boot_addparam(document.location.href, 'static=" + msg + "')", 500); + return it_catcherr('panic ' + msg, '-', -1); } @@ -47,7 +49,12 @@ function it_boot_report(msg, file, line, error) new Image().src = "/itjs/error.gif/" + escape(msg) + "|" + escape(file) + "|" + line + "|" + (new Date().getTime() - it_catcherrstart) + "|" + escape(error); } -function it_boot(file, isretry) +function it_boot_checkcss(style, key, value) +{ + return navigator.userAgent.match(/konqueror/i) || (style && style.getPropertyValue && (style.getPropertyValue(key) == value)); +} + +function it_boot_init() { window.it_domtimer = null; var konqueror = navigator.userAgent.match(/konqueror/i); @@ -55,12 +62,12 @@ function it_boot(file, isretry) var dom = doc && (dom = document.getElementById('it_boot_dom')); // HTML has been rendered var view = dom && doc.defaultView; // We can check if stylesheet is active var style = view && view.getComputedStyle && view.getComputedStyle(dom, ''); - var css = style && style.getPropertyValue && ((style.getPropertyValue("visibility") == "hidden") || konqueror); // CSS active (inline style on tag) - var stylesheet = style && style.getPropertyValue && ((style.getPropertyValue("display") == "none") || konqueror); // External stylesheet loaded + var css = window.it_boot_checkcss(style, "visibility", "hidden"); // CSS active (inline style on tag) + var stylesheet = window.it_boot_checkcss(style, "display", "none"); // External stylesheet loaded - if (!(doc || !(it_boot_status = "doc")) || !(dom || !(it_boot_status = "dom")) || (style && (style.length > 0) && !(stylesheet || !(it_boot_status = "stylesheet")))) + if (!(doc || !(it_boot_status = "doc")) || !(dom || !(it_boot_status = "dom")) || (style && !(stylesheet || !(it_boot_status = "stylesheet")))) { - window.it_domtimer = window.setTimeout("it_boot('" + file + "')" , 42); + window.it_domtimer = window.setTimeout("it_boot_init()" , 42); if (style && !css) it_panic("css"); @@ -68,6 +75,12 @@ function it_boot(file, isretry) return; } + window.clearTimeout(window.it_panictimer); + window.it_boot_start(); +} + +function it_boot(file, isretry) +{ try { var loader = new XMLHttpRequest(); @@ -97,7 +110,7 @@ function it_boot(file, isretry) if (data.code.length == data.len) { - var code = "try {" + data.code + ";window.it_boot_init()} catch (e) { it_boot_report('Load error', '-', -1, e); }"; // Wrapped in try/catch as Konqueror does not support window.onerror + var code = "try {" + data.code + "} catch (e) { it_boot_report('Load error', '-', -1, e); };window.it_boot_init()"; // Wrapped in try/catch as Konqueror does not support window.onerror isretry = true; // No further retry after this point if (window.execScript) |