diff options
Diffstat (limited to 'js/mapspecs.js')
-rw-r--r-- | js/mapspecs.js | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/js/mapspecs.js b/js/mapspecs.js index 21286ee..00bde30 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -1,13 +1,22 @@ -if (document.addEventListener) // Mozilla, Opera, webkit
+var ready_done = false,
+ ready = function() {
+ if (ready_done)
+ return;
+ ready_done = true;
+ loadSol();
+ if (isChallenge)
+ challengeLoad();
+ }
+
+if (document.readyState === 'complete')
+ ready();
+else if (document.addEventListener) { // gecko, webkit, opera, IE 9
document.addEventListener("DOMContentLoaded", ready, false);
-else if (document.attachEvent) // IE
+ window.addEventListener("load", ready, false);
+}
+else if (document.attachEvent) { // IE 8-
document.attachEvent("onreadystatechange", ready);
-
-var ready = function() {
- //document.getElementById('blocksdisplay').innerHTML = "<b>"+blocks+"</b>";
- loadSol();
- if (isChallenge)
- challengeLoad();
+ window.attachEvent("onload", ready);
}
var isChallenge = false;
|