diff --git a/fancySelect.coffee b/fancySelect.coffee index 26de6bd..1788755 100644 --- a/fancySelect.coffee +++ b/fancySelect.coffee @@ -1,23 +1,34 @@ -$ = window.jQuery || window.Zepto || window.$ +$ = window.jQuery or window.Zepto or window.$ -$.fn.fancySelect = (opts = {}) -> +$.fn.fancySelect = (opts) -> + isiOS = undefined + settings = undefined + if opts == null + opts = {} settings = $.extend({ forceiOS: false includeBlank: false optionTemplate: (optionEl) -> - return optionEl.text() + optionEl.text() triggerTemplate: (optionEl) -> - return optionEl.text() - }, opts) - - isiOS = !!navigator.userAgent.match /iP(hone|od|ad)/i + optionEl.text() - return this.each -> + }, opts) + isiOS = ! !navigator.userAgent.match(/iP(hone|od|ad)/i) + @each -> + copyOptionsToList = undefined + disabled = undefined + options = undefined + sel = undefined + trigger = undefined + updateTriggerText = undefined + wrapper = undefined + searchTerm = '' + searchTimeout = undefined sel = $(this) - return if sel.hasClass('fancified') || sel[0].tagName != 'SELECT' - sel.addClass('fancified') - - # hide the native select + if sel.hasClass('fancified') or sel[0].tagName != 'SELECT' + return + sel.addClass 'fancified' sel.css width: 1 height: 1 @@ -26,169 +37,179 @@ $.fn.fancySelect = (opts = {}) -> top: 0 left: 0 opacity: 0 - - # some global setup stuff sel.wrap '
' wrapper = sel.parent() - - wrapper.addClass(sel.data('class')) if sel.data('class') - + if sel.data('class') + wrapper.addClass sel.data('class') wrapper.append '
' - wrapper.append '