PageSourceSearch

https://account.europeanpharmaceuticalreview.com/JavaScript/mootools/core/Utilities/DOMReady.js

js europeanpharmaceuticalreview.com collected 2026-10-02 02:58:33 UTC 2,289 bytes, 107 lines download raw bytes

1/*
2---
3
4name: DOMReady
5
6description: Contains the custom event domready.
7
8license: MIT-style license.
9
10requires: [Browser, Element, Element.Event]
11
12provides: [DOMReady, DomReady]
13
14...
15*/
16
17(function(window, document){
18
19var ready,
20	loaded,
21	checks = [],
22	shouldPoll,
23	timer,
24	testElement = document.createElement('div');
25
26var domready = function(){
27	clearTimeout(timer);
28	if (!ready) {
29		Browser.loaded = ready = true;
30		document.removeListener('DOMContentLoaded', domready).removeListener('readystatechange', check);
31		document.fireEvent('domready');
32		window.fireEvent('domready');
33	}
34	// cleanup scope vars
35	document = window = testElement = null;
36};
37
38var check = function(){
39	for (var i = checks.length; i--;) if (checks[i]()){
40		domready();
41		return true;
42	}
43	return false;
44};
45
46var poll = function(){
47	clearTimeout(timer);
48	if (!check()) timer = setTimeout(poll, 10);
49};
50
51document.addListener('DOMContentLoaded', domready);
52
53/*<ltIE8>*/
54// doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/
55// testElement.doScroll() throws when the DOM is not ready, only in the top window
56var doScrollWorks = function(){
57	try {
58		testElement.doScroll();
59		return true;
60	} catch (e){}
61	return false;
62};
63// If doScroll works already, it can't be used to determine domready
64//   e.g. in an iframe
65if (testElement.doScroll && !doScrollWorks()){
66	checks.push(doScrollWorks);
67	shouldPoll = true;
68}
69/*</ltIE8>*/
70
71if (document.readyState) checks.push(function(){
72	var state = document.readyState;
73	return (state == 'loaded' || state == 'complete');
74});
75
76if ('onreadystatechange' in document) document.addListener('readystatechange', check);
77else shouldPoll = true;
78
79if (shouldPoll) poll();
80
81Element.Events.domready = {
82	onAdd: function(fn){
83		if (ready) fn.call(this);
84	}
85};
86
87// Make sure that domready fires before load
88Element.Events.load = {
89	base: 'load',
90	onAdd: function(fn){
91		if (loaded && this == window) fn.call(this);
92	},
93	condition: function(){
94		if (this == window){
95			domready();
96			delete Element.Events.load;
97		}
98		return true;
99	}
100};
101
102// This is based on the custom load event
103window.addEvent('load', function(){
104	loaded = true;
105});
106
107})(window, document);

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.