o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1359748792.983296: @value"á"{I" class:EFI"ProcessedAsset;FI"logical_path;FI"!cytoplasm/cytoColorPicker.js;FI" pathname;FI"l/Applications/XAMPP/xamppfiles/htdocs/cytoplasm/app/assets/javascripts/cytoplasm/cytoColorPicker.js.erb;FI"content_type;FI"application/javascript;FI" mtime;FI"2013-02-01T14:59:51-05:00;FI" length;FiwI" digest;F"%f3d7981a6740ca9af4a6866847a238f2I" source;FI"w// CytoColorPicker v0.5 // By MacKinley Smith (function($){ var defaults = { format:'hsla', // hsla, hex, rgba events:{ change:function(color){} }, widget:{ previewer:{ css:{ width:'100%', height:'100%', "border-top-left-radius":10, "border-bottom-left-radius":10 }, element:null, wrapper:{ css:{ display:'inline-block', "border-top-left-radius":10, "border-bottom-left-radius":10, background:"url(/assets/cytoplasm/transparent_bg.jpg)", "box-shadow":"0px 0px 10px rgba(0,0,0,0.5)" } } }, slider_table:{ attrs:{ hue:{ max:359 }, saturation:{ max:1, step:0.01 }, lightness:{ max:1, step:0.01 }, alpha:{ max:1, step:0.01 } }, css:{ display:'inline-block', 'vertical-align':'top' }, element:null, sliders:{ elements:[], settings:{ animate:true, min:0, slide:function(e,ui){ $(this).parent().parent().find("span.num").html($(this).slider("value")); methods.update.apply($(this).parents(".cytoColorPicker-wrapper").find('.cytoColorPicker')); }, change:function(e,ui){ $(this).parent().parent().find("span.num").html($(this).slider("value")); methods.update.apply($(this).parents(".cytoColorPicker-wrapper").find('.cytoColorPicker')); } } } }, wrapper:{ css:{}, element:null } }, default_value:"hlsa(0,0%,50%,0)" }; var attrs = ['hue','saturation','lightness','alpha']; var methods = { init:function(options){ return this.each(function(){ var $this = $(this); // Instantiate settings var settings = $.extend(true,{},defaults,options); $this.data('cytoColorPicker',settings); // Generate widget $this.addClass('cytoColorPicker').css({display:'none'}); settings.widget.wrapper.element = $this.wrap("
").parent().css(settings.widget.wrapper.css); settings.widget.previewer.wrapper.element = $('
').addClass('cytoColorPicker-previewer-wrapper').css(settings.widget.previewer.wrapper.css).appendTo(settings.widget.wrapper.element); settings.widget.previewer.element = $('
').addClass('cytoColorPicker-previewer').css(settings.widget.previewer.css).appendTo(settings.widget.previewer.wrapper.element).click(function(e){ }); // Generate slider table var slider_table = $('').cytoTable().css(settings.widget.slider_table.css).appendTo(settings.widget.wrapper.element); $.each(attrs,function(i,attr){ var letter = attr.charAt(0); var tr = $('').appendTo(slider_table); var lc = $('
').addClass('labelcell').html(letter.toUpperCase()+": ").append($('').addClass('num').html(0)).appendTo(tr); var sc = $('').addClass('cytoColorPicker-sliderCell').appendTo(tr); var slider = $('
').appendTo(sc).slider($.extend(true,{},settings.widget.slider_table.sliders.settings,settings.widget.slider_table.attrs[attr])); settings.widget.slider_table.sliders.elements.push(slider); }); slider_table.find('td').css({'padding':"5px 10px"}).filter('.labelcell').width(50); // Set dimensions of previewer settings.widget.previewer.wrapper.element.width(slider_table.outerHeight()+5).height(slider_table.outerHeight()+5); // Get initial value as color settings.value = $.Color(($this.val()!=null && $this.val()!="") ? $this.val() : settings.default_value); // Commit settings to data-cytoColorPicker attribute $this.data('cytoColorPicker',settings); methods.resize.apply($this); methods.value.apply($this,[settings.value]); }); }, update:function(){ return this.each(function(){ var $this = $(this); var settings = $this.data('cytoColorPicker'); if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the update method!"); var wrapper = $this.parent(); var previewer = wrapper.find(".cytoColorPicker-previewer"); var sliders = wrapper.find('.ui-slider'); var color = {}; sliders.each(function(i){color[attrs[i]] = sliders.filter("[data-attr="+attrs[i]+"]").slider("value");}); color = $.Color().hsla(color); previewer.css({"background":color.toHslaString()}); $this.val(color.toHslaString()); settings.events.change.apply($this,[color]); }); }, value:function(color){ if (color == null) return $.Color(this.val()).toHslaString(); if (typeof color != "object") color = $.Color(color); return this.each(function(){ var $this = $(this); var settings = $this.data('cytoColorPicker'); if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the value method!"); var wrapper = $this.parent(); var sliders = wrapper.find('.ui-slider'); sliders.each(function(i){ var c = color.hsla()[i]; if (c==null) c = 0; sliders.filter("[data-attr="+attrs[i]+"]").slider("value",c); }); methods.update.apply($this); }); }, resize:function(){ return this.each(function(){ var $this = $(this); var settings = $this.data('cytoColorPicker'); if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the resize method!"); settings.widget.wrapper.element.width(0).css({opacity:0}); setTimeout(function(){ settings.widget.wrapper.element.width('100%').css({opacity:1}).find('.cytoColorPicker-sliderCell').width(settings.widget.wrapper.element.innerWidth()-settings.widget.previewer.element.outerWidth(true)-100); },1); }); }, destroy:function(){ return this.each(function(){ var $this = $(this); var settings = $(this).data('cytoColorPicker'); if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the destroy method!"); var wrapper = $this.parent(); $this.insertBefore(wrapper).removeClass('cytoColorPicker').data('cytoColorPicker',null); wrapper.remove(); }); }, refresh:function(){ return this.each(function(){ var $this = $(this); var settings = $(this).data('cytoColorPicker'); if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the refresh method!"); methods.destroy.apply($this); methods.init.apply($this,[settings]); $this.trigger('change.cytoColorPicker'); }); }, options:function(newOptions){ if (newOptions!=null) { return this.each(function(){ var $this = $(this); var settings = $this.data('cytoColorPicker'); if (!$this.hasClass("cytoColorPicker") || settings==null) return console.warn("You must instanciate $.cytoColorPicker before you call the options method!"); $this.data('cytoColorPicker',$.extend(true,{},settings,newOptions)); methods.refresh.apply($this); }); } else { var returnVal; this.each(function(){ var $this = $(this); var settings = $this.data('cytoColorPicker'); if (!$this.hasClass("cytoColorPicker") || settings==null) return console.warn("You must instanciate $.cytoColorPicker before you call the options method!"); returnVal = settings; }); return returnVal; } } }; $.fn.cytoColorPicker = function(method){ if (methods[method]) return methods[method].apply(this,Array.prototype.slice.call(arguments,1)); else if (typeof method == 'object' || !method) return methods.init.apply(this,arguments); else $.error('Method ' + method + ' does not exist on $.cytoColorPicker!'); }; $(window).resize(function(){$('.cytoColorPicker').cytoColorPicker("resize");}); $.Cytoplasm("ready",function(){$('.cytoColorPicker').cytoColorPicker();}); })(jQuery); ;FI"dependency_digest;F"%33ffeff499390183507c033fb2d9a22fI"required_paths;F[I"l/Applications/XAMPP/xamppfiles/htdocs/cytoplasm/app/assets/javascripts/cytoplasm/cytoColorPicker.js.erb;FI"dependency_paths;F[{I" path;FI"l/Applications/XAMPP/xamppfiles/htdocs/cytoplasm/app/assets/javascripts/cytoplasm/cytoColorPicker.js.erb;FI" mtime;FI"2013-02-01T14:59:51-05:00;FI" digest;F"%442a6d3febb02a86c5adcc4ff7ee7cd9I" _version;F"%6776f581a4329e299531e1d52aa59832