o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1360695122.381923: @value"76{I" class:EFI"ProcessedAsset;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-12T13:52:02-05:00;FI" length;Fiå2I" digest;F"%cfbe6084be9f15df3731d9a45eca9647I" source;FI"å2// CytoPlasm jQuery Setup v0.1 // By MacKinley Smith // Initialize global JS variables var Cytoplasm; (function($){ // Ensure that jQuery and jQuery UI get loaded $.each(["/assets/jquery.js","/assets/jquery-ui.js"],function(i,script){if (!$('script[src="'+script+'"], script[src="'+script+'?body=1"]').is('*')) $('head').append("");}); $(document).ready(function(){ // Setup header var header = $("header").find('h1').click(function(){window.location = "/";}).end(); }); })(jQuery); // Cytoplasm plugin (function($){ var defaults = { }; var conf = {}; var vars = {}; var ready = false, readyFunctions = [ function(){ var allexceptheader = $('body').children(':not(header)').animate({opacity:1},250,function(){ $('body').css('overflow-y','scroll'); $(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}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; var o = {}; var halves = grad.split("("); o.type = halves[0]; o.params = halves[1].split(")")[0].split(","); if (o.type.indexOf("linear")>-1) { if (isColorStop(o.params[0])) o.params.unshift("to bottom"); o.params[0] = normalizeDirection(o.params[0]); if (reverse) o.params[0] = invertDirection(o.params[0]); o.dir = o.params[0]; o.colors = o.params.slice(1); } else if (o.type.indexOf("radial")>-1) { var firstcolor; if (isColorStop(o.params[0])) o.params.unshift("center"); $.each(o.params,function(i,p){if (isColorStop(p)) {firstcolor = i;return false;}}); o.dir = o.params[0]; o.colors = o.params.slice(firstcolor); } else return false; var params = o.params.join(","); // String types o.shortened = o.type+"("+denormalizeDirection(o.dir)+","+o.colors.join(",")+");"; o.expanded = "background-color:"+((o.colors[0].indexOf("%")>-1) ? o.colors[0].split(" ").slice(0,-1).join(" ") : o.colors[0]) + ";"; o.expanded += "background-image:-webkit-"+o.type+"("+params+");"; o.expanded += "background-image:-moz-"+o.type+"("+params+");"; o.expanded += "background-image:-o-"+o.type+"("+params+");"; o.expanded += "background-image:-ms-"+o.type+"("+params+");"; o.expanded += "background-image:"+o.shortened; return o; }; var expandGradient = function(orig){ if (typeof orig != "string") return console.warn("Cytoplasm.expandGradient only accepts string arguments!"); // Return untouched if not gradient if (orig.indexOf("gradient")==-1) return orig; var g = parseGradient(orig); return g.expanded; }; var reverseGradient = function(orig){ if (typeof orig != "string") return console.warn("Cytoplasm.reverseGradient only accepts string arguments!"); // Return untouched if not gradient if (orig.indexOf("gradient")==-1) return orig; var g = parseGradient(orig,true); return g.shortened; }; var normalizeDirection = function(dir){ var newdir = dir; if (newdir.slice(0,3)!="to ") return newdir; return invertDirection(newdir).slice(3); }; var denormalizeDirection = function(dir){ var newdir = dir; if (newdir.slice(0,3)=="to ") return newdir; return "to "+invertDirection(newdir); }; var invertDirection = function(dir){ var newdir = " "+dir+" "; if (dir.indexOf("top")>-1) newdir = newdir.replace("top","bottom"); else if (dir.indexOf("bottom")>-1) newdir = newdir.replace("bottom","top"); if (dir.indexOf("left")>-1) newdir = newdir.replace("left","right"); else if (dir.indexOf("right")>-1) newdir = newdir.replace("right","left"); newdir = newdir.slice(2,-2); return newdir; }; var isColorStop = function(str){ var cache, p=parseInt, nstr = str; if (nstr.slice(-1) == "%") nstr = nstr.split(" ").slice(0,-1).join(" "); nstr = nstr.replace(/\s\s*/g,'') // Remove all spaces if ($.inArray(nstr,['aqua','black','blue','fuchsia','gray','grey','green','lime','maroon','navy','olive','purple','red','silver','teal','white','yellow'])>-1) return true; return (nstr.match(/^#([\da-fA-F]{2})([\da-fA-F]{2})([\da-fA-F]{2})/) || nstr.match(/^#([\da-fA-F])([\da-fA-F])([\da-fA-F])/) || nstr.match(/^rgba\(([\d]+),([\d]+),([\d]+),([\d]+|[\d]*.[\d]+)\)/) || nstr.match(/^rgb\(([\d]+),([\d]+),([\d]+)\)/)); }; var compileStyles = function(element,styles){ output = ""; output += element+" { "; $.each(styles,function(prop,value){ if (typeof value == "object") output += compileStyles(prop,value); else { if (prop == "background" && value.indexOf("gradient")>-1) output += expandGradient(value); else output += prop+" : "+value+"; "; } }); output += " } "; return output; }; var methods = { init:function(options){ var settings = $.extend(true,{},defaults,options); $('body').css("overflow","hidden").children(':not(header)').css("opacity",0); // Fetch latest settings via AJAX $.ajax("/cytoplasm/settings/fetch",{ type:"POST", success:function(data){ data = $.parseJSON(data); conf = data.conf; vars = data.vars; $(document).ready(function(){ $('body').data('cytoplasm',settings); methods.initStyles.apply(); ready = true; $.each(readyFunctions,function(i,f){f.apply();}); }); } }); }, initStyles:function(userstyles){ if (typeof userstyles != "object") userstyles = {}; // 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 styles = $.extend(true,{},{ body:{ background:vars.colors.global.background, font:vars.fonts.sizes.normal+" "+vars.fonts.faces.regular, color:vars.colors.global.text, padding:vars.layout.padding }, '::selection':{ background:vars.colors.global.accent, color:"contrast("+vars.colors.global.accent+",black,white)" }, '::-moz-selection':{ background:vars.colors.global.accent, color:"contrast("+vars.colors.global.accent+",black,white)" }, a:{ "font-family":vars.fonts.faces.light, "&:hover":{color:vars.colors.global.accent} }, 'h1,h3,h5,b,strong':{ "font-family":vars.fonts.faces.bold, "font-weight":boldweight }, 'h2,h4,h6,.cytoButton':{ "font-family":vars.fonts.faces.light, "font-weight":lightweight }, header:{ margin:vars.layout.header.margin, padding:vars.layout.header.padding, height:vars.layout.header.height, background:vars.colors.header.background, color:vars.colors.header.text, '#logo':{ position:vars.layout.header.logo.position, top:vars.layout.header.logo.y+10 }, h1:{ color:vars.colors.header.text, "&:hover":{ color:vars.colors.global.accent } } }, section:{ background:vars.colors.section.background, color:vars.colors.section.text, margin:vars.layout.section.margin, padding:vars.layout.section.padding }, footer:{ background:vars.colors.footer.background, color:vars.colors.footer.text, margin:vars.layout.footer.margin, padding:vars.layout.footer.padding }, a:{ '&:link':{ color:vars.colors.links.unvisited.text }, '&:visited':{ color:vars.colors.links.visited.text }, '&:hover':{ color:vars.colors.links.hover.text }, '&:active':{ color:vars.colors.links.active.text } }, '.cytoButton':{ border:vars.colors.plugins.cytoButton.border, color:vars.colors.plugins.cytoButton.text, "&:not(.active),&:not(:active)":{background:vars.colors.plugins.cytoButton.background}, "&.active,&:active":{ background:reverseGradient(vars.colors.plugins.cytoButton.background), "box-shadow":vars.layout.plugins.cytoButton.shadow } }, '.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)" } } },userstyles); // Heading sizes (function(){ var verbose = false; var huge = parseInt(vars.fonts.sizes.huge), normal = parseInt(vars.fonts.sizes.normal); var hRange = huge - normal; $.each([1,2,3,4,5,6],function(i,num){ if (verbose) console.log("----- H"+num+" -----"); var factor = Math.pow(vars.fonts.heading_factor,i); if (verbose) console.log("Factor: "+factor); var size = parseInt(vars.fonts.sizes.normal) + (hRange/factor); if (verbose) console.log("Size: "+size); $('h'+num.toString()).css("font-size",size); }); })(); // 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 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 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){$("").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) { returnvar = vars; var levels = []; $.each(which.split("."),function(i,level){ levels.push(level); if (returnvar[level]!=null) returnvar = returnvar[level]; }); } else returnvar = vars[which]; if (returnvar==null) return console.warn("Failed to find Cytoplasm variable "+which+"!"); if (value==null) { return returnvar; } else { if (levels==null || levels==[]) return vars[which] = value; var exp = "vars"; $.each(levels,function(i,level){exp += "["+level.toString()+"]"}); exp += " = "+value.toString(); return eval(exp); } }, 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."); if (ready==true) return func.apply(); else readyFunctions.push(func); } }; $.Cytoplasm = 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 $.Cytoplasm!'); }; $.Cytoplasm(); })(jQuery); ;FI"dependency_digest;F"%197cce77eee0d0c1873a728900e8e8ccI"required_paths;F[I"f/Applications/XAMPP/xamppfiles/htdocs/cytoplasm/app/assets/javascripts/cytoplasm/cytoplasm.js.erb;FI"dependency_paths;F[{I" path;FI"f/Applications/XAMPP/xamppfiles/htdocs/cytoplasm/app/assets/javascripts/cytoplasm/cytoplasm.js.erb;FI" mtime;FI"2013-02-12T13:52:02-05:00;FI" digest;F"%19b2ab5525e440ed6364ea663e7b434cI" _version;F"%6776f581a4329e299531e1d52aa59832