onready() instead of onload()

This commit is contained in:
Michael Save 2012-03-31 19:37:31 +11:00
parent ad657916a0
commit f444fa3b6e
5 changed files with 17 additions and 18 deletions

View File

@ -10,7 +10,7 @@
*
*/
onload(function(){
onready(function(){
var link = document.getElementsByTagName('a');
for(var i = 0; i < link.length; i++) {

View File

@ -10,7 +10,7 @@
*
*/
onload(function(){
onready(function(){
var iso8601 = function(s) {
s = s.replace(/\.\d\d\d+/,""); // remove milliseconds
s = s.replace(/-/,"/").replace(/-/,"/");

View File

@ -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>

View File

@ -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 %}

View File

@ -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>