test/dummy/tmp/cache/assets/D14/170/sprockets%2F40a7b83bb067eea7ce2c8394e1529287 in cytoplasm-0.3.1 vs test/dummy/tmp/cache/assets/D14/170/sprockets%2F40a7b83bb067eea7ce2c8394e1529287 in cytoplasm-0.3.3

- old
+ new

@@ -1,8 +1,8 @@ -o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1360351005.607549: @value"&5{I" +o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1360530370.732219: @value"!7{I" class:EFI"BundledAsset;FI"logical_path;FI"cytoplasm/cytoplasm.js;FI" pathname;FI"f/Applications/XAMPP/xamppfiles/htdocs/cytoplasm/app/assets/javascripts/cytoplasm/cytoplasm.js.erb;FI"content_type;FI"application/javascript;FI" -mtime;FI"2013-02-08T14:16:45-05:00;FI" length;Fi93I" digest;F"%7394f50667f843db198900d9f61fac2bI" source;FI"93// CytoPlasm jQuery Setup v0.1 +mtime;FI"2013-02-10T16:06:10-05:00;FI" length;Fi45I" digest;F"%e1b3941aa818128cad79fb8fe3e01864I" source;FI"45// CytoPlasm jQuery Setup v0.1 // By MacKinley Smith // Initialize global JS variables var Cytoplasm; @@ -31,10 +31,13 @@ $(window).bind('beforeunload',function(){allexceptheader.animate({opacity:0},100);}); }); } ]; + // Default styles + var static_styles = "body{margin:0;height:100%;overflow-y:scroll}h1,h2,h3,h4,h5,h6{margin:20px 0}header{overflow:hidden;h1{margin:0;white-space:nowrap;cursor:pointer;display:inline;text-shadow:0 0 10px rgba(0,0,0,0.5)}#logo{z-index:1000}}nav{ul{padding:0;list-style:none;li{display:inline-block}}}section{min-height:400px;background:white;overflow:hidden;box-shadow:0 0 10px rgba(0,0,0,0.8);clear:both;&>:first-child{margin-top:0;padding-top:0}&>:last-child{margin-bottom:0;padding-bottom:0}}footer{overflow:hidden}.cytoField{width:100%;border:1px solid #aaa;border-radius:5px;font-size:14px;box-shadow:inset 0 0 5px rgba(0,0,0,0.25);&[type=text],&[type=password],&[type=email]{height:28px;padding:0 7px}}textarea.cytoField{resize:none;height:200px;padding:7px}button,input[type=submit]{&.cytoButton{border-radius:5px;cursor:pointer;&.large{width:100%;height:50px}}}"; + // Gradient manipulation library var parseGradient = function(grad,reverse){ // Return untouched if not gradient if (grad.indexOf("gradient")==-1) return grad; if (reverse!=true) reverse = false; @@ -140,26 +143,23 @@ data = $.parseJSON(data); conf = data.conf; vars = data.vars; $(document).ready(function(){ $('body').data('cytoplasm',settings); - methods.setStyles.apply(); + methods.initStyles.apply(); ready = true; $.each(readyFunctions,function(i,f){f.apply();}); }); } }); }, - setStyles:function(userstyles){ + initStyles:function(userstyles){ if (typeof userstyles != "object") userstyles = {}; - // Remove existing cytoplasm styles - if ($('#cytoplasm_dynamic_styles').is("*")) $('#cytoplasm_dynamic_styles').remove(); // Set variables var boldweight = (vars.fonts.faces.bold==vars.fonts.faces.regular)?"bold":"normal"; var lightweight = (vars.fonts.faces.light==vars.fonts.faces.regular)?"lighter":"normal"; - var styletag = "body{margin:0;height:100%;overflow-y:scroll}h1,h2,h3,h4,h5,h6{margin:20px 0}header{overflow:hidden;h1{margin:0;white-space:nowrap;cursor:pointer;display:inline;text-shadow:0 0 10px rgba(0,0,0,0.5)}#logo{z-index:1000}}nav{ul{padding:0;list-style:none;li{display:inline-block}}}section{min-height:400px;background:white;overflow:hidden;box-shadow:0 0 10px rgba(0,0,0,0.8);clear:both;&>:first-child{margin-top:0;padding-top:0}&>:last-child{margin-bottom:0;padding-bottom:0}}footer{overflow:hidden}.cytoField{width:100%;border:1px solid #aaa;border-radius:5px;font-size:14px;box-shadow:inset 0 0 5px rgba(0,0,0,0.25);&[type=text],&[type=password],&[type=email]{height:28px;padding:0 7px}}textarea.cytoField{resize:none;height:200px;padding:7px}button,input[type=submit]{&.cytoButton{border-radius:5px;cursor:pointer;&.large{width:100%;height:50px}}}"; var styles = $.extend(true,{},{ body:{ background:vars.colors.global.background, font:vars.fonts.sizes.normal+" "+vars.fonts.faces.regular, color:vars.colors.global.text, @@ -251,35 +251,10 @@ '.cytoColorPicker-wrapper':{ '.ui-slider[data-attr=hue]':{ background:"linear-gradient(to right,#ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)", "box-shadow":"inset 0px 0px 5px hsla(0,0%,0%,0.5)" } - }, - '.cytoResponseMessage':{ - display:'none', - padding:"10px", - 'margin-bottom':"10px", - "border-radius":"5px", - font:vars.fonts.sizes.small+" "+vars.fonts.faces.light, - '&:first-line':{ - font:vars.fonts.sizes.normal+" "+vars.fonts.faces.bold - }, - '&[data-type=success]':{ - "border-color":"green", - color:"green", - background:"linear-gradient(top, white, #a4ffa4)" - }, - '&[data-type=loading]':{ - "border-color":"yellow", - color:"#777700", - background:"linear-gradient(top, white, #000077)" - }, - '&[data-type=error]':{ - "border-color":"red", - color:"red", - background:"linear-gradient(top, white, rgb(255,170,170))" - } } },userstyles); // Heading sizes (function(){ @@ -298,14 +273,49 @@ // Logo positioning if (vars.layout.header.logo.align == "center") styles.header["#logo"].left = (($(window).width()-$('header #logo').width())/2) + vars.layout.header.logo.x; else styles.header["#logo"][vars.layout.header.logo.align] = vars.layout.header.logo.x+10; // Compile the styles for HTML and add to <head> - $.each(styles,function(e,s){styletag += compileStyles(e,s);}); + methods.addStyles.apply(this,["cytoplasm_static_styles",static_styles]); + methods.addStyles.apply(this,["cytoplasm_dynamic_styles",styles]); + }, + addStyles:function(id,styles){ + if (typeof id != "string") return console.warn("$.Cytoplasm's addStyles method requires an id string as the first parameter!"); + + // Compile the styles for HTML and add to <head> + var styletag = ""; + switch (typeof styles) { + case "object": + $.each(styles,function(e,s){styletag += compileStyles(e,s);}); + break; + case "string": + styletag += styles; + break; + default: + return console.warn("$.Cytoplasm's addStyles method requires either an object containing JSON-formatted LESS CSS or a string containing LESS CSS as its second parameter!"); + } + + // Set styles + methods.removeStyles.apply(this,[id]); var parser = new(less.Parser)({}); - parser.parse(styletag,function(e,tree){$("<style type='text/css' rel='stylesheet' media='screen' id='cytoplasm_dynamic_styles'>"+tree.toCSS({compress:true})+"</style>").appendTo("head");}); + parser.parse(styletag,function(e,tree){$("<style type='text/css' rel='stylesheet' media='screen' id='"+id+"' class='cytoplasm-dynamic-stylesheet'>"+tree.toCSS({compress:true})+"</style>").appendTo("head");}); }, + removeStyles:function(id){ + if (typeof id != "string") return console.warn("$.Cytoplasm's addStyles method requires an id string as the first parameter!"); + if ($('style#'+id).is("*")) $('style#'+id).remove(); + }, + resetStyles:function(){ + $('style.cytoplasm-dynamic-stylesheet').remove(); + methods.initStyles.apply(this); + }, + saveStyles:function(){ + var styletag = ""; + $('.cytoplasm-dynamic-stylesheet').each(function(){styletag += $(this).text();}); + $.post("/cytoplasm/precompile",{styles:styletag},function(data){ + $.cytoAjaxResponse("Styles saved successfully!"); + }); + }, vars:function(which,value){ var returnvar; if (which==null) return vars; if (typeof which != "string") return console.warn("Incorrect argument type passed to $.Cytoplasm(\"vars\")!"); if (which.indexOf(".")>-1) { @@ -325,16 +335,10 @@ $.each(levels,function(i,level){exp += "["+level.toString()+"]"}); exp += " = "+value.toString(); return eval(exp); } }, - style:function(){ - - }, - refresh:function(){ - - }, destroy:function(){ $('body').data('cytoplasm',null); }, ready:function(func){ if (typeof func != "function") return console.warn("$.Cytoplasm's ready method requires a function to be passed as its first and only argument."); @@ -350,6 +354,6 @@ }; $.Cytoplasm(); })(jQuery); -;FI"required_assets_digest;F"%75e24eff9a56b24ba5f77e28fc45a53dI" _version;F"%6776f581a4329e299531e1d52aa59832 +;FI"required_assets_digest;F"%4dee80c72718454feeee142e6aa38b43I" _version;F"%6776f581a4329e299531e1d52aa59832 \ No newline at end of file