corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | define([ |
2 | "../core", |
||
3 | "../core/init", |
||
4 | "../deferred" |
||
5 | ], function( jQuery ) { |
||
6 | |||
7 | // The deferred used on DOM ready |
||
8 | var readyList; |
||
9 | |||
10 | jQuery.fn.ready = function( fn ) { |
||
11 | // Add the callback |
||
12 | jQuery.ready.promise().done( fn ); |
||
13 | |||
14 | return this; |
||
15 | }; |
||
16 | |||
17 | jQuery.extend({ |
||
18 | // Is the DOM ready to be used? Set to true once it occurs. |
||
19 | isReady: false, |
||
20 | |||
21 | // A counter to track how many items to wait for before |
||
22 | // the ready event fires. See #6781 |
||
23 | readyWait: 1, |
||
24 | |||
25 | // Hold (or release) the ready event |
||
26 | holdReady: function( hold ) { |
||
27 | if ( hold ) { |
||
28 | jQuery.readyWait++; |
||
29 | } else { |
||
30 | jQuery.ready( true ); |
||
31 | } |
||
32 | }, |
||
33 | |||
34 | // Handle when the DOM is ready |
||
35 | ready: function( wait ) { |
||
36 | |||
37 | // Abort if there are pending holds or we're already ready |
||
38 | if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { |
||
39 | return; |
||
40 | } |
||
41 | |||
42 | // Remember that the DOM is ready |
||
43 | jQuery.isReady = true; |
||
44 | |||
45 | // If a normal DOM Ready event fired, decrement, and wait if need be |
||
46 | if ( wait !== true && --jQuery.readyWait > 0 ) { |
||
47 | return; |
||
48 | } |
||
49 | |||
50 | // If there are functions bound, to execute |
||
51 | readyList.resolveWith( document, [ jQuery ] ); |
||
52 | |||
53 | // Trigger any bound ready events |
||
54 | if ( jQuery.fn.trigger ) { |
||
55 | jQuery( document ).trigger("ready").off("ready"); |
||
56 | } |
||
57 | } |
||
58 | }); |
||
59 | |||
60 | /** |
||
61 | * The ready event handler and self cleanup method |
||
62 | */ |
||
63 | function completed() { |
||
64 | document.removeEventListener( "DOMContentLoaded", completed, false ); |
||
65 | window.removeEventListener( "load", completed, false ); |
||
66 | jQuery.ready(); |
||
67 | } |
||
68 | |||
69 | jQuery.ready.promise = function( obj ) { |
||
70 | if ( !readyList ) { |
||
71 | |||
72 | readyList = jQuery.Deferred(); |
||
73 | |||
74 | // Catch cases where $(document).ready() is called after the browser event has already occurred. |
||
75 | // we once tried to use readyState "interactive" here, but it caused issues like the one |
||
76 | // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 |
||
77 | if ( document.readyState === "complete" ) { |
||
78 | // Handle it asynchronously to allow scripts the opportunity to delay ready |
||
79 | setTimeout( jQuery.ready ); |
||
80 | |||
81 | } else { |
||
82 | |||
83 | // Use the handy event callback |
||
84 | document.addEventListener( "DOMContentLoaded", completed, false ); |
||
85 | |||
86 | // A fallback to window.onload, that will always work |
||
87 | window.addEventListener( "load", completed, false ); |
||
88 | } |
||
89 | } |
||
90 | return readyList.promise( obj ); |
||
91 | }; |
||
92 | |||
93 | // Kick off the DOM ready check even if the user does not |
||
94 | jQuery.ready.promise(); |
||
95 | |||
96 | }); |