Ultimate Member – User Profile & Membership Plugin - Version 2.0.30

Version Description

Download this release

Release Info

Developer nsinelnikov
Plugin Icon 128x128 Ultimate Member – User Profile & Membership Plugin
Version 2.0.30
Comparing to
See all releases

Code changes from version 2.0.29 to 2.0.30

Files changed (46) hide show
  1. assets/js/um-conditional.js +567 -568
  2. assets/js/um-conditional.min.js +1 -1
  3. assets/js/um-scripts.js +2 -2
  4. assets/js/um-scripts.min.js +1 -1
  5. assets/js/um-scrollto.js +0 -210
  6. assets/js/um-scrollto.min.js +0 -1
  7. assets/js/um-select.js +0 -22
  8. assets/js/um-select.min.js +0 -1
  9. includes/admin/assets/css/um-admin-columns.css +2 -0
  10. includes/admin/assets/js/um-admin-forms.js +18 -11
  11. includes/admin/class-admin.php +18 -8
  12. includes/admin/core/class-admin-ajax-hooks.php +33 -0
  13. includes/admin/core/class-admin-columns.php +32 -8
  14. includes/admin/core/class-admin-enqueue.php +0 -17
  15. includes/admin/core/class-admin-forms.php +1 -1
  16. includes/admin/core/class-admin-metabox.php +33 -2
  17. includes/admin/core/class-admin-notices.php +3 -3
  18. includes/admin/core/class-admin-settings.php +1 -1
  19. includes/admin/templates/directory/shortcode.php +21 -0
  20. includes/admin/templates/form/shortcode.php +21 -0
  21. includes/class-dependencies.php +1 -0
  22. includes/class-init.php +26 -0
  23. includes/core/class-ajax-common.php +1 -0
  24. includes/core/class-date-time.php +18 -20
  25. includes/core/class-enqueue.php +162 -239
  26. includes/core/class-external-integrations.php +2 -2
  27. includes/core/class-fields.php +38 -9
  28. includes/core/class-files.php +17 -2
  29. includes/core/class-gdpr.php +2 -3
  30. includes/core/class-permalinks.php +2 -2
  31. includes/core/class-roles-capabilities.php +5 -2
  32. includes/core/class-shortcodes.php +164 -5
  33. includes/core/class-templates.php +41 -0
  34. includes/core/class-uploader.php +85 -54
  35. includes/core/um-actions-profile.php +7 -9
  36. includes/core/um-filters-avatars.php +29 -2
  37. includes/core/um-filters-fields.php +2 -1
  38. includes/um-deprecated-functions.php +18 -0
  39. includes/um-short-functions.php +14 -31
  40. languages/ultimate-member-en_US.mo +0 -0
  41. languages/ultimate-member-en_US.po +237 -237
  42. readme.txt +17 -1
  43. templates/message.php +1 -1
  44. templates/profile.php +4 -1
  45. templates/searchform.php +5 -5
  46. ultimate-member.php +1 -1
assets/js/um-conditional.js CHANGED
@@ -1,506 +1,571 @@
1
- jQuery(document).ready( function (){
2
3
- var arr_all_conditions = []; //raw
4
- var um_field_conditions = {}; // filtered
5
- var um_field_default_values = {};
6
-
7
- /**
8
- * Get field default value
9
- * @param object $dom
10
- * @return string
11
- */
12
- function um_get_field_default_value( $dom ) {
13
- var default_value = '';
14
- var type = um_get_field_type($dom);
15
- switch ( type ) {
16
-
17
- case 'text':
18
- case 'number':
19
- case 'date':
20
- case 'textarea':
21
- case 'select':
22
- default_value = $dom.find('input:text,input[type=number],textarea,select').val();
23
- break;
24
-
25
- case 'multiselect':
26
- default_value = $dom.find('select').val();
27
- break;
28
-
29
- case 'radio':
30
- if ($dom.find('input[type=radio]:checked').length >= 1) {
31
- default_value = $dom.find('input[type=radio]:checked').val();
32
- }
33
-
34
- break;
35
- case 'checkbox':
36
-
37
- if ($dom.find('input[type=checkbox]:checked').length >= 1) {
38
-
39
- if ($dom.find('input[type=checkbox]:checked').length > 1) {
40
- $dom.find('input[type=checkbox]:checked').each(function () {
41
- default_value = default_value + jQuery(this).val() + ' ';
42
- });
43
- } else {
44
- default_value = $dom.find('input[type=checkbox]:checked').val();
45
- }
46
-
47
- }
48
- break;
49
- }
50
-
51
- return {type: type, value: default_value};
52
- }
53
-
54
- /**
55
- * Get field element by field wrapper
56
- * @param object $dom
57
- * @return object
58
- */
59
- function um_get_field_element( $dom ) {
60
- var default_value = '';
61
- var type = um_get_field_type($dom);
62
-
63
- switch ( type ) {
64
-
65
- case 'text':
66
- case 'number':
67
- case 'date':
68
- case 'textarea':
69
- case 'select':
70
- case 'multiselect':
71
- case 'radio':
72
- case 'checkbox':
73
- return $dom.find('input,textarea,select');
74
- break;
75
-
76
-
77
- }
78
-
79
- return '';
80
- }
81
-
82
- /**
83
- * Get field type
84
- * @param object $dom
85
- * @return string
86
- */
87
- function um_get_field_type($dom) {
88
- var type = '';
89
- var classes = $dom.attr( 'class' );
90
- jQuery.each( classes.split(' '), function (i, d) {
91
- if (d.indexOf('um-field-type') != -1) {
92
- type = d.split('_')[1];
93
- }
94
- });
95
-
96
- return type;
97
-
98
- }
99
-
100
- /**
101
- * Get field siblings/chidren conditions
102
- * @param string field_key
103
- * @return array
104
- */
105
- function um_get_field_children(field_key) {
106
- var arr_conditions = [];
107
- jQuery.each(arr_all_conditions, function (ii, condition) {
108
- if (condition.field.parent == field_key) {
109
- arr_conditions.push(condition.field.condition);
110
- }
111
- });
112
-
113
- return arr_conditions;
114
-
115
- }
116
-
117
- /**
118
- * Split single array to multi-dimensional array
119
- * @param array arr
120
- * @param integer n
121
- * @return array
122
- */
123
- function um_splitup_array(arr, n) {
124
- var rest = arr.length % n,
125
- restUsed = rest,
126
- partLength = Math.floor(arr.length / n),
127
- result = [];
128
-
129
- for (var i = 0; i < arr.length; i += partLength) {
130
- var end = partLength + i,
131
- add = false;
132
-
133
- if (rest !== 0 && restUsed) {
134
- end++;
135
- restUsed--;
136
- add = true;
137
- }
138
-
139
- result.push(arr.slice(i, end));
140
-
141
- if (add) {
142
- i++;
143
- }
144
- }
145
-
146
- var obj_result = [];
147
- jQuery.each(result, function (ii, dd) {
148
- obj_result.push({
149
- action: dd[0],
150
- if_field: dd[1],
151
- operator: dd[2],
152
- value: dd[3]
153
- })
154
- });
155
-
156
- return obj_result;
157
- }
158
-
159
- /**
160
- * Get field live value
161
- * @param object $dom
162
- * @return mixed
163
- */
164
- function um_get_field_data($dom) {
165
- um_live_field = $dom.parents('.um-field').data('key');
166
- um_live_value = $dom.val();
167
-
168
- if ($dom.is(':checkbox')) {
169
-
170
- um_live_value = '';
171
-
172
- if ($dom.parents('.um-field').find('input:checked').length > 1) {
173
- $dom.parents('.um-field').find('input:checked').each(function () {
174
- um_live_value = um_live_value + jQuery(this).val() + ' ';
175
- });
176
- } else {
177
- if ($dom.parents('.um-field').find('input:checked').length >= 1) {
178
- um_live_value = $dom.parents('.um-field').find('input:checked').val();
179
- }
180
- }
181
-
182
- }
183
-
184
- if ($dom.is(':radio')) {
185
- um_live_value = $dom.parents('.um-field').find('input[type=radio]:checked').val();
186
- }
187
-
188
- return um_live_value;
189
-
190
- }
191
-
192
- function um_in_array(needle, haystack, strict){
193
- var found = false, key, strict = !!strict;
194
- for (key in haystack) {
195
- if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
196
- found = true;
197
- break;
198
- }
199
- }
200
-
201
- return found;
202
- }
203
-
204
- /**
205
- * Apply field conditions
206
- * @param object $dom
207
- * @param boolean is_single_update
208
- */
209
- function um_apply_conditions($dom, is_single_update) {
210
- var operators = ['empty', 'not empty', 'equals to', 'not equals', 'greater than', 'less than', 'contains'];
211
- var key = $dom.parents('.um-field[data-key]').data('key');
212
- var conditions = um_field_conditions[key];
213
-
214
- var live_field_value = um_get_field_data($dom);
215
-
216
- var $owners = {};
217
- var $owners_values = {};
218
- var $owner_conditions = {};
219
-
220
- jQuery.each(conditions, function (index, condition) {
221
- if (typeof $owners_values[condition.owner] == 'undefined') {
222
- $owners_values[condition.owner] = [];
223
- $owner_conditions[condition.owner] = {}
224
- }
225
- $owners_values[condition.owner].push(condition.value);
226
- $owner_conditions[condition.owner] = condition;
227
- });
228
-
229
- jQuery.each(conditions, function (index, condition) {
230
- if (typeof $owners[condition.owner] == 'undefined') {
231
- $owners[condition.owner] = {};
232
- }
233
- if (condition.operator == 'empty') {
234
- if (!live_field_value || live_field_value == '' && um_in_array(live_field_value, $owners_values[condition.owner])) {
235
- $owners[condition.owner][index] = true;
236
- } else {
237
- $owners[condition.owner][index] = false;
238
- }
239
- }
240
-
241
- if (condition.operator == 'not empty') {
242
- if (live_field_value && live_field_value != '' && !um_in_array(live_field_value, $owners_values[condition.owner])) {
243
- $owners[condition.owner][index] = true;
244
- } else {
245
- $owners[condition.owner][index] = false;
246
- }
247
- }
248
-
249
- if (condition.operator == 'equals to') {
250
- if (condition.value == live_field_value && um_in_array(live_field_value, $owners_values[condition.owner])) {
251
- $owners[condition.owner][index] = true;
252
- } else {
253
- $owners[condition.owner][index] = false;
254
- }
255
- }
256
-
257
- if (condition.operator == 'not equals') {
258
- if (jQuery.isNumeric(condition.value) && parseInt(live_field_value) != parseInt(condition.value) && live_field_value && !um_in_array(live_field_value, $owners_values[condition.owner])) {
259
- $owners[condition.owner][index] = true;
260
- } else if (condition.value != live_field_value && !um_in_array(live_field_value, $owners_values[condition.owner])) {
261
- $owners[condition.owner][index] = true;
262
- } else {
263
- $owners[condition.owner][index] = false;
264
- }
265
- }
266
-
267
- if (condition.operator == 'greater than') {
268
- if (jQuery.isNumeric(condition.value) && parseInt(live_field_value) > parseInt(condition.value)) {
269
- $owners[condition.owner][index] = true;
270
- } else {
271
- $owners[condition.owner][index] = false;
272
- }
273
- }
274
-
275
- if (condition.operator == 'less than') {
276
- if (jQuery.isNumeric(condition.value) && parseInt(live_field_value) < parseInt(condition.value)) {
277
- $owners[condition.owner][index] = true;
278
- } else {
279
- $owners[condition.owner][index] = false;
280
- }
281
- }
282
-
283
- if ( condition.operator == 'contains' ) {
284
- if ( 'multiselect' == um_get_field_type( $dom.parents('.um-field[data-key]') ) ) {
285
- if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 && um_in_array( condition.value, live_field_value ) ) {
286
- $owners[condition.owner][index] = true;
287
- } else {
288
- $owners[condition.owner][index] = false;
289
- }
290
- } else if ( 'checkbox' == um_get_field_type( $dom.parents('.um-field[data-key]') ) ) {
291
- if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 ) {
292
- $owners[condition.owner][index] = true;
293
- } else {
294
- $owners[condition.owner][index] = false;
295
- }
296
- } else {
297
- if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 && um_in_array( live_field_value, $owners_values[ condition.owner ] ) ) {
298
- $owners[condition.owner][index] = true;
299
- } else {
300
- $owners[condition.owner][index] = false;
301
- }
302
- }
303
- }
304
-
305
- }); // end foreach `conditions`
306
- jQuery.each($owners, function (index, field) {
307
- if (um_in_array(true, field)) {
308
- um_field_apply_action($dom, $owner_conditions[index], true);
309
- } else {
310
- um_field_apply_action($dom, $owner_conditions[index], false);
311
- }
312
- });
313
- $dom.trigger('um_fields_change');
314
-
315
- }
316
-
317
- /**
318
- * Apply condition's action
319
- * @param object $dom
320
- * @param string condition
321
- * @param boolean is_true
322
- */
323
- function um_field_apply_action($dom, condition, is_true) {
324
- var child_dom = jQuery('div.um-field[data-key="' + condition.owner + '"]');
325
-
326
- if (condition.action == 'show' && is_true /*&& child_dom.is(':hidden')*/) {
327
- child_dom.show();
328
- _show_in_ie( child_dom );
329
- um_field_restore_default_value(child_dom);
330
- }
331
-
332
- if (condition.action == 'show' && !is_true /*&& child_dom.is(':visible') */) {
333
- child_dom.hide();
334
- _hide_in_ie( child_dom );
335
- }
336
-
337
- if (condition.action == 'hide' && is_true /*&& child_dom.is(':visible')*/) {
338
- child_dom.hide();
339
- _hide_in_ie( child_dom );
340
- }
341
-
342
- if (condition.action == 'hide' && !is_true /*&& child_dom.is(':hidden')*/) {
343
- child_dom.show();
344
- _show_in_ie( child_dom );
345
- um_field_restore_default_value( child_dom );
346
-
347
- }
348
- $dom.removeClass('um-field-has-changed');
349
- }
350
-
351
- /**
352
- * Restores default field value
353
- * @param object $dom
354
- */
355
- function um_field_restore_default_value( $dom ) {
356
- //um_field_default_values
357
-
358
- var type = um_get_field_type( $dom );
359
- var key = $dom.data('key');
360
- var field = um_field_default_values[key];
361
- switch ( type ) {
362
-
363
- case 'text':
364
- case 'number':
365
- case 'date':
366
- case 'textarea':
367
- $dom.find('input:text,input[type=number],textareas').val(field.value);
368
- break;
369
-
370
- case 'select':
371
- $dom.find('select').find('option').prop('selected', false);
372
- $dom.find('select').val(field.value);
373
- $dom.find('select').trigger('change');
374
- break;
375
-
376
- case 'multiselect':
377
- $dom.find('select').find('option').prop('selected', false);
378
- jQuery.each(field.value, function (i, value) {
379
- $dom.find('select').find('option[value="' + value + '"]').attr('selected', true);
380
- });
381
- $dom.find('select').trigger('change');
382
- break;
383
-
384
- case 'checkbox':
385
-
386
- if ( $dom.find('input[type=checkbox]:checked').length >= 1 ) {
387
-
388
- $dom.find('input[type=checkbox]:checked').removeAttr('checked');
389
- $dom.find('span.um-field-checkbox-state i').removeClass('um-icon-android-checkbox-outline');
390
- $dom.find('span.um-field-checkbox-state i').addClass('um-icon-android-checkbox-outline-blank');
391
- $dom.find('.um-field-checkbox.active').removeClass('active');
392
-
393
- if (jQuery.isArray(field.value)) {
394
- jQuery.each(field.value, function (i, value) {
395
- var cbox_elem = $dom.find('input[type=checkbox][value="' + value + '"]');
396
- cbox_elem.attr('checked', true);
397
- cbox_elem.closest('.um-field-checkbox').find('i').removeClass('um-icon-android-checkbox-outline-blank');
398
- cbox_elem.closest('.um-field-checkbox').find('i').addClass('um-icon-android-checkbox-outline');
399
- cbox_elem.closest('.um-field-checkbox').addClass('active');
400
- });
401
- } else {
402
- var cbox_elem = $dom.find('input[type=checkbox][value="' + field.value + '"]');
403
- cbox_elem.attr('checked', true);
404
- cbox_elem.closest('.um-field-checkbox').find('i').removeClass('um-icon-android-checkbox-outline-blank');
405
- cbox_elem.closest('.um-field-checkbox').find('i').addClass('um-icon-android-checkbox-outline');
406
- cbox_elem.closest('.um-field-checkbox').addClass('active');
407
- }
408
-
409
- }
410
-
411
- break;
412
- case 'radio':
413
-
414
- if ( $dom.find('input[type=radio]:checked').length >= 1 ) {
415
-
416
- setTimeout(function () {
417
-
418
- $dom.find('input[type=radio]:checked').removeAttr('checked');
419
-
420
- $dom.find('span.um-field-radio-state i').removeClass('um-icon-android-radio-button-on');
421
- $dom.find('span.um-field-radio-state i').addClass('um-icon-android-radio-button-off');
422
- $dom.find('.um-field-radio.active').removeClass('active');
423
-
424
- var radio_elem = $dom.find("input[type=radio][value='" + field.value + "']");
425
- radio_elem.attr('checked', true);
426
- radio_elem.closest('.um-field-radio').find('i').removeClass('um-icon-android-radio-button-off');
427
- radio_elem.closest('.um-field-radio').find('i').addClass('um-icon-android-radio-button-on');
428
- radio_elem.closest('.um-field-radio').addClass('active');
429
-
430
- }, 100);
431
- }
432
-
433
- break;
434
-
435
-
436
- } // end switch type
437
-
438
-
439
- if ( ! $dom.hasClass( 'um-field-has-changed' ) ) {
440
- var me = um_get_field_element( $dom );
441
-
442
- if ( type == 'radio' || type == 'checkbox' ) {
443
- me = me.find( ':checked' );
444
- }
445
-
446
- if ( me ) {
447
- me.trigger( 'change' );
448
- $dom.addClass( 'um-field-has-changed' );
449
- }
450
-
451
- /*
452
- maybe future fix
453
- if ( me ) {
454
- if ( type == 'radio' || type == 'checkbox' ) {
455
- me.each( function() {
456
- if ( jQuery(this).is(':checked') ) {
457
- jQuery(this).trigger('change');
458
- }
459
- });
460
- } else {
461
- me.trigger( 'change' );
462
- }
463
-
464
- $dom.addClass( 'um-field-has-changed' );
465
- }*/
466
- }
467
- }
468
-
469
- /**
470
- * Hides sibling/child field when parent field is hidden
471
- */
472
- function um_field_hide_siblings() {
473
-
474
- jQuery.each(um_field_conditions, function (index, conditions) {
475
- if (jQuery('.um-field[data-key="' + index + '"]:hidden').length >= 1 || jQuery('.um-field[data-key="' + index + '"]').css('display') == 'none') {
476
- jQuery.each(conditions, function (key, condition) {
477
- jQuery('.um-field[data-key="' + condition.owner + '"]').hide();
478
- });
479
- }
480
-
481
- });
482
-
483
- }
484
-
485
- /**
486
- * Hides div for IE browser
487
- * @param object $dom
488
- */
489
- function _hide_in_ie( $dom ){
490
- if ( typeof( jQuery.browser ) != 'undefined' && jQuery.browser.msie ) {
491
- $dom.css({"visibility":"hidden"});
492
- }
493
- }
494
-
495
- /**
496
- * Shows div for IE browser
497
- * @param object $dom
498
- */
499
- function _show_in_ie( $dom ){
500
- if ( typeof( jQuery.browser ) != 'undefined' && jQuery.browser.msie ) {
501
- $dom.css({"visibility":"visible"});
502
- }
503
- }
504
505
jQuery(document).on('change', '.um-field select, .um-field input[type="radio"], .um-field input[type="checkbox"]', function () {
506
var me = jQuery(this);
@@ -527,71 +592,5 @@ jQuery(document).ready( function (){
527
um_field_hide_siblings(); // dupes, issue with false field wrapper's visiblity validations. requires optimization.
528
});
529
530
-
531
- /**
532
- * UM Conditional fields Init
533
- */
534
- function um_init_field_conditions() {
535
- var arr_field_keys = [];
536
-
537
- jQuery( '.um-field[data-key]' ).each( function() {
538
-
539
- var key = jQuery(this).data( 'key' );
540
-
541
- arr_field_keys.push( key );
542
-
543
- var parse_attrs = {};
544
- jQuery.each( jQuery(this)[0].attributes, function ( index, attribute ) {
545
- if ( attribute.name.indexOf( 'data-cond' ) != -1 ) {
546
- // replace "data-cond-"
547
- var cond_field_id_and_attr = attribute.name.slice( 10 );
548
- // return "n"
549
- var cond_field_id = cond_field_id_and_attr.substring( 1, 0 );
550
- //replace "n-"
551
- var cond_field_attr = cond_field_id_and_attr.slice( 2 );
552
-
553
- if ( typeof parse_attrs[cond_field_id] == 'undefined' )
554
- parse_attrs[cond_field_id] = {};
555
-
556
- parse_attrs[cond_field_id][cond_field_attr] = attribute.value;
557
- }
558
- });
559
-
560
- jQuery.each( parse_attrs, function ( ii, dd ) {
561
- var obj = {'field' :{
562
- owner: key,
563
- action: dd.action,
564
- parent: dd.field,
565
- operator: dd.operator,
566
- value: dd.value,
567
- condition: {
568
- owner: key,
569
- action: dd.action,
570
- operator: dd.operator,
571
- value: dd.value
572
- }
573
- }};
574
-
575
- arr_all_conditions.push(obj);
576
- });
577
-
578
- um_field_default_values[jQuery(this).data('key')] = um_get_field_default_value( jQuery(this) );
579
- });
580
-
581
- jQuery.each( arr_field_keys, function ( i, field_key ) {
582
- um_field_conditions[field_key] = um_get_field_children( field_key );
583
- });
584
-
585
- jQuery( '.um-field[data-key]:visible' ).each( function() {
586
- var $wrap_dom = jQuery(this);
587
- var me = um_get_field_element( $wrap_dom );
588
- if ( typeof me.trigger !== 'undefined' ) {
589
- me.trigger( 'change' );
590
- }
591
- });
592
-
593
- }
594
-
595
-
596
um_init_field_conditions();
597
});
1
+ var arr_all_conditions = []; //raw
2
+ var um_field_conditions = {}; // filtered
3
+ var um_field_default_values = {};
4
+
5
+ /**
6
+ * Get field default value
7
+ * @param object $dom
8
+ * @return string
9
+ */
10
+ function um_get_field_default_value( $dom ) {
11
+ var default_value = '';
12
+ var type = um_get_field_type($dom);
13
+ switch ( type ) {
14
+
15
+ case 'text':
16
+ case 'number':
17
+ case 'date':
18
+ case 'textarea':
19
+ case 'select':
20
+ default_value = $dom.find('input:text,input[type=number],textarea,select').val();
21
+ break;
22
+
23
+ case 'multiselect':
24
+ default_value = $dom.find('select').val();
25
+ break;
26
+
27
+ case 'radio':
28
+ if ($dom.find('input[type=radio]:checked').length >= 1) {
29
+ default_value = $dom.find('input[type=radio]:checked').val();
30
+ }
31
+
32
+ break;
33
+ case 'checkbox':
34
+
35
+ if ($dom.find('input[type=checkbox]:checked').length >= 1) {
36
+
37
+ if ($dom.find('input[type=checkbox]:checked').length > 1) {
38
+ $dom.find('input[type=checkbox]:checked').each(function () {
39
+ default_value = default_value + jQuery(this).val() + ' ';
40
+ });
41
+ } else {
42
+ default_value = $dom.find('input[type=checkbox]:checked').val();
43
+ }
44
+
45
+ }
46
+ break;
47
+ }
48
+
49
+ return {type: type, value: default_value};
50
+ }
51
+
52
+ /**
53
+ * Get field element by field wrapper
54
+ * @param object $dom
55
+ * @return object
56
+ */
57
+ function um_get_field_element( $dom ) {
58
+ var default_value = '';
59
+ var type = um_get_field_type($dom);
60
+
61
+ switch ( type ) {
62
+
63
+ case 'text':
64
+ case 'number':
65
+ case 'date':
66
+ case 'textarea':
67
+ case 'select':
68
+ case 'multiselect':
69
+ case 'radio':
70
+ case 'checkbox':
71
+ return $dom.find('input,textarea,select');
72
+ break;
73
+
74
+
75
+ }
76
+
77
+ return '';
78
+ }
79
+
80
+ /**
81
+ * Get field type
82
+ * @param object $dom
83
+ * @return string
84
+ */
85
+ function um_get_field_type($dom) {
86
+ var type = '';
87
+ var classes = $dom.attr( 'class' );
88
+ jQuery.each( classes.split(' '), function (i, d) {
89
+ if (d.indexOf('um-field-type') != -1) {
90
+ type = d.split('_')[1];
91
+ }
92
+ });
93
+
94
+ return type;
95
+
96
+ }
97
+
98
+ /**
99
+ * Get field siblings/chidren conditions
100
+ * @param string field_key
101
+ * @return array
102
+ */
103
+ function um_get_field_children(field_key) {
104
+ var arr_conditions = [];
105
+ jQuery.each(arr_all_conditions, function (ii, condition) {
106
+ if (condition.field.parent == field_key) {
107
+ arr_conditions.push(condition.field.condition);
108
+ }
109
+ });
110
+
111
+ return arr_conditions;
112
+
113
+ }
114
+
115
+ /**
116
+ * Split single array to multi-dimensional array
117
+ * @param array arr
118
+ * @param integer n
119
+ * @return array
120
+ */
121
+ function um_splitup_array(arr, n) {
122
+ var rest = arr.length % n,
123
+ restUsed = rest,
124
+ partLength = Math.floor(arr.length / n),
125
+ result = [];
126
+
127
+ for (var i = 0; i < arr.length; i += partLength) {
128
+ var end = partLength + i,
129
+ add = false;
130
+
131
+ if (rest !== 0 && restUsed) {
132
+ end++;
133
+ restUsed--;
134
+ add = true;
135
+ }
136
+
137
+ result.push(arr.slice(i, end));
138
+
139
+ if (add) {
140
+ i++;
141
+ }
142
+ }
143
+
144
+ var obj_result = [];
145
+ jQuery.each(result, function (ii, dd) {
146
+ obj_result.push({
147
+ action: dd[0],
148
+ if_field: dd[1],
149
+ operator: dd[2],
150
+ value: dd[3]
151
+ })
152
+ });
153
+
154
+ return obj_result;
155
+ }
156
+
157
+ /**
158
+ * Get field live value
159
+ * @param object $dom
160
+ * @return mixed
161
+ */
162
+ function um_get_field_data($dom) {
163
+ um_live_field = $dom.parents('.um-field').data('key');
164
+ um_live_value = $dom.val();
165
+
166
+ if ($dom.is(':checkbox')) {
167
+
168
+ um_live_value = '';
169
+
170
+ if ($dom.parents('.um-field').find('input:checked').length > 1) {
171
+ $dom.parents('.um-field').find('input:checked').each(function () {
172
+ um_live_value = um_live_value + jQuery(this).val() + ' ';
173
+ });
174
+ } else {
175
+ if ($dom.parents('.um-field').find('input:checked').length >= 1) {
176
+ um_live_value = $dom.parents('.um-field').find('input:checked').val();
177
+ }
178
+ }
179
+
180
+ }
181
+
182
+ if ($dom.is(':radio')) {
183
+ um_live_value = $dom.parents('.um-field').find('input[type=radio]:checked').val();
184
+ }
185
+
186
+ return um_live_value;
187
+
188
+ }
189
+
190
+ function um_in_array(needle, haystack, strict){
191
+ var found = false, key, strict = !!strict;
192
+ for (key in haystack) {
193
+ if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
194
+ found = true;
195
+ break;
196
+ }
197
+ }
198
+
199
+ return found;
200
+ }
201
+
202
+ /**
203
+ * Apply field conditions
204
+ * @param object $dom
205
+ * @param boolean is_single_update
206
+ */
207
+ function um_apply_conditions($dom, is_single_update) {
208
+ var operators = ['empty', 'not empty', 'equals to', 'not equals', 'greater than', 'less than', 'contains'];
209
+ var key = $dom.parents('.um-field[data-key]').data('key');
210
+ var conditions = um_field_conditions[key];
211
+
212
+ var live_field_value = um_get_field_data($dom);
213
+
214
+ var $owners = {};
215
+ var $owners_values = {};
216
+ var $owner_conditions = {};
217
+
218
+ jQuery.each(conditions, function (index, condition) {
219
+ if (typeof $owners_values[condition.owner] == 'undefined') {
220
+ $owners_values[condition.owner] = [];
221
+ $owner_conditions[condition.owner] = {}
222
+ }
223
+ $owners_values[condition.owner].push(condition.value);
224
+ $owner_conditions[condition.owner] = condition;
225
+ });
226
+
227
+ jQuery.each(conditions, function (index, condition) {
228
+ if (typeof $owners[condition.owner] == 'undefined') {
229
+ $owners[condition.owner] = {};
230
+ }
231
+ if (condition.operator == 'empty') {
232
+ if (!live_field_value || live_field_value == '' && um_in_array(live_field_value, $owners_values[condition.owner])) {
233
+ $owners[condition.owner][index] = true;
234
+ } else {
235
+ $owners[condition.owner][index] = false;
236
+ }
237
+ }
238
+
239
+ if (condition.operator == 'not empty') {
240
+ if (live_field_value && live_field_value != '' && !um_in_array(live_field_value, $owners_values[condition.owner])) {
241
+ $owners[condition.owner][index] = true;
242
+ } else {
243
+ $owners[condition.owner][index] = false;
244
+ }
245
+ }
246
+
247
+ if (condition.operator == 'equals to') {
248
+ if (condition.value == live_field_value && um_in_array(live_field_value, $owners_values[condition.owner])) {
249
+ $owners[condition.owner][index] = true;
250
+ } else {
251
+ $owners[condition.owner][index] = false;
252
+ }
253
+ }
254
+
255
+ if (condition.operator == 'not equals') {
256
+ if (jQuery.isNumeric(condition.value) && parseInt(live_field_value) != parseInt(condition.value) && live_field_value && !um_in_array(live_field_value, $owners_values[condition.owner])) {
257
+ $owners[condition.owner][index] = true;
258
+ } else if (condition.value != live_field_value && !um_in_array(live_field_value, $owners_values[condition.owner])) {
259
+ $owners[condition.owner][index] = true;
260
+ } else {
261
+ $owners[condition.owner][index] = false;
262
+ }
263
+ }
264
+
265
+ if (condition.operator == 'greater than') {
266
+ if (jQuery.isNumeric(condition.value) && parseInt(live_field_value) > parseInt(condition.value)) {
267
+ $owners[condition.owner][index] = true;
268
+ } else {
269
+ $owners[condition.owner][index] = false;
270
+ }
271
+ }
272
+
273
+ if (condition.operator == 'less than') {
274
+ if (jQuery.isNumeric(condition.value) && parseInt(live_field_value) < parseInt(condition.value)) {
275
+ $owners[condition.owner][index] = true;
276
+ } else {
277
+ $owners[condition.owner][index] = false;
278
+ }
279
+ }
280
+
281
+ if ( condition.operator == 'contains' ) {
282
+ if ( 'multiselect' == um_get_field_type( $dom.parents('.um-field[data-key]') ) ) {
283
+ if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 && um_in_array( condition.value, live_field_value ) ) {
284
+ $owners[condition.owner][index] = true;
285
+ } else {
286
+ $owners[condition.owner][index] = false;
287
+ }
288
+ } else if ( 'checkbox' == um_get_field_type( $dom.parents('.um-field[data-key]') ) ) {
289
+ if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 ) {
290
+ $owners[condition.owner][index] = true;
291
+ } else {
292
+ $owners[condition.owner][index] = false;
293
+ }
294
+ } else {
295
+ if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 && um_in_array( live_field_value, $owners_values[ condition.owner ] ) ) {
296
+ $owners[condition.owner][index] = true;
297
+ } else {
298
+ $owners[condition.owner][index] = false;
299
+ }
300
+ }
301
+ }
302
+
303
+ }); // end foreach `conditions`
304
+ jQuery.each($owners, function (index, field) {
305
+ if (um_in_array(true, field)) {
306
+ um_field_apply_action($dom, $owner_conditions[index], true);
307
+ } else {
308
+ um_field_apply_action($dom, $owner_conditions[index], false);
309
+ }
310
+ });
311
+ $dom.trigger('um_fields_change');
312
+
313
+ }
314
+
315
+ /**
316
+ * Apply condition's action
317
+ * @param object $dom
318
+ * @param string condition
319
+ * @param boolean is_true
320
+ */
321
+ function um_field_apply_action($dom, condition, is_true) {
322
+ var child_dom = jQuery('div.um-field[data-key="' + condition.owner + '"]');
323
+
324
+ if (condition.action == 'show' && is_true /*&& child_dom.is(':hidden')*/) {
325
+ child_dom.show();
326
+ _show_in_ie( child_dom );
327
+ um_field_restore_default_value(child_dom);
328
+ }
329
+
330
+ if (condition.action == 'show' && !is_true /*&& child_dom.is(':visible') */) {
331
+ child_dom.hide();
332
+ _hide_in_ie( child_dom );
333
+ }
334
+
335
+ if (condition.action == 'hide' && is_true /*&& child_dom.is(':visible')*/) {
336
+ child_dom.hide();
337
+ _hide_in_ie( child_dom );
338
+ }
339
+
340
+ if (condition.action == 'hide' && !is_true /*&& child_dom.is(':hidden')*/) {
341
+ child_dom.show();
342
+ _show_in_ie( child_dom );
343
+ um_field_restore_default_value( child_dom );
344
+
345
+ }
346
+ $dom.removeClass('um-field-has-changed');
347
+ }
348
+
349
+ /**
350
+ * Restores default field value
351
+ * @param object $dom
352
+ */
353
+ function um_field_restore_default_value( $dom ) {
354
+ //um_field_default_values
355
+
356
+ var type = um_get_field_type( $dom );
357
+ var key = $dom.data('key');
358
+ var field = um_field_default_values[key];
359
+ switch ( type ) {
360
+
361
+ case 'text':
362
+ case 'number':
363
+ case 'date':
364
+ case 'textarea':
365
+ $dom.find('input:text,input[type=number],textareas').val(field.value);
366
+ break;
367
+
368
+ case 'select':
369
+ $dom.find('select').find('option').prop('selected', false);
370
+ $dom.find('select').val(field.value);
371
+ $dom.find('select').trigger('change');
372
+ break;
373
+
374
+ case 'multiselect':
375
+ $dom.find('select').find('option').prop('selected', false);
376
+ jQuery.each(field.value, function (i, value) {
377
+ $dom.find('select').find('option[value="' + value + '"]').attr('selected', true);
378
+ });
379
+ $dom.find('select').trigger('change');
380
+ break;
381
+
382
+ case 'checkbox':
383
+
384
+ if ( $dom.find('input[type=checkbox]:checked').length >= 1 ) {
385
+
386
+ $dom.find('input[type=checkbox]:checked').removeAttr('checked');
387
+ $dom.find('span.um-field-checkbox-state i').removeClass('um-icon-android-checkbox-outline');
388
+ $dom.find('span.um-field-checkbox-state i').addClass('um-icon-android-checkbox-outline-blank');
389
+ $dom.find('.um-field-checkbox.active').removeClass('active');
390
+
391
+ if (jQuery.isArray(field.value)) {
392
+ jQuery.each(field.value, function (i, value) {
393
+ var cbox_elem = $dom.find('input[type=checkbox][value="' + value + '"]');
394
+ cbox_elem.attr('checked', true);
395
+ cbox_elem.closest('.um-field-checkbox').find('i').removeClass('um-icon-android-checkbox-outline-blank');
396
+ cbox_elem.closest('.um-field-checkbox').find('i').addClass('um-icon-android-checkbox-outline');
397
+ cbox_elem.closest('.um-field-checkbox').addClass('active');
398
+ });
399
+ } else {
400
+ var cbox_elem = $dom.find('input[type=checkbox][value="' + field.value + '"]');
401
+ cbox_elem.attr('checked', true);
402
+ cbox_elem.closest('.um-field-checkbox').find('i').removeClass('um-icon-android-checkbox-outline-blank');
403
+ cbox_elem.closest('.um-field-checkbox').find('i').addClass('um-icon-android-checkbox-outline');
404
+ cbox_elem.closest('.um-field-checkbox').addClass('active');
405
+ }
406
+
407
+ }
408
+
409
+ break;
410
+ case 'radio':
411
+
412
+ if ( $dom.find('input[type=radio]:checked').length >= 1 ) {
413
+
414
+ setTimeout(function () {
415
+
416
+ $dom.find('input[type=radio]:checked').removeAttr('checked');
417
+
418
+ $dom.find('span.um-field-radio-state i').removeClass('um-icon-android-radio-button-on');
419
+ $dom.find('span.um-field-radio-state i').addClass('um-icon-android-radio-button-off');
420
+ $dom.find('.um-field-radio.active').removeClass('active');
421
+
422
+ var radio_elem = $dom.find("input[type=radio][value='" + field.value + "']");
423
+ radio_elem.attr('checked', true);
424
+ radio_elem.closest('.um-field-radio').find('i').removeClass('um-icon-android-radio-button-off');
425
+ radio_elem.closest('.um-field-radio').find('i').addClass('um-icon-android-radio-button-on');
426
+ radio_elem.closest('.um-field-radio').addClass('active');
427
+
428
+ }, 100);
429
+ }
430
+
431
+ break;
432
+
433
+
434
+ } // end switch type
435
+
436
+
437
+ if ( ! $dom.hasClass( 'um-field-has-changed' ) ) {
438
+ var me = um_get_field_element( $dom );
439
+
440
+ if ( type == 'radio' || type == 'checkbox' ) {
441
+ me = me.find( ':checked' );
442
+ }
443
+
444
+ if ( me ) {
445
+ me.trigger( 'change' );
446
+ $dom.addClass( 'um-field-has-changed' );
447
+ }
448
+
449
+ /*
450
+ maybe future fix
451
+ if ( me ) {
452
+ if ( type == 'radio' || type == 'checkbox' ) {
453
+ me.each( function() {
454
+ if ( jQuery(this).is(':checked') ) {
455
+ jQuery(this).trigger('change');
456
+ }
457
+ });
458
+ } else {
459
+ me.trigger( 'change' );
460
+ }
461
+
462
+ $dom.addClass( 'um-field-has-changed' );
463
+ }*/
464
+ }
465
+ }
466
+
467
+ /**
468
+ * Hides sibling/child field when parent field is hidden
469
+ */
470
+ function um_field_hide_siblings() {
471
+
472
+ jQuery.each(um_field_conditions, function (index, conditions) {
473
+ if (jQuery('.um-field[data-key="' + index + '"]:hidden').length >= 1 || jQuery('.um-field[data-key="' + index + '"]').css('display') == 'none') {
474
+ jQuery.each(conditions, function (key, condition) {
475
+ jQuery('.um-field[data-key="' + condition.owner + '"]').hide();
476
+ });
477
+ }
478
+
479
+ });
480
+
481
+ }
482
+
483
+ /**
484
+ * Hides div for IE browser
485
+ * @param object $dom
486
+ */
487
+ function _hide_in_ie( $dom ){
488
+ if ( typeof( jQuery.browser ) != 'undefined' && jQuery.browser.msie ) {
489
+ $dom.css({"visibility":"hidden"});
490
+ }
491
+ }
492
+
493
+ /**
494
+ * Shows div for IE browser
495
+ * @param object $dom
496
+ */
497
+ function _show_in_ie( $dom ){
498
+ if ( typeof( jQuery.browser ) != 'undefined' && jQuery.browser.msie ) {
499
+ $dom.css({"visibility":"visible"});
500
+ }
501
+ }
502
+
503
+ /**
504
+ * UM Conditional fields Init
505
+ */
506
+ function um_init_field_conditions() {
507
+ var arr_field_keys = [];
508
+
509
+ jQuery( '.um-field[data-key]' ).each( function() {
510
+
511
+ var key = jQuery(this).data( 'key' );
512
+
513
+ arr_field_keys.push( key );
514
+
515
+ var parse_attrs = {};
516
+ jQuery.each( jQuery(this)[0].attributes, function ( index, attribute ) {
517
+ if ( attribute.name.indexOf( 'data-cond' ) != -1 ) {
518
+ // replace "data-cond-"
519
+ var cond_field_id_and_attr = attribute.name.slice( 10 );
520
+ // return "n"
521
+ var cond_field_id = cond_field_id_and_attr.substring( 1, 0 );
522
+ //replace "n-"
523
+ var cond_field_attr = cond_field_id_and_attr.slice( 2 );
524
+
525
+ if ( typeof parse_attrs[cond_field_id] == 'undefined' )
526
+ parse_attrs[cond_field_id] = {};
527
+
528
+ parse_attrs[cond_field_id][cond_field_attr] = attribute.value;
529
+ }
530
+ });
531
+
532
+ jQuery.each( parse_attrs, function ( ii, dd ) {
533
+ var obj = {'field' :{
534
+ owner: key,
535
+ action: dd.action,
536
+ parent: dd.field,
537
+ operator: dd.operator,
538
+ value: dd.value,
539
+ condition: {
540
+ owner: key,
541
+ action: dd.action,
542
+ operator: dd.operator,
543
+ value: dd.value
544
+ }
545
+ }};
546
+
547
+ arr_all_conditions.push(obj);
548
+ });
549
+
550
+ um_field_default_values[jQuery(this).data('key')] = um_get_field_default_value( jQuery(this) );
551
+ });
552
+
553
+ jQuery.each( arr_field_keys, function ( i, field_key ) {
554
+ um_field_conditions[field_key] = um_get_field_children( field_key );
555
+ });
556
+
557
+ jQuery( '.um-field[data-key]:visible' ).each( function() {
558
+ var $wrap_dom = jQuery(this);
559
+ var me = um_get_field_element( $wrap_dom );
560
+ if ( typeof me.trigger !== 'undefined' ) {
561
+ me.trigger( 'change' );
562
+ }
563
+ });
564
+
565
+ }
566
+
567
568
+ jQuery(document).ready( function (){
569
570
jQuery(document).on('change', '.um-field select, .um-field input[type="radio"], .um-field input[type="checkbox"]', function () {
571
var me = jQuery(this);
592
um_field_hide_siblings(); // dupes, issue with false field wrapper's visiblity validations. requires optimization.
593
});
594
595
um_init_field_conditions();
596
});
assets/js/um-conditional.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(){var e,t=[],d={},o={};function r(e){switch(s(e)){case"text":case"number":case"date":case"textarea":case"select":case"multiselect":case"radio":case"checkbox":return e.find("input,textarea,select")}return""}function s(e){var n="",i=e.attr("class");return jQuery.each(i.split(" "),function(e,i){-1!=i.indexOf("um-field-type")&&(n=i.split("_")[1])}),n}function l(e,i,n){var a,t=!1;n=!!n;for(a in i)if(n&&i[a]===e||!n&&i[a]==e){t=!0;break}return t}function i(n,e){var i,a=n.parents(".um-field[data-key]").data("key"),t=d[a],c=(i=n,um_live_field=i.parents(".um-field").data("key"),um_live_value=i.val(),i.is(":checkbox")&&(um_live_value="",1<i.parents(".um-field").find("input:checked").length?i.parents(".um-field").find("input:checked").each(function(){um_live_value=um_live_value+jQuery(this).val()+" "}):1<=i.parents(".um-field").find("input:checked").length&&(um_live_value=i.parents(".um-field").find("input:checked").val())),i.is(":radio")&&(um_live_value=i.parents(".um-field").find("input[type=radio]:checked").val()),um_live_value),o={},r={},u={};jQuery.each(t,function(e,i){void 0===r[i.owner]&&(r[i.owner]=[],u[i.owner]={}),r[i.owner].push(i.value),u[i.owner]=i}),jQuery.each(t,function(e,i){void 0===o[i.owner]&&(o[i.owner]={}),"empty"==i.operator&&(!c||""==c&&l(c,r[i.owner])?o[i.owner][e]=!0:o[i.owner][e]=!1),"not empty"==i.operator&&(c&&""!=c&&!l(c,r[i.owner])?o[i.owner][e]=!0:o[i.owner][e]=!1),"equals to"==i.operator&&(i.value==c&&l(c,r[i.owner])?o[i.owner][e]=!0:o[i.owner][e]=!1),"not equals"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(c)!=parseInt(i.value)&&c&&!l(c,r[i.owner])?o[i.owner][e]=!0:i.value==c||l(c,r[i.owner])?o[i.owner][e]=!1:o[i.owner][e]=!0),"greater than"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(c)>parseInt(i.value)?o[i.owner][e]=!0:o[i.owner][e]=!1),"less than"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(c)<parseInt(i.value)?o[i.owner][e]=!0:o[i.owner][e]=!1),"contains"==i.operator&&("multiselect"==s(n.parents(".um-field[data-key]"))?c&&0<=c.indexOf(i.value)&&l(i.value,c)?o[i.owner][e]=!0:o[i.owner][e]=!1:"checkbox"==s(n.parents(".um-field[data-key]"))?c&&0<=c.indexOf(i.value)?o[i.owner][e]=!0:o[i.owner][e]=!1:c&&0<=c.indexOf(i.value)&&l(c,r[i.owner])?o[i.owner][e]=!0:o[i.owner][e]=!1)}),jQuery.each(o,function(e,i){l(!0,i)?f(n,u[e],!0):f(n,u[e],!1)}),n.trigger("um_fields_change")}function f(e,i,n){var a=jQuery('div.um-field[data-key="'+i.owner+'"]');"show"==i.action&&n&&(a.show(),h(a),c(a)),"show"!=i.action||n||(a.hide(),u(a)),"hide"==i.action&&n&&(a.hide(),u(a)),"hide"!=i.action||n||(a.show(),h(a),c(a)),e.removeClass("um-field-has-changed")}function c(a){var e=s(a),i=a.data("key"),n=o[i];switch(e){case"text":case"number":case"date":case"textarea":a.find("input:text,input[type=number],textareas").val(n.value);break;case"select":a.find("select").find("option").prop("selected",!1),a.find("select").val(n.value),a.find("select").trigger("change");break;case"multiselect":a.find("select").find("option").prop("selected",!1),jQuery.each(n.value,function(e,i){a.find("select").find('option[value="'+i+'"]').attr("selected",!0)}),a.find("select").trigger("change");break;case"checkbox":if(1<=a.find("input[type=checkbox]:checked").length)if(a.find("input[type=checkbox]:checked").removeAttr("checked"),a.find("span.um-field-checkbox-state i").removeClass("um-icon-android-checkbox-outline"),a.find("span.um-field-checkbox-state i").addClass("um-icon-android-checkbox-outline-blank"),a.find(".um-field-checkbox.active").removeClass("active"),jQuery.isArray(n.value))jQuery.each(n.value,function(e,i){var n=a.find('input[type=checkbox][value="'+i+'"]');n.attr("checked",!0),n.closest(".um-field-checkbox").find("i").removeClass("um-icon-android-checkbox-outline-blank"),n.closest(".um-field-checkbox").find("i").addClass("um-icon-android-checkbox-outline"),n.closest(".um-field-checkbox").addClass("active")});else{var t=a.find('input[type=checkbox][value="'+n.value+'"]');t.attr("checked",!0),t.closest(".um-field-checkbox").find("i").removeClass("um-icon-android-checkbox-outline-blank"),t.closest(".um-field-checkbox").find("i").addClass("um-icon-android-checkbox-outline"),t.closest(".um-field-checkbox").addClass("active")}break;case"radio":1<=a.find("input[type=radio]:checked").length&&setTimeout(function(){a.find("input[type=radio]:checked").removeAttr("checked"),a.find("span.um-field-radio-state i").removeClass("um-icon-android-radio-button-on"),a.find("span.um-field-radio-state i").addClass("um-icon-android-radio-button-off"),a.find(".um-field-radio.active").removeClass("active");var e=a.find("input[type=radio][value='"+n.value+"']");e.attr("checked",!0),e.closest(".um-field-radio").find("i").removeClass("um-icon-android-radio-button-off"),e.closest(".um-field-radio").find("i").addClass("um-icon-android-radio-button-on"),e.closest(".um-field-radio").addClass("active")},100)}if(!a.hasClass("um-field-has-changed")){var c=r(a);"radio"!=e&&"checkbox"!=e||(c=c.find(":checked")),c&&(c.trigger("change"),a.addClass("um-field-has-changed"))}}function n(){jQuery.each(d,function(e,i){(1<=jQuery('.um-field[data-key="'+e+'"]:hidden').length||"none"==jQuery('.um-field[data-key="'+e+'"]').css("display"))&&jQuery.each(i,function(e,i){jQuery('.um-field[data-key="'+i.owner+'"]').hide()})})}function u(e){void 0!==jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"hidden"})}function h(e){void 0!==jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"visible"})}jQuery(document).on("change",'.um-field select, .um-field input[type="radio"], .um-field input[type="checkbox"]',function(){i(jQuery(this))}),jQuery(document).on("input change",'.um-field input[type="text"]',function(){i(jQuery(this))}),jQuery(document).on("input change",'.um-field input[type="number"]',function(){i(jQuery(this))}),jQuery(document).on("input change",'.um-field input[type="password"]',function(){i(jQuery(this))}),jQuery(document).on("um_fields_change",function(){n(),n()}),e=[],jQuery(".um-field[data-key]").each(function(){var a=jQuery(this).data("key");e.push(a);var c={};jQuery.each(jQuery(this)[0].attributes,function(e,i){if(-1!=i.name.indexOf("data-cond")){var n=i.name.slice(10),a=n.substring(1,0),t=n.slice(2);void 0===c[a]&&(c[a]={}),c[a][t]=i.value}}),jQuery.each(c,function(e,i){var n={field:{owner:a,action:i.action,parent:i.field,operator:i.operator,value:i.value,condition:{owner:a,action:i.action,operator:i.operator,value:i.value}}};t.push(n)}),o[jQuery(this).data("key")]=function(e){var i="",n=s(e);switch(n){case"text":case"number":case"date":case"textarea":case"select":i=e.find("input:text,input[type=number],textarea,select").val();break;case"multiselect":i=e.find("select").val();break;case"radio":1<=e.find("input[type=radio]:checked").length&&(i=e.find("input[type=radio]:checked").val());break;case"checkbox":1<=e.find("input[type=checkbox]:checked").length&&(1<e.find("input[type=checkbox]:checked").length?e.find("input[type=checkbox]:checked").each(function(){i=i+jQuery(this).val()+" "}):i=e.find("input[type=checkbox]:checked").val())}return{type:n,value:i}}(jQuery(this))}),jQuery.each(e,function(e,i){var n,a;d[i]=(n=i,a=[],jQuery.each(t,function(e,i){i.field.parent==n&&a.push(i.field.condition)}),a)}),jQuery(".um-field[data-key]:visible").each(function(){var e=r(jQuery(this));void 0!==e.trigger&&e.trigger("change")})});
1
+ var arr_all_conditions=[],um_field_conditions={},um_field_default_values={};function um_get_field_default_value(e){var i="",n=um_get_field_type(e);switch(n){case"text":case"number":case"date":case"textarea":case"select":i=e.find("input:text,input[type=number],textarea,select").val();break;case"multiselect":i=e.find("select").val();break;case"radio":1<=e.find("input[type=radio]:checked").length&&(i=e.find("input[type=radio]:checked").val());break;case"checkbox":1<=e.find("input[type=checkbox]:checked").length&&(1<e.find("input[type=checkbox]:checked").length?e.find("input[type=checkbox]:checked").each(function(){i=i+jQuery(this).val()+" "}):i=e.find("input[type=checkbox]:checked").val())}return{type:n,value:i}}function um_get_field_element(e){switch(um_get_field_type(e)){case"text":case"number":case"date":case"textarea":case"select":case"multiselect":case"radio":case"checkbox":return e.find("input,textarea,select")}return""}function um_get_field_type(e){var n="",i=e.attr("class");return jQuery.each(i.split(" "),function(e,i){-1!=i.indexOf("um-field-type")&&(n=i.split("_")[1])}),n}function um_get_field_children(n){var t=[];return jQuery.each(arr_all_conditions,function(e,i){i.field.parent==n&&t.push(i.field.condition)}),t}function um_splitup_array(e,i){for(var n=e.length%i,t=n,a=Math.floor(e.length/i),u=[],o=0;o<e.length;o+=a){var r=a+o,d=!1;0!==n&&t&&(r++,t--,d=!0),u.push(e.slice(o,r)),d&&o++}var c=[];return jQuery.each(u,function(e,i){c.push({action:i[0],if_field:i[1],operator:i[2],value:i[3]})}),c}function um_get_field_data(e){return um_live_field=e.parents(".um-field").data("key"),um_live_value=e.val(),e.is(":checkbox")&&(um_live_value="",1<e.parents(".um-field").find("input:checked").length?e.parents(".um-field").find("input:checked").each(function(){um_live_value=um_live_value+jQuery(this).val()+" "}):1<=e.parents(".um-field").find("input:checked").length&&(um_live_value=e.parents(".um-field").find("input:checked").val())),e.is(":radio")&&(um_live_value=e.parents(".um-field").find("input[type=radio]:checked").val()),um_live_value}function um_in_array(e,i,n){var t,a=!1;n=!!n;for(t in i)if(n&&i[t]===e||!n&&i[t]==e){a=!0;break}return a}function um_apply_conditions(n,e){var i=n.parents(".um-field[data-key]").data("key"),t=um_field_conditions[i],a=um_get_field_data(n),u={},o={},r={};jQuery.each(t,function(e,i){void 0===o[i.owner]&&(o[i.owner]=[],r[i.owner]={}),o[i.owner].push(i.value),r[i.owner]=i}),jQuery.each(t,function(e,i){void 0===u[i.owner]&&(u[i.owner]={}),"empty"==i.operator&&(!a||""==a&&um_in_array(a,o[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1),"not empty"==i.operator&&(a&&""!=a&&!um_in_array(a,o[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1),"equals to"==i.operator&&(i.value==a&&um_in_array(a,o[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1),"not equals"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(a)!=parseInt(i.value)&&a&&!um_in_array(a,o[i.owner])?u[i.owner][e]=!0:i.value==a||um_in_array(a,o[i.owner])?u[i.owner][e]=!1:u[i.owner][e]=!0),"greater than"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(a)>parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),"less than"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(a)<parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),"contains"==i.operator&&("multiselect"==um_get_field_type(n.parents(".um-field[data-key]"))?a&&0<=a.indexOf(i.value)&&um_in_array(i.value,a)?u[i.owner][e]=!0:u[i.owner][e]=!1:"checkbox"==um_get_field_type(n.parents(".um-field[data-key]"))?a&&0<=a.indexOf(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1:a&&0<=a.indexOf(i.value)&&um_in_array(a,o[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1)}),jQuery.each(u,function(e,i){um_in_array(!0,i)?um_field_apply_action(n,r[e],!0):um_field_apply_action(n,r[e],!1)}),n.trigger("um_fields_change")}function um_field_apply_action(e,i,n){var t=jQuery('div.um-field[data-key="'+i.owner+'"]');"show"==i.action&&n&&(t.show(),_show_in_ie(t),um_field_restore_default_value(t)),"show"!=i.action||n||(t.hide(),_hide_in_ie(t)),"hide"==i.action&&n&&(t.hide(),_hide_in_ie(t)),"hide"!=i.action||n||(t.show(),_show_in_ie(t),um_field_restore_default_value(t)),e.removeClass("um-field-has-changed")}function um_field_restore_default_value(t){var e=um_get_field_type(t),i=t.data("key"),n=um_field_default_values[i];switch(e){case"text":case"number":case"date":case"textarea":t.find("input:text,input[type=number],textareas").val(n.value);break;case"select":t.find("select").find("option").prop("selected",!1),t.find("select").val(n.value),t.find("select").trigger("change");break;case"multiselect":t.find("select").find("option").prop("selected",!1),jQuery.each(n.value,function(e,i){t.find("select").find('option[value="'+i+'"]').attr("selected",!0)}),t.find("select").trigger("change");break;case"checkbox":if(1<=t.find("input[type=checkbox]:checked").length)if(t.find("input[type=checkbox]:checked").removeAttr("checked"),t.find("span.um-field-checkbox-state i").removeClass("um-icon-android-checkbox-outline"),t.find("span.um-field-checkbox-state i").addClass("um-icon-android-checkbox-outline-blank"),t.find(".um-field-checkbox.active").removeClass("active"),jQuery.isArray(n.value))jQuery.each(n.value,function(e,i){var n=t.find('input[type=checkbox][value="'+i+'"]');n.attr("checked",!0),n.closest(".um-field-checkbox").find("i").removeClass("um-icon-android-checkbox-outline-blank"),n.closest(".um-field-checkbox").find("i").addClass("um-icon-android-checkbox-outline"),n.closest(".um-field-checkbox").addClass("active")});else{var a=t.find('input[type=checkbox][value="'+n.value+'"]');a.attr("checked",!0),a.closest(".um-field-checkbox").find("i").removeClass("um-icon-android-checkbox-outline-blank"),a.closest(".um-field-checkbox").find("i").addClass("um-icon-android-checkbox-outline"),a.closest(".um-field-checkbox").addClass("active")}break;case"radio":1<=t.find("input[type=radio]:checked").length&&setTimeout(function(){t.find("input[type=radio]:checked").removeAttr("checked"),t.find("span.um-field-radio-state i").removeClass("um-icon-android-radio-button-on"),t.find("span.um-field-radio-state i").addClass("um-icon-android-radio-button-off"),t.find(".um-field-radio.active").removeClass("active");var e=t.find("input[type=radio][value='"+n.value+"']");e.attr("checked",!0),e.closest(".um-field-radio").find("i").removeClass("um-icon-android-radio-button-off"),e.closest(".um-field-radio").find("i").addClass("um-icon-android-radio-button-on"),e.closest(".um-field-radio").addClass("active")},100)}if(!t.hasClass("um-field-has-changed")){var u=um_get_field_element(t);"radio"!=e&&"checkbox"!=e||(u=u.find(":checked")),u&&(u.trigger("change"),t.addClass("um-field-has-changed"))}}function um_field_hide_siblings(){jQuery.each(um_field_conditions,function(e,i){(1<=jQuery('.um-field[data-key="'+e+'"]:hidden').length||"none"==jQuery('.um-field[data-key="'+e+'"]').css("display"))&&jQuery.each(i,function(e,i){jQuery('.um-field[data-key="'+i.owner+'"]').hide()})})}function _hide_in_ie(e){void 0!==jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"hidden"})}function _show_in_ie(e){void 0!==jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"visible"})}function um_init_field_conditions(){var e=[];jQuery(".um-field[data-key]").each(function(){var t=jQuery(this).data("key");e.push(t);var u={};jQuery.each(jQuery(this)[0].attributes,function(e,i){if(-1!=i.name.indexOf("data-cond")){var n=i.name.slice(10),t=n.substring(1,0),a=n.slice(2);void 0===u[t]&&(u[t]={}),u[t][a]=i.value}}),jQuery.each(u,function(e,i){var n={field:{owner:t,action:i.action,parent:i.field,operator:i.operator,value:i.value,condition:{owner:t,action:i.action,operator:i.operator,value:i.value}}};arr_all_conditions.push(n)}),um_field_default_values[jQuery(this).data("key")]=um_get_field_default_value(jQuery(this))}),jQuery.each(e,function(e,i){um_field_conditions[i]=um_get_field_children(i)}),jQuery(".um-field[data-key]:visible").each(function(){var e=um_get_field_element(jQuery(this));void 0!==e.trigger&&e.trigger("change")})}jQuery(document).ready(function(){jQuery(document).on("change",'.um-field select, .um-field input[type="radio"], .um-field input[type="checkbox"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="text"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="number"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="password"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("um_fields_change",function(){um_field_hide_siblings(),um_field_hide_siblings()}),um_init_field_conditions()});
assets/js/um-scripts.js CHANGED
@@ -124,10 +124,10 @@ jQuery(document).ready(function() {
124
score: function() {return jQuery(this).attr('data-score');},
125
scoreName: function(){return jQuery(this).attr('data-key');},
126
hints: false,
127
- click: function(score, evt) {
128
live_field = this.id;
129
live_value = score;
130
- um_conditional();
131
}
132
});
133
124
score: function() {return jQuery(this).attr('data-score');},
125
scoreName: function(){return jQuery(this).attr('data-key');},
126
hints: false,
127
+ click: function( score, evt ) {
128
live_field = this.id;
129
live_value = score;
130
+ um_apply_conditions( jQuery(this), false );
131
}
132
});
133
assets/js/um-scripts.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(){jQuery(document).on("click",".um-dropdown a",function(e){return!1}),jQuery(document).on("click",".um-dropdown a.real_url",function(e){window.location=jQuery(this).attr("href")}),jQuery(document).on("click",".um-trigger-menu-on-click",function(e){return jQuery(".um-dropdown").hide(),menu=jQuery(this).find(".um-dropdown"),menu.show(),!1}),jQuery(document).on("click",".um-dropdown-hide",function(e){UM_hide_menus()}),jQuery(document).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");jQuery(this).parents(t).find(e).trigger("click")}),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}),jQuery(document).on("change",".um-field-area input[type=radio]",function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeAttr("class").addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeAttr("class").addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",".um-field-area input[type=checkbox]",function(){jQuery(this).parents(".um-field-area");var e=jQuery(this).parents("label");e.hasClass("active")?(e.removeClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline"))}),jQuery(".um-datepicker").each(function(){if(elem=jQuery(this),""!=elem.attr("data-disabled_weekdays"))var e=JSON.parse(elem.attr("data-disabled_weekdays"));else e=!1;var t=elem.attr("data-years"),a=elem.attr("data-date_min"),i=elem.attr("data-date_max"),r=a.split(","),n=i.split(","),u=r.length?new Date(r):null,o=r.length?new Date(n):null;if(u&&"Invalid Date"==u.toString()&&3==r.length){var d=r[1]+"/"+r[2]+"/"+r[0];u=new Date(Date.parse(d))}if(o&&"Invalid Date"==o.toString()&&3==n.length){var s=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(s))}elem.pickadate({selectYears:t,min:u,max:o,disable:e,format:elem.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-timepicker").each(function(){elem=jQuery(this),elem.pickatime({format:elem.attr("data-format"),interval:parseInt(elem.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-rating").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){live_field=this.id,live_value=e,um_conditional()}}),jQuery(".um-rating-readonly").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0}),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src");return t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val("empty_file"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:a}}),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href");return t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val("empty_file"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:a}}),!1}),jQuery(".um-s1,.um-s2").css({display:"block"}),jQuery(".um-s1").select2({allowClear:!0}),jQuery(".um-s2").select2({allowClear:!1,minimumResultsForSearch:10}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e),increase_id=0,e.find(".um-field-group-body").each(function(){increase_id++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+increase_id),e.attr("name",e.data("key")+"-"+increase_id),e.parent().parent().find("label").attr("for",e.data("key")+"-"+increase_id)})}),0<t&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),a=t.data("max_entries");return 1<t.find(".um-field-group-body").length?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),0<a&&t.find(".um-field-group-body").length<a&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document.body).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this),a=jQuery(this).parent();a.addClass("loading");var i=jQuery(this).data("hook");if("um_load_posts"===i){var r=1*jQuery(this).data("pages"),n=1*jQuery(this).data("page")+1;jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_posts",author:jQuery(this).data("author"),page:n},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),n===r?a.remove():t.data("page",n)}})}else{var u=jQuery(this).data("args"),o=jQuery(this).parents(".um").find(".um-ajax-items");jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate",hook:i,args:u},complete:function(){a.removeClass("loading")},success:function(e){a.remove(),o.append(e)}})}}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),a=jQuery(this).data("user_id"),arguments=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_muted_action",hook:t,user_id:a,arguments:arguments},success:function(e){}}),!1}),jQuery(document).on("click","#um-search-button",function(){jQuery(this).parents("form").submit()}),jQuery(".um-form input[class=um-button][type=submit]").removeAttr("disabled"),jQuery(document).one("click",".um:not(.um-account) .um-form input[class=um-button][type=submit]:not(.um-has-recaptcha)",function(){jQuery(this).attr("disabled","disabled"),jQuery(this).parents("form").submit()});var o={};function d(e,t,a,i){var r=e.data("um-parent");e.attr("name"),jQuery('select[name="'+r+'"]');e.find('option[value!=""]').remove(),e.hasClass("um-child-option-disabled")||e.removeAttr("disabled");i=[];var n="";if("yes"===t.post.members_directory){var u=new URLSearchParams(window.location.search);n=u.get(t.post.child_name)}jQuery.each(t.items,function(e,t){i.push({id:e,text:t,selected:t===n})}),e.select2("destroy"),e.select2({data:i,allowClear:!0,minimumResultsForSearch:10}),"yes"!==t.post.members_directory&&(void 0===t.field.default||e.data("um-original-value")?""!=e.data("um-original-value")&&e.val(e.data("um-original-value")).trigger("change"):e.val(t.field.default).trigger("change"),0==t.field.editable&&(e.addClass("um-child-option-disabled"),e.attr("disabled","disabled"))),o[a]=t}jQuery("select[data-um-parent]").each(function(){var r=jQuery(this),n=r.data("um-parent"),u=(r.data("um-ajax-url"),r.data("um-ajax-source"));r.val();r.attr("data-um-init-field",!0),jQuery(document).on("change",'select[name="'+n+'"]',function(){var t=jQuery(this),e=t.closest("form").find("input[type=hidden][name=form_id]").val(),a=t.val();if(""!=t.val()&&"object"!=typeof o[a]&&jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_select_options",parent_option_name:n,parent_option:t.val(),child_callback:u,child_name:r.attr("name"),members_directory:r.attr("data-mebers-directory"),form_id:e},success:function(e){"success"==e.status&&""!=t.val()&&d(r,e,a),void 0!==e.debug&&console.log(e)},error:function(e){console.log(e)}}),""!=t.val()&&"object"==typeof o[a]){var i=o[a];d(r,i,a)}""==t.val()&&(r.find('option[value!=""]').remove(),r.val("").trigger("change"))}),jQuery('select[name="'+n+'"]').trigger("change")})});
1
+ jQuery(document).ready(function(){jQuery(document).on("click",".um-dropdown a",function(e){return!1}),jQuery(document).on("click",".um-dropdown a.real_url",function(e){window.location=jQuery(this).attr("href")}),jQuery(document).on("click",".um-trigger-menu-on-click",function(e){return jQuery(".um-dropdown").hide(),menu=jQuery(this).find(".um-dropdown"),menu.show(),!1}),jQuery(document).on("click",".um-dropdown-hide",function(e){UM_hide_menus()}),jQuery(document).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");jQuery(this).parents(t).find(e).trigger("click")}),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}),jQuery(document).on("change",".um-field-area input[type=radio]",function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeAttr("class").addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeAttr("class").addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",".um-field-area input[type=checkbox]",function(){jQuery(this).parents(".um-field-area");var e=jQuery(this).parents("label");e.hasClass("active")?(e.removeClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline"))}),jQuery(".um-datepicker").each(function(){if(elem=jQuery(this),""!=elem.attr("data-disabled_weekdays"))var e=JSON.parse(elem.attr("data-disabled_weekdays"));else e=!1;var t=elem.attr("data-years"),a=elem.attr("data-date_min"),i=elem.attr("data-date_max"),r=a.split(","),n=i.split(","),u=r.length?new Date(r):null,o=r.length?new Date(n):null;if(u&&"Invalid Date"==u.toString()&&3==r.length){var d=r[1]+"/"+r[2]+"/"+r[0];u=new Date(Date.parse(d))}if(o&&"Invalid Date"==o.toString()&&3==n.length){var s=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(s))}elem.pickadate({selectYears:t,min:u,max:o,disable:e,format:elem.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-timepicker").each(function(){elem=jQuery(this),elem.pickatime({format:elem.attr("data-format"),interval:parseInt(elem.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-rating").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){live_field=this.id,live_value=e,um_apply_conditions(jQuery(this),!1)}}),jQuery(".um-rating-readonly").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0}),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src");return t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val("empty_file"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:a}}),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href");return t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val("empty_file"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:a}}),!1}),jQuery(".um-s1,.um-s2").css({display:"block"}),jQuery(".um-s1").select2({allowClear:!0}),jQuery(".um-s2").select2({allowClear:!1,minimumResultsForSearch:10}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e),increase_id=0,e.find(".um-field-group-body").each(function(){increase_id++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+increase_id),e.attr("name",e.data("key")+"-"+increase_id),e.parent().parent().find("label").attr("for",e.data("key")+"-"+increase_id)})}),0<t&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),a=t.data("max_entries");return 1<t.find(".um-field-group-body").length?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),0<a&&t.find(".um-field-group-body").length<a&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document.body).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this),a=jQuery(this).parent();a.addClass("loading");var i=jQuery(this).data("hook");if("um_load_posts"===i){var r=1*jQuery(this).data("pages"),n=1*jQuery(this).data("page")+1;jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_posts",author:jQuery(this).data("author"),page:n},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),n===r?a.remove():t.data("page",n)}})}else{var u=jQuery(this).data("args"),o=jQuery(this).parents(".um").find(".um-ajax-items");jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate",hook:i,args:u},complete:function(){a.removeClass("loading")},success:function(e){a.remove(),o.append(e)}})}}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),a=jQuery(this).data("user_id"),arguments=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_muted_action",hook:t,user_id:a,arguments:arguments},success:function(e){}}),!1}),jQuery(document).on("click","#um-search-button",function(){jQuery(this).parents("form").submit()}),jQuery(".um-form input[class=um-button][type=submit]").removeAttr("disabled"),jQuery(document).one("click",".um:not(.um-account) .um-form input[class=um-button][type=submit]:not(.um-has-recaptcha)",function(){jQuery(this).attr("disabled","disabled"),jQuery(this).parents("form").submit()});var o={};function d(e,t,a,i){var r=e.data("um-parent");e.attr("name"),jQuery('select[name="'+r+'"]');e.find('option[value!=""]').remove(),e.hasClass("um-child-option-disabled")||e.removeAttr("disabled");i=[];var n="";if("yes"===t.post.members_directory){var u=new URLSearchParams(window.location.search);n=u.get(t.post.child_name)}jQuery.each(t.items,function(e,t){i.push({id:e,text:t,selected:t===n})}),e.select2("destroy"),e.select2({data:i,allowClear:!0,minimumResultsForSearch:10}),"yes"!==t.post.members_directory&&(void 0===t.field.default||e.data("um-original-value")?""!=e.data("um-original-value")&&e.val(e.data("um-original-value")).trigger("change"):e.val(t.field.default).trigger("change"),0==t.field.editable&&(e.addClass("um-child-option-disabled"),e.attr("disabled","disabled"))),o[a]=t}jQuery("select[data-um-parent]").each(function(){var r=jQuery(this),n=r.data("um-parent"),u=(r.data("um-ajax-url"),r.data("um-ajax-source"));r.val();r.attr("data-um-init-field",!0),jQuery(document).on("change",'select[name="'+n+'"]',function(){var t=jQuery(this),e=t.closest("form").find("input[type=hidden][name=form_id]").val(),a=t.val();if(""!=t.val()&&"object"!=typeof o[a]&&jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_select_options",parent_option_name:n,parent_option:t.val(),child_callback:u,child_name:r.attr("name"),members_directory:r.attr("data-mebers-directory"),form_id:e},success:function(e){"success"==e.status&&""!=t.val()&&d(r,e,a),void 0!==e.debug&&console.log(e)},error:function(e){console.log(e)}}),""!=t.val()&&"object"==typeof o[a]){var i=o[a];d(r,i,a)}""==t.val()&&(r.find('option[value!=""]').remove(),r.val("").trigger("change"))}),jQuery('select[name="'+n+'"]').trigger("change")})});
assets/js/um-scrollto.js DELETED
@@ -1,210 +0,0 @@
1
- /*!
2
- * jQuery.scrollTo
3
- * Copyright (c) 2007-2015 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
4
- * Licensed under MIT
5
- * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
6
- * @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery
7
- * @author Ariel Flesler
8
- * @version 2.1.1
9
- */
10
- ;(function(factory) {
11
- 'use strict';
12
- if (typeof define === 'function' && define.amd) {
13
- // AMD
14
- define(['jquery'], factory);
15
- } else if (typeof module !== 'undefined' && module.exports) {
16
- // CommonJS
17
- module.exports = factory(require('jquery'));
18
- } else {
19
- // Global
20
- factory(jQuery);
21
- }
22
- })(function($) {
23
- 'use strict';
24
-
25
- var $scrollTo = $.scrollTo = function(target, duration, settings) {
26
- return $(window).scrollTo(target, duration, settings);
27
- };
28
-
29
- $scrollTo.defaults = {
30
- axis:'xy',
31
- duration: 0,
32
- limit:true
33
- };
34
-
35
- function isWin(elem) {
36
- return !elem.nodeName ||
37
- $.inArray(elem.nodeName.toLowerCase(), ['iframe','#document','html','body']) !== -1;
38
- }
39
-
40
- $.fn.scrollTo = function(target, duration, settings) {
41
- if (typeof duration === 'object') {
42
- settings = duration;
43
- duration = 0;
44
- }
45
- if (typeof settings === 'function') {
46
- settings = { onAfter:settings };
47
- }
48
- if (target === 'max') {
49
- target = 9e9;
50
- }
51
-
52
- settings = $.extend({}, $scrollTo.defaults, settings);
53
- // Speed is still recognized for backwards compatibility
54
- duration = duration || settings.duration;
55
- // Make sure the settings are given right
56
- var queue = settings.queue && settings.axis.length > 1;
57
- if (queue) {
58
- // Let's keep the overall duration
59
- duration /= 2;
60
- }
61
- settings.offset = both(settings.offset);
62
- settings.over = both(settings.over);
63
-
64
- return this.each(function() {
65
- // Null target yields nothing, just like jQuery does
66
- if (target === null) return;
67
-
68
- var win = isWin(this),
69
- elem = win ? this.contentWindow || window : this,
70
- $elem = $(elem),
71
- targ = target,
72
- attr = {},
73
- toff;
74
-
75
- switch (typeof targ) {
76
- // A number will pass the regex
77
- case 'number':
78
- case 'string':
79
- if (/^([+-]=?)?\d+(\.\d+)?(px|%)?#x2F;.test(targ)) {
80
- targ = both(targ);
81
- // We are done
82
- break;
83
- }
84
- // Relative/Absolute selector
85
- targ = win ? $(targ) : $(targ, elem);
86
- if (!targ.length) return;
87
- /* falls through */
88
- case 'object':
89
- // DOMElement / jQuery
90
- if (targ.is || targ.style) {
91
- // Get the real position of the target
92
- toff = (targ = $(targ)).offset();
93
- }
94
- }
95
-
96
- var offset = $.isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset;
97
-
98
- $.each(settings.axis.split(''), function(i, axis) {
99
- var Pos = axis === 'x' ? 'Left' : 'Top',
100
- pos = Pos.toLowerCase(),
101
- key = 'scroll' + Pos,
102
- prev = $elem[key](),
103
- max = $scrollTo.max(elem, axis);
104
-
105
- if (toff) {// jQuery / DOMElement
106
- attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos]);
107
-
108
- // If it's a dom element, reduce the margin
109
- if (settings.margin) {
110
- attr[key] -= parseInt(targ.css('margin'+Pos), 10) || 0;
111
- attr[key] -= parseInt(targ.css('border'+Pos+'Width'), 10) || 0;
112
- }
113
-
114
- attr[key] += offset[pos] || 0;
115
-
116
- if (settings.over[pos]) {
117
- // Scroll to a fraction of its width/height
118
- attr[key] += targ[axis === 'x'?'width':'height']() * settings.over[pos];
119
- }
120
- } else {
121
- var val = targ[pos];
122
- // Handle percentage values
123
- attr[key] = val.slice && val.slice(-1) === '%' ?
124
- parseFloat(val) / 100 * max
125
- : val;
126
- }
127
-
128
- // Number or 'number'
129
- if (settings.limit && /^\d+#x2F;.test(attr[key])) {
130
- // Check the limits
131
- attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);
132
- }
133
-
134
- // Don't waste time animating, if there's no need.
135
- if (!i && settings.axis.length > 1) {
136
- if (prev === attr[key]) {
137
- // No animation needed
138
- attr = {};
139
- } else if (queue) {
140
- // Intermediate animation
141
- animate(settings.onAfterFirst);
142
- // Don't animate this axis again in the next iteration.
143
- attr = {};
144
- }
145
- }
146
- });
147
-
148
- animate(settings.onAfter);
149
-
150
- function animate(callback) {
151
- var opts = $.extend({}, settings, {
152
- // The queue setting conflicts with animate()
153
- // Force it to always be true
154
- queue: true,
155
- duration: duration,
156
- complete: callback && function() {
157
- callback.call(elem, targ, settings);
158
- }
159
- });
160
- $elem.animate(attr, opts);
161
- }
162
- });
163
- };
164
-
165
- // Max scrolling position, works on quirks mode
166
- // It only fails (not too badly) on IE, quirks mode.
167
- $scrollTo.max = function(elem, axis) {
168
- var Dim = axis === 'x' ? 'Width' : 'Height',
169
- scroll = 'scroll'+Dim;
170
-
171
- if (!isWin(elem))
172
- return elem[scroll] - $(elem)[Dim.toLowerCase()]();
173
-
174
- var size = 'client' + Dim,
175
- doc = elem.ownerDocument || elem.document,
176
- html = doc.documentElement,
177
- body = doc.body;
178
-
179
- return Math.max(html[scroll], body[scroll]) - Math.min(html[size], body[size]);
180
- };
181
-
182
- function both(val) {
183
- return $.isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val };
184
- }
185
-
186
- // Add special hooks so that window scroll properties can be animated
187
- $.Tween.propHooks.scrollLeft =
188
- $.Tween.propHooks.scrollTop = {
189
- get: function(t) {
190
- return $(t.elem)[t.prop]();
191
- },
192
- set: function(t) {
193
- var curr = this.get(t);
194
- // If interrupt is true and user scrolled, stop animating
195
- if (t.options.interrupt && t._last && t._last !== curr) {
196
- return $(t.elem).stop();
197
- }
198
- var next = Math.round(t.now);
199
- // Don't waste CPU
200
- // Browsers don't render floating point scroll
201
- if (curr !== next) {
202
- $(t.elem)[t.prop](next);
203
- t._last = this.get(t);
204
- }
205
- }
206
- };
207
-
208
- // AMD requirement
209
- return $scrollTo;
210
- });
assets/js/um-scrollto.min.js DELETED
@@ -1 +0,0 @@
1
- !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(w){"use strict";var y=w.scrollTo=function(e,t,o){return w(window).scrollTo(e,t,o)};function g(e){return!e.nodeName||-1!==w.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])}function t(e){return w.isFunction(e)||w.isPlainObject(e)?e:{top:e,left:e}}return y.defaults={axis:"xy",duration:0,limit:!0},w.fn.scrollTo=function(e,o,x){"object"==typeof o&&(x=o,o=0),"function"==typeof x&&(x={onAfter:x}),"max"===e&&(e=9e9),x=w.extend({},y.defaults,x),o=o||x.duration;var v=x.queue&&1<x.axis.length;return v&&(o/=2),x.offset=t(x.offset),x.over=t(x.over),this.each(function(){if(null!==e){var f,u=g(this),c=u?this.contentWindow||window:this,l=w(c),d=e,m={};switch(typeof d){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?#x2F;.test(d)){d=t(d);break}if(!(d=u?w(d):w(d,c)).length)return;case"object":(d.is||d.style)&&(f=(d=w(d)).offset())}var p=w.isFunction(x.offset)&&x.offset(c,d)||x.offset;w.each(x.axis.split(""),function(e,t){var o="x"===t?"Left":"Top",n=o.toLowerCase(),r="scroll"+o,i=l[r](),s=y.max(c,t);if(f)m[r]=f[n]+(u?0:i-l.offset()[n]),x.margin&&(m[r]-=parseInt(d.css("margin"+o),10)||0,m[r]-=parseInt(d.css("border"+o+"Width"),10)||0),m[r]+=p[n]||0,x.over[n]&&(m[r]+=d["x"===t?"width":"height"]()*x.over[n]);else{var a=d[n];m[r]=a.slice&&"%"===a.slice(-1)?parseFloat(a)/100*s:a}x.limit&&/^\d+#x2F;.test(m[r])&&(m[r]=m[r]<=0?0:Math.min(m[r],s)),!e&&1<x.axis.length&&(i===m[r]?m={}:v&&(h(x.onAfterFirst),m={}))}),h(x.onAfter)}function h(e){var t=w.extend({},x,{queue:!0,duration:o,complete:e&&function(){e.call(c,d,x)}});l.animate(m,t)}})},y.max=function(e,t){var o="x"===t?"Width":"Height",n="scroll"+o;if(!g(e))return e[n]-w(e)[o.toLowerCase()]();var r="client"+o,i=e.ownerDocument||e.document,s=i.documentElement,a=i.body;return Math.max(s[n],a[n])-Math.min(s[r],a[r])},w.Tween.propHooks.scrollLeft=w.Tween.propHooks.scrollTop={get:function(e){return w(e.elem)[e.prop]()},set:function(e){var t=this.get(e);if(e.options.interrupt&&e._last&&e._last!==t)return w(e.elem).stop();var o=Math.round(e.now);t!==o&&(w(e.elem)[e.prop](o),e._last=this.get(e))}},y});
assets/js/um-select.js DELETED
@@ -1,22 +0,0 @@
1
- /*
2
- Copyright 2014 Igor Vaynberg
3
-
4
- Version: 3.4.8 Timestamp: Thu May 1 09:50:32 EDT 2014
5
-
6
- This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
7
- General Public License version 2 (the "GPL License"). You may choose either license to govern your
8
- use of this software only upon the condition that you accept all of the terms of either the Apache
9
- License or the GPL License.
10
-
11
- You may obtain a copy of the Apache License and the GPL License at:
12
-
13
- http://www.apache.org/licenses/LICENSE-2.0
14
- http://www.gnu.org/licenses/gpl-2.0.html
15
-
16
- Unless required by applicable law or agreed to in writing, software distributed under the Apache License
17
- or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
18
- either express or implied. See the Apache License and the GPL License for the specific language governing
19
- permissions and limitations under the Apache License and the GPL License.
20
- */
21
- !function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++d<e&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})}(jQuery),function(a,b){"use strict";function n(b){var c=a(document.createTextNode(""));b.before(c),c.before(b),c.remove()}function o(a){function b(a){return m[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function p(a,b){for(var c=0,d=b.length;d>c;c+=1)if(r(a,b[c]))return c;return-1}function q(){var b=a(l);b.appendTo("body");var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function r(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function s(b,c){var d,e,f;if(null===b||b.length<1)return[];for(d=b.split(c),e=0,f=d.length;f>e;e+=1)d[e]=a.trim(d[e]);return d}function t(a){return a.outerWidth(!1)-a.width()}function u(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function v(c){c.on("mousemove",function(c){var d=i;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function w(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function x(a,b){var c=w(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){p(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus();var e=b.offsetWidth>0||b.offsetHeight>0;e&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!h){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);h=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),h.attr("class","select2-sizer"),a("body").append(h)}return h.text(b.val()),h.width()}function D(b,c,d){var e,g,f=[];e=b.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=c.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(g))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=o(a.toUpperCase()).indexOf(o(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push("<span class='select2-match'>"),c.push(d(a.substring(e,e+f))),c.push("</span>"),c.push(d(a.substring(e+f,a.length))),void 0)}function F(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&"function"==typeof e.abort&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page);i.callback(b)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?(b.callback(c()),void 0):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),b.callback(e),void 0)}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]},h=d?c(e):c;a.isArray(h)&&(a(h).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g))}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;if("string"==typeof b)return!0;throw new Error(c+" must be a string, function, or falsy value")}function K(b){if(a.isFunction(b)){var c=Array.prototype.slice.call(arguments,1);return b.apply(null,c)}return b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(r(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(){var a=this;Array.prototype.forEach.call(arguments,function(b){a[b].remove(),a[b]=null})}function O(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,h,j,k,i={x:0,y:0},c={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case c.LEFT:case c.RIGHT:case c.UP:case c.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case c.SHIFT:case c.CTRL:case c.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="<div class='select2-measure-scrollbar'></div>",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z"};j=a(document),g=function(){var a=1;return function(){return a++}}(),j.on("mousemove",function(a){i.x=a.pageX,i.y=a.pageY}),d=O(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,f=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=a("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+g()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",c.element.attr("title")),this.body=a("body"),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss)),this.container.addClass(K(c.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",A),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",A),this.results=d=this.container.find(f),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),v(this.results),this.dropdown.on("mousemove-filtered",f,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",f,this.bind(function(a){this._touchEvent=!0,this.highlightUnderEvent(a)})),this.dropdown.on("touchmove",f,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",f,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),x(80,this.results),this.dropdown.on("scroll-debounced",f,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),u(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",f,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(a){a.stopPropagation()}),this.nextSearchTerm=b,a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),k=k||q(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",c.searchInputPlaceholder)},destroy:function(){var a=this.opts.element,c=a.data("select2");this.close(),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),c!==b&&(c.container.remove(),c.liveRegion.remove(),c.dropdown.remove(),a.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show()),N.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:r(a.attr("locked"),"locked")||r(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,f,h,i=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),c=a.extend({},{populateResults:function(d,e,f){var h,j=this.opts.id,k=this.liveRegion;h=function(d,e,l){var m,n,o,p,q,r,s,t,u,v;for(d=c.sortResults(d,e,f),m=0,n=d.length;n>m;m+=1)o=d[m],q=o.disabled===!0,p=!q&&j(o)!==b,r=o.children&&o.children.length>0,s=a("<li></li>"),s.addClass("select2-results-dept-"+l),s.addClass("select2-result"),s.addClass(p?"select2-result-selectable":"select2-result-unselectable"),q&&s.addClass("select2-disabled"),r&&s.addClass("select2-result-with-children"),s.addClass(i.opts.formatResultCssClass(o)),s.attr("role","presentation"),t=a(document.createElement("div")),t.addClass("select2-result-label"),t.attr("id","select2-result-label-"+g()),t.attr("role","option"),v=c.formatResult(o,t,f,i.opts.escapeMarkup),v!==b&&(t.html(v),s.append(t)),r&&(u=a("<ul></ul>"),u.addClass("select2-result-sub"),h(o.children,u,l+1),s.append(u)),s.data("select2-data",o),e.append(s);k.text(c.formatMatches(d.length))},h(e,d,0)}},a.fn.select2.defaults,c),"function"!=typeof c.id&&(f=c.id,c.id=function(a){return a[f]}),a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(e?(c.query=this.bind(function(a){var f,g,h,c={results:[],more:!1},e=a.term;h=function(b,c){var d;b.is("option")?a.matcher(e,b.text(),b)&&c.push(i.optionToData(b)):b.is("optgroup")&&(d=i.optionToData(b),b.children().each2(function(a,b){h(b,d.children)}),d.children.length>0&&c.push(d))},f=d.children(),this.getPlaceholder()!==b&&f.length>0&&(g=this.getPlaceholderOption(),g&&(f=f.not(g))),f.each2(function(a,b){h(b,c.results)}),a.callback(c)}),c.id=function(a){return a.id}):"query"in c||("ajax"in c?(h=c.element.data("ajax-url"),h&&h.length>0&&(c.ajax.url=h),c.query=G.call(c.element,c.ajax)):"data"in c?c.query=H(c.data):"tags"in c&&(c.query=I(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(b){return{id:a.trim(b),text:a.trim(b)}}),c.initSelection===b&&(c.initSelection=function(b,d){var e=[];a(s(b.val(),c.separator)).each(function(){var b={id:this,text:this},d=c.tags;a.isFunction(d)&&(d=d()),a(d).each(function(){return r(this.id,b.id)?(b=this,!1):void 0}),e.push(b)}),d(e)}))),"function"!=typeof c.query)throw"query function not defined for Select2 "+c.element.attr("id");if("top"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.unshift(b)};else if("bottom"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.push(b)};else if("function"!=typeof c.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return c},monitorSource:function(){var c,d,a=this.opts.element;a.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),c=this.bind(function(){var c=a.prop("disabled");c===b&&(c=!1),this.enable(!c);var d=a.prop("readonly");d===b&&(d=!1),this.readonly(d),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(K(this.opts.containerCssClass)),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(this.opts.dropdownCssClass))}),a.length&&a[0].attachEvent&&a.each(function(){this.attachEvent("onpropertychange",c)}),d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,d!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new d(function(a){a.forEach(c)}),this.propertyObserver.observe(a.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2-selecting",{val:this.id(b),object:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){a===b&&(a=!0),this._enabled!==a&&(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(a){a===b&&(a=!1),this._readonly!==a&&(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface())},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var t,u,v,w,x,b=this.dropdown,c=this.container.offset(),d=this.container.outerHeight(!1),e=this.container.outerWidth(!1),f=b.outerHeight(!1),g=a(window),h=g.width(),i=g.height(),j=g.scrollLeft()+h,l=g.scrollTop()+i,m=c.top+d,n=c.left,o=l>=m+f,p=c.top-f>=g.scrollTop(),q=b.outerWidth(!1),r=j>=n+q,s=b.hasClass("select2-drop-above");s?(u=!0,!p&&o&&(v=!0,u=!1)):(u=!1,!o&&p&&(v=!0,u=!0)),v&&(b.hide(),c=this.container.offset(),d=this.container.outerHeight(!1),e=this.container.outerWidth(!1),f=b.outerHeight(!1),j=g.scrollLeft()+h,l=g.scrollTop()+i,m=c.top+d,n=c.left,q=b.outerWidth(!1),r=j>=n+q,b.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(x=a(".select2-results",b)[0],b.addClass("select2-drop-auto-width"),b.css("width",""),q=b.outerWidth(!1)+(x.scrollHeight===x.clientHeight?0:k.width),q>e?e=q:q=e,f=b.outerHeight(!1),r=j>=n+q):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(t=this.body.offset(),m-=t.top,n-=t.left),r||(n=c.left+this.container.outerWidth(!1)-q),w={left:n,width:e},u?(w.top=c.top-f,w.bottom="auto",this.container.addClass("select2-drop-above"),b.addClass("select2-drop-above")):(w.top=m,w.bottom="auto",this.container.removeClass("select2-drop-above"),b.removeClass("select2-drop-above")),w=a.extend(w,K(this.opts.dropdownCss)),b.css(w)},shouldOpen:function(){var b;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(b=a.Event("select2-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),!0):!1},opening:function(){var f,b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),f=a("#select2-drop-mask"),0==f.length&&(f=a(document.createElement("div")),f.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),f.hide(),f.appendTo(this.body),f.on("mousedown touchstart click",function(b){n(f);var d,c=a("#select2-drop");c.length>0&&(d=c.data("select2"),d.opts.selectOnBlur&&d.selectHighlighted({noFocus:!0}),d.close(),b.preventDefault(),b.stopPropagation())})),this.dropdown.prev()[0]!==f[0]&&this.dropdown.before(f),a("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),f.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var g=this;this.container.parents().add(window).each(function(){a(this).on(d+" "+c+" "+e,function(){g.opened()&&g.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(a.Event("select2-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return K(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var c,d,e,f,g,h,i,b=this.results;if(d=this.highlight(),!(0>d)){if(0==d)return b.scrollTop(0),void 0;c=this.findHighlightableChoices().find(".select2-result-label"),e=a(c[d]),f=e.offset().top+e.outerHeight(!0),d===c.length-1&&(i=b.find("li.select2-more-results"),i.length>0&&(f=i.offset().top+i.outerHeight(!0))),g=b.offset().top+b.outerHeight(!0),f>g&&b.scrollTop(b.scrollTop()+(f-g)),h=e.offset().top-b.offset().top,0>h&&"none"!=e.css("display")&&b.scrollTop(b.scrollTop()+h)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&d<c.length;){d+=b;var e=a(c[d]);if(e.hasClass("select2-result-selectable")&&!e.hasClass("select2-disabled")&&!e.hasClass("select2-selected")){this.highlight(d);break}}},highlight:function(b){var d,e,c=this.findHighlightableChoices();return 0===arguments.length?p(c.filter(".select2-highlighted")[0],c.get()):(b>=c.length&&(b=c.length-1),0>b&&(b=0),this.removeHighlight(),d=a(c[b]),d.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",d.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(d.text()),e=d.data("select2-data"),e&&this.opts.element.trigger({type:"select2-highlight",val:this.id(e),choice:e}),void 0)},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length
22
- },highlightUnderEvent:function(b){var c=a(b.target).closest(".select2-result-selectable");if(c.length>0&&!c.is(".select2-highlighted")){var d=this.findHighlightableChoices();this.highlight(d.index(c))}else 0==c.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var c,a=this.results,b=a.find("li.select2-more-results"),d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-a.height(),c<=this.opts.loadMorePadding&&(b.addClass("select2-active"),this.opts.query({element:this.opts.element,term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),e.postprocessResults(c,!1,!1),c.more===!0?(b.detach().appendTo(a).text(K(e.opts.formatLoadMore,d+1)),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d,e.context=c.context,this.opts.element.trigger({type:"select2-loaded",items:c}))})})))},tokenize:function(){},updateResults:function(c){function m(){d.removeClass("select2-active"),h.positionDropdown(),e.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?h.liveRegion.text(e.text()):h.liveRegion.text(h.opts.formatMatches(e.find(".select2-result-selectable").length))}function n(a){e.html(a),m()}var g,i,l,d=this.search,e=this.results,f=this.opts,h=this,j=d.val(),k=a.data(this.container,"select2-last-term");if((c===!0||!k||!r(j,k))&&(a.data(this.container,"select2-last-term",j),c===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var o=this.getMaximumSelectionSize();if(o>=1&&(g=this.data(),a.isArray(g)&&g.length>=o&&J(f.formatSelectionTooBig,"formatSelectionTooBig")))return n("<li class='select2-selection-limit'>"+K(f.formatSelectionTooBig,o)+"</li>"),void 0;if(d.val().length<f.minimumInputLength)return J(f.formatInputTooShort,"formatInputTooShort")?n("<li class='select2-no-results'>"+K(f.formatInputTooShort,d.val(),f.minimumInputLength)+"</li>"):n(""),c&&this.showSearch&&this.showSearch(!0),void 0;if(f.maximumInputLength&&d.val().length>f.maximumInputLength)return J(f.formatInputTooLong,"formatInputTooLong")?n("<li class='select2-no-results'>"+K(f.formatInputTooLong,d.val(),f.maximumInputLength)+"</li>"):n(""),void 0;f.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+K(f.formatSearching)+"</li>"),d.addClass("select2-active"),this.removeHighlight(),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;if(l==this.queryCount){if(!this.opened())return this.search.removeClass("select2-active"),void 0;if(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return r(h.id(this),h.id(i))}).length&&this.opts.createSearchChoicePosition(g.results,i)),0===g.results.length&&J(f.formatNoMatches,"formatNoMatches"))return n("<li class='select2-no-results'>"+K(f.formatNoMatches,d.val())+"</li>"),void 0;e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&J(f.formatLoadMore,"formatLoadMore")&&(e.append("<li class='select2-more-results'>"+h.opts.escapeMarkup(K(f.formatLoadMore,this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),m(),this.opts.element.trigger({type:"select2-loaded",items:g})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(a){if(this._touchMoved)return this.clearTouchMoved(),void 0;var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var c=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&c||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.trim(c.text())&&""===c.val())return c}},initContainerWidth:function(){function c(){var c,d,e,f,g,h;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(c=this.opts.element.attr("style"),c!==b)for(d=c.split(";"),f=0,g=d.length;g>f;f+=1)if(h=d[f].replace(/\s/g,""),e=h.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==e&&e.length>=1)return e[1];return"resolve"===this.opts.width?(c=this.opts.element.css("width"),c.indexOf("%")>0?c:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var d=c.call(this);null!==d&&this.container.css("width",d)}}),e=O(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'"," aria-autocomplete='list' />"," </div>"," <ul class='select2-results' role='listbox'>"," </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var c,d,e;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),c=this.search.get(0),c.createTextRange?(d=c.createTextRange(),d.collapse(!1),d.select()):c.setSelectionRange&&(e=this.search.val().length,c.setSelectionRange(e,e))),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"selection","focusser")},initContainer:function(){var b,h,d=this.container,e=this.dropdown,f=g();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=d.find(".select2-choice"),this.focusser=d.find(".select2-focusser"),b.find(".select2-chosen").attr("id","select2-chosen-"+f),this.focusser.attr("aria-labelledby","select2-chosen-"+f),this.results.attr("id","select2-results-"+f),this.search.attr("aria-owns","select2-results-"+f),this.focusser.attr("id","s2id_autogen"+f),h=a("label[for='"+this.opts.element.attr("id")+"']"),this.focusser.prev().text(h.text()).attr("for",this.focusser.attr("id"));var i=this.opts.element.attr("title");this.opts.element.attr("title",i||h.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(a("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){if(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)return A(a),void 0;switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),A(a),void 0;case c.ENTER:return this.selectHighlighted(),A(a),void 0;case c.TAB:return this.selectHighlighted({noFocus:!0}),void 0;case c.ESC:return this.cancel(a),A(a),void 0}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.ESC){if(this.opts.openOnEnter===!1&&a.which===c.ENTER)return A(a),void 0;if(a.which==c.DOWN||a.which==c.UP||a.which==c.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),A(a),void 0}return a.which==c.DELETE||a.which==c.BACKSPACE?(this.opts.allowClear&&this.clear(),A(a),void 0):void 0}})),u(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown touchstart","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),B(a),this.close(),this.selection.focus())})),b.on("mousedown touchstart",this.bind(function(c){n(b),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),A(c)})),e.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),b.on("focus",this.bind(function(a){A(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2-data");if(c){var d=a.Event("select2-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder(),c.nextSearchTerm=c.opts.nextSearchTerm(a,c.search.val()))})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()===b?!1:(a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val()},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected&&!this.disabled});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=r(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){return r(e.id(b.data("select2-data")),e.opts.element.val())?(d=a,!1):void 0}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var g=this.opts.minimumResultsForSearch;g>=0&&this.showSearch(L(a.results)>=g)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.close(),b&&b.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),r(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),c.empty(),null!==a&&(d=this.opts.formatSelection(a,c,this.opts.escapeMarkup)),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1]),this.select)this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return this.clear(c),void 0;if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2-data"),c==b&&(c=null),c):(arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),f=O(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=s(c.val(),b.separator),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return r(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;c<e.length;c++)for(var g=e[c],h=0;h<f.length;h++){var i=f[h];if(r(g,b.id(i))){a.push(i),f.splice(h,1);break}}d(a)}:a.noop})}),b},selectChoice:function(a){var b=this.container.find(".select2-search-choice-focus");b.length&&a&&a[0]==b[0]||(b.length&&this.opts.element.trigger("choice-deselected",b),b.removeClass("select2-search-choice-focus"),a&&a.length&&(this.close(),a.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",a)))},destroy:function(){a("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"searchContainer","selection")},initContainer:function(){var d,b=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=d=this.container.find(b);var e=this;this.selection.on("click",".select2-search-choice:not(.select2-locked)",function(){e.search[0].focus(),e.selectChoice(a(this))}),this.search.attr("id","s2id_autogen"+g()),this.search.prev().text(a("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){++this.keydowns;var b=d.find(".select2-search-choice-focus"),e=b.prev(".select2-search-choice:not(.select2-locked)"),f=b.next(".select2-search-choice:not(.select2-locked)"),g=z(this.search);if(b.length&&(a.which==c.LEFT||a.which==c.RIGHT||a.which==c.BACKSPACE||a.which==c.DELETE||a.which==c.ENTER)){var h=b;return a.which==c.LEFT&&e.length?h=e:a.which==c.RIGHT?h=f.length?f:null:a.which===c.BACKSPACE?this.unselect(b.first())&&(this.search.width(10),h=e.length?e:f):a.which==c.DELETE?this.unselect(b.first())&&(this.search.width(10),h=f.length?f:null):a.which==c.ENTER&&(h=null),this.selectChoice(h),A(a),h&&h.length||this.open(),void 0}if((a.which===c.BACKSPACE&&1==this.keydowns||a.which==c.LEFT)&&0==g.offset&&!g.length)return this.selectChoice(d.find(".select2-search-choice:not(.select2-locked)").last()),A(a),void 0;if(this.selectChoice(null),this.opened())switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),A(a),void 0;case c.ENTER:return this.selectHighlighted(),A(a),void 0;case c.TAB:return this.selectHighlighted({noFocus:!0}),this.close(),void 0;case c.ESC:return this.cancel(a),A(a),void 0}if(a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.BACKSPACE&&a.which!==c.ESC){if(a.which===c.ENTER){if(this.opts.openOnEnter===!1)return;if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return}this.open(),(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)&&A(a),a.which===c.ENTER&&A(a)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(b){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),b.stopImmediatePropagation(),this.opts.element.trigger(a.Event("select2-blur"))})),this.container.on("click",b,this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",b,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c=[],d=[],e=this;a(b).each(function(){p(e.id(this),c)<0&&(c.push(e.id(this)),d.push(this))}),b=d,this.selection.find(".select2-search-choice").remove(),a(b).each(function(){e.addSelectedChoice(this)}),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,c){this.triggerSelect(a)&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.clearSearch(),this.updateResults(),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),c&&c.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(c){var j,k,d=!c.locked,e=a("<li class='select2-search-choice'> <div></div> <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),f=a("<li class='select2-search-choice select2-locked'><div></div></li>"),g=d?e:f,h=this.id(c),i=this.getVal();j=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),j!=b&&g.find("div").replaceWith("<div>"+j+"</div>"),k=this.opts.formatSelectionCssClass(c,g.find("div")),k!=b&&g.addClass(k),d&&g.find(".select2-search-choice-close").on("mousedown",A).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),A(b),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),g.data("select2-data",c),g.insertBefore(this.searchContainer),i.push(h),this.setVal(i)},unselect:function(b){var d,e,c=this.getVal();if(b=b.closest(".select2-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2-search-choice";if(d=b.data("select2-data")){var f=a.Event("select2-removing");if(f.val=this.id(d),f.choice=d,this.opts.element.trigger(f),f.isDefaultPrevented())return!1;for(;(e=p(this.id(d),c))>=0;)c.splice(e,1),this.setVal(c),this.select&&this.postprocessResults();return b.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(d),choice:d}),this.triggerChange({removed:d}),!0}},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2-result"),f=this.results.find(".select2-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2-data"));p(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),f.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),-1==this.highlight()&&c!==!1&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&J(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+K(g.opts.formatNoMatches,g.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-t(this.search)},resizeSearch:function(){var a,b,c,d,e,f=t(this.search);a=C(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),s(a,this.opts.separator))},setVal:function(b){var c;this.select?this.select.val(b):(c=[],a(b).each(function(){p(this,c)<0&&c.push(this)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator)))},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;c<b.length;c++)for(var d=0;d<a.length;d++)r(this.opts.id(b[c]),this.opts.id(a[d]))&&(b.splice(c,1),c>0&&c--,a.splice(d,1),d--);return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),d&&this.triggerChange({added:this.data(),removed:e}),void 0;if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var e,f,d=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(f=this.data(),b||(b=[]),e=a.map(b,function(a){return d.opts.id(a)}),this.setVal(e),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(f,this.data())),void 0)}}),a.fn.select2=function(){var d,e,f,g,h,c=Array.prototype.slice.call(arguments,0),i=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],j=["opened","isFocused","container","dropdown"],k=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?h=d.element.prop("multiple"):(h=d.multiple||!1,"tags"in d&&(d.multiple=h=!0)),e=h?new window.Select2["class"].multi:new window.Select2["class"].single,e.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(p(c[0],i)<0)throw"Unknown method: "+c[0];if(g=b,e=a(this).data("select2"),e===b)return;if(f=c[0],"container"===f?g=e.container:"dropdown"===f?g=e.dropdown:(l[f]&&(f=l[f]),g=e[f].apply(e,c.slice(1))),p(c[0],j)>=0||p(c[0],k)>=0&&1==c.length)return!1}}),g===b?this:g},a.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return E(a.text,c.term,e,d),e.join("")},formatSelection:function(a,c,d){return a?d(a.text):b},sortResults:function(a){return a},formatResultCssClass:function(a){return a.css},formatSelectionCssClass:function(){return b},formatMatches:function(a){return a+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" or more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results\u2026"},formatSearching:function(){return"Searching\u2026"},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a==b?null:a.id},matcher:function(a,b){return o(""+b).toUpperCase().indexOf(o(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:M,escapeMarkup:F,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return b},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(a){var b="ontouchstart"in window||navigator.msMaxTouchPoints>0;return b?a.opts.minimumResultsForSearch<0?!1:!0:!0}},a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:G,local:H,tags:I},util:{debounce:w,markMatch:E,escapeMarkup:F,stripDiacritics:o},"class":{"abstract":d,single:e,multi:f}}}}(jQuery);
assets/js/um-select.min.js DELETED
@@ -1 +0,0 @@
1
- !function(n){void 0===n.fn.each2&&n.extend(n.fn,{each2:function(e){for(var t=n([0]),s=-1,i=this.length;++s<i&&(t.context=t[0]=this[s])&&!1!==e.call(t[0],s,t););return this}})}(jQuery),function(S,b){"use strict";function a(e){var t=S(document.createTextNode(""));e.before(t),t.before(e),t.remove()}function r(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return A[e]||e})}function h(e,t){for(var s=0,i=t.length;s<i;s+=1)if(p(e,t[s]))return s;return-1}function p(e,t){return e===t||e!==b&&t!==b&&(null!==e&&null!==t&&(e.constructor===String?e+""==t+"":t.constructor===String&&t+""==e+""))}function n(e,t){var s,i,n;if(null===e||e.length<1)return[];for(i=0,n=(s=e.split(t)).length;i<n;i+=1)s[i]=S.trim(s[i]);return s}function o(e){return e.outerWidth(!1)-e.width()}function l(t){var s="keyup-change-value";t.on("keydown",function(){S.data(t,s)===b&&S.data(t,s,t.val())}),t.on("keyup",function(){var e=S.data(t,s);e!==b&&t.val()!==e&&(S.removeData(t,s),t.trigger("keyup-change"))})}function d(t,s,i){var n;return i=i||b,function(){var e=arguments;window.clearTimeout(n),n=window.setTimeout(function(){s.apply(i,e)},t)}}function u(e){e.preventDefault(),e.stopPropagation()}function f(e,t,s){var i,n,o=[];(i=e.attr("class"))&&S((i=""+i).split(" ")).each2(function(){0===this.indexOf("select2-")&&o.push(this)}),(i=t.attr("class"))&&S((i=""+i).split(" ")).each2(function(){0!==this.indexOf("select2-")&&((n=s(this))&&o.push(n))}),e.attr("class",o.join(" "))}function c(e,t,s,i){var n=r(e.toUpperCase()).indexOf(r(t.toUpperCase())),o=t.length;return n<0?void s.push(i(e)):(s.push(i(e.substring(0,n))),s.push("<span class='select2-match'>"),s.push(i(e.substring(n,n+o))),s.push("</span>"),void s.push(i(e.substring(n+o,e.length))))}function e(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function i(a){var e,r=null,t=a.quietMillis||100,c=a.url,l=this;return function(o){window.clearTimeout(e),e=window.setTimeout(function(){var e=a.data,t=c,s=a.transport||S.fn.select2.ajaxDefaults.transport,i={type:a.type||"GET",cache:a.cache||!1,jsonpCallback:a.jsonpCallback||b,dataType:a.dataType||"json"},n=S.extend({},S.fn.select2.ajaxDefaults.params,i);e=e?e.call(l,o.term,o.page,o.context):null,t="function"==typeof t?t.call(l,o.term,o.page,o.context):t,r&&"function"==typeof r.abort&&r.abort(),a.params&&(S.isFunction(a.params)?S.extend(n,a.params.call(l)):S.extend(n,a.params)),S.extend(n,{url:t,dataType:a.dataType,data:e,success:function(e){var t=a.results(e,o.page);o.callback(t)}}),r=s.call(l,n)},t)}}function g(e){var t,s,i=e,r=function(e){return""+e.text};S.isArray(i)&&(i={results:s=i}),!1===S.isFunction(i)&&(s=i,i=function(){return s});var n=i();return n.text&&(r=n.text,S.isFunction(r)||(t=n.text,r=function(e){return e[t]})),function(n){var o,a=n.term,s={results:[]};return""===a?void n.callback(i()):(o=function(e,t){var s,i;if((e=e[0]).children){for(i in s={},e)e.hasOwnProperty(i)&&(s[i]=e[i]);s.children=[],S(e.children).each2(function(e,t){o(t,s.children)}),(s.children.length||n.matcher(a,r(s),e))&&t.push(s)}else n.matcher(a,r(e),e)&&t.push(e)},S(i().results).each2(function(e,t){o(t,s.results)}),void n.callback(s))}}function m(t){var o=S.isFunction(t);return function(s){var i=s.term,n={results:[]},e=o?t(s):t;S.isArray(e)&&(S(e).each(function(){var e=this.text!==b,t=e?this.text:this;(""===i||s.matcher(i,t))&&n.results.push(e?this:{id:this,text:this})}),s.callback(n))}}function v(e,t){if(S.isFunction(e))return!0;if(!e)return!1;if("string"==typeof e)return!0;throw new Error(t+" must be a string, function, or falsy value")}function y(e){if(S.isFunction(e)){var t=Array.prototype.slice.call(arguments,1);return e.apply(null,t)}return e}function s(){var t=this;Array.prototype.forEach.call(arguments,function(e){t[e].remove(),t[e]=null})}function t(e,t){var s=function(){};return((s.prototype=new e).constructor=s).prototype.parent=e.prototype,s.prototype=S.extend(s.prototype,t),s}if(window.Select2===b){var w,C,E,x,T,O,P,I={x:0,y:0},k={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){switch(e=e.which?e.which:e){case k.LEFT:case k.RIGHT:case k.UP:case k.DOWN:return!0}return!1},isControl:function(e){switch(e.which){case k.SHIFT:case k.CTRL:case k.ALT:return!0}return!!e.metaKey},isFunctionKey:function(e){return 112<=(e=e.which?e.which:e)&&e<=123}},A={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z"};O=S(document),R=1,x=function(){return R++},O.on("mousemove",function(e){I.x=e.pageX,I.y=e.pageY}),C=t(w=t(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(e){var o,t,s,i,n,a=".select2-results";this.opts=e=this.prepareOpts(e),this.id=e.id,e.element.data("select2")!==b&&null!==e.element.data("select2")&&e.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=S("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(e.element.attr("id")||"autogen"+x()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",e.element.attr("title")),this.body=S("body"),f(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",e.element.attr("style")),this.container.css(y(e.containerCss)),this.container.addClass(y(e.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",u),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),f(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(y(e.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",u),this.results=o=this.container.find(a),this.search=t=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",u),this.results.on("mousemove",function(e){var t=I;(t===b||t.x!==e.pageX||t.y!==e.pageY)&&S(e.target).trigger("mousemove-filtered",e)}),this.dropdown.on("mousemove-filtered",a,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",a,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",a,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",a,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),s=80,i=this.results,n=d(s,function(e){i.trigger("scroll-debounced",e)}),i.on("scroll",function(e){0<=h(e.target,i.get())&&n(e)}),this.dropdown.on("scroll-debounced",a,this.bind(this.loadMoreIfNeeded)),S(this.container).on("change",".select2-input",function(e){e.stopPropagation()}),S(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()}),S.fn.mousewheel&&o.mousewheel(function(e,t,s,i){var n=o.scrollTop();0<i&&n-i<=0?(o.scrollTop(0),u(e)):i<0&&o.get(0).scrollHeight-o.scrollTop()+i<=o.height()&&(o.scrollTop(o.get(0).scrollHeight-o.height()),u(e))}),l(t),t.on("keyup-change input paste",this.bind(this.updateResults)),t.on("focus",function(){t.addClass("select2-focused")}),t.on("blur",function(){t.removeClass("select2-focused")}),this.dropdown.on("mouseup",a,this.bind(function(e){0<S(e.target).closest(".select2-result-selectable").length&&(this.highlightUnderEvent(e),this.selectHighlighted(e))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(e){e.stopPropagation()}),this.nextSearchTerm=b,S.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==e.maximumInputLength&&this.search.attr("maxlength",e.maximumInputLength);var r=e.element.prop("disabled");r===b&&(r=!1),this.enable(!r);var c=e.element.prop("readonly");c===b&&(c=!1),this.readonly(c),P=P||function(){var e=S("<div class='select2-measure-scrollbar'></div>");e.appendTo("body");var t={width:e.width()-e[0].clientWidth,height:e.height()-e[0].clientHeight};return e.remove(),t}(),this.autofocus=e.element.prop("autofocus"),e.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",e.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,t=e.data("select2");this.close(),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),t!==b&&(t.container.remove(),t.liveRegion.remove(),t.dropdown.remove(),e.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show()),s.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:p(e.attr("locked"),"locked")||p(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(v){var a,e,t,s,w=this;if("select"===(a=v.element).get(0).tagName.toLowerCase()&&(this.select=e=v.element),e&&S.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in v)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),"function"!=typeof(v=S.extend({},{populateResults:function(e,t,p){var f,g=this.opts.id,m=this.liveRegion;(f=function(e,t,s){var i,n,o,a,r,c,l,h,d,u;for(i=0,n=(e=v.sortResults(e,t,p)).length;i<n;i+=1)a=!(r=!0===(o=e[i]).disabled)&&g(o)!==b,c=o.children&&0<o.children.length,(l=S("<li></li>")).addClass("select2-results-dept-"+s),l.addClass("select2-result"),l.addClass(a?"select2-result-selectable":"select2-result-unselectable"),r&&l.addClass("select2-disabled"),c&&l.addClass("select2-result-with-children"),l.addClass(w.opts.formatResultCssClass(o)),l.attr("role","presentation"),(h=S(document.createElement("div"))).addClass("select2-result-label"),h.attr("id","select2-result-label-"+x()),h.attr("role","option"),(u=v.formatResult(o,h,p,w.opts.escapeMarkup))!==b&&(h.html(u),l.append(h)),c&&((d=S("<ul></ul>")).addClass("select2-result-sub"),f(o.children,d,s+1),l.append(d)),l.data("select2-data",o),t.append(l);m.text(v.formatMatches(e.length))})(t,e,0)}},S.fn.select2.defaults,v)).id&&(t=v.id,v.id=function(e){return e[t]}),S.isArray(v.element.data("select2Tags"))){if("tags"in v)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+v.element.attr("id");v.tags=v.element.data("select2Tags")}if(e?(v.query=this.bind(function(i){var e,t,n,s={results:[],more:!1},o=i.term;n=function(e,t){var s;e.is("option")?i.matcher(o,e.text(),e)&&t.push(w.optionToData(e)):e.is("optgroup")&&(s=w.optionToData(e),e.children().each2(function(e,t){n(t,s.children)}),0<s.children.length&&t.push(s))},e=a.children(),this.getPlaceholder()!==b&&0<e.length&&((t=this.getPlaceholderOption())&&(e=e.not(t))),e.each2(function(e,t){n(t,s.results)}),i.callback(s)}),v.id=function(e){return e.id}):"query"in v||("ajax"in v?((s=v.element.data("ajax-url"))&&0<s.length&&(v.ajax.url=s),v.query=i.call(v.element,v.ajax)):"data"in v?v.query=g(v.data):"tags"in v&&(v.query=m(v.tags),v.createSearchChoice===b&&(v.createSearchChoice=function(e){return{id:S.trim(e),text:S.trim(e)}}),v.initSelection===b&&(v.initSelection=function(e,t){var s=[];S(n(e.val(),v.separator)).each(function(){var e={id:this,text:this},t=v.tags;S.isFunction(t)&&(t=t()),S(t).each(function(){return p(this.id,e.id)?(e=this,!1):void 0}),s.push(e)}),t(s)}))),"function"!=typeof v.query)throw"query function not defined for Select2 "+v.element.attr("id");if("top"===v.createSearchChoicePosition)v.createSearchChoicePosition=function(e,t){e.unshift(t)};else if("bottom"===v.createSearchChoicePosition)v.createSearchChoicePosition=function(e,t){e.push(t)};else if("function"!=typeof v.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return v},monitorSource:function(){var t,e,s=this.opts.element;s.on("change.select2",this.bind(function(){!0!==this.opts.element.data("select2-change-triggered")&&this.initSelection()})),t=this.bind(function(){var e=s.prop("disabled");e===b&&(e=!1),this.enable(!e);var t=s.prop("readonly");t===b&&(t=!1),this.readonly(t),f(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(y(this.opts.containerCssClass)),f(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(y(this.opts.dropdownCssClass))}),s.length&&s[0].attachEvent&&s.each(function(){this.attachEvent("onpropertychange",t)}),(e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver)!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new e(function(e){e.forEach(t)}),this.propertyObserver.observe(s.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(e){var t=S.Event("select2-selecting",{val:this.id(e),object:e});return this.opts.element.trigger(t),!t.isDefaultPrevented()},triggerChange:function(e){e=e||{},e=S.extend({},e,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(e),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return!0===this.enabledInterface},enableInterface:function(){var e=this._enabled&&!this._readonly,t=!e;return e!==this.enabledInterface&&(this.container.toggleClass("select2-container-disabled",t),this.close(),this.enabledInterface=e,!0)},enable:function(e){e===b&&(e=!0),this._enabled!==e&&(this._enabled=e,this.opts.element.prop("disabled",!e),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(e){e===b&&(e=!1),this._readonly!==e&&(this._readonly=e,this.opts.element.prop("readonly",e),this.enableInterface())},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var e,t,s,i,n,o=this.dropdown,a=this.container.offset(),r=this.container.outerHeight(!1),c=this.container.outerWidth(!1),l=o.outerHeight(!1),h=S(window),d=h.width(),u=h.height(),p=h.scrollLeft()+d,f=h.scrollTop()+u,g=a.top+r,m=a.left,v=g+l<=f,w=a.top-l>=h.scrollTop(),b=o.outerWidth(!1),C=m+b<=p;o.hasClass("select2-drop-above")?(t=!0,!w&&v&&(t=!(s=!0))):(t=!1,!v&&w&&(t=s=!0)),s&&(o.hide(),a=this.container.offset(),r=this.container.outerHeight(!1),c=this.container.outerWidth(!1),l=o.outerHeight(!1),p=h.scrollLeft()+d,f=h.scrollTop()+u,g=a.top+r,C=(m=a.left)+(b=o.outerWidth(!1))<=p,o.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(n=S(".select2-results",o)[0],o.addClass("select2-drop-auto-width"),o.css("width",""),c<(b=o.outerWidth(!1)+(n.scrollHeight===n.clientHeight?0:P.width))?c=b:b=c,l=o.outerHeight(!1),C=m+b<=p):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(g-=(e=this.body.offset()).top,m-=e.left),C||(m=a.left+this.container.outerWidth(!1)-b),i={left:m,width:c},t?(i.top=a.top-l,i.bottom="auto",this.container.addClass("select2-drop-above"),o.addClass("select2-drop-above")):(i.top=g,i.bottom="auto",this.container.removeClass("select2-drop-above"),o.removeClass("select2-drop-above")),i=S.extend(i,y(this.opts.dropdownCss)),o.css(i)},shouldOpen:function(){var e;return!this.opened()&&(!1!==this._enabled&&!0!==this._readonly&&(e=S.Event("select2-opening"),this.opts.element.trigger(e),!e.isDefaultPrevented()))},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return!!this.shouldOpen()&&(this.opening(),!0)},opening:function(){var i,e=this.containerEventName,t="scroll."+e,s="resize."+e,n="orientationchange."+e;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),0==(i=S("#select2-drop-mask")).length&&((i=S(document.createElement("div"))).attr("id","select2-drop-mask").attr("class","select2-drop-mask"),i.hide(),i.appendTo(this.body),i.on("mousedown touchstart click",function(e){a(i);var t,s=S("#select2-drop");0<s.length&&((t=s.data("select2")).opts.selectOnBlur&&t.selectHighlighted({noFocus:!0}),t.close(),e.preventDefault(),e.stopPropagation())})),this.dropdown.prev()[0]!==i[0]&&this.dropdown.before(i),S("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),i.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var o=this;this.container.parents().add(window).each(function(){S(this).on(s+" "+t+" "+n,function(){o.opened()&&o.positionDropdown()})})},close:function(){if(this.opened()){var e=this.containerEventName,t="scroll."+e,s="resize."+e,i="orientationchange."+e;this.container.parents().add(window).each(function(){S(this).off(t).off(s).off(i)}),this.clearDropdownAlignmentPreference(),S("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(S.Event("select2-close"))}},externalSearch:function(e){this.open(),this.search.val(e),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return y(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var e,t,s,i,n,o,a,r=this.results;if(!((t=this.highlight())<0)){if(0==t)return void r.scrollTop(0);e=this.findHighlightableChoices().find(".select2-result-label"),i=(s=S(e[t])).offset().top+s.outerHeight(!0),t===e.length-1&&(0<(a=r.find("li.select2-more-results")).length&&(i=a.offset().top+a.outerHeight(!0))),(n=r.offset().top+r.outerHeight(!0))<i&&r.scrollTop(r.scrollTop()+(i-n)),(o=s.offset().top-r.offset().top)<0&&"none"!=s.css("display")&&r.scrollTop(r.scrollTop()+o)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(e){for(var t=this.findHighlightableChoices(),s=this.highlight();-1<s&&s<t.length;){var i=S(t[s+=e]);if(i.hasClass("select2-result-selectable")&&!i.hasClass("select2-disabled")&&!i.hasClass("select2-selected")){this.highlight(s);break}}},highlight:function(e){var t,s,i=this.findHighlightableChoices();return 0===arguments.length?h(i.filter(".select2-highlighted")[0],i.get()):(e>=i.length&&(e=i.length-1),e<0&&(e=0),this.removeHighlight(),(t=S(i[e])).addClass("select2-highlighted"),this.search.attr("aria-activedescendant",t.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(t.text()),void((s=t.data("select2-data"))&&this.opts.element.trigger({type:"select2-highlight",val:this.id(s),choice:s})))},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(e){var t=S(e.target).closest(".select2-result-selectable");if(0<t.length&&!t.is(".select2-highlighted")){var s=this.findHighlightableChoices();this.highlight(s.index(t))}else 0==t.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var t=this.results,s=t.find("li.select2-more-results"),i=this.resultsPage+1,n=this,o=this.search.val(),a=this.context;0!==s.length&&(s.offset().top-t.offset().top-t.height()<=this.opts.loadMorePadding&&(s.addClass("select2-active"),this.opts.query({element:this.opts.element,term:o,page:i,context:a,matcher:this.opts.matcher,callback:this.bind(function(e){n.opened()&&(n.opts.populateResults.call(this,t,e.results,{term:o,page:i,context:a}),n.postprocessResults(e,!1,!1),!0===e.more?(s.detach().appendTo(t).text(y(n.opts.formatLoadMore,i+1)),window.setTimeout(function(){n.loadMoreIfNeeded()},10)):s.remove(),n.positionDropdown(),n.resultsPage=i,n.context=e.context,this.opts.element.trigger({type:"select2-loaded",items:e}))})})))},tokenize:function(){},updateResults:function(s){function i(){a.removeClass("select2-active"),l.positionDropdown(),r.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?l.liveRegion.text(r.text()):l.liveRegion.text(l.opts.formatMatches(r.find(".select2-result-selectable").length))}function n(e){r.html(e),i()}var e,t,o,a=this.search,r=this.results,c=this.opts,l=this,h=a.val(),d=S.data(this.container,"select2-last-term");if((!0===s||!d||!p(h,d))&&(S.data(this.container,"select2-last-term",h),!0===s||!1!==this.showSearchInput&&this.opened())){o=++this.queryCount;var u=this.getMaximumSelectionSize();if(1<=u&&(e=this.data(),S.isArray(e)&&e.length>=u&&v(c.formatSelectionTooBig,"formatSelectionTooBig")))return void n("<li class='select2-selection-limit'>"+y(c.formatSelectionTooBig,u)+"</li>");if(a.val().length<c.minimumInputLength)return v(c.formatInputTooShort,"formatInputTooShort")?n("<li class='select2-no-results'>"+y(c.formatInputTooShort,a.val(),c.minimumInputLength)+"</li>"):n(""),void(s&&this.showSearch&&this.showSearch(!0));if(c.maximumInputLength&&a.val().length>c.maximumInputLength)return void(v(c.formatInputTooLong,"formatInputTooLong")?n("<li class='select2-no-results'>"+y(c.formatInputTooLong,a.val(),c.maximumInputLength)+"</li>"):n(""));c.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+y(c.formatSearching)+"</li>"),a.addClass("select2-active"),this.removeHighlight(),(t=this.tokenize())!=b&&null!=t&&a.val(t),this.resultsPage=1,c.query({element:c.element,term:a.val(),page:this.resultsPage,context:null,matcher:c.matcher,callback:this.bind(function(e){var t;if(o==this.queryCount){if(!this.opened())return void this.search.removeClass("select2-active");if(this.context=e.context===b?null:e.context,this.opts.createSearchChoice&&""!==a.val()&&((t=this.opts.createSearchChoice.call(l,a.val(),e.results))!==b&&null!==t&&l.id(t)!==b&&null!==l.id(t)&&0===S(e.results).filter(function(){return p(l.id(this),l.id(t))}).length&&this.opts.createSearchChoicePosition(e.results,t)),0===e.results.length&&v(c.formatNoMatches,"formatNoMatches"))return void n("<li class='select2-no-results'>"+y(c.formatNoMatches,a.val())+"</li>");r.empty(),l.opts.populateResults.call(this,r,e.results,{term:a.val(),page:this.resultsPage,context:null}),!0===e.more&&v(c.formatLoadMore,"formatLoadMore")&&(r.append("<li class='select2-more-results'>"+l.opts.escapeMarkup(y(c.formatLoadMore,this.resultsPage))+"</li>"),window.setTimeout(function(){l.loadMoreIfNeeded()},10)),this.postprocessResults(e,s),i(),this.opts.element.trigger({type:"select2-loaded",items:e})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){var i;(i=this.search)[0]!==document.activeElement&&window.setTimeout(function(){var e,t=i[0],s=i.val().length;i.focus(),(0<t.offsetWidth||0<t.offsetHeight)&&t===document.activeElement&&(t.setSelectionRange?t.setSelectionRange(s,s):t.createTextRange&&((e=t.createTextRange()).collapse(!1),e.select()))},0)},selectHighlighted:function(e){if(this._touchMoved)this.clearTouchMoved();else{var t=this.highlight(),s=this.results.find(".select2-highlighted").closest(".select2-result").data("select2-data");s?(this.highlight(t),this.onSelect(s,e)):e&&e.noFocus&&this.close()}},getPlaceholder:function(){var e;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((e=this.getPlaceholderOption())!==b?e.text():b)},getPlaceholderOption:function(){if(this.select){var e=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&e||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===S.trim(e.text())&&""===e.val())return e}},initContainerWidth:function(){var e=function(){var e,t,s,i,n;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if((e=this.opts.element.attr("style"))!==b)for(i=0,n=(t=e.split(";")).length;i<n;i+=1)if(null!==(s=t[i].replace(/\s/g,"").match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i))&&1<=s.length)return s[1];return"resolve"===this.opts.width?0<(e=this.opts.element.css("width")).indexOf("%")?e:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px":null}return S.isFunction(this.opts.width)?this.opts.width():this.opts.width}.call(this);null!==e&&this.container.css("width",e)}}),{createContainer:function(){return S(document.createElement("div")).attr({class:"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'"," aria-autocomplete='list' />"," </div>"," <ul class='select2-results' role='listbox'>"," </ul>","</div>"].join(""))},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var e,t,s;0<=this.opts.minimumResultsForSearch&&this.showSearch(!0),this.parent.opening.apply(this,arguments),!1!==this.showSearchInput&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),(e=this.search.get(0)).createTextRange?((t=e.createTextRange()).collapse(!1),t.select()):e.setSelectionRange&&(s=this.search.val().length,e.setSelectionRange(s,s))),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(S.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){S("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),s.call(this,"selection","focusser")},initContainer:function(){var t,e,s=this.container,i=this.dropdown,n=x();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=t=s.find(".select2-choice"),this.focusser=s.find(".select2-focusser"),t.find(".select2-chosen").attr("id","select2-chosen-"+n),this.focusser.attr("aria-labelledby","select2-chosen-"+n),this.results.attr("id","select2-results-"+n),this.search.attr("aria-owns","select2-results-"+n),this.focusser.attr("id","s2id_autogen"+n),e=S("label[for='"+this.opts.element.attr("id")+"']"),this.focusser.prev().text(e.text()).attr("for",this.focusser.attr("id"));var o=this.opts.element.attr("title");this.opts.element.attr("title",o||e.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(S("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()){if(e.which===k.PAGE_UP||e.which===k.PAGE_DOWN)return void u(e);switch(e.which){case k.UP:case k.DOWN:return this.moveHighlight(e.which===k.UP?-1:1),void u(e);case k.ENTER:return this.selectHighlighted(),void u(e);case k.TAB:return void this.selectHighlighted({noFocus:!0});case k.ESC:return this.cancel(e),void u(e)}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()&&e.which!==k.TAB&&!k.isControl(e)&&!k.isFunctionKey(e)&&e.which!==k.ESC){if(!1===this.opts.openOnEnter&&e.which===k.ENTER)return void u(e);if(e.which==k.DOWN||e.which==k.UP||e.which==k.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;return this.open(),void u(e)}return e.which==k.DELETE||e.which==k.BACKSPACE?(this.opts.allowClear&&this.clear(),void u(e)):void 0}})),l(this.focusser),this.focusser.on("keyup-change input",this.bind(function(e){if(0<=this.opts.minimumResultsForSearch){if(e.stopPropagation(),this.opened())return;this.open()}})),t.on("mousedown touchstart","abbr",this.bind(function(e){var t;this.isInterfaceEnabled()&&(this.clear(),(t=e).preventDefault(),t.stopImmediatePropagation(),this.close(),this.selection.focus())})),t.on("mousedown touchstart",this.bind(function(e){a(t),this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),u(e)})),i.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),t.on("focus",this.bind(function(e){u(e)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(S.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(e){var t=this.selection.data("select2-data");if(t){var s=S.Event("select2-clearing");if(this.opts.element.trigger(s),s.isDefaultPrevented())return;var i=this.getPlaceholderOption();this.opts.element.val(i?i.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),!1!==e&&(this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var t=this;this.opts.initSelection.call(null,this.opts.element,function(e){e!==b&&null!==e&&(t.updateSelection(e),t.close(),t.setPlaceholder(),t.nextSearchTerm=t.opts.nextSearchTerm(e,t.search.val()))})}},isPlaceholderOptionSelected:function(){var e;return this.getPlaceholder()!==b&&((e=this.getPlaceholderOption())!==b&&e.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val())},prepareOpts:function(){var a=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===a.element.get(0).tagName.toLowerCase()?a.initSelection=function(e,t){var s=e.find("option").filter(function(){return this.selected&&!this.disabled});t(i.optionToData(s))}:"data"in a&&(a.initSelection=a.initSelection||function(e,t){var n=e.val(),o=null;a.query({matcher:function(e,t,s){var i=p(n,a.id(s));return i&&(o=s),i},callback:S.isFunction(t)?function(){t(o)}:S.noop})}),a},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(e)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(e,t,s){var i=0,n=this;if(this.findHighlightableChoices().each2(function(e,t){return p(n.id(t.data("select2-data")),n.opts.element.val())?(i=e,!1):void 0}),!1!==s&&(!0===t&&0<=i?this.highlight(i):this.highlight(0)),!0===t){var o=this.opts.minimumResultsForSearch;0<=o&&this.showSearch(function s(e){var i=0;return S.each(e,function(e,t){t.children?i+=s(t.children):i++}),i}(e.results)>=o)}},showSearch:function(e){this.showSearchInput!==e&&(this.showSearchInput=e,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!e),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!e),S(this.dropdown,this.container).toggleClass("select2-with-searchbox",e))},onSelect:function(e,t){if(this.triggerSelect(e)){var s=this.opts.element.val(),i=this.data();this.opts.element.val(this.id(e)),this.updateSelection(e),this.opts.element.trigger({type:"select2-selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.close(),t&&t.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),p(s,this.id(e))||this.triggerChange({added:e,removed:i})}},updateSelection:function(e){var t,s,i=this.selection.find(".select2-chosen");this.selection.data("select2-data",e),i.empty(),null!==e&&(t=this.opts.formatSelection(e,i,this.opts.escapeMarkup)),t!==b&&i.append(t),(s=this.opts.formatSelectionCssClass(e,i))!==b&&i.addClass(s),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var e,t=!1,s=null,i=this,n=this.data();if(0===arguments.length)return this.opts.element.val();if(e=arguments[0],1<arguments.length&&(t=arguments[1]),this.select)this.select.val(e).find("option").filter(function(){return this.selected}).each2(function(e,t){return s=i.optionToData(t),!1}),this.updateSelection(s),this.setPlaceholder(),t&&this.triggerChange({added:s,removed:n});else{if(!e&&0!==e)return void this.clear(t);if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(e),this.opts.initSelection(this.opts.element,function(e){i.opts.element.val(e?i.id(e):""),i.updateSelection(e),i.setPlaceholder(),t&&i.triggerChange({added:e,removed:n})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(e){var t,s=!1;return 0===arguments.length?((t=this.selection.data("select2-data"))==b&&(t=null),t):(1<arguments.length&&(s=arguments[1]),void(e?(t=this.data(),this.opts.element.val(e?this.id(e):""),this.updateSelection(e),s&&this.triggerChange({added:e,removed:t})):this.clear(s)))}}),E=t(w,{createContainer:function(){return S(document.createElement("div")).attr({class:"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""))},prepareOpts:function(){var c=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===c.element.get(0).tagName.toLowerCase()?c.initSelection=function(e,t){var s=[];e.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(e,t){s.push(i.optionToData(t))}),t(s)}:"data"in c&&(c.initSelection=c.initSelection||function(e,o){var a=n(e.val(),c.separator),r=[];c.query({matcher:function(e,t,s){var i=S.grep(a,function(e){return p(e,c.id(s))}).length;return i&&r.push(s),i},callback:S.isFunction(o)?function(){for(var e=[],t=0;t<a.length;t++)for(var s=a[t],i=0;i<r.length;i++){var n=r[i];if(p(s,c.id(n))){e.push(n),r.splice(i,1);break}}o(e)}:S.noop})}),c},selectChoice:function(e){var t=this.container.find(".select2-search-choice-focus");t.length&&e&&e[0]==t[0]||(t.length&&this.opts.element.trigger("choice-deselected",t),t.removeClass("select2-search-choice-focus"),e&&e.length&&(this.close(),e.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",e)))},destroy:function(){S("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),s.call(this,"searchContainer","selection")},initContainer:function(){var a,e=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=a=this.container.find(e);var t=this;this.selection.on("click",".select2-search-choice:not(.select2-locked)",function(){t.search[0].focus(),t.selectChoice(S(this))}),this.search.attr("id","s2id_autogen"+x()),this.search.prev().text(S("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()){++this.keydowns;var t=a.find(".select2-search-choice-focus"),s=t.prev(".select2-search-choice:not(.select2-locked)"),i=t.next(".select2-search-choice:not(.select2-locked)"),n=function(e){var t=0,s=0;if("selectionStart"in(e=S(e)[0]))t=e.selectionStart,s=e.selectionEnd-t;else if("selection"in document){e.focus();var i=document.selection.createRange();s=document.selection.createRange().text.length,i.moveStart("character",-e.value.length),t=i.text.length-s}return{offset:t,length:s}}(this.search);if(t.length&&(e.which==k.LEFT||e.which==k.RIGHT||e.which==k.BACKSPACE||e.which==k.DELETE||e.which==k.ENTER)){var o=t;return e.which==k.LEFT&&s.length?o=s:e.which==k.RIGHT?o=i.length?i:null:e.which===k.BACKSPACE?this.unselect(t.first())&&(this.search.width(10),o=s.length?s:i):e.which==k.DELETE?this.unselect(t.first())&&(this.search.width(10),o=i.length?i:null):e.which==k.ENTER&&(o=null),this.selectChoice(o),u(e),void(o&&o.length||this.open())}if((e.which===k.BACKSPACE&&1==this.keydowns||e.which==k.LEFT)&&0==n.offset&&!n.length)return this.selectChoice(a.find(".select2-search-choice:not(.select2-locked)").last()),void u(e);if(this.selectChoice(null),this.opened())switch(e.which){case k.UP:case k.DOWN:return this.moveHighlight(e.which===k.UP?-1:1),void u(e);case k.ENTER:return this.selectHighlighted(),void u(e);case k.TAB:return this.selectHighlighted({noFocus:!0}),void this.close();case k.ESC:return this.cancel(e),void u(e)}if(e.which!==k.TAB&&!k.isControl(e)&&!k.isFunctionKey(e)&&e.which!==k.BACKSPACE&&e.which!==k.ESC){if(e.which===k.ENTER){if(!1===this.opts.openOnEnter)return;if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return}this.open(),(e.which===k.PAGE_UP||e.which===k.PAGE_DOWN)&&u(e),e.which===k.ENTER&&u(e)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(e){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),e.stopImmediatePropagation(),this.opts.element.trigger(S.Event("select2-blur"))})),this.container.on("click",e,this.bind(function(e){this.isInterfaceEnabled()&&(0<S(e.target).closest(".select2-search-choice").length||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.open(),this.focusSearch(),e.preventDefault()))})),this.container.on("focus",e,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var t=this;this.opts.initSelection.call(null,this.opts.element,function(e){e!==b&&null!==e&&(t.updateSelection(e),t.close(),t.clearSearch())})}},clearSearch:function(){var e=this.getPlaceholder(),t=this.getMaxSearchWidth();e!==b&&0===this.getVal().length&&!1===this.search.hasClass("select2-focused")?(this.search.val(e).addClass("select2-default"),this.search.width(0<t?t:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(S.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(e){var t=[],s=[],i=this;S(e).each(function(){h(i.id(this),t)<0&&(t.push(i.id(this)),s.push(this))}),e=s,this.selection.find(".select2-search-choice").remove(),S(e).each(function(){i.addSelectedChoice(this)}),i.postprocessResults()},tokenize:function(){var e=this.search.val();null!=(e=this.opts.tokenizer.call(this,e,this.data(),this.bind(this.onSelect),this.opts))&&e!=b&&(this.search.val(e),0<e.length&&this.open())},onSelect:function(e,t){this.triggerSelect(e)&&(this.addSelectedChoice(e),this.opts.element.trigger({type:"selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.clearSearch(),this.updateResults(),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(e,!1,!0===this.opts.closeOnSelect),this.opts.closeOnSelect?(this.close(),this.search.width(10)):0<this.countSelectableResults()?(this.search.width(10),this.resizeSearch(),0<this.getMaximumSelectionSize()&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:e}),t&&t.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(e){var t,s,i=!e.locked,n=S("<li class='select2-search-choice'> <div></div> <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),o=S("<li class='select2-search-choice select2-locked'><div></div></li>"),a=i?n:o,r=this.id(e),c=this.getVal();(t=this.opts.formatSelection(e,a.find("div"),this.opts.escapeMarkup))!=b&&a.find("div").replaceWith("<div>"+t+"</div>"),(s=this.opts.formatSelectionCssClass(e,a.find("div")))!=b&&a.addClass(s),i&&a.find(".select2-search-choice-close").on("mousedown",u).on("click dblclick",this.bind(function(e){this.isInterfaceEnabled()&&(this.unselect(S(e.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),u(e),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),a.data("select2-data",e),a.insertBefore(this.searchContainer),c.push(r),this.setVal(c)},unselect:function(e){var t,s,i=this.getVal();if(0===(e=e.closest(".select2-search-choice")).length)throw"Invalid argument: "+e+". Must be .select2-search-choice";if(t=e.data("select2-data")){var n=S.Event("select2-removing");if(n.val=this.id(t),n.choice=t,this.opts.element.trigger(n),n.isDefaultPrevented())return!1;for(;0<=(s=h(this.id(t),i));)i.splice(s,1),this.setVal(i),this.select&&this.postprocessResults();return e.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}),!0}},postprocessResults:function(e,t,s){var i=this.getVal(),n=this.results.find(".select2-result"),o=this.results.find(".select2-result-with-children"),a=this;n.each2(function(e,t){0<=h(a.id(t.data("select2-data")),i)&&(t.addClass("select2-selected"),t.find(".select2-result-selectable").addClass("select2-selected"))}),o.each2(function(e,t){t.is(".select2-result-selectable")||0!==t.find(".select2-result-selectable:not(.select2-selected)").length||t.addClass("select2-selected")}),-1==this.highlight()&&!1!==s&&a.highlight(0),!this.opts.createSearchChoice&&0<!n.filter(".select2-result:not(.select2-selected)").length&&(!e||e&&!e.more&&0===this.results.find(".select2-no-results").length)&&v(a.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+y(a.opts.formatNoMatches,a.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-o(this.search)},resizeSearch:function(){var e,t,s,i,n=o(this.search);e=function(e){if(!T){var t=e[0].currentStyle||window.getComputedStyle(e[0],null);(T=S(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:t.fontSize,fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,textTransform:t.textTransform,whiteSpace:"nowrap"})).attr("class","select2-sizer"),S("body").append(T)}return T.text(e.val()),T.width()}(this.search)+10,t=this.search.offset().left,(i=(s=this.selection.width())-(t-this.selection.offset().left)-n)<e&&(i=s-n),i<40&&(i=s-n),i<=0&&(i=e),this.search.width(Math.floor(i))},getVal:function(){var e;return this.select?null===(e=this.select.val())?[]:e:n(e=this.opts.element.val(),this.opts.separator)},setVal:function(e){var t;this.select?this.select.val(e):(t=[],S(e).each(function(){h(this,t)<0&&t.push(this)}),this.opts.element.val(0===t.length?"":t.join(this.opts.separator)))},buildChangeDetails:function(e,t){t=t.slice(0),e=e.slice(0);for(var s=0;s<t.length;s++)for(var i=0;i<e.length;i++)p(this.opts.id(t[s]),this.opts.id(e[i]))&&(t.splice(s,1),0<s&&s--,e.splice(i,1),i--);return{added:t,removed:e}},val:function(e,s){var i,n=this;if(0===arguments.length)return this.getVal();if((i=this.data()).length||(i=[]),!e&&0!==e)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),void(s&&this.triggerChange({added:this.data(),removed:i}));if(this.setVal(e),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),s&&this.triggerChange(this.buildChangeDetails(i,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(e){var t=S.map(e,n.id);n.setVal(t),n.updateSelection(e),n.clearSearch(),s&&n.triggerChange(n.buildChangeDetails(i,n.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var e=[],t=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){e.push(t.opts.id(S(this).data("select2-data")))}),this.setVal(e),this.triggerChange()},data:function(e,t){var s,i,n=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return S(this).data("select2-data")}).get():(i=this.data(),e||(e=[]),s=S.map(e,function(e){return n.opts.id(e)}),this.setVal(s),this.updateSelection(e),this.clearSearch(),void(t&&this.triggerChange(this.buildChangeDetails(i,this.data()))))}}),S.fn.select2=function(){var e,t,s,i,n,o=Array.prototype.slice.call(arguments,0),a=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],r=["opened","isFocused","container","dropdown"],c=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===o.length||"object"==typeof o[0])(e=0===o.length?{}:S.extend({},o[0])).element=S(this),"select"===e.element.get(0).tagName.toLowerCase()?n=e.element.prop("multiple"):(n=e.multiple||!1,"tags"in e&&(e.multiple=n=!0)),(t=n?new window.Select2.class.multi:new window.Select2.class.single).init(e);else{if("string"!=typeof o[0])throw"Invalid arguments to select2 plugin: "+o;if(h(o[0],a)<0)throw"Unknown method: "+o[0];if(i=b,(t=S(this).data("select2"))===b)return;if("container"===(s=o[0])?i=t.container:"dropdown"===s?i=t.dropdown:(l[s]&&(s=l[s]),i=t[s].apply(t,o.slice(1))),0<=h(o[0],r)||0<=h(o[0],c)&&1==o.length)return!1}}),i===b?this:i},S.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,s,i){var n=[];return c(e.text,s.term,n,i),n.join("")},formatSelection:function(e,t,s){return e?s(e.text):b},sortResults:function(e){return e},formatResultCssClass:function(e){return e.css},formatSelectionCssClass:function(){return b},formatMatches:function(e){return e+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(e,t){var s=t-e.length;return"Please enter "+s+" or more character"+(1==s?"":"s")},formatInputTooLong:function(e,t){var s=e.length-t;return"Please delete "+s+" character"+(1==s?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(1==e?"":"s")},formatLoadMore:function(){return"Loading more results…"},formatSearching:function(){return"Searching…"},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(e){return e==b?null:e.id},matcher:function(e,t){return 0<=r(""+t).toUpperCase().indexOf(r(""+e).toUpperCase())},separator:",",tokenSeparators:[],tokenizer:function(e,t,s,i){var n,o,a,r,c,l=e,h=!1;if(!i.createSearchChoice||!i.tokenSeparators||i.tokenSeparators.length<1)return b;for(;;){for(o=-1,a=0,r=i.tokenSeparators.length;a<r&&(c=i.tokenSeparators[a],!(0<=(o=e.indexOf(c))));a++);if(o<0)break;if(n=e.substring(0,o),e=e.substring(o+c.length),0<n.length&&(n=i.createSearchChoice.call(this,n,t))!==b&&null!==n&&i.id(n)!==b&&null!==i.id(n)){for(h=!1,a=0,r=t.length;a<r;a++)if(p(i.id(n),i.id(t[a]))){h=!0;break}h||s(n)}}return l!==e?e:void 0},escapeMarkup:e,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(e){return e},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return b},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(e){return!("ontouchstart"in window||0<navigator.msMaxTouchPoints)||!(e.opts.minimumResultsForSearch<0)}},S.fn.select2.ajaxDefaults={transport:S.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:i,local:g,tags:m},util:{debounce:d,markMatch:c,escapeMarkup:e,stripDiacritics:r},class:{abstract:w,single:C,multi:E}}}var R}(jQuery);
includes/admin/assets/css/um-admin-columns.css CHANGED
@@ -5,6 +5,7 @@
5
6
.um-admin.post-type-um_form .manage-column.column-id {width: 60px}
7
.um-admin.post-type-um_form .manage-column.column-mode {width: 100px}
8
.um-admin.post-type-um_form .manage-column.column-title {width: 200px}
9
.um-admin.post-type-um_form .manage-column.column-shortcode {width: 200px}
10
.um-admin.post-type-um_form .manage-column.column-impressions {width: 100px}
@@ -12,6 +13,7 @@
12
13
.um-admin.post-type-um_directory .manage-column.column-id {width: 60px}
14
.um-admin.post-type-um_directory .manage-column.column-title {width: 250px}
15
16
.um-admin.post-type-um_role .manage-column.column-title {width: 200px}
17
.um-admin.post-type-um_role .manage-column.column-count {width: 150px}
5
6
.um-admin.post-type-um_form .manage-column.column-id {width: 60px}
7
.um-admin.post-type-um_form .manage-column.column-mode {width: 100px}
8
+ .um-admin.post-type-um_form .manage-column.column-is_default {width: 60px}
9
.um-admin.post-type-um_form .manage-column.column-title {width: 200px}
10
.um-admin.post-type-um_form .manage-column.column-shortcode {width: 200px}
11
.um-admin.post-type-um_form .manage-column.column-impressions {width: 100px}
13
14
.um-admin.post-type-um_directory .manage-column.column-id {width: 60px}
15
.um-admin.post-type-um_directory .manage-column.column-title {width: 250px}
16
+ .um-admin.post-type-um_directory .manage-column.column-is_default {width: 60px}
17
18
.um-admin.post-type-um_role .manage-column.column-title {width: 200px}
19
.um-admin.post-type-um_role .manage-column.column-count {width: 150px}
includes/admin/assets/js/um-admin-forms.js CHANGED
@@ -123,10 +123,13 @@ jQuery(document).ready( function() {
123
button.siblings('.um-media-upload-data-width').val(attachment.width);
124
button.siblings('.um-media-upload-data-height').val(attachment.height);
125
button.siblings('.um-media-upload-data-thumbnail').val(attachment.thumbnail);
126
button.siblings('.um-media-upload-url').val(attachment.url);
127
128
button.siblings('.um-clear-image').show();
129
button.hide();
130
});
131
132
frame.open();
@@ -137,16 +140,20 @@ jQuery(document).ready( function() {
137
});
138
139
jQuery('.um-clear-image').click( function(e) {
140
- var default_image_url = jQuery(this).siblings('.um-forms-field').data('default');
141
- jQuery(this).siblings('.um-set-image').show();
142
- jQuery(this).hide();
143
- jQuery(this).siblings('.icon_preview').attr( 'src', default_image_url );
144
- jQuery(this).siblings('.um-media-upload-data-id').val('');
145
- jQuery(this).siblings('.um-media-upload-data-width').val('');
146
- jQuery(this).siblings('.um-media-upload-data-height').val('');
147
- jQuery(this).siblings('.um-media-upload-data-thumbnail').val('');
148
- jQuery(this).siblings('.um-forms-field').val( default_image_url );
149
- jQuery(this).siblings('.um-media-upload-url').val( default_image_url );
150
});
151
}
152
@@ -154,7 +161,7 @@ jQuery(document).ready( function() {
154
/**
155
* On option fields change
156
*/
157
- jQuery('body').on('change', '.um-forms-field', function() {
158
if ( jQuery('.um-forms-line[data-conditional*=\'"' + jQuery(this).data('field_id') + '",\']').length > 0 ) {
159
run_check_conditions();
160
}
123
button.siblings('.um-media-upload-data-width').val(attachment.width);
124
button.siblings('.um-media-upload-data-height').val(attachment.height);
125
button.siblings('.um-media-upload-data-thumbnail').val(attachment.thumbnail);
126
+ button.siblings('.um-media-upload-data-url').trigger('change');
127
button.siblings('.um-media-upload-url').val(attachment.url);
128
129
button.siblings('.um-clear-image').show();
130
button.hide();
131
+
132
+ jQuery( document ).trigger( 'um_media_upload_select', [button, attachment] );
133
});
134
135
frame.open();
140
});
141
142
jQuery('.um-clear-image').click( function(e) {
143
+ var clear_button = jQuery(this);
144
+ var default_image_url = clear_button.siblings('.um-forms-field').data('default');
145
+ clear_button.siblings('.um-set-image').show();
146
+ clear_button.hide();
147
+ clear_button.siblings('.icon_preview').attr( 'src', default_image_url );
148
+ clear_button.siblings('.um-media-upload-data-id').val('');
149
+ clear_button.siblings('.um-media-upload-data-width').val('');
150
+ clear_button.siblings('.um-media-upload-data-height').val('');
151
+ clear_button.siblings('.um-media-upload-data-thumbnail').val('');
152
+ clear_button.siblings('.um-forms-field').val( default_image_url );
153
+ clear_button.siblings('.um-media-upload-data-url').trigger('change');
154
+ clear_button.siblings('.um-media-upload-url').val( default_image_url );
155
+
156
+ jQuery( document ).trigger( 'um_media_upload_clear', clear_button );
157
});
158
}
159
161
/**
162
* On option fields change
163
*/
164
+ jQuery( document.body ).on('change', '.um-forms-field', function() {
165
if ( jQuery('.um-forms-line[data-conditional*=\'"' + jQuery(this).data('field_id') + '",\']').length > 0 ) {
166
run_check_conditions();
167
}
includes/admin/class-admin.php CHANGED
@@ -45,22 +45,32 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
45
46
add_action( 'um_admin_do_action__install_core_pages', array( &$this, 'install_core_pages' ) );
47
48
add_action( 'parent_file', array( &$this, 'parent_file' ), 9 );
49
add_filter( 'gettext', array( &$this, 'gettext' ), 10, 4 );
50
add_filter( 'post_updated_messages', array( &$this, 'post_updated_messages' ) );
51
52
53
-
54
- add_action( 'wp_ajax_um_dynamic_modal_content', array( UM()->builder(), 'dynamic_modal_content' ) );
55
- add_action( 'wp_ajax_um_populate_dropdown_options', array( UM()->builder(), 'populate_dropdown_options' ) );
56
- add_action( 'wp_ajax_um_update_field', array( UM()->builder(), 'update_field' ) );
57
- add_action( 'wp_ajax_um_do_ajax_action', array( UM()->fields(), 'do_ajax_action' ) );
58
- add_action( 'wp_ajax_um_update_builder', array( UM()->builder(), 'update_builder' ) );
59
- add_action( 'wp_ajax_um_update_order', array( UM()->dragdrop(), 'update_order' ) );
60
- add_action( 'wp_ajax_um_rated', array( UM()->admin_menu(), 'ultimatemember_rated' ) );
61
}
62
63
64
function manual_upgrades_request() {
65
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
66
die();
45
46
add_action( 'um_admin_do_action__install_core_pages', array( &$this, 'install_core_pages' ) );
47
48
+ add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ), 999 );
49
+
50
add_action( 'parent_file', array( &$this, 'parent_file' ), 9 );
51
add_filter( 'gettext', array( &$this, 'gettext' ), 10, 4 );
52
add_filter( 'post_updated_messages', array( &$this, 'post_updated_messages' ) );
53
+ }
54
55
56
+ /**
57
+ * Adds class to our admin pages
58
+ *
59
+ * @param $classes
60
+ *
61
+ * @return string
62
+ */
63
+ function admin_body_class( $classes ) {
64
+ if ( $this->is_um_screen() ) {
65
+ return "$classes um-admin";
66
+ }
67
+ return $classes;
68
}
69
70
71
+ /**
72
+ *
73
+ */
74
function manual_upgrades_request() {
75
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
76
die();
includes/admin/core/class-admin-ajax-hooks.php ADDED
@@ -0,0 +1,33 @@
1
+ <?php
2
+ namespace um\admin\core;
3
+
4
+
5
+ // Exit if accessed directly.
6
+ if ( ! defined( 'ABSPATH' ) ) exit;
7
+
8
+
9
+ if ( ! class_exists( 'um\admin\core\Admin_Ajax_Hooks' ) ) {
10
+
11
+
12
+ /**
13
+ * Class Admin_Ajax_Hooks
14
+ * @package um\admin\core
15
+ */
16
+ class Admin_Ajax_Hooks {
17
+
18
+
19
+ /**
20
+ * Admin_Columns constructor.
21
+ */
22
+ function __construct() {
23
+ add_action( 'wp_ajax_um_do_ajax_action', array( UM()->fields(), 'do_ajax_action' ) );
24
+ add_action( 'wp_ajax_um_update_builder', array( UM()->builder(), 'update_builder' ) );
25
+ add_action( 'wp_ajax_um_update_order', array( UM()->dragdrop(), 'update_order' ) );
26
+ add_action( 'wp_ajax_um_update_field', array( UM()->builder(), 'update_field' ) );
27
+ add_action( 'wp_ajax_um_dynamic_modal_content', array( UM()->builder(), 'dynamic_modal_content' ) );
28
+ add_action( 'wp_ajax_um_populate_dropdown_options', array( UM()->builder(), 'populate_dropdown_options' ) );
29
+ add_action( 'wp_ajax_um_rated', array( UM()->admin_menu(), 'ultimatemember_rated' ) );
30
+ }
31
+
32
+ }
33
+ }
includes/admin/core/class-admin-columns.php CHANGED
@@ -90,11 +90,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
90
*/
91
function manage_edit_um_form_columns( $columns ) {
92
$new_columns['cb'] = '<input type="checkbox" />';
93
- $new_columns['title'] = __( 'Title', 'ulitmatemember' );
94
- $new_columns['id'] = __('ID', 'ulitmatemember' );
95
- $new_columns['mode'] = __( 'Type', 'ulitmatemember' );
96
- $new_columns['shortcode'] = __( 'Shortcode', 'ulitmatemember' );
97
- $new_columns['date'] = __( 'Date', 'ulitmatemember' );
98
99
return $new_columns;
100
}
@@ -111,6 +112,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
111
$new_columns['cb'] = '<input type="checkbox" />';
112
$new_columns['title'] = __( 'Title', 'ultimate-member' );
113
$new_columns['id'] = __( 'ID', 'ultimate-member' );
114
$new_columns['shortcode'] = __( 'Shortcode', 'ultimate-member' );
115
$new_columns['date'] = __( 'Date', 'ultimate-member' );
116
@@ -131,7 +133,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
131
break;
132
133
case 'shortcode':
134
- echo UM()->shortcodes()->get_shortcode( $id );
<