compass-jquery-plugin 0.3.2.3 → 0.3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +54 -37
- data/VERSION.yml +1 -1
- data/lib/handle_attributes.rb +4 -4
- data/lib/handle_js_files.rb +5 -5
- data/lib/jqtouch_theme.rb +2 -2
- data/lib/jquery/dynatree.rb +2 -2
- data/lib/jquery/emulators.rb +1 -1
- data/lib/jquery/flash_messages.rb +6 -6
- data/lib/jquery/graphics.rb +5 -0
- data/lib/jquery/gridify/assertions.rb +1 -1
- data/lib/jquery/gridify/grid.rb +76 -59
- data/lib/jquery/gridify/grid_column.rb +73 -67
- data/lib/jquery/gridify/grid_finder.rb +79 -79
- data/lib/jquery/gridify/grid_options.rb +154 -149
- data/lib/jquery/gridify/grid_view.rb +143 -143
- data/lib/jquery/gridify.rb +25 -25
- data/lib/jquery/ical/calendar.rb +2 -2
- data/lib/jquery/ical/event.rb +48 -44
- data/lib/jquery/ical/helpers/ui_event_helper.rb +3 -3
- data/lib/jquery/jqgrid/jqgrid.rb +58 -58
- data/lib/jquery/jqgrid.rb +1 -1
- data/lib/jquery/jqtouch.rb +1 -1
- data/lib/jquery/jquery.rb +117 -117
- data/lib/jquery/jquery_auto_complete.rb +9 -9
- data/lib/jquery/jquery_json_response.rb +12 -12
- data/lib/jquery/jquery_selector_assertions.rb +55 -53
- data/lib/jquery/jstree.rb +2 -2
- data/lib/jquery/mobile.rb +1 -1
- data/lib/jquery/ribbon.rb +2 -2
- data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +5 -5
- data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +5 -5
- data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +1 -1
- data/lib/jquery/secret_sauce/helpers/ui_form_helper.rb +39 -39
- data/lib/jquery/secret_sauce/helpers/ui_grid_helper.rb +74 -74
- data/lib/jquery/secret_sauce/model/find_for_grid.rb +21 -21
- data/lib/jquery/secret_sauce.rb +1 -1
- data/lib/jquery/tools.rb +1 -1
- data/lib/jquery_mobile_theme.rb +2 -2
- data/lib/jquery_ui_theme.rb +12 -12
- data/templates/dynatree/config/initializers/dynatree.rb +3 -3
- data/templates/dynatree/jquery/dynatree/aero.scss +16 -16
- data/templates/dynatree/jquery/dynatree/aqua.scss +16 -16
- data/templates/dynatree/jquery/dynatree/crystal.scss +16 -16
- data/templates/dynatree/jquery/dynatree/xp.scss +17 -17
- data/templates/dynatree/jquery.dynatree.js +2926 -2912
- data/templates/emulators/config/initializers/emulators.rb +6 -6
- data/templates/graphics/config/initializers/graphics.rb +5 -0
- data/templates/graphics/jquery/ganttView.scss +89 -0
- data/templates/graphics/jquery.ganttView.js +1669 -0
- data/templates/graphics/jquery.ganttView.min.js +70 -0
- data/templates/{jquery → graphics}/jquery.sparkline.js +466 -438
- data/templates/{jquery → graphics}/jquery.sparkline.min.js +0 -0
- data/templates/graphics/manifest.rb +9 -0
- data/templates/jqgrid/config/initializers/jqgrid.rb +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ar.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-bg.js +135 -131
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +135 -131
- data/templates/jqgrid/i18n/jqgrid/locale-cat.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-cn.js +137 -131
- data/templates/jqgrid/i18n/jqgrid/locale-cs.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-da.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-de.js +138 -132
- data/templates/jqgrid/i18n/jqgrid/locale-el.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-en.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-es.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-fa.js +19 -16
- data/templates/jqgrid/i18n/jqgrid/locale-fi.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-fr.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-gl.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-he.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-hu.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-is.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-it.js +8 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ja.js +139 -136
- data/templates/jqgrid/i18n/jqgrid/locale-nl.js +4 -1
- data/templates/jqgrid/i18n/jqgrid/locale-no.js +14 -1
- data/templates/jqgrid/i18n/jqgrid/locale-pl.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-pt.js +130 -124
- data/templates/jqgrid/i18n/jqgrid/locale-ro.js +144 -138
- data/templates/jqgrid/i18n/jqgrid/locale-ru.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-sk.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-sr.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-sv.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-tr.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-ua.js +132 -126
- data/templates/jqgrid/jquery.jqGrid.js +12735 -10444
- data/templates/jqgrid/jquery.jqGrid.min.js +477 -469
- data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +12 -10
- data/templates/jqtouch/config/initializers/jqtouch.rb +3 -3
- data/templates/jqtouch/jquery/touch/jqtouch.scss +1 -1
- data/templates/jqtouch/jquery.jqtouch.js +10025 -10043
- data/templates/jquery/config/initializers/jquery.rb +2 -4
- data/templates/jquery/history.adapter.jquery.js +71 -0
- data/templates/jquery/history.adapter.jquery.min.js +4 -0
- data/templates/jquery/history.html4.js +690 -0
- data/templates/jquery/history.html4.min.js +21 -0
- data/templates/jquery/history.js +1297 -0
- data/templates/jquery/history.min.js +29 -0
- data/templates/jquery/i18n/jquery.ui/datepicker-af.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-ar.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-az.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-bg.js +8 -8
- data/templates/jquery/i18n/jquery.ui/datepicker-bs.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ca.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-cs.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-da.js +14 -14
- data/templates/jquery/i18n/jquery.ui/datepicker-de.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-el.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-GB.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-eo.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-es.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-et.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-eu.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fa.js +18 -18
- data/templates/jquery/i18n/jquery.ui/datepicker-fi.js +15 -15
- data/templates/jquery/i18n/jquery.ui/datepicker-fo.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fr-CH.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fr.js +22 -22
- data/templates/jquery/i18n/jquery.ui/datepicker-gl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-he.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hu.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hu.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-hy.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-id.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-is.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-it.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ja.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ko.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-kz.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-lt.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-lv.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ml.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ms.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-nl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-no.js +16 -16
- data/templates/jquery/i18n/jquery.ui/datepicker-no.min.js +2 -2
- data/templates/jquery/i18n/jquery.ui/datepicker-pl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-pt-BR.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-pt.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-rm.js +18 -18
- data/templates/jquery/i18n/jquery.ui/datepicker-ro.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ru.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sk.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sq.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sr-SR.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sv.js +14 -14
- data/templates/jquery/i18n/jquery.ui/datepicker-ta.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-th.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-tr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-uk.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-vi.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-CN.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-HK.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-TW.js +20 -20
- data/templates/jquery/{partials → jquery/ui}/_flash_messages.scss +0 -0
- data/templates/jquery/jquery/ui/_theme.scss +14 -13
- data/templates/jquery/jquery/ui/contextMenu/configure.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/copy.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/cut.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/delete.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/edit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/exit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/new.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/paste.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/rename.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/show.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/trash.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu.scss +16 -10
- data/templates/jquery/jquery-ui.js +11839 -23066
- data/templates/jquery/jquery-ui.min.js +401 -795
- data/templates/jquery/jquery.bgiframe.js +27 -25
- data/templates/jquery/jquery.contextMenu.js +209 -196
- data/templates/jquery/jquery.cookie.js +3 -1
- data/templates/jquery/jquery.dotimeout.js +236 -228
- data/templates/jquery/jquery.dst.js +154 -151
- data/templates/jquery/jquery.farbtastic.js +293 -293
- data/templates/jquery/jquery.flashMessages.js +26 -0
- data/templates/jquery/jquery.flashMessages.min.js +1 -0
- data/templates/jquery/jquery.form.js +803 -786
- data/templates/jquery/jquery.haml.js +248 -247
- data/templates/jquery/jquery.hotkeys.js +89 -89
- data/templates/jquery/jquery.js +8141 -8106
- data/templates/jquery/jquery.layout.js +2451 -2415
- data/templates/jquery/jquery.min.js +167 -166
- data/templates/jquery/jquery.mousewheel.js +62 -54
- data/templates/jquery/jquery.offline.js +171 -171
- data/templates/jquery/jquery.pngFix.js +76 -76
- data/templates/jquery/jquery.replacetext.js +83 -83
- data/templates/jquery/jquery.themeswitchertool.js +202 -177
- data/templates/jquery/jquery.tmpl.js +478 -473
- data/templates/jquery/jquery.tmplPlus.js +82 -81
- data/templates/jquery/jrails.js +178 -175
- data/templates/jquery/json.js +77 -7
- data/templates/jquery/json2.js +480 -0
- data/templates/jquery/json2.min.js +7 -0
- data/templates/jquery/lib/tasks/haml.rake +2 -2
- data/templates/jquery/manifest.rb +21 -17
- data/templates/jstree/jquery.jstree.js +5967 -4536
- data/templates/mobile/config/initializers/mobile.rb +1 -1
- data/templates/mobile/jquery/mobile/_base.scss +944 -927
- data/templates/mobile/jquery/mobile/default.scss +61 -48
- data/templates/mobile/jquery/mobile/valencia.scss +56 -42
- data/templates/mobile/jquery.mobile.js +4461 -4347
- data/templates/mobile/jquery.mobile.min.js +11 -2
- data/templates/mobile/lib/tasks/jquery.mobile.rake +12 -12
- data/templates/ribbon/config/initializers/ribbon.rb +2 -2
- data/templates/ribbon/jquery.ribbon.js +50 -29
- data/templates/secret_sauce/secret_sauce.js +8 -8
- data/templates/tools/flowplayer.js +945 -1
- data/templates/tools/jquery.tools.js +4645 -4335
- data/templates/tools/jquery.tools.min.js +37 -37
- data/templates/tools/lib/tasks/jquery.tools.rake +4 -4
- data/templates/tools/swfobject.js +813 -773
- metadata +33 -21
- data/templates/jquery/haml.js +0 -506
- data/templates/jquery/haml.min.js +0 -5
- data/templates/jquery/jquery/ui/contextMenu/door.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_copy.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_delete.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_edit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_new.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_paste.png +0 -0
- data/templates/jquery/jquery.compat-1.3.js +0 -291
- data/templates/jquery/jquery.compat-1.3.min.js +0 -6
- data/templates/jquery/jquery.flash_messages.js +0 -5
- data/templates/jquery/jquery.flash_messages.min.js +0 -1
- data/templates/jquery/jquery.history.js +0 -194
- data/templates/jquery/jquery.history.min.js +0 -5
@@ -84,6 +84,8 @@ jQuery.cookie = function (key, value, options) {
|
|
84
84
|
|
85
85
|
// key and possibly options given, get cookie...
|
86
86
|
options = value || {};
|
87
|
-
var result, decode = options.raw ? function (s) {
|
87
|
+
var result, decode = options.raw ? function (s) {
|
88
|
+
return s;
|
89
|
+
} : decodeURIComponent;
|
88
90
|
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
|
89
91
|
};
|
@@ -50,236 +50,244 @@
|
|
50
50
|
// 0.4 - (7/15/2009) Made the "id" argument optional, some other minor tweaks
|
51
51
|
// 0.3 - (6/25/2009) Initial release
|
52
52
|
|
53
|
-
(function($){
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
};
|
120
|
-
|
121
|
-
// Method: jQuery.fn.doTimeout
|
122
|
-
//
|
123
|
-
// Initialize, cancel, or force execution of a callback after a delay.
|
124
|
-
// Operates like <jQuery.doTimeout>, but the passed callback executes in the
|
125
|
-
// context of the jQuery collection of elements, and the id is stored as data
|
126
|
-
// on the first element in that collection.
|
127
|
-
//
|
128
|
-
// If delay and callback are specified, a doTimeout is initialized. The
|
129
|
-
// callback will execute, asynchronously, after the delay. If an id is
|
130
|
-
// specified, this doTimeout will override and cancel any existing doTimeout
|
131
|
-
// with the same id. Any additional arguments will be passed into callback
|
132
|
-
// when it is executed.
|
133
|
-
//
|
134
|
-
// If the callback returns true, the doTimeout loop will execute again, after
|
135
|
-
// the delay, creating a polling loop until the callback returns a non-true
|
136
|
-
// value.
|
137
|
-
//
|
138
|
-
// Note that if an id is not passed as the first argument, this doTimeout will
|
139
|
-
// NOT be able to be manually canceled or forced (for debouncing, be sure to
|
140
|
-
// specify an id).
|
141
|
-
//
|
142
|
-
// If id is specified, but delay and callback are not, the doTimeout will be
|
143
|
-
// canceled without executing the callback. If force_mode is specified, the
|
144
|
-
// callback will be executed, synchronously, but will only be allowed to
|
145
|
-
// continue a polling loop if force_mode is true (provided the callback
|
146
|
-
// returns true, of course). If force_mode is false, no polling loop will
|
147
|
-
// continue, even if the callback returns true.
|
148
|
-
//
|
149
|
-
// Usage:
|
150
|
-
//
|
151
|
-
// > jQuery('selector').doTimeout( [ id, ] delay, callback [, arg ... ] );
|
152
|
-
// > jQuery('selector').doTimeout( id [, force_mode ] );
|
153
|
-
//
|
154
|
-
// Arguments:
|
155
|
-
//
|
156
|
-
// id - (String) An optional unique identifier for this doTimeout, stored as
|
157
|
-
// jQuery data on the element. If id is not specified, the doTimeout will
|
158
|
-
// NOT be able to be manually canceled or forced.
|
159
|
-
// delay - (Number) A zero-or-greater delay in milliseconds after which
|
160
|
-
// callback will be executed.
|
161
|
-
// callback - (Function) A function to be executed after delay milliseconds.
|
162
|
-
// callback - (String) A jQuery.fn method to be executed after delay
|
163
|
-
// milliseconds. This method will only poll if it explicitly returns
|
164
|
-
// true (most jQuery.fn methods return a jQuery object, and not `true`,
|
165
|
-
// which allows them to be chained and prevents polling).
|
166
|
-
// force_mode - (Boolean) If true, execute that id's doTimeout callback
|
167
|
-
// immediately and synchronously, continuing any callback return-true
|
168
|
-
// polling loop. If false, execute the callback immediately and
|
169
|
-
// synchronously but do NOT continue a callback return-true polling loop.
|
170
|
-
// If omitted, cancel that id's doTimeout.
|
171
|
-
//
|
172
|
-
// Returns:
|
173
|
-
//
|
174
|
-
// When creating a <jQuery.fn.doTimeout>, the initial jQuery collection of
|
175
|
-
// elements is returned. Otherwise, if force_mode is true, false or undefined
|
176
|
-
// and there is a yet-to-be-executed callback to cancel, true is returned,
|
177
|
-
// but if no callback remains to be executed, undefined is returned.
|
178
|
-
|
179
|
-
$.fn[doTimeout] = function() {
|
180
|
-
var args = aps.call( arguments ),
|
181
|
-
result = p_doTimeout.apply( this, [ doTimeout + args[0] ].concat( args ) );
|
182
|
-
|
183
|
-
return typeof args[0] === 'number' || typeof args[1] === 'number'
|
184
|
-
? this
|
185
|
-
: result;
|
186
|
-
};
|
187
|
-
|
188
|
-
function p_doTimeout( jquery_data_key ) {
|
189
|
-
var that = this,
|
190
|
-
elem,
|
191
|
-
data = {},
|
192
|
-
|
193
|
-
// Allows the plugin to call a string callback method.
|
194
|
-
method_base = jquery_data_key ? $.fn : $,
|
195
|
-
|
196
|
-
// Any additional arguments will be passed to the callback.
|
197
|
-
args = arguments,
|
198
|
-
slice_args = 4,
|
199
|
-
|
200
|
-
id = args[1],
|
201
|
-
delay = args[2],
|
202
|
-
callback = args[3];
|
203
|
-
|
204
|
-
if ( typeof id !== 'string' ) {
|
205
|
-
slice_args--;
|
206
|
-
|
207
|
-
id = jquery_data_key = 0;
|
208
|
-
delay = args[1];
|
209
|
-
callback = args[2];
|
210
|
-
}
|
211
|
-
|
212
|
-
// If id is passed, store a data reference either as .data on the first
|
213
|
-
// element in a jQuery collection, or in the internal cache.
|
214
|
-
if ( jquery_data_key ) { // Note: key is 'doTimeout' + id
|
215
|
-
|
216
|
-
// Get id-object from the first element's data, otherwise initialize it to {}.
|
217
|
-
elem = that.eq(0);
|
218
|
-
elem.data( jquery_data_key, data = elem.data( jquery_data_key ) || {} );
|
219
|
-
|
220
|
-
} else if ( id ) {
|
221
|
-
// Get id-object from the cache, otherwise initialize it to {}.
|
222
|
-
data = cache[ id ] || ( cache[ id ] = {} );
|
223
|
-
}
|
224
|
-
|
225
|
-
// Clear any existing timeout for this id.
|
226
|
-
data.id && clearTimeout( data.id );
|
227
|
-
delete data.id;
|
228
|
-
|
229
|
-
// Clean up when necessary.
|
230
|
-
function cleanup() {
|
231
|
-
if ( jquery_data_key ) {
|
232
|
-
elem.removeData( jquery_data_key );
|
233
|
-
} else if ( id ) {
|
234
|
-
delete cache[ id ];
|
235
|
-
}
|
53
|
+
(function($) {
|
54
|
+
'$:nomunge'; // Used by YUI compressor.
|
55
|
+
|
56
|
+
var cache = {},
|
57
|
+
|
58
|
+
// Reused internal string.
|
59
|
+
doTimeout = 'doTimeout',
|
60
|
+
|
61
|
+
// A convenient shortcut.
|
62
|
+
aps = Array.prototype.slice;
|
63
|
+
|
64
|
+
// Method: jQuery.doTimeout
|
65
|
+
//
|
66
|
+
// Initialize, cancel, or force execution of a callback after a delay.
|
67
|
+
//
|
68
|
+
// If delay and callback are specified, a doTimeout is initialized. The
|
69
|
+
// callback will execute, asynchronously, after the delay. If an id is
|
70
|
+
// specified, this doTimeout will override and cancel any existing doTimeout
|
71
|
+
// with the same id. Any additional arguments will be passed into callback
|
72
|
+
// when it is executed.
|
73
|
+
//
|
74
|
+
// If the callback returns true, the doTimeout loop will execute again, after
|
75
|
+
// the delay, creating a polling loop until the callback returns a non-true
|
76
|
+
// value.
|
77
|
+
//
|
78
|
+
// Note that if an id is not passed as the first argument, this doTimeout will
|
79
|
+
// NOT be able to be manually canceled or forced. (for debouncing, be sure to
|
80
|
+
// specify an id).
|
81
|
+
//
|
82
|
+
// If id is specified, but delay and callback are not, the doTimeout will be
|
83
|
+
// canceled without executing the callback. If force_mode is specified, the
|
84
|
+
// callback will be executed, synchronously, but will only be allowed to
|
85
|
+
// continue a polling loop if force_mode is true (provided the callback
|
86
|
+
// returns true, of course). If force_mode is false, no polling loop will
|
87
|
+
// continue, even if the callback returns true.
|
88
|
+
//
|
89
|
+
// Usage:
|
90
|
+
//
|
91
|
+
// > jQuery.doTimeout( [ id, ] delay, callback [, arg ... ] );
|
92
|
+
// > jQuery.doTimeout( id [, force_mode ] );
|
93
|
+
//
|
94
|
+
// Arguments:
|
95
|
+
//
|
96
|
+
// id - (String) An optional unique identifier for this doTimeout. If id is
|
97
|
+
// not specified, the doTimeout will NOT be able to be manually canceled or
|
98
|
+
// forced.
|
99
|
+
// delay - (Number) A zero-or-greater delay in milliseconds after which
|
100
|
+
// callback will be executed.
|
101
|
+
// callback - (Function) A function to be executed after delay milliseconds.
|
102
|
+
// callback - (String) A jQuery method to be executed after delay
|
103
|
+
// milliseconds. This method will only poll if it explicitly returns
|
104
|
+
// true.
|
105
|
+
// force_mode - (Boolean) If true, execute that id's doTimeout callback
|
106
|
+
// immediately and synchronously, continuing any callback return-true
|
107
|
+
// polling loop. If false, execute the callback immediately and
|
108
|
+
// synchronously but do NOT continue a callback return-true polling loop.
|
109
|
+
// If omitted, cancel that id's doTimeout.
|
110
|
+
//
|
111
|
+
// Returns:
|
112
|
+
//
|
113
|
+
// If force_mode is true, false or undefined and there is a
|
114
|
+
// yet-to-be-executed callback to cancel, true is returned, but if no
|
115
|
+
// callback remains to be executed, undefined is returned.
|
116
|
+
|
117
|
+
$[doTimeout] = function() {
|
118
|
+
return p_doTimeout.apply(window, [ 0 ].concat(aps.call(arguments)));
|
236
119
|
};
|
237
|
-
|
238
|
-
//
|
239
|
-
|
240
|
-
|
120
|
+
|
121
|
+
// Method: jQuery.fn.doTimeout
|
122
|
+
//
|
123
|
+
// Initialize, cancel, or force execution of a callback after a delay.
|
124
|
+
// Operates like <jQuery.doTimeout>, but the passed callback executes in the
|
125
|
+
// context of the jQuery collection of elements, and the id is stored as data
|
126
|
+
// on the first element in that collection.
|
127
|
+
//
|
128
|
+
// If delay and callback are specified, a doTimeout is initialized. The
|
129
|
+
// callback will execute, asynchronously, after the delay. If an id is
|
130
|
+
// specified, this doTimeout will override and cancel any existing doTimeout
|
131
|
+
// with the same id. Any additional arguments will be passed into callback
|
132
|
+
// when it is executed.
|
133
|
+
//
|
134
|
+
// If the callback returns true, the doTimeout loop will execute again, after
|
135
|
+
// the delay, creating a polling loop until the callback returns a non-true
|
136
|
+
// value.
|
137
|
+
//
|
138
|
+
// Note that if an id is not passed as the first argument, this doTimeout will
|
139
|
+
// NOT be able to be manually canceled or forced (for debouncing, be sure to
|
140
|
+
// specify an id).
|
141
|
+
//
|
142
|
+
// If id is specified, but delay and callback are not, the doTimeout will be
|
143
|
+
// canceled without executing the callback. If force_mode is specified, the
|
144
|
+
// callback will be executed, synchronously, but will only be allowed to
|
145
|
+
// continue a polling loop if force_mode is true (provided the callback
|
146
|
+
// returns true, of course). If force_mode is false, no polling loop will
|
147
|
+
// continue, even if the callback returns true.
|
148
|
+
//
|
149
|
+
// Usage:
|
150
|
+
//
|
151
|
+
// > jQuery('selector').doTimeout( [ id, ] delay, callback [, arg ... ] );
|
152
|
+
// > jQuery('selector').doTimeout( id [, force_mode ] );
|
153
|
+
//
|
154
|
+
// Arguments:
|
155
|
+
//
|
156
|
+
// id - (String) An optional unique identifier for this doTimeout, stored as
|
157
|
+
// jQuery data on the element. If id is not specified, the doTimeout will
|
158
|
+
// NOT be able to be manually canceled or forced.
|
159
|
+
// delay - (Number) A zero-or-greater delay in milliseconds after which
|
160
|
+
// callback will be executed.
|
161
|
+
// callback - (Function) A function to be executed after delay milliseconds.
|
162
|
+
// callback - (String) A jQuery.fn method to be executed after delay
|
163
|
+
// milliseconds. This method will only poll if it explicitly returns
|
164
|
+
// true (most jQuery.fn methods return a jQuery object, and not `true`,
|
165
|
+
// which allows them to be chained and prevents polling).
|
166
|
+
// force_mode - (Boolean) If true, execute that id's doTimeout callback
|
167
|
+
// immediately and synchronously, continuing any callback return-true
|
168
|
+
// polling loop. If false, execute the callback immediately and
|
169
|
+
// synchronously but do NOT continue a callback return-true polling loop.
|
170
|
+
// If omitted, cancel that id's doTimeout.
|
171
|
+
//
|
172
|
+
// Returns:
|
173
|
+
//
|
174
|
+
// When creating a <jQuery.fn.doTimeout>, the initial jQuery collection of
|
175
|
+
// elements is returned. Otherwise, if force_mode is true, false or undefined
|
176
|
+
// and there is a yet-to-be-executed callback to cancel, true is returned,
|
177
|
+
// but if no callback remains to be executed, undefined is returned.
|
178
|
+
|
179
|
+
$.fn[doTimeout] = function() {
|
180
|
+
var args = aps.call(arguments),
|
181
|
+
result = p_doTimeout.apply(this, [ doTimeout + args[0] ].concat(args));
|
182
|
+
|
183
|
+
return typeof args[0] === 'number' || typeof args[1] === 'number'
|
184
|
+
? this
|
185
|
+
: result;
|
241
186
|
};
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
187
|
+
|
188
|
+
function p_doTimeout(jquery_data_key) {
|
189
|
+
var that = this,
|
190
|
+
elem,
|
191
|
+
data = {},
|
192
|
+
|
193
|
+
// Allows the plugin to call a string callback method.
|
194
|
+
method_base = jquery_data_key ? $.fn : $,
|
195
|
+
|
196
|
+
// Any additional arguments will be passed to the callback.
|
197
|
+
args = arguments,
|
198
|
+
slice_args = 4,
|
199
|
+
|
200
|
+
id = args[1],
|
201
|
+
delay = args[2],
|
202
|
+
callback = args[3];
|
203
|
+
|
204
|
+
if (typeof id !== 'string') {
|
205
|
+
slice_args--;
|
206
|
+
|
207
|
+
id = jquery_data_key = 0;
|
208
|
+
delay = args[1];
|
209
|
+
callback = args[2];
|
210
|
+
}
|
211
|
+
|
212
|
+
// If id is passed, store a data reference either as .data on the first
|
213
|
+
// element in a jQuery collection, or in the internal cache.
|
214
|
+
if (jquery_data_key) { // Note: key is 'doTimeout' + id
|
215
|
+
|
216
|
+
// Get id-object from the first element's data, otherwise initialize it to {}.
|
217
|
+
elem = that.eq(0);
|
218
|
+
elem.data(jquery_data_key, data = elem.data(jquery_data_key) || {});
|
219
|
+
|
220
|
+
} else if (id) {
|
221
|
+
// Get id-object from the cache, otherwise initialize it to {}.
|
222
|
+
data = cache[ id ] || ( cache[ id ] = {} );
|
252
223
|
}
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
224
|
+
|
225
|
+
// Clear any existing timeout for this id.
|
226
|
+
data.id && clearTimeout(data.id);
|
227
|
+
delete data.id;
|
228
|
+
|
229
|
+
// Clean up when necessary.
|
230
|
+
function cleanup() {
|
231
|
+
if (jquery_data_key) {
|
232
|
+
elem.removeData(jquery_data_key);
|
233
|
+
} else if (id) {
|
234
|
+
delete cache[ id ];
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
;
|
239
|
+
|
240
|
+
// Yes, there actually is a setTimeout call in here!
|
241
|
+
function actually_setTimeout() {
|
242
|
+
data.id = setTimeout(function() {
|
243
|
+
data.fn();
|
244
|
+
}, delay);
|
245
|
+
}
|
246
|
+
|
247
|
+
;
|
248
|
+
|
249
|
+
if (callback) {
|
250
|
+
// A callback (and delay) were specified. Store the callback reference for
|
251
|
+
// possible later use, and then setTimeout.
|
252
|
+
data.fn = function(no_polling_loop) {
|
253
|
+
|
254
|
+
// If the callback value is a string, it is assumed to be the name of a
|
255
|
+
// method on $ or $.fn depending on where doTimeout was executed.
|
256
|
+
if (typeof callback === 'string') {
|
257
|
+
callback = method_base[ callback ];
|
258
|
+
}
|
259
|
+
|
260
|
+
callback.apply(that, aps.call(args, slice_args)) === true && !no_polling_loop
|
261
|
+
|
262
|
+
// Since the callback returned true, and we're not specifically
|
263
|
+
// canceling a polling loop, do it again!
|
264
|
+
? actually_setTimeout()
|
265
|
+
|
266
|
+
// Otherwise, clean up and quit.
|
267
|
+
: cleanup();
|
268
|
+
};
|
269
|
+
|
270
|
+
// Set that timeout!
|
271
|
+
actually_setTimeout();
|
272
|
+
|
273
|
+
} else if (data.fn) {
|
274
|
+
// No callback passed. If force_mode (delay) is true, execute the data.fn
|
275
|
+
// callback immediately, continuing any callback return-true polling loop.
|
276
|
+
// If force_mode is false, execute the data.fn callback immediately but do
|
277
|
+
// NOT continue a callback return-true polling loop. If force_mode is
|
278
|
+
// undefined, simply clean up. Since data.fn was still defined, whatever
|
279
|
+
// was supposed to happen hadn't yet, so return true.
|
280
|
+
delay === undefined ? cleanup() : data.fn(delay === false);
|
281
|
+
return true;
|
282
|
+
|
283
|
+
} else {
|
284
|
+
// Since no callback was passed, and data.fn isn't defined, it looks like
|
285
|
+
// whatever was supposed to happen already did. Clean up and quit!
|
286
|
+
cleanup();
|
287
|
+
}
|
288
|
+
|
281
289
|
}
|
282
|
-
|
283
|
-
|
284
|
-
|
290
|
+
|
291
|
+
;
|
292
|
+
|
285
293
|
})(jQuery);
|