summaryrefslogtreecommitdiff
path: root/templates
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
parentad657916a03fd01e2bb92ab72bc2f440f4e436d3 (diff)
onready() instead of onload()
Diffstat (limited to 'templates')
-rw-r--r--templates/index.html3
-rw-r--r--templates/main.js25
-rw-r--r--templates/thread.html3
3 files changed, 15 insertions, 16 deletions
diff --git a/templates/index.html b/templates/index.html
index ae94f92a..1e277256 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -53,5 +53,8 @@
{{ boardlist.bottom }}
<p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> {{ config.version }} | <a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2012 Tinyboard Development Group</p>
{% for footer in config.footer %}<p class="unimportant" style="text-align:center;">{{ footer }}</p>{% endfor %}
+ <script type="text/javascript">{% raw %}
+ ready();
+ {% endraw %}</script>
</body>
</html>
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 %}
diff --git a/templates/thread.html b/templates/thread.html
index 680bd004..dae51dd7 100644
--- a/templates/thread.html
+++ b/templates/thread.html
@@ -55,5 +55,8 @@
{{ boardlist.bottom }}
<p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> {{ config.version }} | <a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2012 Tinyboard Development Group</p>
{% for footer in config.footer %}<p class="unimportant" style="text-align:center;">{{ footer }}</p>{% endfor %}
+ <script type="text/javascript">{% raw %}
+ ready();
+ {% endraw %}</script>
</body>
</html>