Template:Team:Washington/Templates/Header
From 2009.igem.org
(Difference between revisions)
Line 37: | Line 37: | ||
} | } | ||
} | } | ||
- | } | + | } |
// From Simon Willison. A safe way to fire onload w/o screwing up everyone else. | // From Simon Willison. A safe way to fire onload w/o screwing up everyone else. | ||
Line 50: | Line 50: | ||
} | } | ||
func(); | func(); | ||
- | } | + | }; |
} | } | ||
- | } | + | } |
// does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload. | // does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload. | ||
Line 70: | Line 70: | ||
// If IE is used and is not in a frame | // If IE is used and is not in a frame | ||
// Continually check to see if the document is ready | // Continually check to see if the document is ready | ||
- | if (eval('browser.msie\x26\x26window == top')) (function(){ | + | if (eval('browser.msie\x26\x26window == top')) {(function(){ |
- | if (isReady) return; | + | if (isReady){return;} |
try { | try { | ||
// If IE is used, use the trick by Diego Perini | // If IE is used, use the trick by Diego Perini | ||
Line 82: | Line 82: | ||
// and execute any waiting functions | // and execute any waiting functions | ||
domReady(); | domReady(); | ||
- | })(); | + | })();} |
if(browser.opera) { | if(browser.opera) { | ||
document.addEventListener( "DOMContentLoaded", function () { | document.addEventListener( "DOMContentLoaded", function () { | ||
- | if (isReady) return; | + | if (isReady) {return;} |
- | for (var i = 0; i < document.styleSheets.length; i++) | + | for (var i = 0; i < document.styleSheets.length; i++){ |
if (document.styleSheets[i].disabled) { | if (document.styleSheets[i].disabled) { | ||
setTimeout( arguments.callee, 0 ); | setTimeout( arguments.callee, 0 ); | ||
return; | return; | ||
} | } | ||
+ | } | ||
// and execute any waiting functions | // and execute any waiting functions | ||
domReady(); | domReady(); | ||
Line 100: | Line 101: | ||
var numStyles; | var numStyles; | ||
(function(){ | (function(){ | ||
- | if (isReady) return; | + | if (isReady) {return;} |
if (eval('document.readyState != "loaded"\x26\x26document.readyState != "complete"')) { | if (eval('document.readyState != "loaded"\x26\x26document.readyState != "complete"')) { | ||
setTimeout( arguments.callee, 0 ); | setTimeout( arguments.callee, 0 ); | ||
Line 127: | Line 128: | ||
// A fallback to window.onload, that will always work | // A fallback to window.onload, that will always work | ||
addLoadEvent(domReady); | addLoadEvent(domReady); | ||
- | } | + | } |
// This is the public function that people can use to hook up ready. | // This is the public function that people can use to hook up ready. | ||
Line 166: | Line 167: | ||
} | } | ||
}; | }; | ||
+ | </script> | ||
<style type="text/css"> | <style type="text/css"> | ||
#h_leftBar { | #h_leftBar { |
Revision as of 08:46, 8 October 2009