summaryrefslogtreecommitdiff
path: root/templates/main.js
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-03-31 19:37:31 +1100
committerMichael Save <savetheinternet@tinyboard.org>2012-03-31 19:37:31 +1100
commitf444fa3b6e272a199f62ac1093db251488a1e2c3 (patch)
tree21e28e5bcf19083f1ce041bd2e83e4a8b91bd188 /templates/main.js
parentad657916a03fd01e2bb92ab72bc2f440f4e436d3 (diff)
onready() instead of onload()
Diffstat (limited to 'templates/main.js')
-rw-r--r--templates/main.js25
1 files changed, 9 insertions, 16 deletions
diff --git a/templates/main.js b/templates/main.js
index 0b514a80..3903ff6e 100644
--- a/templates/main.js
+++ b/templates/main.js
@@ -158,25 +158,18 @@ var RecaptchaOptions = {
theme : 'clean'
};
-function onload(fnc) {
- if(typeof window.addEventListener != "undefined") {
- window.addEventListener("load", fnc, false);
- } else if(typeof window.attachEvent != "undefined") {
- window.attachEvent( "onload", fnc );
- } else {
- if (window.onload != null) {
- var oldOnload = window.onload;
- window.onload = function (e) {
- oldOnload(e);
- window[fnc]();
- };
- } else {
- window.onload = fnc;
- }
+onready_callbacks = [];
+function onready(fnc) {
+ onready_callbacks.push(fnc);
+}
+
+function ready() {
+ for(var i = 0; i < onready_callbacks.length; i++) {
+ onready_callbacks[i]();
}
}
-onload(init);
+onready(init);
{% endraw %}{% if config.google_analytics %}{% raw %}