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'); var link = document.getElementsByTagName('a');
for(var i = 0; i < link.length; i++) { for(var i = 0; i < link.length; i++) {

View File

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

View File

@ -53,5 +53,8 @@
{{ boardlist.bottom }} {{ 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> <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 %} {% for footer in config.footer %}<p class="unimportant" style="text-align:center;">{{ footer }}</p>{% endfor %}
<script type="text/javascript">{% raw %}
ready();
{% endraw %}</script>
</body> </body>
</html> </html>

View File

@ -158,25 +158,18 @@ var RecaptchaOptions = {
theme : 'clean' theme : 'clean'
}; };
function onload(fnc) { onready_callbacks = [];
if(typeof window.addEventListener != "undefined") { function onready(fnc) {
window.addEventListener("load", fnc, false); onready_callbacks.push(fnc);
} else if(typeof window.attachEvent != "undefined") { }
window.attachEvent( "onload", fnc );
} else { function ready() {
if (window.onload != null) { for(var i = 0; i < onready_callbacks.length; i++) {
var oldOnload = window.onload; onready_callbacks[i]();
window.onload = function (e) {
oldOnload(e);
window[fnc]();
};
} else {
window.onload = fnc;
}
} }
} }
onload(init); onready(init);
{% endraw %}{% if config.google_analytics %}{% raw %} {% endraw %}{% if config.google_analytics %}{% raw %}

View File

@ -55,5 +55,8 @@
{{ boardlist.bottom }} {{ 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> <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 %} {% for footer in config.footer %}<p class="unimportant" style="text-align:center;">{{ footer }}</p>{% endfor %}
<script type="text/javascript">{% raw %}
ready();
{% endraw %}</script>
</body> </body>
</html> </html>