Browse Source

onload() function to handle multiple functions

pull/40/head
Michael Save 12 years ago
parent
commit
2dda55da1c
  1. 21
      templates/main.js

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

Loading…
Cancel
Save