// CytoSelect v3.0 // By MacKinley Smith (function($){ var defaults = { widget:{ arrowButton:{ css:{ width:24, height:30, margin:0, padding:0, position:'absolute', top:0, 'border-top-left-radius':0, 'border-bottom-left-radius':0, 'border-left':0 }, img:{ css:{ position:'relative', top:-1, left:-1 }, down:'/assets/cytoplasm/triangle-medium-circle-1.png', up:'/assets/cytoplasm/triangle-medium-circle-2.png' } }, valueButton:{ css:{ 'text-align':'left', padding:5, margin:0, height:30, 'white-space':'nowrap', overflow:'hidden', 'border-top-right-radius':0, 'border-bottom-right-radius':0 }, searchInterval:1000 }, label:{ css:{ float:'left', font:'12px/30px <%=Cytoplasm.vars("fonts.faces.light")%>', margin:'0px 5px' }, html:"Label: " }, optionsList:{ animationSpeed:300, css:{ display:'none', 'list-style':'none', 'margin-top':0, padding:'0 2px 2px', border:'1px solid #666', 'border-bottom-left-radius':5, 'border-bottom-right-radius':5, background:'#777', position:'absolute', right:0, 'z-index':1000, 'box-shadow':'inset 0px 10px 10px -10px rgba(0,0,0,0.3), 0 10px 10px -10px rgba(0,0,0,0.5)' }, li:{ css:{ display:'block', height:20, font:'12px/20px <%=Cytoplasm.vars("fonts.faces.light")%>', color:'<%=Cytoplasm.vars("colors.global.text")%>', margin:'2px 0 0', padding:'0 5px', border:'1px solid #888', 'border-radius':5, cursor:'pointer', overflow:'hidden', 'text-overflow':'ellipsis', 'white-space':'nowrap', 'box-shadow':'inset 0px 0px 5px rgba(0,0,0,0.5)' }, hover:function(cy,e){ $(this).css({background:'<%=Cytoplasm.vars("colors.global.accent")%>'}); }, unhover:function(cy,e){ $(this).css({background:'transparent'}); } }, maxHeight:400, searchTime:1000 }, wrapper:{ css:{ display:'inline-block', padding:0, position:'relative' } }, width:'auto' }, events:{ create:function(cy){}, change:function(cy,e){}, beforeResize:function(cy){}, resize:function(cy,e){}, destroy:function(cy){} } }; var methods = { init:function(options,reinit){ if (reinit==null) reinit = false; return this.each(function(){ var $this = $(this); if ($this.data('cytoSelect')!=null) return console.warn("You cannot reinstatiate $.cytoSelect before calling the destroy method.\nProtip: Use the refresh method to reinstantiate in one move."); if (!$this.hasClass('cytoSelect')) $this.addClass("cytoSelect"); // Initialize settings var settings = $.extend(true,{},defaults,options); // Choose default value var selected = $this.find(":selected"); var label = settings.widget.label; if (!label) label = ($this.data('label') != undefined) ? $this.data('label') : ""; // Generate widget settings.widget.wrapper.element = $this.wrap('
').parent().css(settings.widget.wrapper.css); var tabindex = ($this.data('tabindex') != null) ? $this.data('tabindex') : $this.attr('tabindex'); settings.widget.label.element = $('').addClass('cytoSelect-label').html(label).css(settings.widget.label.css).appendTo(settings.widget.wrapper.element); settings.widget.valueButton.element = $("