o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1357768041.093502:@value"Ô-{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-01-09T16:47:20-05:00; FI"length; Fiç+I"digest; F"%cd9580ac090e2bea673ef7a02d0f5027I"source; FI"ç+// 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(); // Setup callback messages $.each(["success","sending","error"],function(i,v){ var $this = $('#'+v+'_message'); if (!$this.is('*')) { $this = $('
').addClass('callback_message').attr("id",v+"_message"); //if (header.children(':first-child').is('h1')) $this.insertAfter(header.children(':first-child')); //else $this.prependTo(header); $this.hide().appendTo(header); } }); }); })(jQuery); // Cytoplasm plugin (function($){ var defaults = { }; var conf = {}; var vars = {}; var ready = false; // 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 $.cytoAjax("/cytoplasm/settings/fetch",{},function(data){ conf = data.conf; vars = data.vars; $('body').data('cytoplasm',settings); methods.setStyles.apply(this); ready = true; }); }, setStyles:function(){ // 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 = ""; var styles = { body:{ background:vars.colors.global.background, font:vars.fonts.sizes.normal+" "+vars.fonts.faces.regular, color:vars.colors.global.text }, '::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,table.cytoTable,.cytoButton':{ "font-family":vars.fonts.faces.light, "font-weight":lightweight }, header:{ '#logo':{ position:vars.layout.header.logo.position, top:vars.layout.header.logo.y+10 }, h1:{ color:"contrast("+vars.colors.global.background+",black,white)", "&:hover":{ color:vars.colors.global.accent } } }, 'table.cytoTable':{ background:vars.colors.plugins.cytoTable.background, td:{ border:vars.colors.plugins.cytoTable.border, "&.labelcell":{"font-size":vars.fonts.sizes.small} } }, '.cytoField':{"font-family":vars.fonts.faces.regular}, '.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 } } }; // 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.sizes.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 $.each(styles,function(e,s){styletag += compileStyles(e,s);}); var parser = new(less.Parser)({}); parser.parse(styletag,function(e,tree){$("").appendTo("head");}); }, conf:function(which,value){ var returnvar; if (which==null) return conf; if (typeof which != "string") return console.warn("Incorrect argument type passed to $.Cytoplasm(\"conf\")!"); if (which.indexOf(".")>-1) { returnvar = conf; var levels = []; $.each(which.split("."),function(i,level){ levels.push(level); if (returnvar[level]!=null) returnvar = returnvar[level]; }); } else returnvar = conf[which]; if (returnvar==null) return console.warn("Failed to find Cytoplasm config variable "+which+"!"); if (value==null) return returnvar; else { if (levels==null || levels==[]) return conf[which] = value; var exp = "conf"; $.each(levels,function(i,level){exp += "["+level.toString()+"]"}); exp += " = "+value.toString(); return eval(exp); } }, 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); } }, style:function(){ }, refresh:function(){ }, destroy:function(){ $('body').data('cytoplasm',null); }, ready:function(callback){ var interval = setInterval(function(){ if (ready) { clearInterval(interval); 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);}); callback.apply(); }); } },10); } }; $.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 jQuery.Cytoplasm!'); }; $(document).ready(function(){$.Cytoplasm()}); })(jQuery); ; FI"required_assets_digest; F"%5663d59a4529c7d316af0624a1f731c8I" _version; F"%6776f581a4329e299531e1d52aa59832