/* Cached on Thu, 31 Oct 2024 22:49:09 */ (function( $ ) { $.fn.customSelect = function(opt) { return this.each(function() { function setPlaceHolderClass(state) { cSInner.toggleClass('ui-placeholder-text',state); } var select = this; var w = opt.width || 412; var cSClass = 'customSelect-'; if (opt.classes != undefined) { cSClass = opt.classes+' '+cSClass; } var text = $(this).children(':selected').text(); var textNull = opt.textNull; var cSWrap = document.createElement('div'); var cSInner = $('
'); var cSList = document.createElement('ul'); setPlaceHolderClass(!text.length); $(this) .find('option[value!=""]').each( function() { var li = document.createElement('li'); var span = document.createElement('span'); $(span).text($(this).text()); $(span).attr('oid',$(this).val()); $(li).append(span); $(cSList).append(li); } ); $(cSWrap) .addClass(cSClass+'wrap') .css('width',w); $(cSInner) .addClass(cSClass+'inner') .css('background-position',(w-21)+'px 50%') .text((text != '')? text : textNull) .click(function() { $(this).parent().toggleClass('focusOn'); $(this).next().toggle(); }); $(cSList) .addClass(cSClass+'list') .css('width',(w-6)+'px'); $(this) /*.addClass(cSClass+'select')*/ .hide() .wrap(cSWrap) .change(function() { text = $(this).children(':selected').text(); $(this).next().text((text != '')? text : textNull); setPlaceHolderClass(!text.length); }) .after(cSInner) .next().after(cSList); $(this) .nextAll('ul:first') .find('span') .click(function() { $(this).parents('ul').prevAll('select').val($(this).attr('oid')); $(this).parents('ul').prev().click(); $(this).parents('ul').prevAll('select').change(); }); $(document).click(function(e) { if ($(e.target).closest(".customSelect-list,.customSelect-inner").length > 0) {return false} $('.customSelect-inner').parent('.focusOn').children('div').click(); }); }); } })( jQuery );