summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas BrĂ¼derli2007-08-08 14:54:51 +0000
committerThomas BrĂ¼derli2007-08-08 14:54:51 +0000
commit1a413655f0b1b717d568b165c5b72e14575b75f9 (patch)
tree1c8c143b618c359d421cd3e38ec5f9d65e281254
parent983823c499ab3aea81298a8284dbb8d28b4a1b1b (diff)
downloaditools-1a413655f0b1b717d568b165c5b72e14575b75f9.tar.gz
itools-1a413655f0b1b717d568b165c5b72e14575b75f9.tar.bz2
itools-1a413655f0b1b717d568b165c5b72e14575b75f9.zip
Updated it_boot
-rw-r--r--itjs.php13
-rw-r--r--itjs/boot.js35
2 files changed, 15 insertions, 33 deletions
diff --git a/itjs.php b/itjs.php
index c1d8604..3cd2f47 100644
--- a/itjs.php
+++ b/itjs.php
@@ -40,16 +40,11 @@ else if (!ereg('\.html$', $file))
if ($checksum != $_SERVER['HTTP_IF_NONE_MATCH'])
{
- if ($_REQUEST['init'])
- $data .= "window.it_boot_init();";
-
if ($_REQUEST['boot'])
- {
- $data = itjs::strip($data);
- echo itjs::serialize(array('code' => $data, 'len' => strlen($data)));
- }
- else
- echo itjs::strip($data);
+ $data = preg_replace('/([\xa0-\xff])/e', 'sprintf("\\u%04x", ord("\\1"))', $data) . "window.it_boot_init();";
+
+ $data = itjs::strip($data);
+ echo $data;
}
else
header("HTTP/1.0 304 Not Modified");
diff --git a/itjs/boot.js b/itjs/boot.js
index 46c9dc5..cf28518 100644
--- a/itjs/boot.js
+++ b/itjs/boot.js
@@ -40,7 +40,6 @@ function it_panic(msg)
return it_catcherr('panic ' + msg, '-', -1);
}
-
function it_boot_report(msg, file, line, error)
{
window.clearTimeout(window.it_domtimer);
@@ -95,7 +94,7 @@ function it_boot(file, isretry)
if (loader)
{
- loader.open("GET", it_boot_addparam(file, "boot=1" + (isretry ? "&retry=1&t="+new Date().getTime() : "")));
+ loader.open("GET", it_boot_addparam(file, "boot=1" + (isretry ? "&retry=1" : "")));
loader.onreadystatechange = function()
{
var error = "";
@@ -104,28 +103,16 @@ function it_boot(file, isretry)
{
if (loader.status < 400) // Opera gives back 304 if from cache
{
- try
+ if (loader.responseText.length && loader.responseText.lastIndexOf('it_boot_init()') > 0)
{
- var data = eval("(" + loader.responseText + ")");
-
- if (data.code.length == data.len)
- {
- 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)
- window.execScript(code, "javascript"); // IE work-around to get script executed in global scope
- else
- window.setTimeout(code, 0); // Standard compliant version
- }
+ var code = "try {" + loader.responseText + "} catch (e) { it_boot_report('Script exec error', '-', -1, e); }"; // Wrapped in try/catch as Konqueror does not support window.onerror
+ if (window.execScript)
+ window.execScript(code, "javascript"); // IE work-around to get script executed in global scope
else
- error = "Length mismatch " + data.code.length + " != " + data.len;
- }
- catch (e)
- {
- for (i in e)
- error += i + "=" + e[i] + ";";
+ window.setTimeout(code, 0); // Standard compliant version
}
+ else
+ error = "Incomplete script load @ status " + loader.status;
}
else
error = loader.statusText;
@@ -146,12 +133,12 @@ function it_boot(file, isretry)
var doc = document;
var dom = doc && (dom = doc.getElementById('it_boot_dom')); // HTML has been rendered
- if (window.opera)
- document.write('<sc'+'ript type="text/javascript" src="'+it_boot_addparam(file, 'init=1')+'"><\/sc'+'ript>');
+ if (window.opera || (document.all && navigator.platform.indexOf("Mac") >= 0))
+ document.write('<sc'+'ript type="text/javascript" src="'+it_boot_addparam(file, 'boot=1')+'"><\/sc'+'ript>');
else if (dom)
{
var tag = doc.createElement("script");
- tag.src = it_boot_addparam(file, 'init=1');
+ tag.src = it_boot_addparam(file, 'boot=1');
dom.appendChild(tag);
}
else