o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1360781385.841859:@value"´${I" class:EFI"BundledAsset; FI"logical_path; FI"cytoplasm/cytoSlider.js; FI" pathname; FI"g/Applications/XAMPP/xamppfiles/htdocs/cytoplasm/app/assets/javascripts/cytoplasm/cytoSlider.js.erb; FI"content_type; FI"application/javascript; FI" mtime; FI"2013-02-13T13:49:44-05:00; FI"length; FiÅ"I"digest; F"%6c50ec17c14a01b61198a5d140b1e116I"source; FI"Å"// CytoSlider v0.5 // By MacKinley Smith (function($){ var defaults = { dimensions:1, widget:{ label:{ css:{ font:'13px TitilliumTextThin' }, element:false, html:"", readout:{ css:{}, unit:false } }, slider:{ css:{}, elements:[], options:{ min:0, max:100, value:0, step:1, slide:function(e,ui){}, change:function(e,ui){} } }, wrapper:{ css:{ padding:"5px 0px" }, element:false } }, events:{ create:function(cy){}, change:function(cy,event){}, destroy:function(cy){} } }; var methods = { init:function(options,reinit){ if (reinit==null) reinit = false; return this.each(function(){ var $this = $(this); if ($this.data('cytoSlider')!=null) return console.warn("You cannot reinstatiate cytoSlider before calling the destroy method.\nProtip: Use the refresh method to reinstantiate in one move."); if (!$this.hasClass('cytoSlider')) $this.addClass("cytoSlider"); // Initialize settings var settings; if (!reinit) { settings = $.extend(true,{},defaults,options); if ($this.data('settings')!=null) settings = $.extend(true,{},settings,$this.data('settings')); if ($this.data('dimensions')!=null) settings.dimensions = $this.data('dimensions'); if ($this.data('label')!=null) settings.widget.label.html = $this.data('label'); if ($this.data('unit')!=null) settings.widget.label.readout.unit = $this.data('unit'); if ($this.data('min')!=null) settings.widget.slider.options.min = $this.data('min'); if ($this.data('max')!=null) settings.widget.slider.options.max = $this.data('max'); if ($this.data('step')!=null) settings.widget.slider.options.step = $this.data('step'); if ($this.val()!=null && $this.val()!="") settings.widget.slider.options.value = parseInt($this.val()); } else settings = options; // Generate widget settings.widget.wrapper.element = $this.wrap("
").parent().addClass('cytoSlider-wrapper').css(settings.widget.wrapper.css); settings.widget.label.element = $('').attr("for",$this.attr("name")).addClass('cytoSlider-label').css(settings.widget.label.css).html(settings.widget.label.html+": ").prependTo(settings.widget.wrapper.element); settings.widget.label.readout.element = $('').addClass("cytoSlider-label-readout").css(settings.widget.label.readout.css).appendTo(settings.widget.label.element); // Set up sliders $this.data('cytoSlider',settings); methods.setDimensions.apply($this,[settings.dimensions]); // Bindings $this.bind("change.cytoSlider",function(e){ settings.widget.label.readout.element.html($(this).val()); settings.events.change.apply($this,[settings,e]); }); // Save settings data to input $this.data('cytoSlider',settings); methods.resize.apply($this); settings.events.create.apply($this,[settings]); }); }, destroy:function(){ return this.each(function(){ var $this = $(this); var settings = $this.data('cytoSlider'); if (!$this.hasClass("cytoSlider") || settings==null) return console.warn("You must instanciate $.cytoSlider before you call the destroy method!"); // Destroy widget $this.unbind(".cytoSlider").removeClass("cytoSlider").data("cytoSlider",null).insertBefore(settings.widget.wrapper.element); settings.widget.wrapper.element.remove(); settings.events.destroy.apply($this,[settings]); }); }, refresh:function(){ return this.each(function(){ var $this = $(this); var settings = $this.data('cytoSlider'); if (!$this.hasClass("cytoSlider") || settings==null) return console.warn("You must instanciate $.cytoSlider before you call the refresh method!"); // Destroy and reinit methods.destroy.apply($this); methods.init.apply($this,[settings,true]); $this.trigger('change.cytoSlider'); }); }, resize:function(){ return this.each(function(){ var $this = $(this); var settings = $this.data('cytoSlider'); if (!$this.hasClass("cytoSlider") || settings==null) return console.warn("You must instanciate $.cytoSlider before you call the resize method!"); settings.widget.wrapper.element.width(0); setTimeout(function(){ settings.widget.wrapper.element.width("auto"); },1); }); }, addDimension:function(){ return this.each(function(){ var $this = $(this); var settings = $this.data('cytoSlider'); if (!$this.hasClass("cytoSlider") || settings==null) return console.warn("You must instanciate $.cytoSlider before you call the addDimension method!"); var slider = $('').addClass('cytoSlider-slider') .css(settings.widget.slider.css) .appendTo(settings.widget.wrapper.element) .slider(settings.widget.slider.options).slider("value",settings.widget.slider.options.value); settings.widget.slider.elements.push(slider); $this.data('cytoSlider',settings); }); }, removeDimension:function(){ return this.each(function(){ var $this = $(this); var settings = $this.data('cytoSlider'); if (!$this.hasClass("cytoSlider") || settings==null) return console.warn("You must instanciate $.cytoSlider before you call the addDimension method!"); var slider = settings.widget.slider.elements.pop(); slider.remove(); $this.data('cytoSlider',settings); }); }, setDimensions:function(n){ return this.each(function(){ var $this = $(this); var settings = $this.data('cytoSlider'); if (!$this.hasClass("cytoSlider") || settings==null) return console.warn("You must instanciate $.cytoSlider before you call the setDimensions method!"); // Reset sliders $.each(settings.widget.slider.elements,function(i,s){s.remove()}); settings.widget.slider.elements = []; settings.dimensions = n; // Set up options $.each(["slide","change"],function(i,v){ var orig = settings.widget.slider.options[v]; settings.widget.slider.options[v] = function(e,ui){ var values = []; for (var i=0;i