test/dummy/tmp/cache/assets/CD8/900/sprockets%2Fc68606f026190266d8099ada290bbaa4 in cytoplasm-0.2.6 vs test/dummy/tmp/cache/assets/CD8/900/sprockets%2Fc68606f026190266d8099ada290bbaa4 in cytoplasm-0.2.7
- old
+ new
@@ -1,24 +1,33 @@
-o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1359060903.90209:@value"6!{I"
+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-01-24T15:55:03-05:00; FI"length; FiÌI"digest; F"%1ad6582e7527e67477d9cec0ac45fd89I"source; FI"Ì// CytoColorPicker v0.5
+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:{
- display:'inline-block',
- "margin-right":10,
- "border-radius":10,
- "box-shadow":"0px 0px 10px rgba(0,0,0,0.5)"
+ width:'100%',
+ height:'100%',
+ "border-top-left-radius":10,
+ "border-bottom-left-radius":10
},
- element:null
+ 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
@@ -36,12 +45,11 @@
step:0.01
}
},
css:{
display:'inline-block',
- 'vertical-align':'top',
- 'border-width':1
+ 'vertical-align':'top'
},
element:null,
sliders:{
elements:[],
settings:{
@@ -61,11 +69,11 @@
wrapper:{
css:{},
element:null
}
},
- default_value:"hlsa(0,0%,100%,1)"
+ default_value:"hlsa(0,0%,50%,0)"
};
var attrs = ['hue','saturation','lightness','alpha'];
var methods = {
init:function(options){
return this.each(function(){
@@ -76,72 +84,74 @@
$this.data('cytoColorPicker',settings);
// Generate widget
$this.addClass('cytoColorPicker').css({display:'none'});
settings.widget.wrapper.element = $this.wrap("<div class='cytoColorPicker-wrapper' />").parent().css(settings.widget.wrapper.css);
- settings.widget.previewer.element = $('<div />').addClass('cytoColorPicker-previewer').css(settings.widget.previewer.css).appendTo(settings.widget.wrapper.element).click(function(e){
+ settings.widget.previewer.wrapper.element = $('<div />').addClass('cytoColorPicker-previewer-wrapper').css(settings.widget.previewer.wrapper.css).appendTo(settings.widget.wrapper.element);
+ settings.widget.previewer.element = $('<div />').addClass('cytoColorPicker-previewer').css(settings.widget.previewer.css).appendTo(settings.widget.previewer.wrapper.element).click(function(e){
});
// Generate slider table
- var slider_table = $('<table />').attr({cellPadding:0,cellSpacing:0}).css(settings.widget.slider_table.css).appendTo(settings.widget.wrapper.element);
- for (var i=0;i<settings.format.length;i++) {
- var letter = settings.format[i];
+ var slider_table = $('<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 = $('<tr />').appendTo(slider_table);
var lc = $('<td />').addClass('labelcell').html(letter.toUpperCase()+": ").append($('<span />').addClass('num').html(0)).appendTo(tr);
var sc = $('<td />').addClass('cytoColorPicker-sliderCell').appendTo(tr);
- var slider = $('<div data-attr="'+attrs[i]+'" />').appendTo(sc).slider($.extend(true,{},settings.widget.slider_table.sliders.settings,settings.widget.slider_table.attrs[attrs[i]]));
+ var slider = $('<div data-attr="'+attr+'" />').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);
- settings.widget.previewer.element.width(slider_table.outerHeight()).height(slider_table.outerHeight());
+ // Set dimensions of previewer
+ settings.widget.previewer.wrapper.element.width(slider_table.outerHeight()+5).height(slider_table.outerHeight()+5);
- $this.data('cytoColorPicker',settings);
-
// Get initial value as color
- var wasSet = ($this.val()!="");
- if (wasSet) settings.default_value = $this.val();
- settings.value = $.Color(settings.default_value);
+ 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);
- if (wasSet) methods.value.apply($this,[settings.value]);
- else methods.update.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 this method!");
+ 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(color);
- previewer.css({"background-color":color.toHslaString()});
+ 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 set method!");
+ if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the value method!");
var wrapper = $this.parent();
- color = $.Color(color);
var sliders = wrapper.find('.ui-slider');
- sliders.each(function(i){sliders.filter("[data-attr="+attrs[i]+"]").slider("value",color.hsla()[i]);});
+ 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,[color]);
+ methods.update.apply($this);
});
},
resize:function(){
return this.each(function(){
var $this = $(this);
@@ -202,7 +212,7 @@
};
$(window).resize(function(){$('.cytoColorPicker').cytoColorPicker("resize");});
$.Cytoplasm("ready",function(){$('.cytoColorPicker').cytoColorPicker();});
})(jQuery);
-; FI"dependency_digest; F"%a987fa4de6570dcf5a4697727251f80fI"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-01-24T15:55:03-05:00; FI"digest; F"%bb300055356641abf2374d14c6313f0aI"
_version; F"%6776f581a4329e299531e1d52aa59832
+; 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
\ No newline at end of file