/* * jquery.sumoselect - v3.0.3 * http://hemantnegi.github.io/jquery.sumoselect * 2016-12-12 * * Copyright 2015 Hemant Negi * Email : hemant.frnz@gmail.com * Compressor http://refresh-sf.com/ */ (function(factory) { 'use strict'; if (typeof define === 'function' && define.amd) { define(['jquery'], factory); } else if (typeof exports !== 'undefined') { module.exports = factory(require('jquery')); } else { factory(jQuery); } })(function ($) { 'namespace sumo'; $.fn.SumoSelect = function (options) { /* This is the easiest way to have default options.*/ var settings = $.extend({ placeholder: 'Select Here', /* Dont change it here.*/ csvDispCount: 3, /* display no. of items in multiselect. 0 to display all.*/ captionFormat:'{0} Selected', /* format of caption text. you can set your locale.*/ captionFormatAllSelected:'{0} all selected!', /* format of caption text when all elements are selected. set null to use captionFormat. It will not work if there are disabled elements in select.*/ floatWidth: 400, /* Screen width of device at which the list is rendered in floating popup fashion.*/ forceCustomRendering: false, /* force the custom modal on all devices below floatWidth resolution.*/ nativeOnDevice: ['Android', 'BlackBerry', 'iPhone', 'iPad', 'iPod', 'Opera Mini', 'IEMobile', 'Silk'], outputAsCSV: false, /* true to POST data as csv ( false for Html control array ie. default select )*/ csvSepChar: ',', /* separation char in csv mode*/ okCancelInMulti: false, /* display ok cancel buttons in desktop mode multiselect also.*/ isClickAwayOk: false, /* for okCancelInMulti=true. sets whether click outside will trigger Ok or Cancel (default is cancel).*/ triggerChangeCombined: true, /* im multi select mode whether to trigger change event on individual selection or combined selection.*/ selectAll: false, /* to display select all button in multiselect mode.|| also select all will not be available on mobile devices.*/ search: false, /* to display input for filtering content. selectAlltext will be input text placeholder*/ searchText: 'Search...', /* placeholder for search input*/ noMatch: 'No matches for "{0}"', prefix: '', /* some prefix usually the field name. eg. 'Hello'*/ locale: ['OK', 'Cancel', 'Select All'], /* all text that is used. don't change the index.*/ up: false, /* set true to open upside.*/ showTitle: true /* set to false to prevent title (tooltip) from appearing*/ }, options); var ret = this.each(function () { var selObj = this; /* the original select object.*/ if (this.sumo || !$(this).is('select')) return; /* already initialized*/ this.sumo = { E: $(selObj), /* the jquery object of original select element.*/ is_multi: $(selObj).attr('multiple'), /* if its a multiple select*/ select: '', caption: '', placeholder: '', optDiv: '', CaptionCont: '', ul:'', is_floating: false, is_opened: false, /* backdrop: '', */ mob:false, /* if to open device default select */ Pstate: [], createElems: function () { var O = this; O.E.wrap('