diff options
author | David Flatz | 2013-04-23 13:54:30 +0000 |
---|---|---|
committer | David Flatz | 2013-04-23 13:54:30 +0000 |
commit | 4164f9c2956a76f1335f7413e02e2f8cb870a960 (patch) | |
tree | 07ebb1736203e8aa9b3948593f03318f909492a1 /itjs/boot.js | |
parent | 87cb9ae8265e38296d02a3e3d499ccc7ee62a31d (diff) | |
download | itools-4164f9c2956a76f1335f7413e02e2f8cb870a960.tar.gz itools-4164f9c2956a76f1335f7413e02e2f8cb870a960.tar.bz2 itools-4164f9c2956a76f1335f7413e02e2f8cb870a960.zip |
load javascript files separately when debugging to get the right linenumbers
Diffstat (limited to 'itjs/boot.js')
-rw-r--r-- | itjs/boot.js | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/itjs/boot.js b/itjs/boot.js index 5261405..dd5169d 100644 --- a/itjs/boot.js +++ b/itjs/boot.js @@ -235,16 +235,40 @@ function it_boot(file, isretry) { var doc = document; var dom = doc && (dom = doc.getElementById('it_boot_dom')); // HTML has been rendered + var files = []; it_boot.sequence += "n"; bootparam += "&script=1"; + if (jsdebug) { + var path = file.match(/^(.*\/)[^\/]*$/)[1]; + var params = file.match(/\?.*$/)[0]; + var imports = file.split(','); + for (var i=0; i<imports.length; i++) { + var script = imports[i]; + if (script.substr(0, path.length) != path) + script = path + script; + if (script.substr(script.length - params.length, params.length) != params) + script = script + params; + if (i == imports.length-1) + script = it_boot_addparam(script, bootparam); + else + script = it_boot_addparam(script, 'script=1'); + files.push(script); + } + } + else + files = [it_boot_addparam(file, bootparam)]; - if (window.opera || (document.all && navigator.platform.indexOf("Mac") >= 0)) - document.write('<sc'+'ript type="text/javascript" src="'+it_boot_addparam(file, bootparam)+'"><\/sc'+'ript>'); + if (window.opera || (document.all && navigator.platform.indexOf("Mac") >= 0)) { + for (var i=0; i < files.length; i++) + document.write('<sc'+'ript type="text/javascript" src="' + files[i] + '"><\/sc'+'ript>'); + } else if (dom) { - var tag = doc.createElement("script"); - tag.src = it_boot_addparam(file, bootparam); - dom.appendChild(tag); + for (var i=0; i < files.length; i++) { + var tag = doc.createElement("script"); + tag.src = files[i]; + dom.appendChild(tag); + } } else window.it_domtimer = window.setTimeout("it_boot('" + file + "')" , 42); |