PageSourceSearch

https://www.ucmo.edu/_resources/js/custom-ou-edits.js?v=202600612

js ucmo.edu collected 2026-10-02 03:16:16 UTC 80,287 bytes, 2,013 lines download raw bytes

1$(document).ready(function () {
2/*=============================
3 on click hide show jqury
4 ==============================*/
5	$('.search-btn').click(function () {
6		$(".search-sec").toggleClass("s-open");
7		$('#srchbox').focus();
8	});
9	$('#s-close').click(function () {
10		$("#search-sec").toggleClass("s-open");
11	});
12	$('#s-close2').click(function () {
13		$("#search-sec2").toggleClass("s-open");
14	});
15
16	
17	
18    $('.dropdown-submenu a.test').on("click", function (e) {
19        $(this).next('ul').toggle();
20        e.stopPropagation();
21        e.preventDefault();
22    });
23    $alertHeight = $(".alertbar").outerHeight();
24    $('.header').css('top', $alertHeight+'px');
25});
26/*=============================
27 Owl Carousel jqury
28 ==============================*/
29
30$(document).ready(function () {
31    /*  $('.until-slide-owl').owlCarousel({
32     loop: true,
33     items: 1,
34     margin: 0,
35     nav: true,
36     dots: false,
37     navText: ['<img src="/_resources/img/arrow-left.png" alt="Previous" />', '<img src="/_resources/img/arrow-right.png" alt="Next" />']
38     });
39     */
40
41    $(".overview-owl-demo").owlCarousel({
42        navigation: true, // Show next and prev buttons
43        navigationText: ['<img src="/_resources/img/arrow-left_2.png" alt="Previous" />', '<img src="/_resources/img/arrow-right_2.png" alt="Next" />'],
44        slideSpeed: 300,
45        paginationSpeed: 400,
46
47        pagination: false,
48        singleItem: true
49    });
50    $('.news-overview-owl').owlCarousel({
51        loop: true,
52        items: 1,
53        margin: 0,
54        nav: true,
55        dots: false,
56        navText: ['<img src="/_resources/img/arrow-left_2.png" alt="Previous" />', '<img src="/_resources/img/arrow-right_2.png" alt="Next" />']
57    });
58});
59
60/*=============================
61 A not Jump top jqury
62 ==============================*/
63//$('a').click(function (e) {
64//    e.preventDefault();
65//});
66/*========================
67 Multipl select jqury
68 =========================*/
69!function ($) {
70    "use strict";// jshint ;_;
71
72    if (typeof ko !== 'undefined' && ko.bindingHandlers && !ko.bindingHandlers.multiselect) {
73        ko.bindingHandlers.multiselect = {
74            after: ['options', 'value', 'selectedOptions', 'enable', 'disable'],
75
76            init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
77                var $element = $(element);
78                var config = ko.toJS(valueAccessor());
79
80                $element.multiselect(config);
81
82                if (allBindings.has('options')) {
83                    var options = allBindings.get('options');
84                    if (ko.isObservable(options)) {
85                        ko.computed({
86                            read: function () {
87                                options();
88                                setTimeout(function () {
89                                    var ms = $element.data('multiselect');
90                                    if (ms)
91                                        ms.updateOriginalOptions();//Not sure how beneficial this is.
92                                    $element.multiselect('rebuild');
93                                }, 1);
94                            },
95                            disposeWhenNodeIsRemoved: element
96                        });
97                    }
98                }
99
100                //value and selectedOptions are two-way, so these will be triggered even by our own actions.
101                //It needs some way to tell if they are triggered because of us or because of outside change.
102                //It doesn't loop but it's a waste of processing.
103                if (allBindings.has('value')) {
104                    var value = allBindings.get('value');
105                    if (ko.isObservable(value)) {
106                        ko.computed({
107                            read: function () {
108                                value();
109                                setTimeout(function () {
110                                    $element.multiselect('refresh');
111                                }, 1);
112                            },
113                            disposeWhenNodeIsRemoved: element
114                        }).extend({rateLimit: 100, notifyWhenChangesStop: true});
115                    }
116                }
117
118                //Switched from arrayChange subscription to general subscription using 'refresh'.
119                //Not sure performance is any better using 'select' and 'de
vendor: 5,328 bytes, lines 119-255
119select'.
120                if (allBindings.has('selectedOptions')) {
121                    var selectedOptions = allBindings.get('selectedOptions');
122                    if (ko.isObservable(selectedOptions)) {
123                        ko.computed({
124                            read: function () {
125                                selectedOptions();
126                                setTimeout(function () {
127                                    $element.multiselect('refresh');
128                                }, 1);
129                            },
130                            disposeWhenNodeIsRemoved: element
131                        }).extend({rateLimit: 100, notifyWhenChangesStop: true});
132                    }
133                }
134
135                var setEnabled = function (enable) {
136                    setTimeout(function () {
137                        if (enable)
138                            $element.multiselect('enable');
139                        else
140                            $element.multiselect('disable');
141                    });
142                };
143
144                if (allBindings.has('enable')) {
145                    var enable = allBindings.get('enable');
146                    if (ko.isObservable(enable)) {
147                        ko.computed({
148                            read: function () {
149                                setEnabled(enable());
150                            },
151                            disposeWhenNodeIsRemoved: element
152                        }).extend({rateLimit: 100, notifyWhenChangesStop: true});
153                    } else {
154                        setEnabled(enable);
155                    }
156                }
157
158                if (allBindings.has('disable')) {
159                    var disable = allBindings.get('disable');
160                    if (ko.isObservable(disable)) {
161                        ko.computed({
162                            read: function () {
163                                setEnabled(!disable());
164                            },
165                            disposeWhenNodeIsRemoved: element
166                        }).extend({rateLimit: 100, notifyWhenChangesStop: true});
167                    } else {
168                        setEnabled(!disable);
169                    }
170                }
171
172                ko.utils.domNodeDisposal.addDisposeCallback(element, function () {
173                    $element.multiselect('destroy');
174                });
175            },
176
177            update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
178                var $element = $(element);
179                var config = ko.toJS(valueAccessor());
180
181                $element.multiselect('setOptions', config);
182                $element.multiselect('rebuild');
183            }
184        };
185    }
186
187    function forEach(array, callback) {
188        for (var index = 0; index < array.length; ++index) {
189            callback(array[index], index);
190        }
191    }
192
193    /**
194     * Constructor to create a new multiselect using the given select.
195     *
196     * @param {jQuery} select
197     * @param {Object} options
198     * @returns {Multiselect}
199     */
200    function Multiselect(select, options) {
201
202        this.$select = $(select);
203        this.options = this.mergeOptions($.extend({}, options, this.$select.data()));
204
205        // Placeholder via data attributes
206        if (this.$select.attr("data-placeholder")) {
207            this.options.nonSelectedText = this.$select.data("placeholder");
208        }
209
210        // Initialization.
211        // We have to clone to create a new reference.
212        this.originalOptions = this.$select.clone()[0].options;
213        this.query = '';
214        this.searchTimeout = null;
215        this.lastToggledInput = null;
216
217        this.options.multiple = this.$select.attr('multiple') === "multiple";
218        this.options.onChange = $.proxy(this.options.onChange, this);
219        this.options.onSelectAll = $.proxy(this.options.onSelectAll, this);
220        this.options.onDeselectAll = $.proxy(this.options.onDeselectAll, this);
221        this.options.onDropdownShow = $.proxy(this.options.onDropdownShow, this);
222        this.options.onDropdownHide = $.proxy(this.options.onDropdownHide, this);
223        this.options.onDropdownShown = $.proxy(this.options.onDropdownShown, this);
224        this.options.onDropdownHidden = $.proxy(this.options.onDropdownHidden, this);
225        this.options.onInitialized = $.proxy(this.options.onInitialized, this);
226        this.options.onFiltering = $.proxy(this.options.onFiltering, this);
227
228        // Build select all if enabled.
229        this.buildContainer();
230        this.buildButton();
231        this.buildDropdown();
232        this.buildSelectAll();
233        this.buildDropdownOptions();
234        this.buildFilter();
235
236        this.updateButtonText();
237        this.updateSelectAll(true);
238
239        if (this.options.enableClickableOptGroups && this.options.multiple) {
240            this.updateOptGroups();
241        }
242
243        this.options.wasDisabled = this.$select.prop('disabled');
244        if (this.options.disableIfEmpty && $('option', this.$select).length <= 0) {
245            this.disable();
246        }
247
248        this.$select.wrap('<span class="multiselect-native-select" />').after(this.$container);
249        this.options.onInitialized(this.$select, this.$container);
250    }
251
252    Multiselect.prototype = {
253
254        defaults: {
255            /**
256             * Default text function will either print 'None selected' in case no
257             * option is selected or a list of the selected options up to a length
258             * of 3 selected options.
259             *
260             * @param {jQuery} options
261             * @param {jQuery} select
262             * @returns {String}
263             */
264            buttonText: function (options, select) {
265                if (this.disabledText.length > 0
266                        && (select.prop('disabled') || (options.length == 0 && this.disableIfEmpty))) {
267
268                    return this.disabledText;
269                } else if (options.length === 0) {
270                    return this.nonSelectedText;
271                } else if (this.allSelectedText
272                        && options.length === $('option', $(select)).length
273                        && $('option', $(select)).length !== 1
274                        && this.multiple) {
275
276                    if (this.selectAllNumber) {
277                        return this.allSelectedText + ' (' + options.length + ')';
278                    } else {
279                        return this.allSelectedText;
280                    }
281                } else if (options.length > this.numberDisplayed) {
282                    return options.length + ' ' + this.nSelectedText;
283                } else {
284                    var selected = '';
285                    var delimiter = this.delimiterText;
286
287                    options.each(function () {
288                        var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).text();
289                        selected += label + delimiter;
290                    });
291
292                    return selected.substr(0, selected.length - this.delimiterText.length);
293                }
294            },
295            /**
296             * Updates the title of the button similar to the buttonText function.
297             *
298             * @param {jQuery} options
299             * @param {jQuery} select
300             * @returns {@exp;selected@call;substr}
301             */
302            buttonTitle: function (options, select) {
303                if (options.length === 0) {
304                    return this.nonSelectedText;
305                } else {
306                    var selected = '';
307                    var delimiter = this.delimiterText;
308
309                    options.each(function () {
310                        var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).text();
311                        selected += label + delimiter;
312                    });
313                    return selected.substr(0, selected.length - this.delimiterText.length);
314                }
315            },
316            checkboxName: function (option) {
317                return false; // no checkbox name
318            },
319            /**
320             * Create a label.
321             *
322             * @param {jQuery} element
323             * @returns {String}
324             */
325            optionLabel: function (element) {
326                return $(element).attr('label') || $(element).text();
327            },
328            /**
329             * Create a class.
330             *
331             * @param {jQuery} element
332             * @returns {String}
333             */
334            optionClass: function (element) {
335                return $(element).attr('class') || '';
336            },
337            /**
338             * Triggered on change of the multiselect.
339             *
340             * Not triggered when selecting/deselecting options manually.
341             *
342             * @param {jQuery} option
343             * @param {Boolean} checked
344             */
345            onChange: function (option, checked) {
346
347            },
348            /**
349             * Triggered when the dropdown is shown.
350             *
351             * @param {jQuery} event
352             */
353            onDropdownShow: function (event) {
354
355            },
356            /**
357             * Triggered when the dropdown is hidden.
358             *
359             * @param {jQuery} event
360             */
361            onDropdownHide: function (event) {
362
363            },
364            /**
365             * Triggered after the dropdown is shown.
366             *
367             * @param {jQuery} event
368             */
369            onDropdownShown: function (event) {
370
371            },
372            /**
373             * Triggered after the dropdown is hidden.
374             *
375             * @param {jQuery} event
376             */
377            onDropdownHidden: function (event) {
378
379            },
380            /**
381             * Triggered on select all.
382             */
383            onSelectAll: function () {
384
385            },
386            /**
387             * Triggered on deselect all.
388             */
389            onDeselectAll: function () {
390
391            },
392            /**
393             * Triggered after initializing.
394             *
395             * @param {jQuery} $select
396             * @param {jQuery} $container
397             */
398            onInitialized: function ($select, $container) {
399
400            },
401            /**
402             * Triggered on filtering.
403             *
404             * @param {jQuery} $filter
405             */
406            onFiltering: function ($filter) {
407
408            },
409            enableHTML: false,
410            buttonClass: 'btn btn-default',
411            inheritClass: false,
412            buttonWidth: 'auto',
413            buttonContainer: '<div class="" />',
414            dropRight: false,
415            dropUp: false,
416            selectedClass: 'active',
417            // Maximum height of the dropdown menu.
418            // If maximum height is exceeded a scrollbar will be displayed.
419            maxHeight: false,
420            includeSelectAllOption: false,
421            includeSelectAllIfMoreThan: 0,
422            selectAllText: ' Select all',
423            selectAllValue: 'multiselect-all',
424            selectAllName: false,
425            selectAllNumber: true,
426            selectAllJustVisible: true,
427            enableFiltering: false,
428            enableCaseInsensitiveFiltering: false,
429            enableFullValueFiltering: false,
430            enableClickableOptGroups: false,
431            enableCollapsibleOptGroups: false,
432            filterPlaceholder: 'Search',
433            // possible options: 'text', 'value', 'both'
434            filterBehavior: 'text',
435            includeFilterClearBtn: true,
436            preventInputChangeEvent: false,
437            nonSelectedText: 'None selected',
438            nSelectedText: 'selected',
439            allSelectedText: 'All selected',
440            numberDisplayed: 3,
441            disableIfEmpty: false,
442            disabledText: '',
443            delimiterText: ', ',
444            templates: {
445                button: '<button type="button" class="multiselect dropdown-toggle btn-block text-left" data-toggle="dropdown"><span class="multiselect-selected-text"></span> <b class="caret"></b></button>',
446                ul: '<ul class="multiselect-container dropdown-menu"></ul>',
447                filter: '<li class="multiselect-item multiselect-filter"><div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span><input class="form-control multiselect-search" type="text"></div></li>',
448                filterClearBtn: '<span class="input-group-btn"><button class="btn btn-default multiselect-clear-filter" type="button"><i class="glyphicon glyphicon-remove-circle"></i></button></span>',
449                li: '<li><a tabindex="0"><label></label></a></li>',
450                divider: '<li class="multiselect-item divider"></li>',
451                liGroup: '<li class="multiselect-item multiselect-group"><label></label></li>'
452            }
453        },
454
455        constructor: Multiselect,
456
457        /**
458         * Builds the container of the multiselect.
459         */
460        buildContainer: function () {
461            this.$container = $(this.options.buttonContainer);
462            this.$container.on('show.bs.dropdown', this.options.onDropdownShow);
463            this.$container.on('hide.bs.dropdown', this.options.onDropdownHide);
464            this.$container.on('shown.bs.dropdown', this.options.onDropdownShown);
465            this.$container.on('hidden.bs.dropdown', this.options.onDropdownHidden);
466        },
467
468        /**
469         * Builds the button of the multiselect.
470         */
471        buildButton: function () {
472            this.$button = $(this.options.templates.button).addClass(this.options.buttonClass);
473            if (this.$select.attr('class') && this.options.inheritClass) {
474                this.$button.addClass(this.$select.attr('class'));
475            }
476            // Adopt active state.
477            if (this.$select.prop('disabled')) {
478                this.disable();
479            } else {
480                this.enable();
481            }
482
483            // Manually add button width if set.
484            if (this.options.buttonWidth && this.options.buttonWidth !== 'auto') {
485                this.$button.css({
486                    'width': '100%', //this.options.buttonWidth,
487                    'overflow': 'hidden',
488                    'text-overflow': 'ellipsis'
489                });
490                this.$container.css({
491                    'width': this.options.buttonWidth
492                });
493            }
494
495            // Keep the tab index from the select.
496            var tabindex = this.$select.attr('tabindex');
497            if (tabindex) {
498                this.$button.attr('tabindex', tabindex);
499            }
500
501            this.$container.prepend(this.$button);
502        },
503
504        /**
505         * Builds the ul representing the dropdown menu.
506         */
507        buildDropdown: function () {
508
509            // Build ul.
510            this.$ul = $(this.options.templates.ul);
511
512            if (this.options.dropRight) {
513                this.$ul.addClass('pull-right');
514            }
515
516            // Set max height of dropdown menu to activate auto scrollbar.
517            if (this.options.maxHeight) {
518                // TODO: Add a class for this option to move the css declarations.
519                this.$ul.css({
520                    'max-height': this.options.maxHeight + 'px',
521                    'overflow-y': 'auto',
522                    'overflow-x': 'hidden'
523                });
524            }
525
526            if (this.options.dropUp) {
527
528                var height = Math.min(this.options.maxHeight, $('option[data-role!="divider"]', this.$select).length * 26 + $('option[data-role="divider"]', this.$select).length * 19 + (this.options.includeSelectAllOption ? 26 : 0) + (this.options.enableFiltering || this.options.enableCaseInsensitiveFiltering ? 44 : 0));
529                var moveCalc = height + 34;
530
531                this.$ul.css({
532                    'max-height': height + 'px',
533                    'overflow-y': 'auto',
534                    'overflow-x': 'hidden',
535                    'margin-top': "-" + moveCalc + 'px'
536                });
537            }
538
539            this.$container.append(this.$ul);
540        },
541
542        /**
543         * Build the dropdown options and binds all necessary events.
544         *
545         * Uses createDivider and createOptionValue to create the necessary options.
546         */
547        buildDropdownOptions: function () {
548
549            this.$select.children().each($.proxy(function (index, element) {
550
551                var $element = $(element);
vendor: 4,264 bytes, lines 552-657
552                // Support optgroups and options without a group simultaneously.
553                var tag = $element.prop('tagName')
554                        .toLowerCase();
555
556                if ($element.prop('value') === this.options.selectAllValue) {
557                    return;
558                }
559
560                if (tag === 'optgroup') {
561                    this.createOptgroup(element);
562                } else if (tag === 'option') {
563
564                    if ($element.data('role') === 'divider') {
565                        this.createDivider();
566                    } else {
567                        this.createOptionValue(element);
568                    }
569
570                }
571
572                // Other illegal tags will be ignored.
573            }, this));
574
575            // Bind the change event on the dropdown elements.
576            $('li:not(.multiselect-group) input', this.$ul).on('change', $.proxy(function (event) {
577                var $target = $(event.target);
578
579                var checked = $target.prop('checked') || false;
580                var isSelectAllOption = $target.val() === this.options.selectAllValue;
581
582                // Apply or unapply the configured selected class.
583                if (this.options.selectedClass) {
584                    if (checked) {
585                        $target.closest('li')
586                                .addClass(this.options.selectedClass);
587                    } else {
588                        $target.closest('li')
589                                .removeClass(this.options.selectedClass);
590                    }
591                }
592
593                // Get the corresponding option.
594                var value = $target.val();
595                var $option = this.getOptionByValue(value);
596
597                var $optionsNotThis = $('option', this.$select).not($option);
598                var $checkboxesNotThis = $('input', this.$container).not($target);
599
600                if (isSelectAllOption) {
601
602                    if (checked) {
603                        this.selectAll(this.options.selectAllJustVisible, true);
604                    } else {
605                        this.deselectAll(this.options.selectAllJustVisible, true);
606                    }
607                } else {
608                    if (checked) {
609                        $option.prop('selected', true);
610
611                        if (this.options.multiple) {
612                            // Simply select additional option.
613                            $option.prop('selected', true);
614                        } else {
615                            // Unselect all other options and corresponding checkboxes.
616                            if (this.options.selectedClass) {
617                                $($checkboxesNotThis).closest('li').removeClass(this.options.selectedClass);
618                            }
619
620                            $($checkboxesNotThis).prop('checked', false);
621                            $optionsNotThis.prop('selected', false);
622
623                            // It's a single selection, so close.
624                            this.$button.click();
625                        }
626
627                        if (this.options.selectedClass === "active") {
628                            $optionsNotThis.closest("a").css("outline", "");
629                        }
630                    } else {
631                        // Unselect option.
632                        $option.prop('selected', false);
633                    }
634
635                    // To prevent select all from firing onChange: #575
636                    this.options.onChange($option, checked);
637
638                    // Do not update select all or optgroups on select all change!
639                    this.updateSelectAll();
640
641                    if (this.options.enableClickableOptGroups && this.options.multiple) {
642                        this.updateOptGroups();
643                    }
644                }
645
646                this.$select.change();
647                this.updateButtonText();
648
649                if (this.options.preventInputChangeEvent) {
650                    return false;
651                }
652            }, this));
653
654            $('li a', this.$ul).on('mousedown', function (e) {
655                if (e.shiftKey) {
656                    // Prevent selecting text by Shift+click
657                    return false;
658                }
659            });
660
661            $('li a', this.$ul).on('touchstart click', $.proxy(function (event) {
662                event.stopPropagation();
663
664                var $target = $(event.target);
665
666                if (event.shiftKey && this.options.multiple) {
667                    if ($target.is("label")) { // Handles checkbox selection manually (see https://github.com/davidstutz/bootstrap-multiselect/issues/431)
668                        event.preventDefault();
669                        $target = $target.find("input");
670                        $target.prop("checked", !$target.prop("checked"));
671                    }
672                    var checked = $target.prop('checked') || false;
673
674                    if (this.lastToggledInput !== null && this.lastToggledInput !== $target) { // Make sure we actually have a range
675                        var from = $target.closest("li").index();
676                        var to = this.lastToggledInput.closest("li").index();
677
678                        if (from > to) { // Swap the indices
679                            var tmp = to;
680                            to = from;
681                            from = tmp;
682                        }
683
684                        // Make sure we grab all elements since slice excludes the last index
685                        ++to;
686
687                        // Change the checkboxes and underlying options
688                        var range = this.$ul.find("li").slice(from, to).find("input");
689
690                        range.prop('checked', checked);
691
692                        if (this.options.selectedClass) {
693                            range.closest('li')
694                                    .toggleClass(this.options.selectedClass, checked);
695                        }
696
697                        for (var i = 0, j = range.length; i < j; i++) {
698                            var $checkbox = $(range[i]);
699
700                            var $option = this.getOptionByValue($checkbox.val());
701
702                            $option.prop('selected', checked);
703                        }
704                    }
705
706                    // Trigger the select "change" event
707                    $target.trigger("change");
708                }
709
710                // Remembers last clicked option
711                if ($target.is("input") && !$target.closest("li").is(".multiselect-item")) {
712                    this.lastToggledInput = $target;
713                }
714
715                $target.blur();
716            }, this));
717
718            // Keyboard support.
719            this.$container.off('keydown.multiselect').on('keydown.multiselect', $.proxy(function (event) {
720                if ($('input[type="text"]', this.$container).is(':focus')) {
721                    return;
722                }
723
724                if (event.keyCode === 9 && this.$container.hasClass('open')) {
725                    this.$button.click();
726                } else {
727                    var $items = $(this.$container).find("li:not(.divider):not(.disabled) a").filter(":visible");
728
729                    if (!$items.length) {
730                        return;
731                    }
732
733                    var index = $items.index($items.filter(':focus'));
734
735                    // Navigation up.
736                    if (event.keyCode === 38 && index > 0) {
737                        index--;
738                    }
739                    // Navigate down.
740                    else if (event.keyCode === 40 && index < $items.length - 1) {
741                        index++;
742                    } else if (!~index) {
743                        index = 0;
744                    }
745
746                    var $current = $items.eq(index);
747                    $current.focus();
748
749                    if (event.keyCode === 32 || event.keyCode === 13) {
750                        var $checkbox = $current.find('input');
751
752                        $checkbox.prop("checked", !$checkbox.prop("checked"));
753                        $checkbox.change();
754                    }
755
756                    event.stopPropagation();
757                    event.preventDefault();
758                }
759            }, this));
760
761            if (this.options.enableClickableOptGroups && this.options.multiple) {
762                $("li.multiselect-group input", this.$ul).on("change", $.proxy(function (event) {
763                    event.stopPropagation();
764
765                    var $target = $(event.target);
766                    var checked = $target.prop('checked') || false;
767
768                    var $li = $(event.target).closest('li');
769                    var $group = $li.nextUntil("li.multiselect-group")
770                            .not('.multiselect-filter-hidden')
771                            .not('.disabled');
772
773                    var $inputs = $group.find("input");
774
775                    var values = [];
776                    var $options = [];
777
778                    if (this.options.selectedClass) {
779                        if (checked) {
780                            $li.addClass(this.options.selectedClass);
781                        } else {
782                            $li.removeClass(this.options.selectedClass);
783                        }
784                    }
785
786                    $.each($inputs, $.proxy(function (index, input) {
787                        var value = $(input).val();
788                        var $option = this.getOptionByValue(value);
789
790                        if (checked) {
791                            $(input).prop('checked', true);
792                            $(input).closest('li')
793                                    .addClass(this.options.selectedClass);
794
795                            $option.prop('selected', true);
796                        } else {
797                            $(input).prop('checked', false);
798                            $(input).closest('li')
799                                    .removeClass(this.options.selectedClass);
800
801                            $option.prop('selected', false);
802                        }
803
804                        $options.push(this.getOptionByValue(value));
805                    }, this))
806
807                    // Cannot use select or deselect here because it would call updateOptGroups again.
808
809                    this.options.onChange($options, checked);
810
811                    this.updateButtonText();
812                    this.updateSelectAll();
813                }, this));
814            }
815
816            if (this.options.enableCollapsibleOptGroups && this.options.multiple) {
817                $("li.multiselect-group .caret-container", this.$ul).on("click", $.proxy(function (event) {
818                    var $li = $(event.target).closest('li');
819                    var $inputs = $li.nextUntil("li.multiselect-group")
820                            .not('.multiselect-filter-hidden');
821
822                    var visible = true;
823                    $inputs.each(function () {
824                        visible = visible && $(this).is(':visible');
825                    });
826
827                    if (visible) {
828                        $inputs.hide()
829                                .addClass('multiselect-collapsible-hidden');
830                    } else {
831                        $inputs.show()
832                                .removeClass('multiselect-collapsible-hidden');
833                    }
834                }, this));
835
836                $("li.multiselect-all", this.$ul).css('background', '#f3f3f3').css('border-bottom', '1px solid #eaeaea');
837                $("li.multiselect-all > a > label.checkbox", this.$ul).css('padding', '3px 20px 3px 35px');
838                $("li.multiselect-group > a > input", this.$ul).css('margin', '4px 0px 5px -20px');
839            }
840        },
841
842        /**
843         * Create an option using the given select option.
844         *
845         * @param {jQuery} element
846         */
847        createOptionValue: function (element) {
848            var $element = $(element);
849            if ($element.is(':selected')) {
850                $element.prop('selected', true);
851            }
852
853            // Support the label attribute on options.
854            var label = this.options.optionLabel(element);
855            var classes = this.options.optionClass(element);
856            var value = $element.val();
857            var inputType = this.options.multiple ? "checkbox" : "radio";
858
859            var $li = $(this.options.templates.li);
860            var $label = $('label', $li);
861            $label.addClass(inputType);
862            $li.addClass(classes);
863
864            if (this.options.enableHTML) {
865                $label.html(" " + label);
866            } else {
867                $label.text(" " + label);
868            }
869
870            var $checkbox = $('<input/>').attr('type', inputType);
871
872            var name = this.options.checkboxName($element);
873            if (name) {
874                $checkbox.attr('name', name);
875            }
876
877            $label.prepend($checkbox);
878
879            var selected = $element.prop('selected') || false;
880            $checkbox.val(value);
881
882            if (value === this.options.selectAllValue) {
883                $li.addClass("multiselect-item multiselect-all");
884                $checkbox.parent().parent()
885                        .addClass('multiselect-all');
886            }
887
888            $label.attr('title', $element.attr('title'));
889
890            this.$ul.append($li);
891
892            if ($element.is(':disabled')) {
893                $checkbox.attr('disabled', 'disabled')
894                        .prop('disabled', true)
895                        .closest('a')
896                        .attr("tabindex", "-1")
897                        .closest('li')
898                        .addClass('disabled');
899            }
900
901            $checkbox.prop('checked', selected);
902
903            if (selected && this.options.selectedClass) {
904                $checkbox.closest('li')
905                        .addClass(this.options.selectedClass);
906            }
907        },
908
909        /**
910         * Creates a divider using the given select option.
911         *
912         * @param {jQuery} element
913         */
914        createDivider: function (element) {
915            var $divider = $(this.options.templates.divider);
916            this.$ul.append($divider);
917        },
918
919        /**
920         * Creates an optgroup.
921         *
922         * @param {jQuery} group
923         */
924        createOptgroup: function (group) {
925            var label = $(group).attr("label");
926            var value = $(group).attr("value");
927            var $li = $('<li class="multiselect-item multiselect-group"><a href="javascript:void(0);"><label><b></b></label></a></li>');
928
929            var classes = this.options.optionClass(group);
930            $li.addClass(classes);
931
932            if (this.options.enableHTML) {
933                $('label b', $li).html(" " + label);
934            } else {
935                $('label b', $li).text(" " + label);
936            }
937
938            if (this.options.enableCollapsibleOptGroups && this.options.multiple) {
939                $('a', $li).append('<span class="caret-container"><b class="caret"></b></span>');
940            }
941
942            if (this.options.enableClickableOptGroups && this.options.multiple) {
943                $('a label', $li).prepend('<input type="checkbox" value="' + value + '"/>');
944            }
945
946            if ($(group).is(':disabled')) {
947                $li.addClass('disabled');
948            }
949
950            this.$ul.append($li);
951
952            $("option", group).each($.proxy(function ($, group) {
953                this.createOptionValue(group);
954            }, this))
955        },
956
957        /**
958         * Build the select all.
959         *
960         * Checks if a select all has already been created.
961         */
962        buildSelectAll: function () {
963            if (typeof this.options.selectAllValue === 'number') {
964                this.options.selectAllValue = this.options.selectAllValue.toString();
965            }
966
967            var alreadyHasSelectAll = this.hasSelectAll();
968
969            if (!alreadyHasSelectAll && this.options.includeSelectAllOption && this.options.multiple
970                    && $('option', this.$select).length > this.options.includeSelectAllIfMoreThan) {
971
972                // Check whether to add a divider after the select all.
973                if (this.options.includeSelectAllDivider) {
974                    this.$ul.prepend($(this.options.templates.divider));
975                }
976
977                var $li = $(this.options.templates.li);
978                $('label', $li).addClass("checkbox");
979
980                if (this.options.enableHTML) {
981                    $('label', $li).html(" " + this.options.selectAllText);
982                } else {
983                    $('label', $li).text(" " + this.options.selectAllText);
984                }
985
986                if (this.options.selectAllName) {
987                    $('label', $li).prepend('<input type="checkbox" name="' + this.options.selectAllName + '" />');
988                } else {
989                    $('label', $li).prepend('<input type="checkbox" />');
990                }
991
992                var $checkbox = $('input', $li);
993                $checkbox.val(this.options.selectAllValue);
994
995                $li.addClass("multiselect-item multiselect-all");
996                $checkbox.parent().parent()
997                        .addClass('multiselect-all');
998
999                this.$ul.prepend($li);
1000
1001                $checkbox.prop('checked', false);
1002            }
1003        },
1004
1005        /**
1006         * Builds the filter.
1007         */
1008        buildFilter: function () {
1009
1010            // Build filter if filtering OR case insensitive filtering is enabled and the number of options exceeds (or equals) enableFilterLength.
1011            if (this.options.enableFiltering || this.options.enableCaseInsensitiveFiltering) {
1012                var enableFilterLength = Math.max(this.options.enableFiltering, this.options.enableCaseInsensitiveFiltering);
1013
1014                if (this.$select.find('option').length >= enableFilterLength) {
1015
1016                    this.$filter = $(this.options.templates.filter);
1017                    $('input', this.$filter).attr('placeholder', this.options.filterPlaceholder);
1018
1019                    // Adds optional filter clear button
1020                    if (this.options.includeFilterClearBtn) {
1021                        var clearBtn = $(this.options.templates.filterClearBtn);
1022                        clearBtn.on('click', $.proxy(function (event) {
1023                            clearTimeout(this.searchTimeout);
1024
1025                            this.$filter.find('.multiselect-search').val('');
1026                            $('li', this.$ul).show().removeClass('multiselect-filter-hidden');
1027
1028                            this.updateSelectAll();
1029
1030                            if (this.options.enableClickableOptGroups && this.options.multiple) {
1031                                this.updateOptGroups();
1032                            }
1033
1034                        }, this));
1035                        this.$filter.find('.input-group').append(clearBtn);
1036                    }
1037
1038                    this.$ul.prepend(this.$filter);
1039
1040                    this.$filter.val(this.query).on('click', function (event) {
1041                        event.stopPropagation();
1042                    }).on('input keydown', $.proxy(function (event) {
1043                        // Cancel enter key default behaviour
1044                        if (event.which === 13) {
1045                            event.preventDefault();
1046                        }
1047
1048                        // This is useful to catch "keydown" events after the browser has updated the control.
1049                        clearTimeout(this.searchTimeout);
1050
1051                        this.searchTimeout = this.asyncFunction($.proxy(function () {
1052
1053                            if (this.query !== event.target.value) {
1054                                this.query = event.target.value;
1055
1056                                var currentGroup, currentGroupVisible;
1057                                $.each($('li', this.$ul), $.proxy(function (index, element) {
1058                                    var value = $('input', element).length > 0 ? $('input', element).val() : "";
1059                                    var text = $('label', element).text();
1060
1061                                    var filterCandidate = '';
1062                                    if ((this.options.filterBehavior === 'text')) {
1063                                        filterCandidate = text;
1064                                    } else if ((this.options.filterBehavior === 'value')) {
1065                                        filterCandidate = value;
1066                                    } else if (this.options.filterBehavior === 'both') {
1067                                        filterCandidate = text + '\n' + value;
1068                                    }
1069
1070                                    if (value !== this.options.selectAllValue && text) {
1071
1072                                        // By default lets assume that element is not
1073                                        // interesting for this search.
1074                                        var showElement = false;
1075
1076                                        if (this.options.enableCaseInsensitiveFiltering) {
1077                                            filterCandidate = filterCandidate.toLowerCase();
1078                                            this.query = this.query.toLowerCase();
1079                                        }
1080
1081                                        if (this.options.enableFullValueFiltering && this.options.filterBehavior !== 'both') {
1082                                            var valueToMatch = filterCandidate.trim().substring(0, this.query.length);
1083                                            if (this.query.indexOf(valueToMatch) > -1) {
1084                                                showElement = true;
1085                                            }
1086                                        } else if (filterCandidate.indexOf(this.query) > -1) {
1087                                            showElement = true;
1088                                        }
1089
1090                                        // Toggle current element (group or group item) according to showElement boolean.
1091                                        $(element).toggle(showElement)
1092                                                .toggleClass('multiselect-filter-hidden', !showElement);
1093
1094                                        // Differentiate groups and group items.
1095                                        if ($(element).hasClass('multiselect-group')) {
1096                                            // Remember group status.
1097                                            currentGroup = element;
1098                                            currentGroupVisible = showElement;
1099                                        } else {
1100                                            // Show group name when at least one of its items is visible.
1101                                            if (showElement) {
1102                                                $(currentGroup).show()
1103                                                        .removeClass('multiselect-filter-hidden');
1104                                            }
1105
1106                                            // Show all group items when group name satisfies filter.
1107                                            if (!showElement && currentGroupVisible) {
1108                                                $(element).show()
1109                                                        .removeClass('multiselect-filter-hidden');
1110                                            }
1111                                        }
1112                                    }
1113                                }, this));
1114                            }
1115
1116                            this.updateSelectAll();
1117
1118                            if (this.options.enableClickableOptGroups && this.options.multiple) {
1119                                this.updateOptGroups();
1120                            }
1121
1122                            this.options.onFiltering(event.target);
1123
1124                        }, this), 300, this);
1125                    }, this));
1126                }
1127            }
1128        },
1129
1130        /**
1131         * Unbinds the whole plugin.
1132         */
1133        destroy: function () {
1134            this.$container.remove();
1135            this.$select.show();
1136
1137            // reset original state
1138            this.$select.prop('disabled', this.options.wasDisabled);
1139
1140            this.$select.data('multiselect', null);
1141        },
1142
1143        /**
1144         * Refreshs the multiselect based on the selected options of the select.
1145         */
1146        refresh: function () {
1147            var inputs = $.map($('li input', this.$ul), $);
1148
1149            $('option', this.$select).each($.proxy(function (index, element) {
1150                var $elem = $(element);
1151                var value = $elem.val();
1152                var $input;
1153                for (var i = inputs.length; 0 < i--; /**/) {
1154                    if (value !== ($input = inputs[i]).val())
1155                        continue; // wrong li
1156
1157                    if ($elem.is(':selected')) {
1158                        $input.prop('checked', true);
1159
1160                        if (this.options.selectedClass) {
1161                            $input.closest('li')
1162                                    .addClass(this.options.selectedClass);
1163                        }
1164                    } else {
1165                        $input.prop('checked', false);
1166
1167                        if (this.options.selectedClass) {
1168                            $input.closest('li')
1169                                    .removeClass(this.options.selectedClass);
1170                        }
1171                    }
1172
1173                    if ($elem.is(":disabled")) {
1174                        $input.attr('disabled', 'disabled')
1175                                .prop('disabled', true)
1176                                .closest('li')
1177                                .addClass('disabled');
1178                    } else {
1179                        $input.prop('disabled', false)
1180                                .closest('li')
1181                                .removeClass('disabled');
1182                    }
1183                    break; // assumes unique values
1184                }
1185            }, this));
1186
1187            this.updateButtonText();
1188            this.updateSelectAll();
1189
1190            if (this.options.enableClickableOptGroups && this.options.multiple) {
1191                this.updateOptGroups();
1192            }
1193        },
1194
1195        /**
1196         * Select all options of the given values.
1197         *
1198         * If triggerOnChange is set to true, the on change event is triggered if
1199         * and only if one value is passed.
1200         *
1201         * @param {Array} selectValues
1202         * @param {Boolean} triggerOnChange
1203         */
1204        select: function (selectValues, triggerOnChange) {
1205            if (!$.isArray(selectValues)) {
1206                selectValues = [selectValues];
1207            }
1208
1209            for (var i = 0; i < selectValues.length; i++) {
1210                var value = selectValues[i];
1211
1212                if (value === null || value === undefined) {
1213                    continue;
1214                }
1215
1216                var $option = this.getOptionByValue(value);
1217                var $checkbox = this.getInputByValue(value);
1218
1219                if ($option === undefined || $checkbox === undefined) {
1220                    continue;
1221                }
1222
1223                if (!this.options.multiple) {
1224                    this.deselectAll(false);
1225                }
1226
1227                if (this.options.selectedClass) {
1228                    $checkbox.closest('li')
1229                            .addClass(this.options.selectedClass);
1230                }
1231
1232                $checkbox.prop('checked', true);
1233                $option.prop('selected', true);
1234
1235                if (triggerOnChange) {
1236                    this.options.onChange($option, true);
1237                }
1238            }
1239
1240            this.updateButtonText();
1241            this.updateSelectAll();
1242
1243            if (this.options.enableClickableOptGroups && this.options.multiple) {
1244                this.updateOptGroups();
1245            }
1246        },
1247
1248        /**
1249         * Clears all selected items.
1250         */
1251        clearSelection: function () {
1252            this.deselectAll(false);
1253            this.updateButtonText();
1254            this.updateSelectAll();
1255
1256            if (this.options.enableClickableOptGroups && this.options.multiple) {
1257                this.updateOptGroups();
1258            }
1259        },
1260
1261        /**
1262         * Deselects all options of the given values.
1263         *
1264         * If triggerOnChange is set to true, the on change event is triggered, if
1265         * and only if one value is passed.
1266         *
1267         * @param {Array} deselectValues
1268         * @param {Boolean} triggerOnChange
1269         */
1270        deselect: function (deselectValues, triggerOnChange) {
1271            if (!$.isArray(deselectValues)) {
1272                deselectValues = [deselectValues];
1273            }
1274
1275            for (var i = 0; i < deselectValues.length; i++) {
1276                var value = deselectValues[i];
1277
1278                if (value === null || value === undefined) {
1279                    continue;
1280                }
1281
1282                var $option = this.getOptionByValue(value);
1283                var $checkbox = this.getInputByValue(value);
1284
1285                if ($option === undefined || $checkbox === undefined) {
1286                    continue;
1287                }
1288
1289                if (this.options.selectedClass) {
1290                    $checkbox.closest('li')
1291                            .removeClass(this.options.selectedClass);
1292                }
1293
1294                $checkbox.prop('checked', false);
1295                $option.prop('selected', false);
1296
1297                if (triggerOnChange) {
1298                    this.options.onChange($option, false);
1299                }
1300            }
1301
1302            this.updateButtonText();
1303            this.updateSelectAll();
1304
1305            if (this.options.enableClickableOptGroups && this.options.multiple) {
1306                this.updateOptGroups();
1307            }
1308        },
1309
1310        /**
1311         * Selects all enabled & visible options.
1312         *
1313         * If justVisible is true or not specified, only visible options are selected.
1314         *
1315         * @param {Boolean} justVisible
1316         * @param {Boolean} triggerOnSelectAll
1317         */
1318        selectAll: function (justVisible, triggerOnSelectAll) {
1319
1320            var justVisible = typeof justVisible === 'undefined' ? true : justVisible;
1321            var allLis = $("li:not(.divider):not(.disabled):not(.multiselect-group)", this.$ul);
1322            var visibleLis = $("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)", this.$ul).filter(':visible');
1323
1324            if (justVisible) {
1325                $('input:enabled', visibleLis).prop('checked', true);
1326                visibleLis.addClass(this.options.selectedClass);
1327
1328                $('input:enabled', visibleLis).each($.proxy(function (index, element) {
1329                    var value = $(element).val();
1330                    var option = this.getOptionByValue(value);
1331                    $(option).prop('selected', true);
1332                }, this));
1333            } else {
1334                $('input:enabled', allLis).prop('checked', true);
1335                allLis.addClass(this.options.selectedClass);
1336
1337                $('input:enabled', allLis).each($.proxy(function (index, element) {
1338                    var value = $(element).val();
1339                    var option = this.getOptionByValue(value);
1340                    $(option).prop('selected', true);
1341                }, this));
1342            }
1343
1344            $('li input[value="' + this.options.selectAllValue + '"]', this.$ul).prop('checked', true);
1345
1346            if (this.options.enableClickableOptGroups && this.options.multiple) {
1347                this.updateOptGroups();
1348            }
1349
1350            if (triggerOnSelectAll) {
1351                this.options.onSelectAll();
1352            }
1353        },
1354
1355        /**
1356         * Deselects all options.
1357         *
1358         * If justVisible is true or not specified, only visible options are deselected.
1359         *
1360         * @param {Boolean} justVisible
1361         */
1362        deselectAll: function (justVisible, triggerOnDeselectAll) {
1363
1364            var justVisible = typeof justVisible === 'undefined' ? true : justVisible;
1365            var allLis = $("li:not(.divider):not(.disabled):not(.multiselect-group)", this.$ul);
1366            var visibleLis = $("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)", this.$ul).filter(':visible');
1367
1368            if (justVisible) {
1369                $('input[type="checkbox"]:enabled', visibleLis).prop('checked', false);
1370                visibleLis.removeClass(this.options.selectedClass);
1371
1372                $('input[type="checkbox"]:enabled', visibleLis).each($.proxy(function (index, element) {
1373                    var value = $(element).val();
1374                    var option = this.getOptionByValue(value);
1375                    $(option).prop('selected', false);
1376                }, this));
1377            } else {
1378                $('input[type="checkbox"]:enabled', allLis).prop('checked', false);
1379                allLis.removeClass(this.options.selectedClass);
1380
1381                $('input[type="checkbox"]:enabled', allLis).each($.proxy(function (index, element) {
1382                    var value = $(element).val();
1383                    var option = this.getOptionByValue(value);
1384                    $(option).prop('selected', false);
1385                }, this));
1386            }
1387
1388            $('li input[value="' + this.options.selectAllValue + '"]', this.$ul).prop('checked', false);
1389
1390            if (this.options.enableClickableOptGroups && this.options.multiple) {
1391                this.updateOptGroups();
1392            }
1393
1394            if (triggerOnDeselectAll) {
1395                this.options.onDeselectAll();
1396            }
1397        },
1398
1399        /**
1400         * Rebuild the plugin.
1401         *
1402         * Rebuilds the dropdown, the filter and the select all option.
1403         */
1404        rebuild: function () {
1405            this.$ul.html('');
1406
1407            // Important to distinguish between radios and checkboxes.
1408            this.options.multiple = this.$select.attr('multiple') === "multiple";
1409
1410            this.buildSelectAll();
1411            this.buildDropdownOptions();
1412            this.buildFilter();
1413
1414            this.updateButtonText();
1415            this.updateSelectAll(true);
1416
1417            if (this.options.enableClickableOptGroups && this.options.multiple) {
1418                this.updateOptGroups();
1419            }
1420
1421            if (this.options.disableIfEmpty && $('option', this.$select).length <= 0) {
1422                this.disable();
1423            } else {
1424                this.enable();
1425            }
1426
1427            if (this.options.dropRight) {
1428                this.$ul.addClass('pull-right');
1429            }
1430        },
1431
1432        /**
1433         * The provided data will be used to build the dropdown.
1434         */
1435        dataprovider: function (dataprovider) {
1436
1437            var groupCounter = 0;
1438            var $select = this.$select.empty();
1439
1440            $.each(dataprovider, function (index, option) {
1441                var $tag;
1442
1443                if ($.isArray(option.children)) { // create optiongroup tag
1444                    groupCounter++;
1445
1446                    $tag = $('<optgroup/>').attr({
1447                        label: option.label || 'Group ' + groupCounter,
1448                        disabled: !!option.disabled
1449                    });
1450
vendor: 5,353 bytes, lines 1451-1596
1451                    forEach(option.children, function (subOption) { // add children option tags
1452                        var attributes = {
1453                            value: subOption.value,
1454                            label: subOption.label || subOption.value,
1455                            title: subOption.title,
1456                            selected: !!subOption.selected,
1457                            disabled: !!subOption.disabled
1458                        };
1459
1460                        //Loop through attributes object and add key-value for each attribute
1461                        for (var key in subOption.attributes) {
1462                            attributes['data-' + key] = subOption.attributes[key];
1463                        }
1464                        //Append original attributes + new data attributes to option
1465                        $tag.append($('<option/>').attr(attributes));
1466                    });
1467                } else {
1468
1469                    var attributes = {
1470                        'value': option.value,
1471                        'label': option.label || option.value,
1472                        'title': option.title,
1473                        'class': option.class,
1474                        'selected': !!option.selected,
1475                        'disabled': !!option.disabled
1476                    };
1477                    //Loop through attributes object and add key-value for each attribute
1478                    for (var key in option.attributes) {
1479                        attributes['data-' + key] = option.attributes[key];
1480                    }
1481                    //Append original attributes + new data attributes to option
1482                    $tag = $('<option/>').attr(attributes);
1483
1484                    $tag.text(option.label || option.value);
1485                }
1486
1487                $select.append($tag);
1488            });
1489
1490            this.rebuild();
1491        },
1492
1493        /**
1494         * Enable the multiselect.
1495         */
1496        enable: function () {
1497            this.$select.prop('disabled', false);
1498            this.$button.prop('disabled', false)
1499                    .removeClass('disabled');
1500        },
1501
1502        /**
1503         * Disable the multiselect.
1504         */
1505        disable: function () {
1506            this.$select.prop('disabled', true);
1507            this.$button.prop('disabled', true)
1508                    .addClass('disabled');
1509        },
1510
1511        /**
1512         * Set the options.
1513         *
1514         * @param {Array} options
1515         */
1516        setOptions: function (options) {
1517            this.options = this.mergeOptions(options);
1518        },
1519
1520        /**
1521         * Merges the given options with the default options.
1522         *
1523         * @param {Array} options
1524         * @returns {Array}
1525         */
1526        mergeOptions: function (options) {
1527            return $.extend(true, {}, this.defaults, this.options, options);
1528        },
1529
1530        /**
1531         * Checks whether a select all checkbox is present.
1532         *
1533         * @returns {Boolean}
1534         */
1535        hasSelectAll: function () {
1536            return $('li.multiselect-all', this.$ul).length > 0;
1537        },
1538
1539        /**
1540         * Update opt groups.
1541         */
1542        updateOptGroups: function () {
1543            var $groups = $('li.multiselect-group', this.$ul)
1544            var selectedClass = this.options.selectedClass;
1545
1546            $groups.each(function () {
1547                var $options = $(this).nextUntil('li.multiselect-group')
1548                        .not('.multiselect-filter-hidden')
1549                        .not('.disabled');
1550
1551                var checked = true;
1552                $options.each(function () {
1553                    var $input = $('input', this);
1554
1555                    if (!$input.prop('checked')) {
1556                        checked = false;
1557                    }
1558                });
1559
1560                if (selectedClass) {
1561                    if (checked) {
1562                        $(this).addClass(selectedClass);
1563                    } else {
1564                        $(this).removeClass(selectedClass);
1565                    }
1566                }
1567
1568                $('input', this).prop('checked', checked);
1569            });
1570        },
1571
1572        /**
1573         * Updates the select all checkbox based on the currently displayed and selected checkboxes.
1574         */
1575        updateSelectAll: function (notTriggerOnSelectAll) {
1576            if (this.hasSelectAll()) {
1577                var allBoxes = $("li:not(.multiselect-item):not(.multiselect-filter-hidden):not(.multiselect-group):not(.disabled) input:enabled", this.$ul);
1578                var allBoxesLength = allBoxes.length;
1579                var checkedBoxesLength = allBoxes.filter(":checked").length;
1580                var selectAllLi = $("li.multiselect-all", this.$ul);
1581                var selectAllInput = selectAllLi.find("input");
1582
1583                if (checkedBoxesLength > 0 && checkedBoxesLength === allBoxesLength) {
1584                    selectAllInput.prop("checked", true);
1585                    selectAllLi.addClass(this.options.selectedClass);
1586                } else {
1587                    selectAllInput.prop("checked", false);
1588                    selectAllLi.removeClass(this.options.selectedClass);
1589                }
1590            }
1591        },
1592
1593        /**
1594         * Update the button text and its title based on the currently selected options.
1595         */
1596        updateButtonText: function () {
1597            var options = this.getSelected();
1598
1599            // First update the displayed button text.
1600            if (this.options.enableHTML) {
1601                $('.multiselect .multiselect-selected-text', this.$container).html(this.options.buttonText(options, this.$select));
1602            } else {
1603                $('.multiselect .multiselect-selected-text', this.$container).text(this.options.buttonText(options, this.$select));
1604            }
1605
1606            // Now update the title attribute of the button.
1607            $('.multiselect', this.$container).attr('title', this.options.buttonTitle(options, this.$select));
1608        },
1609
1610        /**
1611         * Get all selected options.
1612         *
1613         * @returns {jQUery}
1614         */
1615        getSelected: function () {
1616            return $('option', this.$select).filter(":selected");
1617        },
1618
1619        /**
1620         * Gets a select option by its value.
1621         *
1622         * @param {String} value
1623         * @returns {jQuery}
1624         */
1625        getOptionByValue: function (value) {
1626
1627            var options = $('option', this.$select);
1628            var valueToCompare = value.toString();
1629
1630            for (var i = 0; i < options.length; i = i + 1) {
1631                var option = options[i];
1632                if (option.value === valueToCompare) {
1633                    return $(option);
1634                }
1635            }
1636        },
1637
1638        /**
1639         * Get the input (radio/checkbox) by its value.
1640         *
1641         * @param {String} value
1642         * @returns {jQuery}
1643         */
1644        getInputByValue: function (value) {
1645
1646            var checkboxes = $('li input:not(.multiselect-search)', this.$ul);
1647            var valueToCompare = value.toString();
1648
1649            for (var i = 0; i < checkboxes.length; i = i + 1) {
1650                var checkbox = checkboxes[i];
1651                if (checkbox.value === valueToCompare) {
1652                    return $(checkbox);
1653                }
1654            }
1655        },
1656
1657        /**
1658         * Used for knockout integration.
1659         */
1660        updateOriginalOptions: function () {
1661            this.originalOptions = this.$select.clone()[0].options;
1662        },
1663
1664        asyncFunction: function (callback, timeout, self) {
1665            var args = Array.prototype.slice.call(arguments, 3);
1666            return setTimeout(function () {
1667                callback.apply(self || window, args);
1668            }, timeout);
1669        },
1670
1671        setAllSelectedText: function (allSelectedText) {
1672            this.options.allSelectedText = allSelectedText;
1673            this.updateButtonText();
1674        }
1675    };
1676
1677    $.fn.multiselect = function (option, parameter, extraOptions) {
1678        return this.each(function () {
1679            var data = $(this).data('multiselect');
1680            var options = typeof option === 'object' && option;
1681
1682            // Initialize the multiselect.
1683            if (!data) {
1684                data = new Multiselect(this, options);
1685                $(this).data('multiselect', data);
1686            }
1687
1688            // Call multiselect method.
1689            if (typeof option === 'string') {
1690                data[option](parameter, extraOptions);
1691
1692                if (option === 'destroy') {
1693                    $(this).data('multiselect', false);
1694                }
1695            }
1696        });
1697    };
1698
1699    $.fn.multiselect.Constructor = Multiselect;
1700
1701    $(function () {
1702        $("select[data-role=multiselect]").multiselect();
1703    });
1704
1705}(window.jQuery);
1706/*========================
1707 Grid List jqury
1708 =========================*/
1709$(function () {
1710
1711    $('#wlt_txn_type').on('change', function () {
1712        if ($(this).val() == 'list') {
1713            $('#products .item').addClass('list-group-item');
1714            $('#products .item').removeClass('grid-group-item');
1715        } else {
1716            $('#products .item').addClass('grid-group-item');
1717            $('#products .item').removeClass('list-group-item');
1718        }
1719    });
1720
1721});
1722
1723/*=============================
1724 Navigation onclick jqury
1725 ==============================*/
1726if ($(window).width() > 768) {
1727    $(".navbar-default .navbar-nav li").mouseover(function (e) {
1728        $(this).toggleClass('');
1729        e.preventDefault();
1730    });
1731}
1732if ($(window).width() > 768) {
1733    $(".navbar-default .navbar-nav li.nav1").mouseover(function (e) {
1734        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1735        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1736        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1737        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1738        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1739        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1740        e.preventDefault();
1741    });
1742}
1743if ($(window).width() > 768) {
1744    $(".navbar-default .navbar-nav li.nav2").mouseover(function (e) {
1745        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1746        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1747        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1748        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1749        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1750        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1751        e.preventDefault();
1752    });
1753}
1754if ($(window).width() > 768) {
1755    $(".navbar-default .navbar-nav li.nav3").mouseover(function (e) {
1756        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1757        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1758        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1759        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1760        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1761        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1762        e.preventDefault();
1763    });
1764}
1765if ($(window).width() > 768) {
1766    $(".navbar-default .navbar-nav li.nav4").mouseover(function (e) {
1767        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1768        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1769        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1770        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1771        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1772        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1773        e.preventDefault();
1774    });
1775}
1776if ($(window).width() > 768) {
1777    $(".navbar-default .navbar-nav li.nav5").mouseover(function (e) {
1778        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1779        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1780        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1781        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1782        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1783        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1784        e.preventDefault();
1785    });
1786}
1787if ($(window).width() > 768) {
1788    $(".navbar-default .navbar-nav li.nav6").mouseover(function (e) {
1789        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1790        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1791        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1792        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1793        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1794        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1795        e.preventDefault();
1796    });
1797}
1798if ($(window).width() > 768) {
1799    $(".navbar-default .navbar-nav li.nav7").mouseover(function (e) {
1800        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1801        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1802        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1803        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1804        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1805        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1806        e.preventDefault();
1807    });
1808}
1809if ($(window).width() < 768) {
1810    $(".navbar-default .navbar-nav li").on('click', function (e) {
1811        $(this).toggleClass('active');
1812        e.preventDefault();
1813    });
1814}
1815if ($(window).width() < 768) {
1816    $(".navbar-default .navbar-nav li.nav1").on('click', function (e) {
1817        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1818        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1819        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1820        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1821        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1822        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1823        $(".navbar-default .navbar-nav li.nav2").toggleClass("abch");
1824        $(".navbar-default .navbar-nav li.nav3").toggleClass("abch");
1825        $(".navbar-default .navbar-nav li.nav4").toggleClass("abch");
1826        $(".navbar-default .navbar-nav li.nav5").toggleClass("abch");
1827        $(".navbar-default .navbar-nav li.nav6").toggleClass("abch");
1828        $(".navbar-default .navbar-nav li.nav7").toggleClass("abch");
1829        e.preventDefault();
1830    });
1831
1832}
1833if ($(window).width() < 768) {
1834    $(".navbar-default .navbar-nav li.nav2").on('click', function (e) {
1835        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1836        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1837        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1838        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1839        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1840        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1841        $(".navbar-default .navbar-nav li.nav1").toggleClass("abch");
1842        $(".navbar-default .navbar-nav li.nav3").toggleClass("abch");
1843        $(".navbar-default .navbar-nav li.nav4").toggleClass("abch");
1844        $(".navbar-default .navbar-nav li.nav5").toggleClass("abch");
1845        $(".navbar-default .navbar-nav li.nav6").toggleClass("abch");
1846        $(".navbar-default .navbar-nav li.nav7").toggleClass("abch");
1847        e.preventDefault();
1848    });
1849}
1850if ($(window).width() < 768) {
1851    $(".navbar-default .navbar-nav li.nav3").on('click', function (e) {
1852        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1853        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1854        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1855        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1856        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1857        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1858        $(".navbar-default .navbar-nav li.nav1").toggleClass("abch");
1859        $(".navbar-default .navbar-nav li.nav2").toggleClass("abch");
1860        $(".navbar-default .navbar-nav li.nav4").toggleClass("abch");
1861        $(".navbar-default .navbar-nav li.nav5").toggleClass("abch");
1862        $(".navbar-default .navbar-nav li.nav6").toggleClass("abch");
1863        $(".navbar-default .navbar-nav li.nav7").toggleClass("abch");
1864        e.preventDefault();
1865    });
1866}
1867if ($(window).width() < 768) {
1868    $(".navbar-default .navbar-nav li.nav4").on('click', function (e) {
1869        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1870        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1871        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1872        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1873        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1874        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1875        $(".navbar-default .navbar-nav li.nav1").toggleClass("abch");
1876        $(".navbar-default .navbar-nav li.nav2").toggleClass("abch");
1877        $(".navbar-default .navbar-nav li.nav3").toggleClass("abch");
1878        $(".navbar-default .navbar-nav li.nav5").toggleClass("abch");
1879        $(".navbar-default .navbar-nav li.nav6").toggleClass("abch");
1880        $(".navbar-default .navbar-nav li.nav7").toggleClass("abch");
1881        e.preventDefault();
1882    });
1883}
1884if ($(window).width() < 768) {
1885    $(".navbar-default .navbar-nav li.nav5").on('click', function (e) {
1886        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1887        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1888        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1889        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1890        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1891        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1892        $(".navbar-default .navbar-nav li.nav1").toggleClass("abch");
1893        $(".navbar-default .navbar-nav li.nav2").toggleClass("abch");
1894        $(".navbar-default .navbar-nav li.nav3").toggleClass("abch");
1895        $(".navbar-default .navbar-nav li.nav4").toggleClass("abch");
1896        $(".navbar-default .navbar-nav li.nav6").toggleClass("abch");
1897        $(".navbar-default .navbar-nav li.nav7").toggleClass("abch");
1898        e.preventDefault();
1899    });
1900}
1901if ($(window).width() < 768) {
1902    $(".navbar-default .navbar-nav li.nav6").on('click', function (e) {
1903        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1904        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1905        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1906        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1907        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1908        $(".navbar-default .navbar-nav li.nav7.active").removeClass('active');
1909        $(".navbar-default .navbar-nav li.nav1").toggleClass("abch");
1910        $(".navbar-default .navbar-nav li.nav2").toggleClass("abch");
1911        $(".navbar-default .navbar-nav li.nav3").toggleClass("abch");
1912        $(".navbar-default .navbar-nav li.nav4").toggleClass("abch");
1913        $(".navbar-default .navbar-nav li.nav5").toggleClass("abch");
1914        $(".navbar-default .navbar-nav li.nav7").toggleClass("abch");
1915        e.preventDefault();
1916    });
1917}
1918if ($(window).width() < 768) {
1919    $(".navbar-default .navbar-nav li.nav7").on('click', function (e) {
1920        $(".navbar-default .navbar-nav li.nav1.active").removeClass('active');
1921        $(".navbar-default .navbar-nav li.nav2.active").removeClass('active');
1922        $(".navbar-default .navbar-nav li.nav3.active").removeClass('active');
1923        $(".navbar-default .navbar-nav li.nav4.active").removeClass('active');
1924        $(".navbar-default .navbar-nav li.nav5.active").removeClass('active');
1925        $(".navbar-default .navbar-nav li.nav6.active").removeClass('active');
1926        $(".navbar-default .navbar-nav li.nav1").toggleClass("abch");
1927        $(".navbar-default .navbar-nav li.nav2").toggleClass("abch");
1928        $(".navbar-default .navbar-nav li.nav3").toggleClass("abch");
1929        $(".navbar-default .navbar-nav li.nav4").toggleClass("abch");
1930        $(".navbar-default .navbar-nav li.nav5").toggleClass("abch");
1931        $(".navbar-default .navbar-nav li.nav6").toggleClass("abch");
1932        e.preventDefault();
1933    });
1934
1935    $(".mobail-header .navbar-default .navbar-toggle").click(function () {
1936        $(".mobail-header .search-sec").toggleClass("testing");
1937    });
1938	$(".navbar-default .navbar-nav .sub-menu li a").on('click', function (e) {
1939		$url = $(this).attr('href');
1940        window.location = $url;
1941        return true;
1942    });
1943}
1944/*=============================
1945 Header sticky jqury
1946 ==============================*/
1947$(window).scroll(function () {
1948    if ($(document).scrollTop() > 150) {
1949        $('.header-wrapper').addClass('shrink');
1950    } else {
1951        $('.header-wrapper').removeClass('shrink');
1952    }
1953});
1954$(document).ready(function () {
1955    $('.thumb').click(function (e) {
1956        var dataSlide = $(this).attr('data-slide-to');
1957        if (dataSlide == '2') {
1958            e.preventDefault();
1959            $("#video")[0].contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*')
1960
1961        } else {
1962            e.preventDefault();
1963            $("#video")[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*')
1964
1965        }
1966    });
1967
1968    $('.reload_btn').click(function () {
1969        location.reload();
1970    });
1971
1972});
1973
1974$(document).ready(function () {
1975    $("a.morelink").click(function () {
1976        var morelesstext = $(".more-less-text-span").text();
1977        if (morelesstext == 'View More') {
1978            $(".more-less-text-span").text('View Less');
1979        } else {
1980            $(".more-less-text-span").text('View More');
1981        }
1982    });
1983
1984    $divcount = 0;
1985    $(".seven-menus .m-link").each(function () {
1986        $divcount++;
1987        if($divcount > 7) {
1988            $html = $(this).html();
1989            $('#viewmorepanel .panel-body').append('<div class="squaredFour">'+$html+'</div>');
1990            $('#viewmoreaccordion').show();
1991        }
1992    });
1993    $divcount = 0;
1994    $(".seven-menus .m-link").each(function () {
1995        $divcount++;
1996        if($divcount > 7) {
1997            $(this).remove();
1998        }
1999    });
2000});
2001                                                
2002
2003function hide(target) {
2004    document.getElementById(target).style.display = 'none';
2005    $('.header').css('top', '0');
2006}    
2007
2008$(document).ready(function () { 
2009	$('.leftnav .nav a').on('click', function () { 
2010		$('html, body').animate({scrollTop: $(this.hash).offset().top - 180}, 1000); 
2011		return false; 
2012	}); 
2013});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.