Now for whatever reason the original author does something on initialization I can't quite make sense of. There is this code which seems to me to be redundant:
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', init, false);
}
(function() {
/*@cc_on
try {
document.body.doScroll('up');
return init();
} catch(e) {}
/*@if (false) @*/
if (/loaded|complete/.test(document.readyState)) return init();
/*@end @*/
if (!init.done) setTimeout(arguments.callee, 30);
})();
if (window.addEventListener) {
window.addEventListener('load', init, false);
} else if (window.attachEvent) {
window.attachEvent('onload', init);
}
function init()
{
if (arguments.callee.done) return;
arguments.callee.done = true;
// do your thing
//[...]
}
What might the purpose of this be? Or is it nonsense?