PageSourceSearch

https://www.masterportal.org/_assets/6020ad64298e304d8b844c8dc69c472e/JavaScript/Lib/domready.js?1747813254

js masterportal.org collected 2026-10-02 06:42:22 UTC 4,086 bytes, 146 lines download raw bytes

1(function(){
2
3    var DomReady = window.DomReady = {};
4
5	// Everything that has to do with properly supporting our document ready event. Brought over from the most awesome jQuery. 
6
7    var userAgent = navigator.userAgent.toLowerCase();
8
9    // Figure out what browser is being used
10    var browser = {
11    	version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
12    	safari: /webkit/.test(userAgent),
13    	opera: /opera/.test(userAgent),
14    	msie: (/msie/.test(userAgent)) && (!/opera/.test( userAgent )),
15    	mozilla: (/mozilla/.test(userAgent)) && (!/(compatible|webkit)/.test(userAgent))
16    };    
17
18	var readyBound = false;	
19	var isReady = false;
20	var readyList = [];
21
22	// Handle when the DOM is ready
23	function domReady() {
24		// Make sure that the DOM is not already loaded
25		if(!isReady) {
26			// Remember that the DOM is ready
27			isReady = true;
28        
29	        if(readyList) {
30	            for(var fn = 0; fn < readyList.length; fn++) {
31	                readyList[fn].call(window, []);
32	            }
33            
34	            readyList = [];
35	        }
36		}
37	};
38
39	// From Simon Willison. A safe way to fire onload w/o screwing up everyone else.
40	function addLoadEvent(func) {
41	  var oldonload = window.onload;
42	  if (typeof window.onload != 'function') {
43	    window.onload = func;
44	  } else {
45	    window.onload = function() {
46	      if (oldonload) {
47	        oldonload();
48	      }
49	      func();
50	    }
51	  }
52	};
53
54	// does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload.
55	function bindReady() {
56		if(readyBound) {
57		    return;
58	    }
59	
60		readyBound = true;
61
62		// Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
63		if (document.addEventListener && !browser.opera) {
64			// Use the handy event callback
65			document.addEventListener("DOMContentLoaded", domReady, false);
66		}
67
68		// If IE is used and is not in a frame
69		// Continually check to see if the document is ready
70		if (browser.msie && window == top) (function(){
71			if (isReady) return;
72			try {
73				// If IE is used, use the trick by Diego Perini
74				// http://javascript.nwbox.com/IEContentLoaded/
75				document.documentElement.doScroll("left");
76			} catch(error) {
77				setTimeout(arguments.callee, 0);
78				return;
79			}
80			// and execute any waiting functions
81		    domReady();
82		})();
83
84		if(browser.opera) {
85			document.addEventListener( "DOMContentLoaded", function () {
86				if (isReady) return;
87				for (var i = 0; i < document.styleSheets.length; i++)
88					if (document.styleSheets[i].disabled) {
89						setTimeout( arguments.callee, 0 );
90						return;
91					}
92				// and execute any waiting functions
93	            domReady();
94			}, false);
95		}
96
97		if(browser.safari) {
98		    var numStyles;
99			(function(){
100				if (isReady) return;
101				if (document.readyState != "loaded" && document.readyState != "complete") {
102					setTimeout( arguments.callee, 0 );
103					return;
104				}
105				if (numStyles === undefined) {
106	                var links = document.getElementsByTagName("link");
107	                for (var i=0; i < links.length; i++) {
108	                	if(links[i].getAttribute('rel') == 'stylesheet') {
109	                	    numStyles++;
110	                	}
111	                }
112	                var styles = document.getElementsByTagName("style");
113	                numStyles += styles.length;
114				}
115				if (document.styleSheets.length != numStyles) {
116					setTimeout( arguments.callee, 0 );
117					return;
118				}
119			
120				// and execute any waiting functions
121				domReady();
122			})();
123		}
124
125		// A fallback to window.onload, that will always work
126	    addLoadEvent(domReady);
127	};
128
129	// This is the public function that people can use to hook up ready.
130	DomReady.ready = function(fn, args) {
131		// Attach the listeners
132		bindReady();
133    
134		// If the DOM is already ready
135		if (isReady) {
136			// Execute the function immediately
137			fn.call(window, []);
138	    } else {
139			// Add the function to the wait list
140	        readyList.push( function() { return fn.call(window, []); } );
141	    }
142	};
143    
144	bindReady();
145	
146})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.