onload() function to handle multiple functions

This commit is contained in:
Michael Save 2012-03-31 19:12:26 +11:00
parent c0876c4e86
commit 2dda55da1c

View File

@ -197,7 +197,26 @@ var RecaptchaOptions = {
theme : 'clean' theme : 'clean'
}; };
window.onload = init; 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;
}
}
}
onload(init);
{% endraw %}{% if config.google_analytics %}{% raw %} {% endraw %}{% if config.google_analytics %}{% raw %}
var _gaq = _gaq || [];_gaq.push(['_setAccount', '{% endraw %}{{ config.google_analytics }}{% raw %}']);{% endraw %}{% if config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', '{% endraw %}{{ config.google_analytics_domain }}{% raw %}']){% endraw %}{% endif %}{% if not config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', 'none']){% endraw %}{% endif %}{% raw %};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();{% endraw %}{% endif %} var _gaq = _gaq || [];_gaq.push(['_setAccount', '{% endraw %}{{ config.google_analytics }}{% raw %}']);{% endraw %}{% if config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', '{% endraw %}{{ config.google_analytics_domain }}{% raw %}']){% endraw %}{% endif %}{% if not config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', 'none']){% endraw %}{% endif %}{% raw %};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();{% endraw %}{% endif %}