rollout_ui 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rollout_ui/feature.rb +6 -2
- data/lib/rollout_ui/version.rb +1 -1
- data/spec/dummy/log/test.log +231 -10862
- data/spec/lib/rollout_ui/feature_spec.rb +3 -1
- metadata +7 -72
- data/spec/dummy/log/development.log +0 -15639
- data/spec/dummy/log/production.log +0 -19
- data/spec/dummy/log/stdout.log +0 -3192
- data/spec/dummy/tmp/cache/assets/C44/C60/sprockets%2F32619064c16276c9031bc469f111b6f1 +0 -369
- data/spec/dummy/tmp/cache/assets/CA9/290/sprockets%2Ffde33cd38c83e40045112ef236908326 +0 -1012
- data/spec/dummy/tmp/cache/assets/CB1/0F0/sprockets%2F097929f05538ada1621d2b34d0748fb8 +0 -0
- data/spec/dummy/tmp/cache/assets/D0C/460/sprockets%2Fbf6917215d0871b152f3d3ec4ece0486 +0 -0
- data/spec/dummy/tmp/cache/assets/D1E/9E0/sprockets%2Fb92e466db7d4e78f107d8386ea19560a +0 -0
- data/spec/dummy/tmp/cache/assets/D22/D60/sprockets%2F6c1d9d3c966b8286c00d8dd46bd54598 +0 -371
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/D3E/870/sprockets%2F82e617ed3b33c78bb8340cdbd603d189 +0 -1015
- data/spec/dummy/tmp/cache/assets/D45/1B0/sprockets%2F89743b2dcefe650c86e16c60dc248a26 +0 -0
- data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
- data/spec/dummy/tmp/cache/assets/D62/900/sprockets%2F4d745068b58dab09efc05fd3bd030c05 +0 -1387
- data/spec/dummy/tmp/cache/assets/D71/220/sprockets%2Fd07f8aed535b53034c9a4489bd6cb45d +0 -374
- data/spec/dummy/tmp/cache/assets/D74/0C0/sprockets%2F28c2d3c4b8de13fe5b746c94d96042dd +0 -0
- data/spec/dummy/tmp/cache/assets/D7D/C20/sprockets%2Ff5f71be7464ea98757bc8e41df514a4b +0 -433
- data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
- data/spec/dummy/tmp/cache/assets/D93/100/sprockets%2Ffd9e48a89d83e7b764e2de324ee888b6 +0 -917
- data/spec/dummy/tmp/cache/assets/DC2/770/sprockets%2F7f10ac108ce75bbb0e9877b50bcb22fe +0 -0
- data/spec/dummy/tmp/cache/assets/E00/850/sprockets%2Fd5e1f4415f71da50c8365f7ecdeca2ff +0 -436
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/E3E/230/sprockets%2F8156dcfebf95ff75b117c7e5bffb71dc +0 -372
- data/spec/dummy/tmp/cache/assets/E7A/F10/sprockets%2Ff3d71fbeaa5fdddf600a0ac52af1d8e2 +0 -0
- data/spec/dummy/tmp/capybara/capybara-201110152250496494273346.html +0 -141
- data/spec/dummy/tmp/capybara/capybara-201110152251237384633452.html +0 -141
- data/spec/dummy/tmp/capybara/capybara-201110152253073784924369.html +0 -141
- data/spec/dummy/tmp/capybara/capybara-201110152255118447806623.html +0 -141
- data/spec/dummy/tmp/capybara/capybara-201110152257286050916603.html +0 -141
- data/spec/dummy/tmp/capybara/capybara-201110152258202877532249.html +0 -139
- data/spec/dummy/tmp/capybara/capybara-201110152259224345897143.html +0 -139
- data/spec/dummy/tmp/pids/server.pid +0 -1
@@ -1,369 +0,0 @@
|
|
1
|
-
o: ActiveSupport::Cache::Entry :@expires_in0:@value{ "
|
2
|
-
* Unobtrusive scripting adapter for jQuery
|
3
|
-
*
|
4
|
-
* Requires jQuery 1.6.0 or later.
|
5
|
-
* https://github.com/rails/jquery-ujs
|
6
|
-
|
7
|
-
* Uploading file using rails.js
|
8
|
-
* =============================
|
9
|
-
*
|
10
|
-
* By default, browsers do not allow files to be uploaded via AJAX. As a result, if there are any non-blank file fields
|
11
|
-
* in the remote form, this adapter aborts the AJAX submission and allows the form to submit through standard means.
|
12
|
-
*
|
13
|
-
* The `ajax:aborted:file` event allows you to bind your own handler to process the form submission however you wish.
|
14
|
-
*
|
15
|
-
* Ex:
|
16
|
-
* $('form').live('ajax:aborted:file', function(event, elements){
|
17
|
-
* // Implement own remote file-transfer handler here for non-blank file inputs passed in `elements`.
|
18
|
-
* // Returning false in this handler tells rails.js to disallow standard form submission
|
19
|
-
* return false;
|
20
|
-
* });
|
21
|
-
*
|
22
|
-
* The `ajax:aborted:file` event is fired when a file-type input is detected with a non-blank value.
|
23
|
-
*
|
24
|
-
* Third-party tools can use this hook to detect when an AJAX file upload is attempted, and then use
|
25
|
-
* techniques like the iframe method to upload the file instead.
|
26
|
-
*
|
27
|
-
* Required fields in rails.js
|
28
|
-
* ===========================
|
29
|
-
*
|
30
|
-
* If any blank required inputs (required="required") are detected in the remote form, the whole form submission
|
31
|
-
* is canceled. Note that this is unlike file inputs, which still allow standard (non-AJAX) form submission.
|
32
|
-
*
|
33
|
-
* The `ajax:aborted:required` event allows you to bind your own handler to inform the user of blank required inputs.
|
34
|
-
*
|
35
|
-
* !! Note that Opera does not fire the form's submit event if there are blank required inputs, so this event may never
|
36
|
-
* get fired in Opera. This event is what causes other browsers to exhibit the same submit-aborting behavior.
|
37
|
-
*
|
38
|
-
* Ex:
|
39
|
-
* $('form').live('ajax:aborted:required', function(event, elements){
|
40
|
-
* // Returning false in this handler tells rails.js to submit the form anyway.
|
41
|
-
* // The blank required inputs are passed to this function in `elements`.
|
42
|
-
* return ! confirm("Would you like to submit the form with missing info?");
|
43
|
-
* });
|
44
|
-
*/
|
45
|
-
|
46
|
-
|
47
|
-
(function($, undefined) {
|
48
|
-
// Shorthand to make it a little easier to call public rails functions from within rails.js
|
49
|
-
var rails;
|
50
|
-
|
51
|
-
$.rails = rails = {
|
52
|
-
// Link elements bound by jquery-ujs
|
53
|
-
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]',
|
54
|
-
|
55
|
-
// Select elements bound by jquery-ujs
|
56
|
-
inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
|
57
|
-
|
58
|
-
// Form elements bound by jquery-ujs
|
59
|
-
formSubmitSelector: 'form',
|
60
|
-
|
61
|
-
// Form input elements bound by jquery-ujs
|
62
|
-
formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not(button[type])',
|
63
|
-
|
64
|
-
// Form input elements disabled during form submission
|
65
|
-
disableSelector: 'input[data-disable-with], button[data-disable-with], textarea[data-disable-with]',
|
66
|
-
|
67
|
-
// Form input elements re-enabled after form submission
|
68
|
-
enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled',
|
69
|
-
|
70
|
-
// Form required input elements
|
71
|
-
requiredInputSelector: 'input[name][required]:not([disabled]),textarea[name][required]:not([disabled])',
|
72
|
-
|
73
|
-
// Form file input elements
|
74
|
-
fileInputSelector: 'input:file',
|
75
|
-
|
76
|
-
// Link onClick disable selector with possible reenable after remote submission
|
77
|
-
linkDisableSelector: 'a[data-disable-with]',
|
78
|
-
|
79
|
-
// Make sure that every Ajax request sends the CSRF token
|
80
|
-
CSRFProtection: function(xhr) {
|
81
|
-
var token = $('meta[name="csrf-token"]').attr('content');
|
82
|
-
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
|
83
|
-
},
|
84
|
-
|
85
|
-
// Triggers an event on an element and returns false if the event result is false
|
86
|
-
fire: function(obj, name, data) {
|
87
|
-
var event = $.Event(name);
|
88
|
-
obj.trigger(event, data);
|
89
|
-
return event.result !== false;
|
90
|
-
},
|
91
|
-
|
92
|
-
// Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
|
93
|
-
confirm: function(message) {
|
94
|
-
return confirm(message);
|
95
|
-
},
|
96
|
-
|
97
|
-
// Default ajax function, may be overridden with custom function in $.rails.ajax
|
98
|
-
ajax: function(options) {
|
99
|
-
return $.ajax(options);
|
100
|
-
},
|
101
|
-
|
102
|
-
// Submits "remote" forms and links with ajax
|
103
|
-
handleRemote: function(element) {
|
104
|
-
var method, url, data,
|
105
|
-
crossDomain = element.data('cross-domain') || null,
|
106
|
-
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType),
|
107
|
-
options;
|
108
|
-
|
109
|
-
if (rails.fire(element, 'ajax:before')) {
|
110
|
-
|
111
|
-
if (element.is('form')) {
|
112
|
-
method = element.attr('method');
|
113
|
-
url = element.attr('action');
|
114
|
-
data = element.serializeArray();
|
115
|
-
// memoized value from clicked submit button
|
116
|
-
var button = element.data('ujs:submit-button');
|
117
|
-
if (button) {
|
118
|
-
data.push(button);
|
119
|
-
element.data('ujs:submit-button', null);
|
120
|
-
}
|
121
|
-
} else if (element.is(rails.inputChangeSelector)) {
|
122
|
-
method = element.data('method');
|
123
|
-
url = element.data('url');
|
124
|
-
data = element.serialize();
|
125
|
-
if (element.data('params')) data = data + "&" + element.data('params');
|
126
|
-
} else {
|
127
|
-
method = element.data('method');
|
128
|
-
url = element.attr('href');
|
129
|
-
data = element.data('params') || null;
|
130
|
-
}
|
131
|
-
|
132
|
-
options = {
|
133
|
-
type: method || 'GET', data: data, dataType: dataType, crossDomain: crossDomain,
|
134
|
-
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
135
|
-
beforeSend: function(xhr, settings) {
|
136
|
-
if (settings.dataType === undefined) {
|
137
|
-
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
138
|
-
}
|
139
|
-
return rails.fire(element, 'ajax:beforeSend', [xhr, settings]);
|
140
|
-
},
|
141
|
-
success: function(data, status, xhr) {
|
142
|
-
element.trigger('ajax:success', [data, status, xhr]);
|
143
|
-
},
|
144
|
-
complete: function(xhr, status) {
|
145
|
-
element.trigger('ajax:complete', [xhr, status]);
|
146
|
-
},
|
147
|
-
error: function(xhr, status, error) {
|
148
|
-
element.trigger('ajax:error', [xhr, status, error]);
|
149
|
-
}
|
150
|
-
};
|
151
|
-
// Only pass url to `ajax` options if not blank
|
152
|
-
if (url) { options.url = url; }
|
153
|
-
|
154
|
-
rails.ajax(options);
|
155
|
-
}
|
156
|
-
},
|
157
|
-
|
158
|
-
// Handles "data-method" on links such as:
|
159
|
-
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
160
|
-
handleMethod: function(link) {
|
161
|
-
var href = link.attr('href'),
|
162
|
-
method = link.data('method'),
|
163
|
-
target = link.attr('target'),
|
164
|
-
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
165
|
-
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
166
|
-
form = $('<form method="post" action="' + href + '"></form>'),
|
167
|
-
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
168
|
-
|
169
|
-
if (csrf_param !== undefined && csrf_token !== undefined) {
|
170
|
-
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
171
|
-
}
|
172
|
-
|
173
|
-
if (target) { form.attr('target', target); }
|
174
|
-
|
175
|
-
form.hide().append(metadata_input).appendTo('body');
|
176
|
-
form.submit();
|
177
|
-
},
|
178
|
-
|
179
|
-
/* Disables form elements:
|
180
|
-
- Caches element value in 'ujs:enable-with' data store
|
181
|
-
- Replaces element text with value of 'data-disable-with' attribute
|
182
|
-
- Sets disabled property to true
|
183
|
-
*/
|
184
|
-
disableFormElements: function(form) {
|
185
|
-
form.find(rails.disableSelector).each(function() {
|
186
|
-
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
187
|
-
element.data('ujs:enable-with', element[method]());
|
188
|
-
element[method](element.data('disable-with'));
|
189
|
-
element.prop('disabled', true);
|
190
|
-
});
|
191
|
-
},
|
192
|
-
|
193
|
-
/* Re-enables disabled form elements:
|
194
|
-
- Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)
|
195
|
-
- Sets disabled property to false
|
196
|
-
*/
|
197
|
-
enableFormElements: function(form) {
|
198
|
-
form.find(rails.enableSelector).each(function() {
|
199
|
-
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
200
|
-
if (element.data('ujs:enable-with')) element[method](element.data('ujs:enable-with'));
|
201
|
-
element.prop('disabled', false);
|
202
|
-
});
|
203
|
-
},
|
204
|
-
|
205
|
-
/* For 'data-confirm' attribute:
|
206
|
-
- Fires `confirm` event
|
207
|
-
- Shows the confirmation dialog
|
208
|
-
- Fires the `confirm:complete` event
|
209
|
-
|
210
|
-
Returns `true` if no function stops the chain and user chose yes; `false` otherwise.
|
211
|
-
Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.
|
212
|
-
Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
|
213
|
-
return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.
|
214
|
-
*/
|
215
|
-
allowAction: function(element) {
|
216
|
-
var message = element.data('confirm'),
|
217
|
-
answer = false, callback;
|
218
|
-
if (!message) { return true; }
|
219
|
-
|
220
|
-
if (rails.fire(element, 'confirm')) {
|
221
|
-
answer = rails.confirm(message);
|
222
|
-
callback = rails.fire(element, 'confirm:complete', [answer]);
|
223
|
-
}
|
224
|
-
return answer && callback;
|
225
|
-
},
|
226
|
-
|
227
|
-
// Helper function which checks for blank inputs in a form that match the specified CSS selector
|
228
|
-
blankInputs: function(form, specifiedSelector, nonBlank) {
|
229
|
-
var inputs = $(), input,
|
230
|
-
selector = specifiedSelector || 'input,textarea';
|
231
|
-
form.find(selector).each(function() {
|
232
|
-
input = $(this);
|
233
|
-
// Collect non-blank inputs if nonBlank option is true, otherwise, collect blank inputs
|
234
|
-
if (nonBlank ? input.val() : !input.val()) {
|
235
|
-
inputs = inputs.add(input);
|
236
|
-
}
|
237
|
-
});
|
238
|
-
return inputs.length ? inputs : false;
|
239
|
-
},
|
240
|
-
|
241
|
-
// Helper function which checks for non-blank inputs in a form that match the specified CSS selector
|
242
|
-
nonBlankInputs: function(form, specifiedSelector) {
|
243
|
-
return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank
|
244
|
-
},
|
245
|
-
|
246
|
-
// Helper function, needed to provide consistent behavior in IE
|
247
|
-
stopEverything: function(e) {
|
248
|
-
$(e.target).trigger('ujs:everythingStopped');
|
249
|
-
e.stopImmediatePropagation();
|
250
|
-
return false;
|
251
|
-
},
|
252
|
-
|
253
|
-
// find all the submit events directly bound to the form and
|
254
|
-
// manually invoke them. If anyone returns false then stop the loop
|
255
|
-
callFormSubmitBindings: function(form) {
|
256
|
-
var events = form.data('events'), continuePropagation = true;
|
257
|
-
if (events !== undefined && events['submit'] !== undefined) {
|
258
|
-
$.each(events['submit'], function(i, obj){
|
259
|
-
if (typeof obj.handler === 'function') return continuePropagation = obj.handler(obj.data);
|
260
|
-
});
|
261
|
-
}
|
262
|
-
return continuePropagation;
|
263
|
-
},
|
264
|
-
|
265
|
-
// replace element's html with the 'data-disable-with' after storing original html
|
266
|
-
// and prevent clicking on it
|
267
|
-
disableElement: function(element) {
|
268
|
-
element.data('ujs:enable-with', element.html()); // store enabled state
|
269
|
-
element.html(element.data('disable-with')); // set to disabled state
|
270
|
-
element.bind('click.railsDisable', function(e) { // prevent further clicking
|
271
|
-
return rails.stopEverything(e)
|
272
|
-
});
|
273
|
-
},
|
274
|
-
|
275
|
-
// restore element to its original state which was disabled by 'disableElement' above
|
276
|
-
enableElement: function(element) {
|
277
|
-
if (element.data('ujs:enable-with') !== undefined) {
|
278
|
-
element.html(element.data('ujs:enable-with')); // set to old enabled state
|
279
|
-
// this should be element.removeData('ujs:enable-with')
|
280
|
-
// but, there is currently a bug in jquery which makes hyphenated data attributes not get removed
|
281
|
-
element.data('ujs:enable-with', false); // clean up cache
|
282
|
-
}
|
283
|
-
element.unbind('click.railsDisable'); // enable element
|
284
|
-
}
|
285
|
-
|
286
|
-
};
|
287
|
-
|
288
|
-
$.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});
|
289
|
-
|
290
|
-
$(rails.linkDisableSelector).live('ajax:complete', function() {
|
291
|
-
rails.enableElement($(this));
|
292
|
-
});
|
293
|
-
|
294
|
-
$(rails.linkClickSelector).live('click.rails', function(e) {
|
295
|
-
var link = $(this), method = link.data('method'), data = link.data('params');
|
296
|
-
if (!rails.allowAction(link)) return rails.stopEverything(e);
|
297
|
-
|
298
|
-
if (link.is(rails.linkDisableSelector)) rails.disableElement(link);
|
299
|
-
|
300
|
-
if (link.data('remote') !== undefined) {
|
301
|
-
if ( (e.metaKey || e.ctrlKey) && (!method || method === 'GET') && !data ) { return true; }
|
302
|
-
rails.handleRemote(link);
|
303
|
-
return false;
|
304
|
-
} else if (link.data('method')) {
|
305
|
-
rails.handleMethod(link);
|
306
|
-
return false;
|
307
|
-
}
|
308
|
-
});
|
309
|
-
|
310
|
-
$(rails.inputChangeSelector).live('change.rails', function(e) {
|
311
|
-
var link = $(this);
|
312
|
-
if (!rails.allowAction(link)) return rails.stopEverything(e);
|
313
|
-
|
314
|
-
rails.handleRemote(link);
|
315
|
-
return false;
|
316
|
-
});
|
317
|
-
|
318
|
-
$(rails.formSubmitSelector).live('submit.rails', function(e) {
|
319
|
-
var form = $(this),
|
320
|
-
remote = form.data('remote') !== undefined,
|
321
|
-
blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector),
|
322
|
-
nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);
|
323
|
-
|
324
|
-
if (!rails.allowAction(form)) return rails.stopEverything(e);
|
325
|
-
|
326
|
-
// skip other logic when required values are missing or file upload is present
|
327
|
-
if (blankRequiredInputs && form.attr("novalidate") == undefined && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
|
328
|
-
return rails.stopEverything(e);
|
329
|
-
}
|
330
|
-
|
331
|
-
if (remote) {
|
332
|
-
if (nonBlankFileInputs) {
|
333
|
-
return rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);
|
334
|
-
}
|
335
|
-
|
336
|
-
// If browser does not support submit bubbling, then this live-binding will be called before direct
|
337
|
-
// bindings. Therefore, we should directly call any direct bindings before remotely submitting form.
|
338
|
-
if (!$.support.submitBubbles && rails.callFormSubmitBindings(form) === false) return rails.stopEverything(e);
|
339
|
-
|
340
|
-
rails.handleRemote(form);
|
341
|
-
return false;
|
342
|
-
} else {
|
343
|
-
// slight timeout so that the submit button gets properly serialized
|
344
|
-
setTimeout(function(){ rails.disableFormElements(form); }, 13);
|
345
|
-
}
|
346
|
-
});
|
347
|
-
|
348
|
-
$(rails.formInputClickSelector).live('click.rails', function(event) {
|
349
|
-
var button = $(this);
|
350
|
-
|
351
|
-
if (!rails.allowAction(button)) return rails.stopEverything(event);
|
352
|
-
|
353
|
-
// register the pressed submit button
|
354
|
-
var name = button.attr('name'),
|
355
|
-
data = name ? {name:name, value:button.val()} : null;
|
356
|
-
|
357
|
-
button.closest('form').data('ujs:submit-button', data);
|
358
|
-
});
|
359
|
-
|
360
|
-
$(rails.formSubmitSelector).live('ajax:beforeSend.rails', function(event) {
|
361
|
-
if (this == event.target) rails.disableFormElements($(this));
|
362
|
-
});
|
363
|
-
|
364
|
-
$(rails.formSubmitSelector).live('ajax:complete.rails', function(event) {
|
365
|
-
if (this == event.target) rails.enableFormElements($(this));
|
366
|
-
});
|
367
|
-
|
368
|
-
})( jQuery );
|
369
|
-
:@compressedF:@created_atf1318830254.8105991��
|
@@ -1,1012 +0,0 @@
|
|
1
|
-
o: ActiveSupport::Cache::Entry :@expires_in0:@value{ "
|
2
|
-
// by Patrick Filler for Harvest, http://getharvest.com
|
3
|
-
//
|
4
|
-
// Version 0.9.5
|
5
|
-
// Full source at https://github.com/harvesthq/chosen
|
6
|
-
// Copyright (c) 2011 Harvest http://getharvest.com
|
7
|
-
|
8
|
-
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
9
|
-
// This file is generated by `cake build`, do not edit it by hand.
|
10
|
-
(function() {
|
11
|
-
var SelectParser;
|
12
|
-
SelectParser = (function() {
|
13
|
-
function SelectParser() {
|
14
|
-
this.options_index = 0;
|
15
|
-
this.parsed = [];
|
16
|
-
}
|
17
|
-
SelectParser.prototype.add_node = function(child) {
|
18
|
-
if (child.nodeName === "OPTGROUP") {
|
19
|
-
return this.add_group(child);
|
20
|
-
} else {
|
21
|
-
return this.add_option(child);
|
22
|
-
}
|
23
|
-
};
|
24
|
-
SelectParser.prototype.add_group = function(group) {
|
25
|
-
var group_position, option, _i, _len, _ref, _results;
|
26
|
-
group_position = this.parsed.length;
|
27
|
-
this.parsed.push({
|
28
|
-
array_index: group_position,
|
29
|
-
group: true,
|
30
|
-
label: group.label,
|
31
|
-
children: 0,
|
32
|
-
disabled: group.disabled
|
33
|
-
});
|
34
|
-
_ref = group.childNodes;
|
35
|
-
_results = [];
|
36
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
37
|
-
option = _ref[_i];
|
38
|
-
_results.push(this.add_option(option, group_position, group.disabled));
|
39
|
-
}
|
40
|
-
return _results;
|
41
|
-
};
|
42
|
-
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
43
|
-
if (option.nodeName === "OPTION") {
|
44
|
-
if (option.text !== "") {
|
45
|
-
if (group_position != null) {
|
46
|
-
this.parsed[group_position].children += 1;
|
47
|
-
}
|
48
|
-
this.parsed.push({
|
49
|
-
array_index: this.parsed.length,
|
50
|
-
options_index: this.options_index,
|
51
|
-
value: option.value,
|
52
|
-
text: option.text,
|
53
|
-
html: option.innerHTML,
|
54
|
-
selected: option.selected,
|
55
|
-
disabled: group_disabled === true ? group_disabled : option.disabled,
|
56
|
-
group_array_index: group_position,
|
57
|
-
classes: option.className,
|
58
|
-
style: option.style.cssText
|
59
|
-
});
|
60
|
-
} else {
|
61
|
-
this.parsed.push({
|
62
|
-
array_index: this.parsed.length,
|
63
|
-
options_index: this.options_index,
|
64
|
-
empty: true
|
65
|
-
});
|
66
|
-
}
|
67
|
-
return this.options_index += 1;
|
68
|
-
}
|
69
|
-
};
|
70
|
-
return SelectParser;
|
71
|
-
})();
|
72
|
-
SelectParser.select_to_array = function(select) {
|
73
|
-
var child, parser, _i, _len, _ref;
|
74
|
-
parser = new SelectParser();
|
75
|
-
_ref = select.childNodes;
|
76
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
77
|
-
child = _ref[_i];
|
78
|
-
parser.add_node(child);
|
79
|
-
}
|
80
|
-
return parser.parsed;
|
81
|
-
};
|
82
|
-
this.SelectParser = SelectParser;
|
83
|
-
}).call(this);
|
84
|
-
(function() {
|
85
|
-
/*
|
86
|
-
Chosen source: generate output using 'cake build'
|
87
|
-
Copyright (c) 2011 by Harvest
|
88
|
-
*/
|
89
|
-
var AbstractChosen, root;
|
90
|
-
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
91
|
-
root = this;
|
92
|
-
AbstractChosen = (function() {
|
93
|
-
function AbstractChosen(form_field, options) {
|
94
|
-
this.form_field = form_field;
|
95
|
-
this.options = options != null ? options : {};
|
96
|
-
this.set_default_values();
|
97
|
-
this.is_multiple = this.form_field.multiple;
|
98
|
-
this.default_text_default = this.form_field.multiple ? "Select Some Options" : "Select an Option";
|
99
|
-
this.setup();
|
100
|
-
this.set_up_html();
|
101
|
-
this.register_observers();
|
102
|
-
this.finish_setup();
|
103
|
-
}
|
104
|
-
AbstractChosen.prototype.set_default_values = function() {
|
105
|
-
this.click_test_action = __bind(function(evt) {
|
106
|
-
return this.test_active_click(evt);
|
107
|
-
}, this);
|
108
|
-
this.activate_action = __bind(function(evt) {
|
109
|
-
return this.activate_field(evt);
|
110
|
-
}, this);
|
111
|
-
this.active_field = false;
|
112
|
-
this.mouse_on_container = false;
|
113
|
-
this.results_showing = false;
|
114
|
-
this.result_highlighted = null;
|
115
|
-
this.result_single_selected = null;
|
116
|
-
this.allow_single_deselect = (this.options.allow_single_deselect != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
117
|
-
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
118
|
-
this.choices = 0;
|
119
|
-
return this.results_none_found = this.options.no_results_text || "No results match";
|
120
|
-
};
|
121
|
-
AbstractChosen.prototype.mouse_enter = function() {
|
122
|
-
return this.mouse_on_container = true;
|
123
|
-
};
|
124
|
-
AbstractChosen.prototype.mouse_leave = function() {
|
125
|
-
return this.mouse_on_container = false;
|
126
|
-
};
|
127
|
-
AbstractChosen.prototype.input_focus = function(evt) {
|
128
|
-
if (!this.active_field) {
|
129
|
-
return setTimeout((__bind(function() {
|
130
|
-
return this.container_mousedown();
|
131
|
-
}, this)), 50);
|
132
|
-
}
|
133
|
-
};
|
134
|
-
AbstractChosen.prototype.input_blur = function(evt) {
|
135
|
-
if (!this.mouse_on_container) {
|
136
|
-
this.active_field = false;
|
137
|
-
return setTimeout((__bind(function() {
|
138
|
-
return this.blur_test();
|
139
|
-
}, this)), 100);
|
140
|
-
}
|
141
|
-
};
|
142
|
-
AbstractChosen.prototype.result_add_option = function(option) {
|
143
|
-
var classes, style;
|
144
|
-
if (!option.disabled) {
|
145
|
-
option.dom_id = this.container_id + "_o_" + option.array_index;
|
146
|
-
classes = option.selected && this.is_multiple ? [] : ["active-result"];
|
147
|
-
if (option.selected) {
|
148
|
-
classes.push("result-selected");
|
149
|
-
}
|
150
|
-
if (option.group_array_index != null) {
|
151
|
-
classes.push("group-option");
|
152
|
-
}
|
153
|
-
if (option.classes !== "") {
|
154
|
-
classes.push(option.classes);
|
155
|
-
}
|
156
|
-
style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
|
157
|
-
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
|
158
|
-
} else {
|
159
|
-
return "";
|
160
|
-
}
|
161
|
-
};
|
162
|
-
AbstractChosen.prototype.results_update_field = function() {
|
163
|
-
this.result_clear_highlight();
|
164
|
-
this.result_single_selected = null;
|
165
|
-
return this.results_build();
|
166
|
-
};
|
167
|
-
AbstractChosen.prototype.results_toggle = function() {
|
168
|
-
if (this.results_showing) {
|
169
|
-
return this.results_hide();
|
170
|
-
} else {
|
171
|
-
return this.results_show();
|
172
|
-
}
|
173
|
-
};
|
174
|
-
AbstractChosen.prototype.results_search = function(evt) {
|
175
|
-
if (this.results_showing) {
|
176
|
-
return this.winnow_results();
|
177
|
-
} else {
|
178
|
-
return this.results_show();
|
179
|
-
}
|
180
|
-
};
|
181
|
-
AbstractChosen.prototype.keyup_checker = function(evt) {
|
182
|
-
var stroke, _ref;
|
183
|
-
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
184
|
-
this.search_field_scale();
|
185
|
-
switch (stroke) {
|
186
|
-
case 8:
|
187
|
-
if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
|
188
|
-
return this.keydown_backstroke();
|
189
|
-
} else if (!this.pending_backstroke) {
|
190
|
-
this.result_clear_highlight();
|
191
|
-
return this.results_search();
|
192
|
-
}
|
193
|
-
break;
|
194
|
-
case 13:
|
195
|
-
evt.preventDefault();
|
196
|
-
if (this.results_showing) {
|
197
|
-
return this.result_select(evt);
|
198
|
-
} else if (this.is_tag) {
|
199
|
-
return this.choice_append();
|
200
|
-
}
|
201
|
-
break;
|
202
|
-
case 27:
|
203
|
-
if (this.results_showing) {
|
204
|
-
return this.results_hide();
|
205
|
-
}
|
206
|
-
break;
|
207
|
-
case 9:
|
208
|
-
case 38:
|
209
|
-
case 40:
|
210
|
-
case 16:
|
211
|
-
case 91:
|
212
|
-
case 17:
|
213
|
-
break;
|
214
|
-
default:
|
215
|
-
return this.results_search();
|
216
|
-
}
|
217
|
-
};
|
218
|
-
AbstractChosen.prototype.generate_field_id = function() {
|
219
|
-
var new_id;
|
220
|
-
new_id = this.generate_random_id();
|
221
|
-
this.form_field.id = new_id;
|
222
|
-
return new_id;
|
223
|
-
};
|
224
|
-
AbstractChosen.prototype.generate_random_char = function() {
|
225
|
-
var chars, newchar, rand;
|
226
|
-
chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
|
227
|
-
rand = Math.floor(Math.random() * chars.length);
|
228
|
-
return newchar = chars.substring(rand, rand + 1);
|
229
|
-
};
|
230
|
-
return AbstractChosen;
|
231
|
-
})();
|
232
|
-
root.AbstractChosen = AbstractChosen;
|
233
|
-
}).call(this);
|
234
|
-
(function() {
|
235
|
-
/*
|
236
|
-
Chosen source: generate output using 'cake build'
|
237
|
-
Copyright (c) 2011 by Harvest
|
238
|
-
*/
|
239
|
-
var $, Chosen, get_side_border_padding, root;
|
240
|
-
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
|
241
|
-
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
|
242
|
-
function ctor() { this.constructor = child; }
|
243
|
-
ctor.prototype = parent.prototype;
|
244
|
-
child.prototype = new ctor;
|
245
|
-
child.__super__ = parent.prototype;
|
246
|
-
return child;
|
247
|
-
}, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
248
|
-
root = this;
|
249
|
-
$ = jQuery;
|
250
|
-
$.fn.extend({
|
251
|
-
chosen: function(options) {
|
252
|
-
if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
|
253
|
-
return this;
|
254
|
-
}
|
255
|
-
return $(this).each(function(input_field) {
|
256
|
-
if (!($(this)).hasClass("chzn-done")) {
|
257
|
-
return new Chosen(this, options);
|
258
|
-
}
|
259
|
-
});
|
260
|
-
}
|
261
|
-
});
|
262
|
-
Chosen = (function() {
|
263
|
-
__extends(Chosen, AbstractChosen);
|
264
|
-
function Chosen() {
|
265
|
-
Chosen.__super__.constructor.apply(this, arguments);
|
266
|
-
}
|
267
|
-
Chosen.prototype.setup = function() {
|
268
|
-
var tag, tags, val, _i, _len, _results;
|
269
|
-
this.form_field_jq = $(this.form_field);
|
270
|
-
this.is_tag = this.form_field_jq.attr("type") === "text";
|
271
|
-
this.is_multiple = this.is_tag ? true : this.is_multiple;
|
272
|
-
this.default_text_default = this.is_tag ? "Enter Tags" : this.default_text_default;
|
273
|
-
this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
|
274
|
-
this.tags = [];
|
275
|
-
if (this.is_tag) {
|
276
|
-
val = this.form_field.value;
|
277
|
-
this.form_field.value = '';
|
278
|
-
if (val !== '') {
|
279
|
-
tags = val.split(',');
|
280
|
-
_results = [];
|
281
|
-
for (_i = 0, _len = tags.length; _i < _len; _i++) {
|
282
|
-
tag = tags[_i];
|
283
|
-
_results.push(this.tags.push(unescape(tag)));
|
284
|
-
}
|
285
|
-
return _results;
|
286
|
-
}
|
287
|
-
}
|
288
|
-
};
|
289
|
-
Chosen.prototype.finish_setup = function() {
|
290
|
-
var tag, _i, _len, _ref, _results;
|
291
|
-
this.form_field_jq.addClass("chzn-done");
|
292
|
-
_ref = this.tags;
|
293
|
-
_results = [];
|
294
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
295
|
-
tag = _ref[_i];
|
296
|
-
_results.push(this.choice_append(tag, tag));
|
297
|
-
}
|
298
|
-
return _results;
|
299
|
-
};
|
300
|
-
Chosen.prototype.set_up_html = function() {
|
301
|
-
var container_div, dd_top, dd_width, sf_width;
|
302
|
-
this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
|
303
|
-
this.container_id += "_chzn";
|
304
|
-
this.f_width = this.form_field_jq.outerWidth();
|
305
|
-
this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
|
306
|
-
container_div = $("<div />", {
|
307
|
-
id: this.container_id,
|
308
|
-
"class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
|
309
|
-
style: 'width: ' + this.f_width + 'px;'
|
310
|
-
});
|
311
|
-
if (this.is_multiple) {
|
312
|
-
container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
|
313
|
-
} else {
|
314
|
-
container_div.html('<a href="javascript:void(0)" class="chzn-single"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
|
315
|
-
}
|
316
|
-
this.form_field_jq.hide().after(container_div);
|
317
|
-
this.container = $('#' + this.container_id);
|
318
|
-
this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
|
319
|
-
if (!this.is_multiple && this.form_field.options.length <= this.disable_search_threshold) {
|
320
|
-
this.container.addClass("chzn-container-single-nosearch");
|
321
|
-
}
|
322
|
-
this.dropdown = this.container.find('div.chzn-drop').first();
|
323
|
-
dd_top = this.container.height();
|
324
|
-
dd_width = this.f_width - get_side_border_padding(this.dropdown);
|
325
|
-
this.dropdown.css({
|
326
|
-
"width": dd_width + "px",
|
327
|
-
"top": dd_top + "px"
|
328
|
-
});
|
329
|
-
this.search_field = this.container.find('input').first();
|
330
|
-
this.search_results = this.container.find('ul.chzn-results').first();
|
331
|
-
this.search_field_scale();
|
332
|
-
this.search_no_results = this.container.find('li.no-results').first();
|
333
|
-
if (this.is_multiple) {
|
334
|
-
this.search_choices = this.container.find('ul.chzn-choices').first();
|
335
|
-
this.search_container = this.container.find('li.search-field').first();
|
336
|
-
} else {
|
337
|
-
this.search_container = this.container.find('div.chzn-search').first();
|
338
|
-
this.selected_item = this.container.find('.chzn-single').first();
|
339
|
-
sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
|
340
|
-
this.search_field.css({
|
341
|
-
"width": sf_width + "px"
|
342
|
-
});
|
343
|
-
}
|
344
|
-
if (this.is_tag) {
|
345
|
-
this.container.prepend('<select id="' + this.container_id + '_shadow" name="' + this.form_field.name + '" style="display: none;" multiple="multiple"></select>');
|
346
|
-
this.form_field_jq = $('#' + this.container_id + '_shadow');
|
347
|
-
this.form_field = this.form_field_jq.get(0);
|
348
|
-
}
|
349
|
-
this.results_build();
|
350
|
-
return this.set_tab_index();
|
351
|
-
};
|
352
|
-
Chosen.prototype.register_observers = function() {
|
353
|
-
this.container.mousedown(__bind(function(evt) {
|
354
|
-
return this.container_mousedown(evt);
|
355
|
-
}, this));
|
356
|
-
this.container.mouseup(__bind(function(evt) {
|
357
|
-
return this.container_mouseup(evt);
|
358
|
-
}, this));
|
359
|
-
this.container.mouseenter(__bind(function(evt) {
|
360
|
-
return this.mouse_enter(evt);
|
361
|
-
}, this));
|
362
|
-
this.container.mouseleave(__bind(function(evt) {
|
363
|
-
return this.mouse_leave(evt);
|
364
|
-
}, this));
|
365
|
-
this.search_results.mouseup(__bind(function(evt) {
|
366
|
-
return this.search_results_mouseup(evt);
|
367
|
-
}, this));
|
368
|
-
this.search_results.mouseover(__bind(function(evt) {
|
369
|
-
return this.search_results_mouseover(evt);
|
370
|
-
}, this));
|
371
|
-
this.search_results.mouseout(__bind(function(evt) {
|
372
|
-
return this.search_results_mouseout(evt);
|
373
|
-
}, this));
|
374
|
-
this.form_field_jq.bind("liszt:updated", __bind(function(evt) {
|
375
|
-
return this.results_update_field(evt);
|
376
|
-
}, this));
|
377
|
-
this.search_field.blur(__bind(function(evt) {
|
378
|
-
return this.input_blur(evt);
|
379
|
-
}, this));
|
380
|
-
this.search_field.keyup(__bind(function(evt) {
|
381
|
-
return this.keyup_checker(evt);
|
382
|
-
}, this));
|
383
|
-
this.search_field.keydown(__bind(function(evt) {
|
384
|
-
return this.keydown_checker(evt);
|
385
|
-
}, this));
|
386
|
-
if (this.is_multiple) {
|
387
|
-
this.search_choices.click(__bind(function(evt) {
|
388
|
-
return this.choices_click(evt);
|
389
|
-
}, this));
|
390
|
-
return this.search_field.focus(__bind(function(evt) {
|
391
|
-
return this.input_focus(evt);
|
392
|
-
}, this));
|
393
|
-
}
|
394
|
-
};
|
395
|
-
Chosen.prototype.search_field_disabled = function() {
|
396
|
-
this.is_disabled = this.form_field_jq.attr('disabled');
|
397
|
-
if (this.is_disabled) {
|
398
|
-
this.container.addClass('chzn-disabled');
|
399
|
-
this.search_field.attr('disabled', true);
|
400
|
-
if (!this.is_multiple) {
|
401
|
-
this.selected_item.unbind("focus", this.activate_action);
|
402
|
-
}
|
403
|
-
return this.close_field();
|
404
|
-
} else {
|
405
|
-
this.container.removeClass('chzn-disabled');
|
406
|
-
this.search_field.attr('disabled', false);
|
407
|
-
if (!this.is_multiple) {
|
408
|
-
return this.selected_item.bind("focus", this.activate_action);
|
409
|
-
}
|
410
|
-
}
|
411
|
-
};
|
412
|
-
Chosen.prototype.container_mousedown = function(evt) {
|
413
|
-
var target_closelink;
|
414
|
-
if (!this.is_disabled) {
|
415
|
-
target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
|
416
|
-
if (evt && evt.type === "mousedown") {
|
417
|
-
evt.stopPropagation();
|
418
|
-
}
|
419
|
-
if (!this.pending_destroy_click && !target_closelink) {
|
420
|
-
if (!this.active_field) {
|
421
|
-
if (this.is_multiple) {
|
422
|
-
this.search_field.val("");
|
423
|
-
}
|
424
|
-
$(document).click(this.click_test_action);
|
425
|
-
this.results_show();
|
426
|
-
} else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) {
|
427
|
-
evt.preventDefault();
|
428
|
-
this.results_toggle();
|
429
|
-
}
|
430
|
-
return this.activate_field();
|
431
|
-
} else {
|
432
|
-
return this.pending_destroy_click = false;
|
433
|
-
}
|
434
|
-
}
|
435
|
-
};
|
436
|
-
Chosen.prototype.container_mouseup = function(evt) {
|
437
|
-
if (evt.target.nodeName === "ABBR") {
|
438
|
-
return this.results_reset(evt);
|
439
|
-
}
|
440
|
-
};
|
441
|
-
Chosen.prototype.blur_test = function(evt) {
|
442
|
-
if (!this.active_field && this.container.hasClass("chzn-container-active")) {
|
443
|
-
return this.close_field();
|
444
|
-
}
|
445
|
-
};
|
446
|
-
Chosen.prototype.close_field = function() {
|
447
|
-
$(document).unbind("click", this.click_test_action);
|
448
|
-
if (!this.is_multiple) {
|
449
|
-
this.selected_item.attr("tabindex", this.search_field.attr("tabindex"));
|
450
|
-
this.search_field.attr("tabindex", -1);
|
451
|
-
}
|
452
|
-
this.active_field = false;
|
453
|
-
this.results_hide();
|
454
|
-
this.container.removeClass("chzn-container-active");
|
455
|
-
this.winnow_results_clear();
|
456
|
-
this.clear_backstroke();
|
457
|
-
this.show_search_field_default();
|
458
|
-
return this.search_field_scale();
|
459
|
-
};
|
460
|
-
Chosen.prototype.activate_field = function() {
|
461
|
-
if (!this.is_multiple && !this.active_field) {
|
462
|
-
this.search_field.attr("tabindex", this.selected_item.attr("tabindex"));
|
463
|
-
this.selected_item.attr("tabindex", -1);
|
464
|
-
}
|
465
|
-
this.container.addClass("chzn-container-active");
|
466
|
-
this.active_field = true;
|
467
|
-
this.search_field.val(this.search_field.val());
|
468
|
-
return this.search_field.focus();
|
469
|
-
};
|
470
|
-
Chosen.prototype.test_active_click = function(evt) {
|
471
|
-
if ($(evt.target).parents('#' + this.container_id).length) {
|
472
|
-
return this.active_field = true;
|
473
|
-
} else {
|
474
|
-
return this.close_field();
|
475
|
-
}
|
476
|
-
};
|
477
|
-
Chosen.prototype.results_build = function() {
|
478
|
-
var content, data, hash, i, opt, result, startTime, _i, _j, _len, _len2, _len3, _ref, _ref2;
|
479
|
-
startTime = new Date();
|
480
|
-
this.parsing = true;
|
481
|
-
if (this.is_tag && (typeof results !== "undefined" && results !== null)) {
|
482
|
-
hash = {};
|
483
|
-
_ref = this.form_field.options;
|
484
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
485
|
-
opt = _ref[_i];
|
486
|
-
if (opt.selected) {
|
487
|
-
hash[opt.value] = true;
|
488
|
-
}
|
489
|
-
}
|
490
|
-
this.results_data = [];
|
491
|
-
for (i = 0, _len2 = results.length; i < _len2; i++) {
|
492
|
-
result = results[i];
|
493
|
-
this.results_data.push({
|
494
|
-
array_index: i,
|
495
|
-
options_index: i,
|
496
|
-
value: result.value,
|
497
|
-
text: result.text,
|
498
|
-
html: result.text,
|
499
|
-
selected: result.value in hash ? 1 : 0,
|
500
|
-
disabled: 0,
|
501
|
-
group_array_index: null
|
502
|
-
});
|
503
|
-
}
|
504
|
-
} else {
|
505
|
-
this.results_data = root.SelectParser.select_to_array(this.form_field);
|
506
|
-
if (this.is_multiple && this.choices > 0) {
|
507
|
-
this.search_choices.find("li.search-choice").remove();
|
508
|
-
this.choices = 0;
|
509
|
-
} else if (!this.is_multiple) {
|
510
|
-
this.selected_item.find("span").text(this.default_text);
|
511
|
-
}
|
512
|
-
}
|
513
|
-
content = '';
|
514
|
-
_ref2 = this.results_data;
|
515
|
-
for (_j = 0, _len3 = _ref2.length; _j < _len3; _j++) {
|
516
|
-
data = _ref2[_j];
|
517
|
-
if (data.group) {
|
518
|
-
content += this.result_add_group(data);
|
519
|
-
} else if (!data.empty) {
|
520
|
-
content += this.result_add_option(data);
|
521
|
-
if (this.is_tag && (typeof results !== "undefined" && results !== null)) {
|
522
|
-
continue;
|
523
|
-
}
|
524
|
-
if (data.selected && this.is_multiple) {
|
525
|
-
this.choice_build(data);
|
526
|
-
} else if (data.selected && !this.is_multiple) {
|
527
|
-
this.selected_item.find("span").text(data.text);
|
528
|
-
if (this.allow_single_deselect) {
|
529
|
-
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
530
|
-
}
|
531
|
-
}
|
532
|
-
}
|
533
|
-
}
|
534
|
-
if (this.is_tag && (typeof results !== "undefined" && results !== null)) {
|
535
|
-
this.search_results.html(content);
|
536
|
-
this.results_show();
|
537
|
-
} else {
|
538
|
-
this.search_field_disabled();
|
539
|
-
this.show_search_field_default();
|
540
|
-
this.search_field_scale();
|
541
|
-
this.search_results.html(content);
|
542
|
-
}
|
543
|
-
return this.parsing = false;
|
544
|
-
};
|
545
|
-
Chosen.prototype.result_add_group = function(group) {
|
546
|
-
if (!group.disabled) {
|
547
|
-
group.dom_id = this.container_id + "_g_" + group.array_index;
|
548
|
-
return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
|
549
|
-
} else {
|
550
|
-
return "";
|
551
|
-
}
|
552
|
-
};
|
553
|
-
Chosen.prototype.result_do_highlight = function(el) {
|
554
|
-
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
555
|
-
if (el.length) {
|
556
|
-
this.result_clear_highlight();
|
557
|
-
this.result_highlight = el;
|
558
|
-
this.result_highlight.addClass("highlighted");
|
559
|
-
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
560
|
-
visible_top = this.search_results.scrollTop();
|
561
|
-
visible_bottom = maxHeight + visible_top;
|
562
|
-
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
563
|
-
high_bottom = high_top + this.result_highlight.outerHeight();
|
564
|
-
if (high_bottom >= visible_bottom) {
|
565
|
-
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
566
|
-
} else if (high_top < visible_top) {
|
567
|
-
return this.search_results.scrollTop(high_top);
|
568
|
-
}
|
569
|
-
}
|
570
|
-
};
|
571
|
-
Chosen.prototype.result_clear_highlight = function() {
|
572
|
-
if (this.result_highlight) {
|
573
|
-
this.result_highlight.removeClass("highlighted");
|
574
|
-
}
|
575
|
-
return this.result_highlight = null;
|
576
|
-
};
|
577
|
-
Chosen.prototype.results_show = function() {
|
578
|
-
var dd_top;
|
579
|
-
if (!this.is_multiple) {
|
580
|
-
this.selected_item.addClass("chzn-single-with-drop");
|
581
|
-
if (this.result_single_selected) {
|
582
|
-
this.result_do_highlight(this.result_single_selected);
|
583
|
-
}
|
584
|
-
}
|
585
|
-
dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
|
586
|
-
this.dropdown.css({
|
587
|
-
"top": dd_top + "px",
|
588
|
-
"left": 0
|
589
|
-
});
|
590
|
-
this.results_showing = true;
|
591
|
-
this.search_field.focus();
|
592
|
-
this.search_field.val(this.search_field.val());
|
593
|
-
return this.winnow_results();
|
594
|
-
};
|
595
|
-
Chosen.prototype.results_hide = function() {
|
596
|
-
if (!this.is_multiple) {
|
597
|
-
this.selected_item.removeClass("chzn-single-with-drop");
|
598
|
-
}
|
599
|
-
this.result_clear_highlight();
|
600
|
-
this.dropdown.css({
|
601
|
-
"left": "-9000px"
|
602
|
-
});
|
603
|
-
return this.results_showing = false;
|
604
|
-
};
|
605
|
-
Chosen.prototype.set_tab_index = function(el) {
|
606
|
-
var ti;
|
607
|
-
if (this.form_field_jq.attr("tabindex")) {
|
608
|
-
ti = this.form_field_jq.attr("tabindex");
|
609
|
-
this.form_field_jq.attr("tabindex", -1);
|
610
|
-
if (this.is_multiple) {
|
611
|
-
return this.search_field.attr("tabindex", ti);
|
612
|
-
} else {
|
613
|
-
this.selected_item.attr("tabindex", ti);
|
614
|
-
return this.search_field.attr("tabindex", -1);
|
615
|
-
}
|
616
|
-
}
|
617
|
-
};
|
618
|
-
Chosen.prototype.show_search_field_default = function() {
|
619
|
-
if (this.is_multiple && this.choices < 1 && !this.active_field) {
|
620
|
-
this.search_field.val(this.default_text);
|
621
|
-
return this.search_field.addClass("default");
|
622
|
-
} else {
|
623
|
-
this.search_field.val("");
|
624
|
-
return this.search_field.removeClass("default");
|
625
|
-
}
|
626
|
-
};
|
627
|
-
Chosen.prototype.search_results_mouseup = function(evt) {
|
628
|
-
var target;
|
629
|
-
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
630
|
-
if (target.length) {
|
631
|
-
this.result_highlight = target;
|
632
|
-
return this.result_select(evt);
|
633
|
-
}
|
634
|
-
};
|
635
|
-
Chosen.prototype.search_results_mouseover = function(evt) {
|
636
|
-
var target;
|
637
|
-
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
638
|
-
if (target) {
|
639
|
-
return this.result_do_highlight(target);
|
640
|
-
}
|
641
|
-
};
|
642
|
-
Chosen.prototype.search_results_mouseout = function(evt) {
|
643
|
-
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
644
|
-
return this.result_clear_highlight();
|
645
|
-
}
|
646
|
-
};
|
647
|
-
Chosen.prototype.choices_click = function(evt) {
|
648
|
-
evt.preventDefault();
|
649
|
-
if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
|
650
|
-
return this.results_show();
|
651
|
-
}
|
652
|
-
};
|
653
|
-
Chosen.prototype.choice_append = function(text, value) {
|
654
|
-
var i, item, opt, result, txt, val, _i, _len, _len2, _ref, _ref2;
|
655
|
-
txt = text != null ? text : $.trim(this.search_field.val());
|
656
|
-
val = value != null ? value : txt;
|
657
|
-
if (txt.length < 1 || val.length < 1) {
|
658
|
-
return this.results_hide();
|
659
|
-
}
|
660
|
-
_ref = this.form_field.options;
|
661
|
-
for (i = 0, _len = _ref.length; i < _len; i++) {
|
662
|
-
opt = _ref[i];
|
663
|
-
if (opt.value === val) {
|
664
|
-
if (opt.selected) {
|
665
|
-
return this.results_hide();
|
666
|
-
} else {
|
667
|
-
break;
|
668
|
-
}
|
669
|
-
}
|
670
|
-
}
|
671
|
-
_ref2 = this.results_data;
|
672
|
-
for (_i = 0, _len2 = _ref2.length; _i < _len2; _i++) {
|
673
|
-
result = _ref2[_i];
|
674
|
-
if (result.value === val) {
|
675
|
-
result.selected = true;
|
676
|
-
break;
|
677
|
-
}
|
678
|
-
}
|
679
|
-
if (i === this.form_field.length) {
|
680
|
-
this.form_field.options[i] = new Option(txt, val);
|
681
|
-
}
|
682
|
-
this.form_field.options[i].selected = true;
|
683
|
-
item = {
|
684
|
-
array_index: i,
|
685
|
-
options_index: i,
|
686
|
-
value: val,
|
687
|
-
text: txt,
|
688
|
-
html: txt,
|
689
|
-
selected: 1,
|
690
|
-
disabled: 0,
|
691
|
-
group_array_index: null
|
692
|
-
};
|
693
|
-
this.choice_build(item);
|
694
|
-
this.results_hide();
|
695
|
-
this.search_field.val("");
|
696
|
-
this.form_field_jq.trigger("change");
|
697
|
-
return this.search_field_scale();
|
698
|
-
};
|
699
|
-
Chosen.prototype.choice_build = function(item) {
|
700
|
-
var choice_id, link;
|
701
|
-
choice_id = this.container_id + "_c_" + item.array_index;
|
702
|
-
this.choices += 1;
|
703
|
-
this.search_container.before('<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>');
|
704
|
-
link = $('#' + choice_id).find("a").first();
|
705
|
-
return link.click(__bind(function(evt) {
|
706
|
-
return this.choice_destroy_link_click(evt);
|
707
|
-
}, this));
|
708
|
-
};
|
709
|
-
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
710
|
-
evt.preventDefault();
|
711
|
-
if (!this.is_disabled) {
|
712
|
-
this.pending_destroy_click = true;
|
713
|
-
return this.choice_destroy($(evt.target));
|
714
|
-
} else {
|
715
|
-
return evt.stopPropagation;
|
716
|
-
}
|
717
|
-
};
|
718
|
-
Chosen.prototype.choice_destroy = function(link) {
|
719
|
-
this.choices -= 1;
|
720
|
-
this.show_search_field_default();
|
721
|
-
if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
|
722
|
-
this.results_hide();
|
723
|
-
}
|
724
|
-
this.result_deselect(link.attr("rel"));
|
725
|
-
return link.parents('li').first().remove();
|
726
|
-
};
|
727
|
-
Chosen.prototype.results_reset = function(evt) {
|
728
|
-
this.form_field.options[0].selected = true;
|
729
|
-
this.selected_item.find("span").text(this.default_text);
|
730
|
-
this.show_search_field_default();
|
731
|
-
$(evt.target).remove();
|
732
|
-
this.form_field_jq.trigger("change");
|
733
|
-
if (this.active_field) {
|
734
|
-
return this.results_hide();
|
735
|
-
}
|
736
|
-
};
|
737
|
-
Chosen.prototype.result_select = function(evt) {
|
738
|
-
var high, high_id, item, position;
|
739
|
-
if (this.result_highlight) {
|
740
|
-
high = this.result_highlight;
|
741
|
-
high_id = high.attr("id");
|
742
|
-
this.result_clear_highlight();
|
743
|
-
if (this.is_multiple) {
|
744
|
-
this.result_deactivate(high);
|
745
|
-
} else {
|
746
|
-
this.search_results.find(".result-selected").removeClass("result-selected");
|
747
|
-
this.result_single_selected = high;
|
748
|
-
}
|
749
|
-
high.addClass("result-selected");
|
750
|
-
position = high_id.substr(high_id.lastIndexOf("_") + 1);
|
751
|
-
item = this.results_data[position];
|
752
|
-
item.selected = true;
|
753
|
-
if (this.is_tag) {
|
754
|
-
this.choice_append(item.text, item.value);
|
755
|
-
} else {
|
756
|
-
this.form_field.options[item.options_index].selected = true;
|
757
|
-
if (this.is_multiple) {
|
758
|
-
this.choice_build(item);
|
759
|
-
} else {
|
760
|
-
this.selected_item.find("span").first().text(item.text);
|
761
|
-
if (this.allow_single_deselect) {
|
762
|
-
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
763
|
-
}
|
764
|
-
}
|
765
|
-
}
|
766
|
-
if (!(evt.metaKey && this.is_multiple)) {
|
767
|
-
this.results_hide();
|
768
|
-
}
|
769
|
-
this.search_field.val("");
|
770
|
-
this.form_field_jq.trigger("change");
|
771
|
-
return this.search_field_scale();
|
772
|
-
}
|
773
|
-
};
|
774
|
-
Chosen.prototype.result_activate = function(el) {
|
775
|
-
return el.addClass("active-result");
|
776
|
-
};
|
777
|
-
Chosen.prototype.result_deactivate = function(el) {
|
778
|
-
return el.removeClass("active-result");
|
779
|
-
};
|
780
|
-
Chosen.prototype.result_deselect = function(pos) {
|
781
|
-
var result, result_data;
|
782
|
-
if (this.is_tag) {
|
783
|
-
this.form_field.options[pos].selected = false;
|
784
|
-
} else {
|
785
|
-
result_data = this.results_data[pos];
|
786
|
-
result_data.selected = false;
|
787
|
-
this.form_field.options[result_data.options_index].selected = false;
|
788
|
-
}
|
789
|
-
result = $("#" + this.container_id + "_o_" + pos);
|
790
|
-
result.removeClass("result-selected").addClass("active-result").show();
|
791
|
-
this.result_clear_highlight();
|
792
|
-
this.winnow_results();
|
793
|
-
this.form_field_jq.trigger("change");
|
794
|
-
return this.search_field_scale();
|
795
|
-
};
|
796
|
-
Chosen.prototype.winnow_results = function() {
|
797
|
-
var found, option, part, parts, regex, result_id, results, searchText, startTime, startpos, text, zregex, _i, _j, _len, _len2, _ref;
|
798
|
-
startTime = new Date();
|
799
|
-
this.no_results_clear();
|
800
|
-
results = 0;
|
801
|
-
searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
|
802
|
-
regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
803
|
-
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
804
|
-
_ref = this.results_data;
|
805
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
806
|
-
option = _ref[_i];
|
807
|
-
if (!option.disabled && !option.empty) {
|
808
|
-
if (option.group) {
|
809
|
-
$('#' + option.dom_id).hide();
|
810
|
-
} else if (!(this.is_multiple && option.selected)) {
|
811
|
-
found = false;
|
812
|
-
result_id = option.dom_id;
|
813
|
-
if (regex.test(option.html)) {
|
814
|
-
found = true;
|
815
|
-
results += 1;
|
816
|
-
} else if (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0) {
|
817
|
-
parts = option.html.replace(/\[|\]/g, "").split(" ");
|
818
|
-
if (parts.length) {
|
819
|
-
for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
|
820
|
-
part = parts[_j];
|
821
|
-
if (regex.test(part)) {
|
822
|
-
found = true;
|
823
|
-
results += 1;
|
824
|
-
}
|
825
|
-
}
|
826
|
-
}
|
827
|
-
}
|
828
|
-
if (found) {
|
829
|
-
if (searchText.length) {
|
830
|
-
startpos = option.html.search(zregex);
|
831
|
-
text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
|
832
|
-
text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
833
|
-
} else {
|
834
|
-
text = option.html;
|
835
|
-
}
|
836
|
-
if ($("#" + result_id).html !== text) {
|
837
|
-
$("#" + result_id).html(text);
|
838
|
-
}
|
839
|
-
this.result_activate($("#" + result_id));
|
840
|
-
if (option.group_array_index != null) {
|
841
|
-
$("#" + this.results_data[option.group_array_index].dom_id).show();
|
842
|
-
}
|
843
|
-
} else {
|
844
|
-
if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
|
845
|
-
this.result_clear_highlight();
|
846
|
-
}
|
847
|
-
this.result_deactivate($("#" + result_id));
|
848
|
-
}
|
849
|
-
}
|
850
|
-
}
|
851
|
-
}
|
852
|
-
if (results < 1 && searchText.length) {
|
853
|
-
return this.no_results(searchText);
|
854
|
-
} else {
|
855
|
-
return this.winnow_results_set_highlight();
|
856
|
-
}
|
857
|
-
};
|
858
|
-
Chosen.prototype.winnow_results_clear = function() {
|
859
|
-
var li, lis, _i, _len, _results;
|
860
|
-
this.search_field.val("");
|
861
|
-
lis = this.search_results.find("li");
|
862
|
-
_results = [];
|
863
|
-
for (_i = 0, _len = lis.length; _i < _len; _i++) {
|
864
|
-
li = lis[_i];
|
865
|
-
li = $(li);
|
866
|
-
_results.push(li.hasClass("group-result") ? li.show() : !this.is_multiple || !li.hasClass("result-selected") ? this.result_activate(li) : void 0);
|
867
|
-
}
|
868
|
-
return _results;
|
869
|
-
};
|
870
|
-
Chosen.prototype.winnow_results_set_highlight = function() {
|
871
|
-
var do_high, selected_results;
|
872
|
-
if (!this.result_highlight) {
|
873
|
-
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
874
|
-
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
875
|
-
if (do_high != null) {
|
876
|
-
return this.result_do_highlight(do_high);
|
877
|
-
}
|
878
|
-
}
|
879
|
-
};
|
880
|
-
Chosen.prototype.no_results = function(terms) {
|
881
|
-
var no_results_html;
|
882
|
-
if (this.is_tag) {
|
883
|
-
return this.results_hide();
|
884
|
-
}
|
885
|
-
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
886
|
-
no_results_html.find("span").first().html(terms);
|
887
|
-
return this.search_results.append(no_results_html);
|
888
|
-
};
|
889
|
-
Chosen.prototype.no_results_clear = function() {
|
890
|
-
return this.search_results.find(".no-results").remove();
|
891
|
-
};
|
892
|
-
Chosen.prototype.keydown_arrow = function() {
|
893
|
-
var first_active, next_sib;
|
894
|
-
if (!this.result_highlight) {
|
895
|
-
first_active = this.search_results.find("li.active-result").first();
|
896
|
-
if (first_active) {
|
897
|
-
this.result_do_highlight($(first_active));
|
898
|
-
}
|
899
|
-
} else if (this.results_showing) {
|
900
|
-
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
901
|
-
if (next_sib) {
|
902
|
-
this.result_do_highlight(next_sib);
|
903
|
-
}
|
904
|
-
}
|
905
|
-
if (!this.results_showing) {
|
906
|
-
return this.results_show();
|
907
|
-
}
|
908
|
-
};
|
909
|
-
Chosen.prototype.keyup_arrow = function() {
|
910
|
-
var prev_sibs;
|
911
|
-
if (!this.results_showing && !this.is_multiple) {
|
912
|
-
return this.results_show();
|
913
|
-
} else if (this.result_highlight) {
|
914
|
-
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
915
|
-
if (prev_sibs.length) {
|
916
|
-
return this.result_do_highlight(prev_sibs.first());
|
917
|
-
} else {
|
918
|
-
if (this.choices > 0) {
|
919
|
-
this.results_hide();
|
920
|
-
}
|
921
|
-
return this.result_clear_highlight();
|
922
|
-
}
|
923
|
-
}
|
924
|
-
};
|
925
|
-
Chosen.prototype.keydown_backstroke = function() {
|
926
|
-
if (this.pending_backstroke) {
|
927
|
-
this.choice_destroy(this.pending_backstroke.find("a").first());
|
928
|
-
return this.clear_backstroke();
|
929
|
-
} else {
|
930
|
-
this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
|
931
|
-
return this.pending_backstroke.addClass("search-choice-focus");
|
932
|
-
}
|
933
|
-
};
|
934
|
-
Chosen.prototype.clear_backstroke = function() {
|
935
|
-
if (this.pending_backstroke) {
|
936
|
-
this.pending_backstroke.removeClass("search-choice-focus");
|
937
|
-
}
|
938
|
-
return this.pending_backstroke = null;
|
939
|
-
};
|
940
|
-
Chosen.prototype.keydown_checker = function(evt) {
|
941
|
-
var stroke, _ref;
|
942
|
-
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
943
|
-
this.search_field_scale();
|
944
|
-
if (stroke !== 8 && this.pending_backstroke) {
|
945
|
-
this.clear_backstroke();
|
946
|
-
}
|
947
|
-
switch (stroke) {
|
948
|
-
case 8:
|
949
|
-
this.backstroke_length = this.search_field.val().length;
|
950
|
-
break;
|
951
|
-
case 9:
|
952
|
-
this.mouse_on_container = false;
|
953
|
-
break;
|
954
|
-
case 13:
|
955
|
-
evt.preventDefault();
|
956
|
-
break;
|
957
|
-
case 38:
|
958
|
-
evt.preventDefault();
|
959
|
-
this.keyup_arrow();
|
960
|
-
break;
|
961
|
-
case 40:
|
962
|
-
this.keydown_arrow();
|
963
|
-
break;
|
964
|
-
}
|
965
|
-
};
|
966
|
-
Chosen.prototype.search_field_scale = function() {
|
967
|
-
var dd_top, div, h, style, style_block, styles, w, _i, _len;
|
968
|
-
if (this.is_multiple) {
|
969
|
-
h = 0;
|
970
|
-
w = 0;
|
971
|
-
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
972
|
-
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
973
|
-
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
974
|
-
style = styles[_i];
|
975
|
-
style_block += style + ":" + this.search_field.css(style) + ";";
|
976
|
-
}
|
977
|
-
div = $('<div />', {
|
978
|
-
'style': style_block
|
979
|
-
});
|
980
|
-
div.text(this.search_field.val());
|
981
|
-
$('body').append(div);
|
982
|
-
w = div.width() + 25;
|
983
|
-
div.remove();
|
984
|
-
if (w > this.f_width - 10) {
|
985
|
-
w = this.f_width - 10;
|
986
|
-
}
|
987
|
-
this.search_field.css({
|
988
|
-
'width': w + 'px'
|
989
|
-
});
|
990
|
-
dd_top = this.container.height();
|
991
|
-
return this.dropdown.css({
|
992
|
-
"top": dd_top + "px"
|
993
|
-
});
|
994
|
-
}
|
995
|
-
};
|
996
|
-
Chosen.prototype.generate_random_id = function() {
|
997
|
-
var string;
|
998
|
-
string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
|
999
|
-
while ($("#" + string).length > 0) {
|
1000
|
-
string += this.generate_random_char();
|
1001
|
-
}
|
1002
|
-
return string;
|
1003
|
-
};
|
1004
|
-
return Chosen;
|
1005
|
-
})();
|
1006
|
-
get_side_border_padding = function(elmt) {
|
1007
|
-
var side_border_padding;
|
1008
|
-
return side_border_padding = elmt.outerWidth() - elmt.width();
|
1009
|
-
};
|
1010
|
-
root.get_side_border_padding = get_side_border_padding;
|
1011
|
-
}).call(this);
|
1012
|
-
:@compressedF:@created_atf1318830254.8189111i
|