/* * Better Select Multiple - jQuery Plugin * * based on Alternate Select Multiple (asmSelect) 1.0.4a beta (http://www.ryancramer.com/projects/asmselect/) * * Copyright (c) 2009 by Ryan Cramer - http://www.ryancramer.com * Copyright (c) 2010 by Victor Berchet - http://www.github.com/vicb * * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. * * bsmSelect version: v1.4.3 - 2011-05-05 */ (function($) { function BsmSelect(target, options) { this.$original = $(target); // the original select multiple this.buildingSelect = false; // is the new select being constructed right now? this.ieClick = false; // in IE, has a click event occurred? ignore if not this.ignoreOriginalChangeEvent = false; // originalChangeEvent bypassed when this is true this.options = options; this.buildDom(); } BsmSelect.prototype = { /** * Generate an UID */ generateUid: function(index) { return (this.uid = this.options.containerClass + index); }, /** * Build the DOM for bsmSelect */ buildDom: function() { var self = this, o = this.options; if (o.addItemTarget === 'original') { $('option', this.$original).each(function(i, o) { if ($(o).data('bsm-order') === null) { $(o).data('bsm-order', i); } }); } for (var index = 0; $('#' + this.generateUid(index)).size(); index++) {} this.$select = $(' optionDisabledClass: 'bsmOptionDisabled', // Class for items that are already selected / disabled listClass: 'bsmList', // Class for the list ($list) listItemClass: 'bsmListItem', // Class for the
  • list items listItemLabelClass: 'bsmListItemLabel', // Class for the label text that appears in list items removeClass: 'bsmListItemRemove', // Class given to the 'remove' link highlightClass: 'bsmHighlight' // Class given to the highlight }; })(jQuery);