diff options
| author | Michael Save <savetheinternet@tinyboard.org> | 2012-03-31 19:12:26 +1100 |
|---|---|---|
| committer | Michael Save <savetheinternet@tinyboard.org> | 2012-03-31 19:12:26 +1100 |
| commit | 2dda55da1cb0382876ce5a841307b998cced53c6 (patch) | |
| tree | 01f01e27f004289f0fdeb5752f233ac55851611a /templates/main.js | |
| parent | c0876c4e86080b71c80414de6db25f42b5bbaa42 (diff) | |
onload() function to handle multiple functions
Diffstat (limited to 'templates/main.js')
| -rw-r--r-- | templates/main.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/templates/main.js b/templates/main.js index 42d38eb9..9e51aa7b 100644 --- a/templates/main.js +++ b/templates/main.js @@ -197,7 +197,26 @@ var RecaptchaOptions = { 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 %}
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 %}
|
