summaryrefslogtreecommitdiff
path: root/lib/exe/js.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-06-16 12:45:39 +0200
committerAndreas Gohr <andi@splitbrain.org>2006-06-16 12:45:39 +0200
commit5cafff964bdbfadfa66e4752eb6b392d2fce9087 (patch)
treed542d0dd06174b786b90e78adfdaf09749d96709 /lib/exe/js.php
parentf0ae5d4c73ebc531da690dcc7a9f21c00700af54 (diff)
downloadrpg-5cafff964bdbfadfa66e4752eb6b392d2fce9087.tar.gz
rpg-5cafff964bdbfadfa66e4752eb6b392d2fce9087.tar.bz2
better onload handling
This patch improves the way the window.oninit JavaScript function is called. This function is used to initialiaze all JavaScript funcions attached to the DOM so it needs to be executed **after** the full DOM was parsed by the browser. Unfortunately currently only Mozilla supports a DOMContentLoaded event. In all other browsers we had to wait for the window.onload event which will only be called after **all** content (including images) was loaded - this caused a visible delay on all JavaScript generated content (like the toolbar) in non-Mozilla browsers. Dean Edwards now presented a solution [1] which will work for all the bigger Browsers and is used in this patch. The following browsers now should fire the init event right after parsing the DOM: All Mozilla based browsers Internet Explorer Safari Opera > darcs-hash:20060616104539-7ad00-db70d31fcb21cb812cf4982fe80a7d649e2daa1c.gz
Diffstat (limited to 'lib/exe/js.php')
-rw-r--r--lib/exe/js.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/exe/js.php b/lib/exe/js.php
index de996a117..75b9b1f1c 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -143,11 +143,11 @@ function js_out(){
js_runonstart('scrollToMarker()');
js_runonstart('focusMarker()');
- // initialize init pseudo event
+/* // initialize init pseudo event
echo 'if (document.addEventListener) {'.NL;
echo ' document.addEventListener("DOMContentLoaded", window.fireoninit, null);'.NL;
echo '}'.NL;
- echo 'addEvent(window,"load",window.fireoninit);'.NL;
+ echo 'addEvent(window,"load",window.fireoninit);'.NL;*/
// end output buffering and get contents
$js = ob_get_contents();
@@ -245,8 +245,8 @@ function js_compress($s){
while($i < $len){
$ch = $s{$i};
- // multiline comments
- if($ch == '/' && $s{$i+1} == '*'){
+ // multiline comments (keeping IE conditionals)
+ if($ch == '/' && $s{$i+1} == '*' && $s{$i+2} != '@'){
$endC = strpos($s,'*/',$i+2);
if($endC === false) trigger_error('Found invalid /*..*/ comment', E_USER_ERROR);
$i = $endC + 2;