/* jshint forin:true, noarg:true, noempty:true, eqeqeq:true, boss:true, undef:true, curly:true, browser:true, jquery:true */ /* * jQuery MultiSelect UI Widget 2.0.1 * Copyright (c) 2012 Eric Hynds * * http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/ * * Depends: * - jQuery 1.4.2+ * - jQuery UI 1.11 widget factory * * Optional: * - jQuery UI effects * - jQuery UI position utility * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ (function($, undefined) { // Counter used to prevent collisions var multiselectID = 0; var $doc = $(document); $.widget("ech.multiselect", { // default options options: { header: true, height: 175, minWidth: 225, classes: '', checkAllText: 'Check all', uncheckAllText: 'Uncheck all', noneSelectedText: 'Select options', showCheckAll: true, showUncheckAll: true, selectedText: '# selected', selectedList: 0, closeIcon: 'ui-icon-circle-close', show: null, hide: null, autoOpen: false, multiple: true, position: {}, appendTo: null, menuWidth:null, selectedListSeparator: ', ', disableInputsOnToggle: true, groupColumns: false }, _getAppendEl: function() { var element = this.options.appendTo; if(element) { element = element.jquery || element.nodeType ? $(element) : this.document.find(element).eq(0); } if(!element || !element[0]) { element = this.element.closest(".ui-front, dialog"); } if(!element.length) { element = this.document[0].body; } return element; }, _create: function() { var el = this.element; var o = this.options; this.speed = $.fx.speeds._default; // default speed for effects this._isOpen = false; // assume no this.inputIdCounter = 0; // create a unique namespace for events that the widget // factory cannot unbind automatically. Use eventNamespace if on // jQuery UI 1.9+, and otherwise fallback to a custom string. this._namespaceID = this.eventNamespace || ('multiselect' + multiselectID); // bump unique ID after assigning it to the widget instance this.multiselectID = multiselectID++; var button = (this.button = $('')) .addClass('ui-multiselect ui-widget ui-state-default ui-corner-all') .addClass(o.classes) .attr({ 'title':el.attr('title'), 'tabIndex':el.attr('tabIndex'), 'id': el.attr('id') ? el.attr('id') + '_ms' : null }) .prop('aria-haspopup', true) .insertAfter(el); this.buttonlabel = $('') .html(o.noneSelectedText) .appendTo(button); this.menu = $('
') .addClass('ui-multiselect-menu ui-widget ui-widget-content ui-corner-all') .addClass(o.classes) .appendTo(this._getAppendEl()); this.header = $('
') .addClass('ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix') .appendTo(this.menu); this.headerLinkContainer = $('