From e8cd94fdcfb2f936121a6ecac75810394cff6414 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Sat, 26 Oct 2013 13:07:04 +0200 Subject: [PATCH] new YSLow, new ruleset names, closes #288 --- CHANGELOG | 1 + dependencies/yslow-3.1.5-sitespeed.js | 2 +- sitespeed.io | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index bfa24966c..d91460390 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ version 2.1 * Centralized the error logging * Added an easy way of include sitespeed.io in Travis-CI * Made it possible to analyze sitew with non signed certificates +* Prepared for HTTP2.0 rules & renamed the current rulesets, new names: sitespeed.io-desktop & sitespeed.io-mobile * Bug fix: The crawler sometimes picked up URL:s linking to other content types than HTML * Bug fix: The JUnit xslt outputted timings metrics diff --git a/dependencies/yslow-3.1.5-sitespeed.js b/dependencies/yslow-3.1.5-sitespeed.js index 37a2c8dcf..14057df89 100644 --- a/dependencies/yslow-3.1.5-sitespeed.js +++ b/dependencies/yslow-3.1.5-sitespeed.js @@ -1 +1 @@ -if(!Date.prototype.toISOString){Date.prototype.toISOString=function(){function b(c){return c<10?"0"+c:c}function a(c){return c<10?"00"+c:c<100?"0"+c:c}return this.getFullYear()+"-"+b(this.getMonth()+1)+"-"+b(this.getDate())+"T"+b(this.getHours())+":"+b(this.getMinutes())+":"+b(this.getSeconds())+"."+a(this.getMilliseconds())+"Z"}}function createHAR(c,f,d,e,b){var a=[];e.forEach(function(j){var h=j.request,g=j.startReply,k=j.endReply;if(!h||!g||!k){return}if(h.url.match(/(^data:image\/.*)/i)){return}a.push({startedDateTime:h.time.toISOString(),time:k.time-h.time,request:{method:h.method,url:h.url,httpVersion:"HTTP/1.1",cookies:[],headers:h.headers,queryString:[],headersSize:-1,bodySize:-1},response:{status:k.status,statusText:k.statusText,httpVersion:"HTTP/1.1",cookies:[],headers:k.headers,redirectURL:"",headersSize:-1,bodySize:g.bodySize,content:{size:g.bodySize,mimeType:k.contentType}},cache:{},timings:{blocked:0,dns:-1,connect:-1,send:0,wait:g.time-h.time,receive:k.time-g.time,ssl:-1},pageref:c})});return{log:{version:"1.2",creator:{name:"PhantomJS",version:phantom.version.major+"."+phantom.version.minor+"."+phantom.version.patch},pages:[{startedDateTime:d.toISOString(),id:c,title:f,pageTimings:{onLoad:b}}],entries:a}}}var i,arg,page,urlCount,viewport,webpage=require("webpage"),args=phantom.args,len=args.length,urls=[],yslowArgs={info:"all",format:"json",ruleset:"ydefault",beacon:false,ua:false,viewport:false,headers:false,console:0,threshold:80,harfilename:""},unaryArgs={help:false,version:false,dict:false,verbose:false},argsAlias={i:"info",f:"format",r:"ruleset",h:"help",V:"version",d:"dict",u:"ua",vp:"viewport",c:"console",b:"beacon",v:"verbose",t:"threshold",ch:"headers",n:"harfilename"};for(i=0;i specify the information to display/log (basic|grade|stats|comps|all) [all]"," -f, --format specify the output results format (json|xml|plain|tap|junit) [json]"," -r, --ruleset specify the YSlow performance ruleset to be used (ydefault|yslow1|yblog) [ydefault]"," -b, --beacon specify an URL to log the results"," -d, --dict include dictionary of results fields"," -v, --verbose output beacon response information"," -t, --threshold for test formats, the threshold to test scores ([0-100]|[A-F]|{JSON}) [80]",' e.g.: -t B or -t 75 or -t \'{"overall": "B", "ycdn": "F", "yexpires": 85}\'',' -u, --ua "" specify the user agent string sent to server when the page requests resources'," -vp, --viewport specify page viewport size WxY, where W = width and H = height [400x300]",' -ch, --headers specify custom request headers, e.g.: -ch \'{"Cookie": "foo=bar"}\''," -c, --console output page console messages (0: none, 1: message, 2: message + line + source) [0]"," -n, --harfilename the name of the HAR file, if no name is supplied, no HAR is created",""," Examples:",""," phantomjs "+phantom.scriptName+" http://yslow.org"," phantomjs "+phantom.scriptName+" -i grade -f xml www.yahoo.com www.cnn.com www.nytimes.com"," phantomjs "+phantom.scriptName+' -info all --format plain --ua "MSIE 9.0" http://yslow.org'," phantomjs "+phantom.scriptName+" -i basic --rulseset yslow1 -d http://yslow.org"," phantomjs "+phantom.scriptName+" -i grade -b http://www.showslow.com/beacon/yslow/ -v yslow.org"," phantomjs --load-plugins=yes "+phantom.scriptName+" -vp 800x600 http://www.yahoo.com"," phantomjs "+phantom.scriptName+" -i grade -f tap -t 85 http://yslow.org",""].join("\n"));phantom.exit()}yslowArgs.dict=unaryArgs.dict;yslowArgs.verbose=unaryArgs.verbose;urls.forEach(function(a){var c=webpage.create();c.resources={};c.harresources=[];c.address=a;c.redirects=[];c.settings.webSecurityEnabled=false;c.onLoadStarted=function(){c.startTime=new Date()};c.onResourceRequested=function(d){c.resources[d.url]={request:d};d.starttime=d.time.getTime();c.harresources[d.id]={request:d,startReply:null,endReply:null}};c.onResourceReceived=function(e){if(e.stage==="start"){c.harresources[e.id].startReply=e}if(e.stage==="end"){c.harresources[e.id].endReply=e;if(e.status===301||e.status===302){var h;for(var d=0;d0){if(!n.exists(yslowArgs.harfilename)){n.write(yslowArgs.harfilename,JSON.stringify(har,undefined,4),"w")}}for(d in g){if(g.hasOwnProperty(d)){h=g[d].response;if(h){h.time=new Date(h.time)-e}}}f=function(){if(typeof YSLOW==="undefined"){YSLOW={}}YSLOW.DEBUG=true;YSLOW.registerRule=function(s){YSLOW.controller.addRule(s)};YSLOW.registerRuleset=function(s){YSLOW.controller.addRuleset(s)};YSLOW.registerRenderer=function(s){YSLOW.controller.addRenderer(s)};YSLOW.registerTool=function(s){YSLOW.Tools.addCustomTool(s)};YSLOW.addEventListener=function(t,u,s){YSLOW.util.event.addListener(t,u,s)};YSLOW.removeEventListener=function(s,t){return YSLOW.util.event.removeListener(s,t)};YSLOW.Error=function(s,t){this.name=s;this.message=t};YSLOW.Error.prototype={toString:function(){return this.name+"\n"+this.message}};YSLOW.version="3.1.8";YSLOW.ComponentSet=function(s,t){this.root_node=s;this.components=[];this.outstanding_net_request=0;this.component_info=[];this.onloadTimestamp=t;this.nextID=1;this.notified_fetch_done=false};YSLOW.ComponentSet.prototype={clear:function(){this.components=[];this.component_info=[];this.cleared=true;if(this.outstanding_net_request>0){YSLOW.util.dump("YSLOW.ComponentSet.Clearing component set before all net requests finish.")}},addComponent:function(v,w,t,y){var s,x,u;if(!v){if(!this.empty_url){this.empty_url=[]}this.empty_url[w]=(this.empty_url[w]||0)+1}if(v&&w){if(!YSLOW.ComponentSet.isValidProtocol(v)||!YSLOW.ComponentSet.isValidURL(v)){return s}v=YSLOW.util.makeAbsoluteUrl(v,t);v=YSLOW.util.escapeHtml(v);x=typeof this.component_info[v]!=="undefined";u=w==="doc";if(!x||u){this.component_info[v]={state:"NONE",count:x?this.component_info[v].count:0};s=new YSLOW.Component(v,w,this,y);if(s){s.id=this.nextID+=1;this.components[this.components.length]=s;if(!this.doc_comp&&u){this.doc_comp=s}if(this.component_info[v].state==="NONE"){this.component_info[v].state="REQUESTED";this.outstanding_net_request+=1}}else{this.component_info[v].state="ERROR";YSLOW.util.event.fire("componentFetchError")}}this.component_info[v].count+=1}return s},addComponentNoDuplicate:function(t,u,s){if(t&&u){t=YSLOW.util.escapeHtml(t);t=YSLOW.util.makeAbsoluteUrl(t,s);if(this.component_info[t]===undefined){return this.addComponent(t,u,s)}}},getComponentsByType:function(F,C,w){var y,x,D,v,G,A,u,z=this.components,E=this.component_info,s=[],B={};if(typeof C==="undefined"){C=!(YSLOW.util.Preference.getPref("excludeAfterOnload",true))}if(typeof w==="undefined"){w=!(YSLOW.util.Preference.getPref("excludeBeaconsFromLint",true))}if(typeof F==="string"){B[F]=1}else{for(y=0,D=F.length;y0){y=w.substr(0,u);for(v=0;v0){y.expires=new Date(y.headers.expires)}}if(y.type==="image"&&!u){if(typeof Image!==D){w=new Image()}else{w=document.createElement("img")}if(y.body.length){A="data:"+y.headers["content-type"]+";base64,"+YSLOW.util.base64Encode(y.body);B=1}else{A=y.url}w.onerror=function(){w.onerror=v;if(B){w.src=y.url}};w.onload=function(){w.onload=v;if(w&&w.width&&w.height){if(y.object_prop){y.object_prop.actual_width=w.width;y.object_prop.actual_height=w.height}else{y.object_prop={width:w.width,height:w.height,actual_width:w.width,actual_height:w.height}}if(w.width<2&&w.height<2){y.is_beacon=true}}};w.src=A}};YSLOW.Component.prototype.hasOldModifiedDate=function(){var s=Number(new Date()),t=this.headers["last-modified"];if(typeof t!=="undefined"){return((s-Number(new Date(t)))>(24*60*60*1000))}return false};YSLOW.Component.prototype.hasFarFutureExpiresOrMaxAge=function(){var v,t=Number(new Date()),u=YSLOW.util.Preference.getPref("minFutureExpiresSeconds",2*24*60*60),s=u*1000;if(typeof this.expires==="object"){v=Number(this.expires);if((v-t)>s){return true}}return false};YSLOW.Component.prototype.getEtag=function(){return this.headers.etag||""};YSLOW.Component.prototype.getMaxAge=function(){var t,u,s,v=this.headers["cache-control"];if(v){t=v.indexOf("max-age");if(t>-1){u=parseInt(v.substring(t+8),10);if(u>0){s=YSLOW.util.maxAgeToDate(u)}}}return s};YSLOW.Component.prototype.getSetCookieSize=function(){var u,s,t=0;if(this.headers&&this.headers["set-cookie"]){u=this.headers["set-cookie"].split("\n");if(u.length>0){for(s=0;s0){u=this.cookie.split("\n");if(u.length>0){for(s=0;ss.parent.onloadTimestamp;s.populateProperties(false,true);s.get_info_state="DONE";s.parent.onComponentGetInfoStateChange({comp:s,state:"DONE"})};if(u.request&&u.response){t(u.request,u.response)}};YSLOW.controller={rules:{},rulesets:{},onloadTimestamp:null,renderers:{},default_ruleset_id:"ydefault",run_pending:0,init:function(){var t,s,v,u;YSLOW.util.event.addListener("onload",function(w){this.onloadTimestamp=w.time;YSLOW.util.setTimer(function(){YSLOW.controller.run_pending_event()})},this);YSLOW.util.event.addListener("onUnload",function(w){this.run_pending=0;this.onloadTimestamp=null},this);t=YSLOW.util.Preference.getPrefList("customRuleset.",undefined);if(t&&t.length>0){for(s=0;s0){v=JSON.parse(u,null);v.custom=true;this.addRuleset(v)}}}this.default_ruleset_id=YSLOW.util.Preference.getPref("defaultRuleset","ydefault");this.loadRulePreference()},run:function(v,w,t){var x,s,u=v.document;if(!u||!u.location||u.location.href.indexOf("about:")===0||"undefined"===typeof u.location.hostname){if(!t){s="Please enter a valid website address before running YSlow.";YSLOW.ysview.openDialog(YSLOW.ysview.panel_doc,389,150,s,"","Ok")}return}if(!w.PAGE.loaded){this.run_pending={win:v,yscontext:w};return}YSLOW.util.event.fire("peelStart",undefined);x=YSLOW.peeler.peel(u,this.onloadTimestamp);w.component_set=x;YSLOW.util.event.fire("peelComplete",{component_set:x});x.notifyPeelDone()},run_pending_event:function(){if(this.run_pending){this.run(this.run_pending.win,this.run_pending.yscontext,false);this.run_pending=0}},lint:function(J,u,s){var v,z,H,y,A,B,I,G=[],E=[],F=0,D=0,w=this,x=w.rulesets,C=w.default_ruleset_id;if(s){G=x[s]}else{if(C&&x[C]){G=x[C]}else{for(H in x){if(x.hasOwnProperty(H)&&x[H]){G=x[H];break}}}}z=G.rules;for(H in z){if(z.hasOwnProperty(H)&&z[H]&&this.rules.hasOwnProperty(H)){try{v=this.rules[H];y=YSLOW.util.merge(v.config,z[H]);A=v.lint(J,u.component_set,y);B=(G.weights?G.weights[H]:undefined);if(B!==undefined){B=parseInt(B,10)}if(B===undefined||B<0||B>100){if(x.ydefault.weights[H]){B=x.ydefault.weights[H]}else{B=5}}A.weight=B;if(A.score!==undefined){if(typeof A.score!=="number"){I=parseInt(A.score,10);if(!isNaN(I)){A.score=I}}if(typeof A.score==="number"){D+=A.weight;if(!YSLOW.util.Preference.getPref("allowNegativeScore",false)){if(A.score<0){A.score=0}if(typeof A.score!=="number"){A.score=-1}}if(A.score!==0){F+=A.score*(typeof A.weight!=="undefined"?A.weight:1)}}}A.name=v.name;A.category=v.category;A.rule_id=H;E[E.length]=A}catch(t){YSLOW.util.dump("YSLOW.controller.lint: "+H,t);YSLOW.util.event.fire("lintError",{rule:H,message:t})}}}u.PAGE.overallScore=F/(D>0?D:1);u.result_set=new YSLOW.ResultSet(E,u.PAGE.overallScore,G);u.result_set.url=u.component_set.doc_comp.url;YSLOW.util.event.fire("lintResultReady",{yslowContext:u});return u.result_set},runTool:function(F,C,u){var I,y,E,x,A,t,D,v,H,G,z,B=YSLOW.Tools.getTool(F);try{if(typeof B==="object"){I=B.run(C.document,C.component_set,u);if(B.print_output){y="";if(typeof I==="object"){y=I.html}else{if(typeof I==="string"){y=I}}E=YSLOW.util.getNewDoc();z=E.body||E.documentElement;z.innerHTML=y;x=E.getElementsByTagName("head")[0];if(typeof I.css==="undefined"){t="chrome://yslow/content/yslow/tool.css";D=new XMLHttpRequest();D.open("GET",t,false);D.send(null);A=D.responseText}else{A=I.css}if(typeof A==="string"){v=E.createElement("style");v.setAttribute("type","text/css");v.appendChild(E.createTextNode(A));x.appendChild(v)}if(typeof I.js!=="undefined"){H=E.createElement("script");H.setAttribute("type","text/javascript");H.appendChild(E.createTextNode(I.js));x.appendChild(H)}if(typeof I.plot_component!=="undefined"&&I.plot_component===true){YSLOW.renderer.plotComponents(E,C)}}}else{G=F+" is not a tool.";YSLOW.util.dump(G);YSLOW.util.event.fire("toolError",{tool_id:F,message:G})}}catch(w){YSLOW.util.dump("YSLOW.controller.runTool: "+F,w);YSLOW.util.event.fire("toolError",{tool_id:F,message:w})}},render:function(w,s,v){var u=this.renderers[w],t="";if(u.supports[s]!==undefined&&u.supports[s]===1){switch(s){case"components":t=u.componentsView(v.comps,v.total_size);break;case"reportcard":t=u.reportcardView(v.result_set);break;case"stats":t=u.statsView(v.stats);break;case"tools":t=u.toolsView(v.tools);break;case"rulesetEdit":t=u.rulesetEditView(v.rulesets);break}}return t},getRenderer:function(s){return this.renderers[s]},addRule:function(u){var s,t,v=["id","name","config","info","lint"];if(YSLOW.doc.rules&&YSLOW.doc.rules[u.id]){t=YSLOW.doc.rules[u.id];if(t.name){u.name=t.name}if(t.info){u.info=t.info}}for(s=0;s0&&t){t.config.howfar=s}}};YSLOW.util={merge:function(t,s){var u,v={};for(u in t){if(t.hasOwnProperty(u)){v[u]=t[u]}}for(u in s){if(s.hasOwnProperty(u)){v[u]=s[u]}}return v},dump:function(){var s;if(!YSLOW.DEBUG){return}s=Array.prototype.slice.apply(arguments);s=s&&s.length===1?s[0]:s;try{if(typeof Firebug!=="undefined"&&Firebug.Console&&Firebug.Console.log){Firebug.Console.log(s)}else{if(typeof Components!=="undefined"&&Components.classes&&Components.interfaces){Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService).logStringMessage(JSON.stringify(s,null,2))}}}catch(u){try{console.log(s)}catch(t){}}},filter:function(v,w,t){var u,s=t?[]:{};for(u in v){if(v.hasOwnProperty(u)&&w(u,v[u])){s[t?s.length:u]=v[u]}}return s},expires_month:{Jan:1,Feb:2,Mar:3,Apr:4,May:5,Jun:6,Jul:7,Aug:8,Sep:9,Oct:10,Nov:11,Dec:12},prettyExpiresDate:function(s){var t;if(Object.prototype.toString.call(s)==="[object Date]"&&s.toString()!=="Invalid Date"&&!isNaN(s)){t=s.getMonth()+1;return s.getFullYear()+"/"+t+"/"+s.getDate()}else{if(!s){return"no expires"}}return"invalid date object"},maxAgeToDate:function(t){var s=new Date();s=s.getTime()+parseInt(t,10)*1000;return new Date(s)},plural:function(u,v){var t,s=u,w={are:["are","is"],s:["s",""],"do":["do","does"],num:[v,v]};for(t in w){if(w.hasOwnProperty(t)){s=s.replace(new RegExp("%"+t+"%","gm"),(v===1)?w[t][1]:w[t][0])}}return s},countExpressions:function(u){var s=0,t;t=u.indexOf("expression(");while(t!==-1){s+=1;t=u.indexOf("expression(",t+1)}return s},countAlphaImageLoaderFilter:function(x){var v,w,u,y,t=0,z=0,s={};v=x.indexOf("filter:");while(v!==-1){u=false;if(v>0&&x.charAt(v-1)==="_"){u=true}w=x.indexOf(";",v+7);if(w!==-1){y=x.substring(v+7,w);if(y.indexOf("AlphaImageLoader")!==-1){if(u){z+=1}else{t+=1}}}v=x.indexOf("filter:",v+1)}if(z>0){s.hackFilter=z}if(t>0){s.filter=t}return s},getHostname:function(t){var s=t.split("/")[2];return(s&&s.split(":")[0])||""},getUniqueDomains:function(y,w){var v,t,x,s={},u=[];for(v=0,t=y.length;v0.2){return false}return true},isETagGood:function(s){var u=/^[0-9a-f]+:([1-9a-f]|[0-9a-f]{2,})$/,t=/^[0-9a-f]+\-[0-9a-f]+\-[0-9a-f]+$/;if(!s){return true}s=s.replace(/^["']|["'][\s\S]*$/g,"");return !(t.test(s)||u.test(s))},getComponentType:function(s){var t="unknown";if(s&&typeof s==="string"){if(s==="text/html"||s==="text/plain"){t="doc"}else{if(s==="text/css"){t="css"}else{if(/javascript/.test(s)){t="js"}else{if(/flash/.test(s)){t="flash"}else{if(/image/.test(s)){t="image"}else{if(/font/.test(s)){t="font"}}}}}}}return t},base64Encode:function(x){var w,v,u,z,t="",y=0,s=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];for(w=0;w>2];t+=s[((v&3)<<4)|((u&240)>>4)];if(y>0){t+="="}else{t+=s[((u&15)<<2)|((z&192)>>6)]}if(y>1){t+="="}else{t+=s[(z&63)]}}return t},getXHR:function(){var s=0,v=null,t=["MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];if(typeof XMLHttpRequest==="function"){return new XMLHttpRequest()}for(s=0;s/g,">")},escapeQuotes:function(t,s){if(s==="single"){return t.replace(/\'/g,"\\'")}if(s==="double"){return t.replace(/\"/g,'\\"')}return t.replace(/\'/g,"\\'").replace(/\"/g,'\\"')},formatHeaderName:(function(){var s={"content-md5":"Content-MD5",dnt:"DNT",etag:"ETag",p3p:"P3P",te:"TE","www-authenticate":"WWW-Authenticate","x-att-deviceid":"X-ATT-DeviceId","x-cdn":"X-CDN","x-ua-compatible":"X-UA-Compatible","x-xss-protection":"X-XSS-Protection"};return function(u){var t=u.toLowerCase();if(s.hasOwnProperty(t)){return s[t]}else{return t.replace(/(^|-)([a-z])/g,function(v,w,x){return w+x.toUpperCase()})}}}()),mod:function(s,t){return Math.round(s-(Math.floor(s/t)*t))},briefUrl:function(u,s){var t,v,w,x;s=s||100;if(u===undefined){return""}t=u.indexOf("//");if(-1!==t){v=u.indexOf("?");if(-1!==v){u=u.substring(0,v)+"?..."}if(u.length>s){w=u.indexOf("/",t+2);x=u.lastIndexOf("/");if(-1!==w&&-1!==x&&w!==x){u=u.substring(0,w+1)+"..."+u.substring(x)}else{u=u.substring(0,s+1)+"..."}}}return u},prettyAnchor:function(A,t,v,u,y,s,B){var w,z="",x="",C=0;if(typeof t==="undefined"){t=A}if(typeof v==="undefined"){v=""}else{v=' class="'+v+'"'}if(typeof y==="undefined"){y=100}if(typeof s==="undefined"){s=1}B=(B)?' rel="'+B+'"':"";t=YSLOW.util.escapeHtml(t);A=YSLOW.util.escapeHtml(A);w=YSLOW.util.escapeQuotes(t,"double");if(u){A=YSLOW.util.briefUrl(A,y);z=' title="'+w+'"'}while(0"+A.substring(0,y);A=A.substring(y);C+=1;if(C>=s){if(0";break}else{x+=" "}}return x},kbSize:function(s){var t=s%(s>100?100:10);s-=t;return parseFloat(s/1000)+(0===(s%1000)?".0":"")+"K"},prettyTypes:{image:"Image",doc:"HTML/Text",cssimage:"CSS Image",css:"Stylesheet File",js:"JavaScript File",flash:"Flash Object",iframe:"IFrame",xhr:"XMLHttpRequest",redirect:"Redirect",favicon:"Favicon",unknown:"Unknown"},prettyType:function(s){return YSLOW.util.prettyTypes[s]},prettyScore:function(t){var s="F";if(!parseInt(t,10)&&t!==0){return t}if(t===-1){return"N/A"}if(t>=90){s="A"}else{if(t>=80){s="B"}else{if(t>=70){s="C"}else{if(t>=60){s="D"}else{if(t>=50){s="E"}}}}}return s},getResults:function(y,U){var Q,N,L,w,v,J,V,I,H,z,x,t,Y,S,K,u,G,F,A,C,P,M,D,B=/ "):"")}}return{score:L,message:B,components:t}}});YSLOW.registerRule({id:"yexpires",url:"http://developer.yahoo.com/performance/rules.html#expires",category:["server"],config:{points:11,howfar:172800,types:["css","js","image","cssimage","flash","favicon"]},lint:function(A,C,t){var z,v,B,u,y,w=parseInt(t.howfar,10)*1000,x=[],s=C.getComponentsByType(t.types);for(v=0,y=s.length;vz+w){continue}}x.push(s[v])}u=100-x.length*parseInt(t.points,10);return{score:u,message:(x.length>0)?YSLOW.util.plural("There %are% %num% static component%s%",x.length)+" without a far-future expiration date.":"",components:x}}});YSLOW.registerRule({id:"ycompress",url:"http://developer.yahoo.com/performance/rules.html#gzip",category:["server"],config:{min_filesize:500,types:["doc","iframe","xhr","js","css"],points:11},lint:function(z,A,t){var v,y,u,w,x=[],s=A.getComponentsByType(t.types);for(v=0,y=s.length;v0)?YSLOW.util.plural("There %are% %num% plain text component%s%",x.length)+" that should be sent compressed":"",components:x}}});YSLOW.registerRule({id:"ycsstop",url:"http://developer.yahoo.com/performance/rules.html#css_top",category:["css"],config:{points:10},lint:function(z,A,t){var v,y,u,w,s=A.getComponentsByType("css"),x=[];for(v=0,y=s.length;v0){u-=1+x.length*parseInt(t.points,10)}return{score:u,message:(x.length>0)?YSLOW.util.plural("There %are% %num% stylesheet%s%",x.length)+" found in the body of the document":"",components:x}}});YSLOW.registerRule({id:"yjsbottom",url:"http://developer.yahoo.com/performance/rules.html#js_bottom",category:["javascript"],config:{points:5},lint:function(z,A,t){var v,y,w,u,x=[],s=A.getComponentsByType("js");for(v=0,y=s.length;v0)?YSLOW.util.plural("There %are% %num% JavaScript script%s%",x.length)+" found in the head of the document":"",components:x}}});YSLOW.registerRule({id:"yexpressions",url:"http://developer.yahoo.com/performance/rules.html#css_expressions",category:["css"],config:{points:2},lint:function(A,D,t){var v,y,C,w,B=(D.inline&&D.inline.styles)||[],s=D.getComponentsByType("css"),x=[],u=100,z=0;for(v=0,y=s.length;v0){w.yexpressions=YSLOW.util.plural("%num% expression%s%",C);z+=C;x.push(w)}}for(v=0,y=B.length;v0){x.push("inline <style> tag #"+(v+1)+" ("+YSLOW.util.plural("%num% expression%s%",C)+")");z+=C}}if(z>0){u=90-z*t.points}return{score:u,message:z>0?"There is a total of "+YSLOW.util.plural("%num% expression%s%",z):"",components:x}}});YSLOW.registerRule({id:"yexternal",url:"http://developer.yahoo.com/performance/rules.html#external",category:["javascript","css"],config:{},lint:function(x,z,t){var v,w=z.inline,u=(w&&w.styles)||[],s=(w&&w.scripts)||[],y=[];if(u.length){v=YSLOW.util.plural("There is a total of %num% inline css",u.length);y.push(v)}if(s.length){v=YSLOW.util.plural("There is a total of %num% inline script%s%",s.length);y.push(v)}return{score:"n/a",message:"Only consider this if your property is a common user home page.",components:y}}});YSLOW.registerRule({id:"ydns",url:"http://developer.yahoo.com/performance/rules.html#dns_lookups",category:["content"],config:{max_domains:4,points:5},lint:function(A,C,s){var v,x,u,w=YSLOW.util,y=w.kbSize,z=w.plural,t=100,B=w.summaryByDomain(C.components,["size","size_compressed"],true);if(B.length>s.max_domains){t-=(B.length-s.max_domains)*s.points}if(B.length){for(v=0,x=B.length;v0?" ("+y(u.sum_size_compressed)+" GZip)":"")}}return{score:t,message:(B.length>s.max_domains)?z("The components are split over more than %num% domain%s%",s.max_domains):"",components:B}}});YSLOW.registerRule({id:"yminify",url:"http://developer.yahoo.com/performance/rules.html#minify",category:["javascript","css"],config:{points:10,types:["js","css"]},lint:function(C,E,t){var w,z,u,B,x,A=E.inline,D=(A&&A.styles)||[],v=(A&&A.scripts)||[],s=E.getComponentsByType(t.types),y=[];for(w=0,z=s.length;w0)?YSLOW.util.plural("There %are% %num% component%s% that can be minified",y.length):"",components:y}}});YSLOW.registerRule({id:"yredirects",url:"http://developer.yahoo.com/performance/rules.html#redirects",category:["content"],config:{points:10},lint:function(A,B,t){var w,z,x,u,y=[],v=YSLOW.util.briefUrl,s=B.getComponentsByType("redirect");for(w=0,z=s.length;w0)?YSLOW.util.plural("There %are% %num% redirect%s%",s.length):"",components:y}}});YSLOW.registerRule({id:"ydupes",url:"http://developer.yahoo.com/performance/rules.html#js_dupes",category:["javascript","css"],config:{points:5,types:["js","css"]},lint:function(A,B,u){var x,s,v,z,w={},y=[],t=B.getComponentsByType(u.types);for(x=0,z=t.length;x1){y.push(t[w[x].compindex])}}v=100-y.length*parseInt(u.points,10);return{score:v,message:(y.length>0)?YSLOW.util.plural("There %are% %num% duplicate component%s%",y.length):"",components:y}}});YSLOW.registerRule({id:"yetags",url:"http://developer.yahoo.com/performance/rules.html#etags",category:["server"],config:{points:11,types:["flash","js","css","cssimage","image","favicon"]},lint:function(A,B,t){var v,y,u,w,z,x=[],s=B.getComponentsByType(t.types);for(v=0,y=s.length;v0)?YSLOW.util.plural("There %are% %num% component%s% with misconfigured ETags",x.length):"",components:x}}});YSLOW.registerRule({id:"yxhr",url:"http://developer.yahoo.com/performance/rules.html#cacheajax",category:["content"],config:{points:5,min_cache_time:3600},lint:function(A,C,t){var w,B,z,u,y,v=parseInt(t.min_cache_time,10)*1000,x=[],s=C.getComponentsByType("xhr");for(w=0;wz+v){continue}}x.push(s[w])}u=100-x.length*parseInt(t.points,10);return{score:u,message:(x.length>0)?YSLOW.util.plural("There %are% %num% XHR component%s% that %are% not cacheable",x.length):"",components:x}}});YSLOW.registerRule({id:"yxhrmethod",url:"http://developer.yahoo.com/performance/rules.html#ajax_get",category:["server"],config:{points:5},lint:function(u,y,s){var t,v,x=[],w=y.getComponentsByType("xhr");for(t=0;t0)?YSLOW.util.plural("There %are% %num% XHR component%s% that %do% not use GET HTTP method",x.length):"",components:x}}});YSLOW.registerRule({id:"ymindom",url:"http://developer.yahoo.com/performance/rules.html#min_dom",category:["content"],config:{range:250,points:10,maxdom:900},lint:function(u,w,t){var s=w.domElementsCount,v=100;if(s>t.maxdom){v=99-Math.ceil((s-parseInt(t.maxdom,10))/parseInt(t.range,10))*parseInt(t.points,10)}return{score:v,message:(s>t.maxdom)?YSLOW.util.plural("There %are% %num% DOM element%s% on the page",s):"",components:[]}}});YSLOW.registerRule({id:"yno404",url:"http://developer.yahoo.com/performance/rules.html#no404",category:["content"],config:{points:5,types:["css","js","image","cssimage","flash","xhr","favicon"]},lint:function(z,A,t){var v,y,w,u,x=[],s=A.getComponentsByType(t.types);for(v=0,y=s.length;v0)?YSLOW.util.plural("There %are% %num% request%s% that %are% 404 Not Found",x.length):"",components:x}}});YSLOW.registerRule({id:"ymincookie",url:"http://developer.yahoo.com/performance/rules.html#cookie_size",category:["cookie"],config:{points:10,max_cookie_size:1000},lint:function(w,z,t){var y,v=z.cookies,s=(v&&v.length)||0,u="",x=100;if(s>t.max_cookie_size){y=Math.floor(s/t.max_cookie_size);x-=1+y*parseInt(t.points,10);u=YSLOW.util.plural("There %are% %num% byte%s% of cookies on this page",s)}return{score:x,message:u,components:[]}}});YSLOW.registerRule({id:"ycookiefree",url:"http://developer.yahoo.com/performance/rules.html#cookie_free",category:["cookie"],config:{points:5,types:["js","css","image","cssimage","flash","favicon"]},lint:function(C,D,v){var x,B,w,z,s,A=[],u=YSLOW.util.getHostname,y=u(D.doc_comp.url),t=D.getComponentsByType(v.types);for(x=0,B=t.length;x0)?YSLOW.util.plural("There %are% %num% component%s% that %are% not cookie-free",A.length):"",components:A}}});YSLOW.registerRule({id:"ynofilter",url:"http://developer.yahoo.com/performance/rules.html#no_filters",category:["css"],config:{points:5,halfpoints:2},lint:function(D,G,u){var w,A,v,x,C,z,F,E=(G.inline&&G.inline.styles)||[],t=G.getComponentsByType("css"),y=[],s=0,B=0;for(w=0,A=t.length;w0){t[w].yfilters=YSLOW.util.plural("%num% filter%s%",z);y.push(t[w])}}for(w=0,A=E.length;w0){y.push("inline <style> tag #"+(w+1)+" ("+YSLOW.util.plural("%num% filter%s%",z)+")")}}v=100-(s*u.points+B*u.halfpoints);return{score:v,message:(s+B)>0?"There is a total of "+YSLOW.util.plural("%num% filter%s%",s+B):"",components:y}}});YSLOW.registerRule({id:"yimgnoscale",url:"http://developer.yahoo.com/performance/rules.html#no_scale",category:["images"],config:{points:5},lint:function(u,z,s){var t,y,v,x=[],w=z.getComponentsByType("image");for(t=0;t0)?YSLOW.util.plural("There %are% %num% image%s% that %are% scaled down",x.length):"",components:x}}});YSLOW.registerRule({id:"yfavicon",url:"http://developer.yahoo.com/performance/rules.html#favicon",category:["images"],config:{points:5,size:2000,min_cache_time:3600},lint:function(A,C,t){var z,B,y,v,u,x=[],w=parseInt(t.min_cache_time,10)*1000,s=C.getComponentsByType("favicon");if(s.length){y=s[0];if(parseInt(y.status,10)===404){x.push("Favicon was not found")}if(y.size>t.size){x.push(YSLOW.util.plural("Favicon is more than %num% bytes",t.size))}B=y.expires;if(typeof B==="object"&&typeof B.getTime==="function"){z=new Date().getTime();u=B.getTime()>=z+w}if(!u){x.push("Favicon is not cacheable")}}v=100-x.length*parseInt(t.points,10);return{score:v,message:(x.length>0)?x.join("\n"):"",components:[]}}});YSLOW.registerRule({id:"yemptysrc",url:"http://developer.yahoo.com/performance/rules.html#emptysrc",category:["server"],config:{points:100},lint:function(z,C,t){var y,u,x,A=C.empty_url,w=[],v=[],s="",B=parseInt(t.points,10);u=100;if(A){for(y in A){if(A.hasOwnProperty(y)){x=A[y];u-=x*B;v.push(x+" "+y)}}s=v.join(", ")+YSLOW.util.plural(" component%s% with empty link were found.",v.length)}return{score:u,message:s,components:w}}});YSLOW.registerRuleset({id:"ydefault",name:"YSlow(V2)",rules:{ynumreq:{},ycdn:{},yemptysrc:{},yexpires:{},ycompress:{},ycsstop:{},yjsbottom:{},yexpressions:{},yexternal:{},ydns:{},yminify:{},yredirects:{},ydupes:{},yetags:{},yxhr:{},yxhrmethod:{},ymindom:{},yno404:{},ymincookie:{},ycookiefree:{},ynofilter:{},yimgnoscale:{},yfavicon:{}},weights:{ynumreq:8,ycdn:6,yemptysrc:30,yexpires:10,ycompress:8,ycsstop:4,yjsbottom:4,yexpressions:3,yexternal:4,ydns:3,yminify:4,yredirects:4,ydupes:4,yetags:2,yxhr:4,yxhrmethod:3,ymindom:3,yno404:4,ymincookie:3,ycookiefree:3,ynofilter:4,yimgnoscale:3,yfavicon:2}});YSLOW.registerRuleset({id:"yslow1",name:"Classic(V1)",rules:{ynumreq:{},ycdn:{},yexpires:{},ycompress:{},ycsstop:{},yjsbottom:{},yexpressions:{},yexternal:{},ydns:{},yminify:{types:["js"],check_inline:false},yredirects:{},ydupes:{types:["js"]},yetags:{}},weights:{ynumreq:8,ycdn:6,yexpires:10,ycompress:8,ycsstop:4,yjsbottom:4,yexpressions:3,yexternal:4,ydns:3,yminify:4,yredirects:4,ydupes:4,yetags:2}});YSLOW.registerRuleset({id:"yblog",name:"Small Site or Blog",rules:{ynumreq:{},yemptysrc:{},ycompress:{},ycsstop:{},yjsbottom:{},yexpressions:{},ydns:{},yminify:{},yredirects:{},ydupes:{},ymindom:{},yno404:{},ynofilter:{},yimgnoscale:{},yfavicon:{}},weights:{ynumreq:8,yemptysrc:30,ycompress:8,ycsstop:4,yjsbottom:4,yexpressions:3,ydns:3,yminify:4,yredirects:4,ydupes:4,ymindom:3,yno404:4,ynofilter:4,yimgnoscale:3,yfavicon:2}});var p={};p.getTLD=function(u){var t=u;var s=/\.(gov|ac|mil|net|org|co)\.\w\w$/i;if(u.match(s)){var v=/[\w]+\.[\w]+\.[\w]+$/i;t=u.match(v).toString()}else{var w=/[\w]+\.[\w]+$/i;t=u.match(w).toString()}return t};p.getSynchronouslyJavascripts=function(u){var t=[];for(var s=0;s0){for(var w=0;w=(t||0)}p.versionCompare=function(u,w){if(u===undefined){return true}u=u.split(".");var s=r(u[0],w[0]),t=r(u[1],w[1]),v=r(u[2],w[2]);return(!s||s&&!t||s&&t&&!v)};p.isSameDomainTLD=function(t,u,s){if((/^http/).test(s)){if(t===p.getTLD(YSLOW.util.getHostname(s))){return true}else{return false}}else{if(t===p.getTLD(YSLOW.util.getHostname(u))){return true}else{return false}}return false};YSLOW.registerRule({id:"cssprint",name:"Do not load print stylesheets, use @media type print instead",info:"Loading a specific stylesheet for printing slows down the page, even though it is not used",category:["css"],config:{points:20},url:"http://sitespeed.io/rules/#cssprint",lint:function(A,C,v){var y,u,w,s,z=[],x={},t=C.getComponentsByType("css"),B=A.getElementsByTagName("link");for(y=0,len=B.length;y0)?YSLOW.util.plural("There %are% %num% print css files included on the page, that should be @media query instead",z.length):"",components:z}}});YSLOW.registerRule({id:"ttfb",name:"Time to first byte",info:"It is important to have low time to the first byte to be able to render the page fast",category:["server"],config:{points:10,limitInMs:300,hurtEveryMs:100},url:"http://sitespeed.io/rules/#ttfb",lint:function(y,A,u){var x,w=parseInt(u.limitInMs,10),z=parseInt(u.hurtEveryMs,10),v,t,s=A.getComponentsByType("doc");for(x=0,len=s.length;xw){v=100-(Math.ceil((t-w)/z)*parseInt(u.points,10))}}if(v<0){v=0}return{score:v,message:(v<100)?"The TTFB is too slow:"+t+" ms. The limit is "+w+" ms and for every "+z+" ms points are removed":"",components:[""+t]}}});YSLOW.registerRule({id:"cssinheaddomain",name:"Load CSS in head from document domain",info:"Make sure css in head is loaded from same domain as document, in order to have a better user experience and minimize dns lookups",category:["css"],config:{points:10},url:"http://sitespeed.io/rules/#cssinheaddomain",lint:function(D,F,u){var A=D.getElementsByTagName("link"),t=F.getComponentsByType("css"),B,z,s,C={},w=[],x=[],v=100;z=YSLOW.util.getHostname(F.doc_comp.url);for(y=0,len=A.length;yy){continue}}w.push(s[v])}u=100-w.length*parseInt(t.points,10);B=(w.length>0)?YSLOW.util.plural("There %are% %num% static component%s%",w.length)+" without a future expiration date.":"";return{score:u,message:B,components:w}}});YSLOW.registerRule({id:"longexpirehead",name:"Have expires headers equals or longer than one year",info:"All static components of a page should have at least one year expire header. However, analythics scripts will not give you bad points.",url:"http://sitespeed.io/rules/#longexpires",category:["server"],config:{points:5,types:["css","js","image","cssimage","flash","favicon"],skip:["https://secure.gaug.es/track.js","https://ssl.google-analytics.com/ga.js","http://www.google-analytics.com/ga.js"]},lint:function(B,E,t){var A,v,C,u,y,D,x=[],z=[],w=31535000*1000,s=E.getComponentsByType(t.types);for(v=0,y=s.length;vA+w){continue}else{if(t.skip.indexOf(s[v].url)>1){z.push(s[v].url);continue}}}x.push(s[v])}u=100-x.length*parseInt(t.points,10);D=(x.length>0)?YSLOW.util.plural("There %are% %num% static component%s%",x.length)+" without a expire header equal or longer than one year.":"";D+=(z.length>0)?YSLOW.util.plural(" There %are% %num% static component%s% that are skipped from the score calculation",z.length)+":"+z:"";return{score:u,message:D,components:x}}});YSLOW.registerRule({id:"inlinecsswhenfewrequest",name:"Do not load css files when the page has few request",info:"When a page has few requests, it is better to inline the css, to make the page to start render as early as possible",category:["css"],config:{points:20,limit:15,types:["css","js","image","cssimage","flash","favicon"]},url:"http://sitespeed.io/rules/#inlinecsswhenfewrequest",lint:function(v,z,s){var y=z.getComponentsByType(s.types),t=z.getComponentsByType("css"),u="",w=100,x=[];if(y.length0){for(i=0,len=t.length;i1){for(i=0,len=y.length;is.max_css){x-=(u.length-s.max_css)*s.points_css;v="This page has "+YSLOW.util.plural("%num% external stylesheet%s%",u.length)+". Try combining them into fewer requests.";for(var t=0;ts.max_cssimages){x-=(u.length-s.max_cssimages)*s.points_cssimages;v="This page has "+YSLOW.util.plural("%num% external css image%s%",u.length)+". Try combining them into fewer request.";for(var t=0;tt.max_js){B="There "+YSLOW.util.plural("%are% %num% script%s%",x.length)+" loaded synchronously that could be combined into fewer requests.";u-=(x.length-t.max_js)*parseInt(t.points_js,10)}return{score:u,message:B,components:x}}});YSLOW.registerRule({id:"noduplicates",name:"Remove duplicate JS and CSS",info:"It is bad practice include the same js or css twice",category:["js","css"],config:{},url:"http://developer.yahoo.com/performance/rules.html#js_dupes",lint:function(D,E,u){var y,s,v,C,A,x={},B=[],t=E.getComponentsByType(["js","css"]),w=D.getElementsByTagName("script"),z=D.getElementsByTagName("link");for(y=0,C=w.length;y1){B.push(t[y])}}v=100-B.length*11;return{score:v,message:(B.length>0)?YSLOW.util.plural("There %are% %num% js/css file%s% included more than once on the page",B.length):"",components:B}}});YSLOW.registerRule({id:"mindom",name:"Reduce the number of DOM elements",info:"The number of dom elements are in correlation to if the page is fast or not",url:"http://developer.yahoo.com/performance/rules.html#min_dom",category:["content"],config:{range:250,points:10,maxdom:900},lint:function(u,w,t){var s=w.domElementsCount,v=100;if(s>t.maxdom){v=99-Math.ceil((s-parseInt(t.maxdom,10))/parseInt(t.range,10))*parseInt(t.points,10)}return{score:v,message:(s>t.maxdom)?YSLOW.util.plural("There %are% %num% DOM element%s% on the page",s):"",components:[""+s]}}});YSLOW.registerRule({id:"thirdpartyversions",name:"Always use latest versions of third party javascripts",info:"Unisng the latest versions, will make sure you have the fastest and hopefully leanest javascripts.",url:"http://sitespeed.io/rules/#thirdpartyversions",category:["js"],config:{points:10},lint:function(u,x,s){var t="",v,w=0;if(typeof jQuery=="function"){if(p.versionCompare(jQuery.fn.jquery,[2,0,0])){t="You are using an old version of JQuery: "+jQuery.fn.jquery+" Newer version is faster & better. Upgrade to the newest version from http://jquery.com/";w+=1}}v=100-w*parseInt(s.points,10);return{score:v,message:t,components:[]}}});YSLOW.registerRule({id:"avoidscalingimages",name:"Never scale images in HTML",info:"Always use the correct size for images to avoid that a browser download an image that is larger than necessary.",url:"http://sitespeed.io/rules/#avoidscalingimages",category:["images"],config:{reallyBadLimit:100},lint:function(B,C,t){var D="",u,y=[],x={},A=0,s=C.getComponentsByType("image"),z=B.getElementsByTagName("img");for(var w=0;w0){D=D+" "+v.src+" [browserWidth:"+v.clientWidth+" realImageWidth: "+v.naturalWidth+"]";x[v.src]=1;if((v.clientWidth+t.reallyBadLimit)0)?YSLOW.util.plural("You have %num% image%s% that %are% scaled in the HTML:"+D,y.length):"",components:y}}});YSLOW.registerRule({id:"redirects",name:"Never do redirects",info:"Avoid doing redirects, it will kill you web page on mobile.",url:"http://sitespeed.io/rules/#redirects",category:["content"],config:{points:10},lint:function(t,v,s){var u;u=100-v.redirects.length*parseInt(s.points,10);return{score:u,message:(v.redirects.length>0)?YSLOW.util.plural("There %are% %num% redirect%s%.",v.redirects.length)+" "+v.redirects:"",components:[]}}});YSLOW.registerRuleset({id:"sitespeed.io-2.0-desktop",name:"Sitespeed.io desktop rules v2.0",rules:{criticalpath:{},spof:{fontFaceInCssSpof:false,inlineFontFaceSpof:false},cssnumreq:{},cssimagesnumreq:{},jsnumreq:{},yemptysrc:{},ycompress:{},ycsstop:{},yjsbottom:{},yexpressions:{},ydns:{},yminify:{},redirects:{},noduplicates:{},yetags:{},yxhr:{},yxhrmethod:{},mindom:{},yno404:{},ymincookie:{},ycookiefree:{},ynofilter:{},avoidscalingimages:{},yfavicon:{},thirdpartyasyncjs:{},cssprint:{},cssinheaddomain:{},syncjsinhead:{},avoidfont:{},totalrequests:{},expiresmod:{},longexpirehead:{},nodnslookupswhenfewrequests:{},inlinecsswhenfewrequest:{},textcontent:{},thirdpartyversions:{}},weights:{criticalpath:15,spof:5,cssnumreq:8,cssimagesnumreq:8,jsnumreq:8,yemptysrc:30,ycompress:8,ycsstop:4,yjsbottom:4,yexpressions:3,ydns:3,yminify:4,redirects:4,noduplicates:4,yetags:2,yxhr:4,yxhrmethod:3,mindom:3,yno404:4,ymincookie:3,ycookiefree:3,ynofilter:4,avoidscalingimages:5,yfavicon:2,thirdpartyasyncjs:10,cssprint:3,cssinheaddomain:8,syncjsinhead:20,avoidfont:1,totalrequests:10,expiresmod:10,longexpirehead:5,nodnslookupswhenfewrequests:8,inlinecsswhenfewrequest:7,textcontent:1,thirdpartyversions:5}});YSLOW.registerRuleset({id:"sitespeed.io-2.0-mobile",name:"Sitespeed.io mobile rules v2.0",rules:{criticalpath:{},spof:{fontFaceInCssSpof:false,inlineFontFaceSpof:false},cssnumreq:{},cssimagesnumreq:{},jsnumreq:{},yemptysrc:{},ycompress:{},ycsstop:{},yjsbottom:{},yexpressions:{},ydns:{},yminify:{},redirects:{},noduplicates:{},yetags:{},yxhr:{},yxhrmethod:{},mindom:{},yno404:{},ymincookie:{},ycookiefree:{},ynofilter:{},avoidscalingimages:{},yfavicon:{},thirdpartyasyncjs:{},cssprint:{},cssinheaddomain:{},syncjsinhead:{},avoidfont:{},totalrequests:{},expiresmod:{},longexpirehead:{},nodnslookupswhenfewrequests:{},inlinecsswhenfewrequest:{},textcontent:{},thirdpartyversions:{}},weights:{criticalpath:20,spof:5,cssnumreq:8,cssimagesnumreq:8,jsnumreq:8,yemptysrc:30,ycompress:8,ycsstop:4,yjsbottom:4,yexpressions:3,ydns:3,yminify:4,redirects:15,noduplicates:4,yetags:2,yxhr:4,yxhrmethod:3,mindom:3,yno404:4,ymincookie:3,ycookiefree:3,ynofilter:4,avoidscalingimages:10,yfavicon:2,thirdpartyasyncjs:10,cssprint:3,cssinheaddomain:8,syncjsinhead:20,avoidfont:5,totalrequests:14,expiresmod:10,longexpirehead:5,nodnslookupswhenfewrequests:15,inlinecsswhenfewrequest:10,textcontent:1,thirdpartyversions:5}});YSLOW.ResultSet=function(u,t,s){this.ruleset_applied=s;this.overall_score=t;this.results=u};YSLOW.ResultSet.prototype={getResults:function(){return this.results},getRulesetApplied:function(){return this.ruleset_applied},getOverallScore:function(){return this.overall_score}};YSLOW.view=function(t,y){var w,v,x,s,u;this.panel_doc=t.document;this.buttonViews={};this.curButtonId="";this.panelNode=t.panelNode;this.loadCSS(this.panel_doc);w=this.panel_doc.createElement("div");w.id="toolbarDiv";w.innerHTML=this.getToolbarSource();w.style.display="block";v=this.panel_doc.createElement("div");v.style.display="block";x='

text

';s=this.panel_doc.createElement("div");s.id="dialogDiv";s.innerHTML=x;s.style.display="none";this.modaldlg=s;this.tooltip=new YSLOW.view.Tooltip(this.panel_doc,t.panelNode);u=this.panel_doc.createElement("div");u.id="copyrightDiv";u.innerHTML=YSLOW.doc.copyright;this.copyright=u;if(t.panelNode){t.panelNode.id="yslowDiv";t.panelNode.appendChild(s);t.panelNode.appendChild(w);t.panelNode.appendChild(v);t.panelNode.appendChild(u)}this.viewNode=v;this.viewNode.id="viewDiv";this.viewNode.className="yui-skin-sam";this.yscontext=y;YSLOW.util.addEventListener(this.panelNode,"click",function(F){var A,B,z,G,C;var E=FBL.getContentView(t.document);var D=E.ysview.getElementByTagNameAndId(t.panelNode,"div","toolbarDiv");if(D){B=E.ysview.getElementByTagNameAndId(D,"li","helpLink");if(B){z=B.offsetLeft;G=B.offsetTop;C=B.offsetParent;while(C){z+=C.offsetLeft;G+=C.offsetTop;C=C.offsetParent}if(F.clientX>=z&&F.clientY>=G&&F.clientX"+A.name+"

"+A.info,B.target)}}}});YSLOW.util.addEventListener(this.panelNode,"mouseout",function(A){var z=FBL.getContentView(t.document);z.ysview.tooltip.hide()});YSLOW.util.addEventListener(this.panel_doc.defaultView||this.panel_doc.parentWindow,"resize",function(B){var A=FBL.getContentView(t.document);var z=A.ysview.modaldlg;if(z&&z.style.display==="block"){z.style.display="none"}})};YSLOW.view.prototype={setDocument:function(s){this.panel_doc=s},loadCSS:function(){},addButtonView:function(s,u){var t=this.getButtonView(s);if(!t){t=this.panel_doc.createElement("div");t.style.display="none";this.viewNode.appendChild(t);this.buttonViews[s]=t}t.innerHTML=u;this.showButtonView(s)},clearAllButtonView:function(){var t=this.buttonViews,u=this.viewNode,s=function(w){if(t.hasOwnProperty(w)){u.removeChild(t[w]);delete t[w]}};s("ysPerfButton");s("ysCompsButton");s("ysStatsButton")},showButtonView:function(t){var s,u=this.getButtonView(t);if(!u){YSLOW.util.dump("ERROR: YSLOW.view.showButtonView: Couldn't find ButtonView '"+t+"'.");return}for(s in this.buttonViews){if(this.buttonViews.hasOwnProperty(s)&&s!==t){this.buttonViews[s].style.display="none"}}if(t==="ysPerfButton"){if(this.copyright){this.copyright.style.display="none"}}else{if(this.curButtonId==="ysPerfButton"){if(this.copyright){this.copyright.style.display="block"}}}u.style.display="block";this.curButtonId=t},getButtonView:function(s){return(this.buttonViews.hasOwnProperty(s)?this.buttonViews[s]:undefined)},setButtonView:function(s,u){var t=this.getButtonView(s);if(!t){YSLOW.util.dump("ERROR: YSLOW.view.setButtonView: Couldn't find ButtonView '"+s+"'.");return}t.innerHTML=u;this.showButtonView(s)},setSplashView:function(t,u,v){var y,x="Grade your web pages with YSlow",z="YSlow gives you:",w="
  • Grade based on the performance (you can define your own rules)
  • Summary of the Components in the page
  • Chart with statistics
  • Tools including Smush.It and JSLint
  • ",s="Learn more about YSlow and YDN";if(YSLOW.doc.splash){if(YSLOW.doc.splash.title){x=YSLOW.doc.splash.title}if(YSLOW.doc.splash.content){if(YSLOW.doc.splash.content.header){z=YSLOW.doc.splash.content.header}if(YSLOW.doc.splash.content.text){w=YSLOW.doc.splash.content.text}}if(YSLOW.doc.splash.more_info){s=YSLOW.doc.splash.more_info}}if(typeof v!=="undefined"){YSLOW.hideToolsInfo=v}else{v=YSLOW.hideToolsInfo}if(v){w=w.replace(/
  • Tools[^<]+<\/li>/,"")}y='

    '+x+'

    '+z+'

      '+w+"
    ";if(typeof t!=="undefined"){YSLOW.hideAutoRun=t}else{t=YSLOW.hideAutoRun}if(!t){y+=''}y+='
    ";this.addButtonView("panel_about",y)},genProgressView:function(){var s='

    Finding components in the page:

    Getting component information:

    start...
    ';this.setButtonView("panel_about",s)},updateProgressView:function(s,x){var w,z,A,y,B,t,u,v,C="";if(this.curButtonId==="panel_about"){B=this.getButtonView(this.curButtonId);if(s==="peel"){w=this.getElementByTagNameAndId(B,"div","peelprogress");z=this.getElementByTagNameAndId(B,"div","progbar");A=this.getElementByTagNameAndId(B,"div","progtext");C=x.message;y=(x.current_step*100)/x.total_step}else{if(s==="fetch"){w=this.getElementByTagNameAndId(B,"div","fetchprogress");z=this.getElementByTagNameAndId(B,"div","progbar2");A=this.getElementByTagNameAndId(B,"div","progtext2");C=x.last_component_url;y=(x.current*100)/x.total}else{if(s==="message"){A=this.getElementByTagNameAndId(B,"div","progtext2");if(A){A.innerHTML=x}return}else{return}}}}if(w&&z&&A){t=w.clientWidth;if(y<0){y=0}if(y>100){y=100}y=100-y;u=(t*y)/100;if(u>t){u=t}v=t-parseInt(u,10);z.style.width=parseInt(u,10)+"px";z.style.left=parseInt(v,10)+"px";A.innerHTML=C}},updateStatusBar:function(z){var B,u,C,v,s,t=YSLOW,w=t.util,y=t.view,A=w.Preference,x=this.yscontext;if(!x.PAGE.statusbar){x.PAGE.statusbar=true;if(!x.PAGE.overallScore){t.controller.lint(z,x)}if(!x.PAGE.totalSize){x.collectStats()}B=w.kbSize(x.PAGE.totalSize);u=w.prettyScore(x.PAGE.overallScore);y.setStatusBar(u,"yslow_status_grade");y.setStatusBar(B,"yslow_status_size");if(A.getPref("optinBeacon",false)){v=A.getPref("beaconInfo","basic"),s=A.getPref("beaconUrl","http://rtblab.pclick.yahoo.com/images/ysb.gif");C=w.getResults(x,v);w.sendBeacon(C,v,s)}}},getRulesetListSource:function(s){var w,u,v="",t=YSLOW.controller.getDefaultRulesetId();for(w in s){if(s[w]){v+='"}}return v},updateRulesetList:function(){var w,y,u,v=this.panel_doc.getElementsByTagName("select"),s=YSLOW.controller.getRegisteredRuleset(),t=this.getRulesetListSource(s),x=function(z){var A=FBL.getContentView(this.ownerDocument);A.ysview.onChangeRuleset(z)};for(w=0;wRulesets ";v+='';v+='";v+='";v+="";return v},show:function(t){var u="html",s="";t=t||this.yscontext.defaultview;if(this.yscontext.component_set===null){YSLOW.controller.run(window.top.content,this.yscontext,false);this.yscontext.defaultview=t}else{if(this.getButtonView(t)){this.showButtonView(t)}else{if("ysCompsButton"===t){s+=this.yscontext.genComponents(u);this.addButtonView("ysCompsButton",s)}else{if("ysStatsButton"===t){s+=this.yscontext.genStats(u);this.addButtonView("ysStatsButton",s);YSLOW.renderer.plotComponents(this.getButtonView("ysStatsButton"),this.yscontext)}else{if("ysToolButton"===t){s+=this.yscontext.genToolsView(u);this.addButtonView("ysToolButton",s)}else{s+=this.yscontext.genPerformance(u);this.addButtonView("ysPerfButton",s)}}}}this.panelNode.scrollTop=0;this.panelNode.scrollLeft=0;this.updateStatusBar(this.yscontext.document);this.updateToolbarSelection()}},updateToolbarSelection:function(){var s,t,u;switch(this.curButtonId){case"ysCompsButton":case"ysPerfButton":case"ysStatsButton":case"ysToolButton":s=this.getElementByTagNameAndId(this.panelNode,"li",this.curButtonId);if(s){if(s.className.indexOf("selected")!==-1){return}else{s.className+=" selected";if(s.previousSibling){s.previousSibling.className+=" off"}}}break;default:break}t=this.getElementByTagNameAndId(this.panelNode,"ul","toolbarLinks");u=t.firstChild;while(u){if(u.id!==this.curButtonId&&u.className.indexOf("selected")!==-1){this.unselect(u);if(u.previousSibling){YSLOW.view.removeClassName(u.previousSibling,"off")}}u=u.nextSibling}},showPerformance:function(){this.show("ysPerfButton")},showStats:function(){this.show("ysStatsButton")},showComponents:function(){this.show("ysCompsButton")},showTools:function(){this.show("ysToolButton")},showRuleSettings:function(){var s=this.yscontext.genRulesetEditView("html");this.addButtonView("ysRuleEditButton",s);this.panelNode.scrollTop=0;this.panelNode.scrollLeft=0;this.updateToolbarSelection()},runTest:function(){YSLOW.controller.run(window.top.content,this.yscontext,false)},setAutorun:function(s){YSLOW.util.Preference.setPref("extensions.yslow.autorun",s)},setAntiIframe:function(s){YSLOW.antiIframe=s},addCDN:function(B){var v,t,x=this,z=document,C=x.yscontext,D=YSLOW.util.Preference,y=D.getPref("cdnHostnames",""),s=x.panel_doc,u=s.getElementById("tab-label-list"),A=u.getElementsByTagName("li"),w=A.length;if(y){y=y.replace(/\s+/g,"").split(",");y.push(B);y=y.join()}else{y=B}D.setPref("extensions.yslow.cdnHostnames",y);for(v=0;v-1){t=u.id;break}}YSLOW.controller.lint(C.document,C);x.addButtonView("ysPerfButton",C.genPerformance("html"));YSLOW.view.restoreStatusBar(C);x.updateToolbarSelection();u=s.getElementById(t);x.onclickTabLabel({currentTarget:u},true)},onChangeRuleset:function(v){var w,t,x,y,s=YSLOW.util.getCurrentTarget(v),u=s.options[s.selectedIndex];YSLOW.controller.setDefaultRuleset(u.value);w=s.ownerDocument;t="Do you want to run the selected ruleset now?";x="Run Test";y=function(A){var z;w.ysview.closeDialog(w);if(w.yslowContext.component_set===null){YSLOW.controller.run(w.yslowContext.document.defaultView||w.yslowContext.document.parentWindow,w.yslowContext,false)}else{YSLOW.controller.lint(w.yslowContext.document,w.yslowContext)}z=w.yslowContext.genPerformance("html");w.ysview.addButtonView("ysPerfButton",z);w.ysview.panelNode.scrollTop=0;w.ysview.panelNode.scrollLeft=0;YSLOW.view.restoreStatusBar(w.yslowContext);w.ysview.updateToolbarSelection()};this.openDialog(w,389,150,t,undefined,x,y)},onclickTabLabel:function(s,y){var u,t,v,A,C,B,x,D=YSLOW.util.getCurrentTarget(s),z=D.parentNode,w=z.nextSibling;if(D.className.indexOf("selected")!==-1||D.id.indexOf("label")===-1){return false}if(z){u=z.firstChild;while(u){if(this.unselect(u)){t=u.id.substring(5);break}u=u.nextSibling}D.className+=" selected";v=D.id.substring(5);u=w.firstChild;while(u){x=u.id.substring(3);if(!A&&t&&x===t){if(u.className.indexOf("yui-hidden")===-1){u.className+=" yui-hidden"}A=true}if(!C&&v&&x===v){YSLOW.view.removeClassName(u,"yui-hidden");C=true;B=u}if((A||!t)&&(C||!v)){break}u=u.nextSibling}if(y===true&&C===true&&B){this.positionResultTab(B,w,D)}}return false},positionResultTab:function(t,s,z){var w,B,C,x=5,A=this.panel_doc,v=A.defaultView||A.parentWindow,u=v.offsetHeight?v.offsetHeight:v.innerHeight,D=z.offsetTop+t.offsetHeight;s.style.height=D+"px";t.style.position="absolute";t.style.left=z.offsetLeft+z.offsetWidth+"px";t.style.top=z.offsetTop+"px";w=t.offsetTop;B=t.offsetParent;while(B!==null){w+=B.offsetTop;B=B.offsetParent}if(wthis.panelNode.scrollTop+u){if(ww-this.panelNode.scrollTop){C=w-this.panelNode.scrollTop}this.panelNode.scrollTop+=C}}},onclickResult:function(s){YSLOW.util.preventDefault(s);return this.onclickTabLabel(s,true)},unselect:function(s){return YSLOW.view.removeClassName(s,"selected")},filterResult:function(B,s){var x,w,t,y,u,z,v,A=this.getButtonView("ysPerfButton");if(s==="all"){w=true}if(A){x=this.getElementByTagNameAndId(A,"ul","tab-label-list")}if(x){t=x.firstChild;v=x.nextSibling;u=v.firstChild;while(t){YSLOW.view.removeClassName(t,"first");if(w||t.className.indexOf(s)!==-1){t.style.display="block";if(y===undefined){y=u;z=t;YSLOW.view.removeClassName(u,"yui-hidden");t.className+=" first";if(t.className.indexOf("selected")===-1){t.className+=" selected"}t=t.nextSibling;u=u.nextSibling;continue}}else{t.style.display="none"}if(u.className.indexOf("yui-hidden")===-1){u.className+=" yui-hidden"}this.unselect(t);t=t.nextSibling;u=u.nextSibling}if(y){this.positionResultTab(y,v,z)}}},updateFilterSelection:function(u){var s,t=YSLOW.util.getCurrentTarget(u);YSLOW.util.preventDefault(u);if(t.className.indexOf("selected")!==-1){return}t.className+=" selected";s=t.parentNode.firstChild;while(s){if(s!==t&&this.unselect(s)){break}s=s.nextSibling}this.filterResult(t.ownerDocument,t.id)},onclickToolbarMenu:function(s){var w,u=YSLOW.util.getCurrentTarget(s),v=u.parentNode,t=v.parentNode;if(v.className.indexOf("selected")!==-1){return}v.className+=" selected";if(v.previousSibling){v.previousSibling.className+=" off"}if(t){w=t.firstChild;while(w){if(w!==v&&this.unselect(w)){if(w.previousSibling){YSLOW.view.removeClassName(w.previousSibling,"off")}break}w=w.nextSibling}}},expandCollapseComponentType:function(w,t){var u,v=YSLOW.controller.getRenderer("html"),s=this.getButtonView("ysCompsButton");if(s){u=this.getElementByTagNameAndId(s,"table","components-table");v.expandCollapseComponentType(w,u,t)}},expandAll:function(v){var t,u=YSLOW.controller.getRenderer("html"),s=this.getButtonView("ysCompsButton");if(s){t=this.getElementByTagNameAndId(s,"table","components-table");u.expandAllComponentType(v,t)}},regenComponentsTable:function(x,w,t){var u,v=YSLOW.controller.getRenderer("html"),s=this.getButtonView("ysCompsButton");if(s){u=this.getElementByTagNameAndId(s,"table","components-table");v.regenComponentsTable(x,u,w,t,this.yscontext.component_set)}},showComponentHeaders:function(u){var t,v,s=this.getButtonView("ysCompsButton");if(s){t=this.getElementByTagNameAndId(s,"tr",u);if(t){v=t.firstChild;if(t.style.display==="none"){t.style.display="table-row"}else{t.style.display="none"}}}},openLink:function(s){YSLOW.util.openLink(s)},openPopup:function(u,t,w,s,v){window.open(u,t||"_blank","width="+(w||626)+",height="+(s||436)+","+(v||"toolbar=0,status=1,location=1,resizable=1"))},runTool:function(s,t){YSLOW.controller.runTool(s,this.yscontext,t)},onclickRuleset:function(x){var u,t,s,w,y=YSLOW.util.getCurrentTarget(x),v=y.className.indexOf("ruleset-");YSLOW.util.preventDefault(x);if(v!==-1){t=y.className.indexOf(" ",v+8);if(t!==-1){u=y.className.substring(v+8,t)}else{u=y.className.substring(v+8)}s=this.getButtonView("ysRuleEditButton");if(s){w=this.getElementByTagNameAndId(s,"form","edit-form");YSLOW.renderer.initRulesetEditForm(y.ownerDocument,w,YSLOW.controller.getRuleset(u))}}return this.onclickTabLabel(x,false)},openSaveAsDialog:function(u,t){var s='',v="Save",w=function(D){var A,y,x,B,z,C=YSLOW.util.getCurrentTarget(D).ownerDocument;if(C.ysview.modaldlg){A=C.ysview.getElementByTagNameAndId(C.ysview.modaldlg,"input","saveas-name")}if(A){if(YSLOW.controller.checkRulesetName(A.value)===true){y=s+'
    '+A.value+" ruleset already exists.
    ";C.ysview.closeDialog(C);C.ysview.openDialog(C,389,150,y,"",v,w)}else{x=C.ysview.getButtonView("ysRuleEditButton");if(x){B=C.ysview.getElementByTagNameAndId(x,"form",t);z=C.createElement("input");z.type="hidden";z.name="saveas-name";z.value=A.value;B.appendChild(z);B.submit()}C.ysview.closeDialog(C)}}};this.openDialog(u,389,150,s,undefined,v,w)},openPrintableDialog:function(v){var u="Please run YSlow first before using Printable View.",t="Check which information you want to view or print
    ",s='
    ',w="Ok",x=function(A){var y,z=YSLOW.util.getCurrentTarget(A).ownerDocument,z=FBL.getContentView(z);aInputs=z.getElementsByName("print-type"),print_type={};for(y=0;y0){for(s=0;s0){if(L[G].className==="dialog-box"){I=L[G]}else{if(L[G].className==="dialog-text"){B=L[G]}else{if(L[G].className==="dialog-more-text"){A=L[G]}}}}}if(J&&I&&B&&A){B.innerHTML=(z?z:"");A.innerHTML=(y?y:"");t=J.getElementsByTagName("input");for(F=0;F0)?u:225)+"px";I.style.top=((C&&C>0)?C:80)+"px";J.style.left=this.panelNode.scrollLeft+"px";J.style.top=this.panelNode.scrollTop+"px";J.style.display="block";if(t.length>0){t[0].focus()}}},closeDialog:function(t){var s=this.modaldlg;s.style.display="none"},saveRuleset:function(w,t){var u,v=YSLOW.controller.getRenderer("html"),s=this.getButtonView("ysRuleEditButton");if(s){u=this.getElementByTagNameAndId(s,"form",t);v.saveRuleset(w,u)}},deleteRuleset:function(w,t){var u,v=YSLOW.controller.getRenderer("html"),s=this.getButtonView("ysRuleEditButton");if(s){u=this.getElementByTagNameAndId(s,"form",t);v.deleteRuleset(w,u)}},shareRuleset:function(x,v){var s,z,w,A,y,t=YSLOW.controller.getRenderer("html"),u=this.getButtonView("ysRuleEditButton");if(u){s=this.getElementByTagNameAndId(u,"form",v);z=t.getEditFormRulesetId(s);w=YSLOW.controller.getRuleset(z);if(w){A=YSLOW.Exporter.exportRuleset(w);if(A){y="";this.openDialog(x,389,150,y,"","Ok")}}}},createRuleset:function(u,t){var s,v,x=u.parentNode,w=x.parentNode,y=w.firstChild;while(y){this.unselect(y);y=y.nextSibling}s=this.getButtonView("ysRuleEditButton");if(s){v=this.getElementByTagNameAndId(s,"form",t);YSLOW.renderer.initRulesetEditForm(this.panel_doc,v)}},showHideHelp:function(){var s,t=this.getElementByTagNameAndId(this.panelNode,"div","toolbarDiv");if(t){s=this.getElementByTagNameAndId(t,"div","helpDiv")}if(s){if(s.style.visibility==="visible"){s.style.visibility="hidden"}else{s.style.visibility="visible"}}},smushIt:function(t,s){YSLOW.util.smushIt(s,function(y){var w,v,x,z,u="";if(y.error){u+="
    "+y.error+"
    "}else{x=YSLOW.util.getSmushUrl();z=YSLOW.util.makeAbsoluteUrl(y.dest,x);u+="
    Original size: "+y.src_size+" bytes
    Result size: "+y.dest_size+" bytes
    % Savings: "+y.percent+"%
    "}w='
    Image: '+YSLOW.util.briefUrl(s,250)+"
    ";v=u;t.ysview.openDialog(t,389,150,w,v,"Ok")})},checkAllRules:function(x,u,t){var v,s,w,y;if(typeof t!=="boolean"){return}s=this.getButtonView("ysRuleEditButton");if(s){w=this.getElementByTagNameAndId(s,"form",u);y=w.elements;for(v=0;vF||J>s){this.tooltip.style.display="none";return}H=A.offsetParent;while(H!==null){D+=H.offsetLeft;C+=H.offsetTop;H=H.offsetParent}D+=A.offsetLeft;C+=A.offsetTop;if(DG.ysview.panelNode.scrollTop+s)){this.tooltip.style.display="none";return}v=D+A.offsetWidth/2;u=C+A.offsetHeight/2;if(D+A.offsetWidth+E+w=G.ysview.panelNode.scrollTop)&&(C-E+J+E<=G.ysview.panelNode.scrollTop+s)){C=C-E;t="right top"}else{C+=A.offsetHeight-J;t="right bottom"}}else{if(C-J-E>=G.ysview.panelNode.scrollTop){C-=J+E;t="top"}else{C+=A.offsetHeight+E;t="bottom"}B=Math.floor(v-w/2);if((B>=G.ysview.panelNode.scrollLeft)&&(B+w<=G.ysview.panelNode.scrollLeft+F)){D=B}else{if(B0&&s&&s.length>0){v=u.className.split(" ");for(t=0;t0){A[s]=y[s]}E+=y[s]}}return{total_size:E,num_requests:t,count_obj:x,size_obj:y,canvas_data:A}},collectStats:function(){var s=this.computeStats();if(s!==undefined){this.PAGE.totalSize=s.total_size;this.PAGE.totalRequests=s.num_requests;this.PAGE.totalObjCount=s.count_obj;this.PAGE.totalObjSize=s.size_obj;this.PAGE.canvas_data.empty=s.canvas_data}s=this.computeStats(true);if(s){this.PAGE.totalSizePrimed=s.total_size;this.PAGE.totalRequestsPrimed=s.num_requests;this.PAGE.totalObjCountPrimed=s.count_obj;this.PAGE.totalObjSizePrimed=s.size_obj;this.PAGE.canvas_data.primed=s.canvas_data}},genPerformance:function(t,s){if(this.result_set===null){if(!s){s=this.document}YSLOW.controller.lint(s,this)}return YSLOW.controller.render(t,"reportcard",{result_set:this.result_set})},genStats:function(t){var s={};if(!this.PAGE.totalSize){this.collectStats()}s.PAGE=this.PAGE;return YSLOW.controller.render(t,"stats",{stats:s})},genComponents:function(s){if(!this.PAGE.totalSize){this.collectStats()}return YSLOW.controller.render(s,"components",{comps:this.component_set.components,total_size:this.PAGE.totalSize})},genToolsView:function(t){var s=YSLOW.Tools.getAllTools();return YSLOW.controller.render(t,"tools",{tools:s})},genRulesetEditView:function(s){return YSLOW.controller.render(s,"rulesetEdit",{rulesets:YSLOW.controller.getRegisteredRuleset()})}};YSLOW.renderer={sortBy:"type",sortDesc:false,bPrintable:false,colors:{doc:"#8963df",redirect:"#FC8C8C",iframe:"#FFDFDF",xhr:"#89631f",flash:"#8D4F5B",js:"#9fd0e8",css:"#aba5eb",cssimage:"#677ab8",image:"#d375cd",favicon:"#a26c00",unknown:"#888888"},reset:function(){this.sortBy="type";this.sortDesc=false},genStats:function(A,B){var x,y,u,t,D,z,s,w,v="",C=0;if(!A.PAGE){return""}if(B){x=A.PAGE.totalObjCountPrimed;y=A.PAGE.totalObjSizePrimed;u=A.PAGE.totalRequestsPrimed;C=A.PAGE.totalSizePrimed}else{x=A.PAGE.totalObjCount;y=A.PAGE.totalObjSize;u=A.PAGE.totalRequests;C=A.PAGE.totalSize}t=YSLOW.peeler.types;D=(B)?"primed":"empty";for(z=0;z
     
    '+x[s]+''+YSLOW.util.prettyType(s)+''+YSLOW.util.kbSize(y[s])+""}}w='
    HTTP Requests - '+u+'
    Total Weight - '+YSLOW.util.kbSize(C)+'
    '+v+"
    ";return w},plotComponents:function(s,t){if(typeof s!=="object"){return}this.plotOne(s,t.PAGE.canvas_data.empty,t.PAGE.totalSize,"comp-canvas-empty");this.plotOne(s,t.PAGE.canvas_data.primed,t.PAGE.totalSizePrimed,"comp-canvas-primed")},plotOne:function(C,v,B,A){var u,w,E,t,z,s,y,F,x,D=C.getElementsByTagName("canvas");for(w=0;w'+YSLOW.util.escapeHtml(s.headers[u])+""}}if(s.req_headers){t+='Request Headers';for(u in s.req_headers){if(s.req_headers.hasOwnProperty(u)&&s.req_headers[u]){t+=''+YSLOW.util.escapeHtml(YSLOW.util.formatHeaderName(u))+'

    '+YSLOW.util.escapeHtml(s.req_headers[u])+"

    "}}}t+="";return t},genComponentRow:function(y,x,t,w){var u,C,v,s,B,A,z;if(typeof t!=="string"){t=""}if(x.status>=400&&x.status<500){t+=" compError"}if(x.after_onload===true){t+=" afteronload"}u="compHeaders"+x.id;C='";for(v in y){if(y.hasOwnProperty(v)){s=v;B="";if(v==="type"){B+=x[v];if(x.is_beacon){B+=" †"}if(x.after_onload){B+=" *"}}else{if(v==="size"){B+=YSLOW.util.kbSize(x.size)}else{if(v==="url"){if(x.status>=400&&x.status<500){C+=''+x[v]+" (status: "+x.status+")";continue}else{B+=YSLOW.util.prettyAnchor(x[v],x[v],undefined,!YSLOW.renderer.bPrintable,100,1,x.type)}}else{if(v==="gzip"&&(x.compressed==="gzip"||x.compressed==="deflate")){B+=(x.size_compressed!==undefined?YSLOW.util.kbSize(x.size_compressed):"uncertain")}else{if(v==="set-cookie"){A=x.getSetCookieSize();B+=A>0?A:""}else{if(v==="cookie"){z=x.getReceivedCookieSize();B+=z>0?z:""}else{if(v==="etag"){B+=x.getEtag()}else{if(v==="expires"){B+=YSLOW.util.prettyExpiresDate(x.expires)}else{if(v==="headers"){if(YSLOW.renderer.bPrintable){continue}if(x.raw_headers&&x.raw_headers.length>0){B+="'}}else{if(v==="action"){if(YSLOW.renderer.bPrintable){continue}if(x.type==="cssimage"||x.type==="image"){if(x.response_type===undefined||x.response_type==="image"){B+="smush.it"}}}else{if(x[v]!==undefined){B+=x[v]}}}}}}}}}}}C+=''+B+""}}C+="";if(x.raw_headers&&x.raw_headers.length>0){C+=''+this.getComponentHeadersTable(x)+""}return C},componentSortCallback:function(s,A){var t,v,w,y="",x="",z=YSLOW.renderer.sortBy,u=YSLOW.renderer.sortDesc;switch(z){case"type":y=s.type;x=A.type;break;case"size":y=s.size?Number(s.size):0;x=A.size?Number(A.size):0;break;case"gzip":y=s.size_compressed?Number(s.size_compressed):0;x=A.size_compressed?Number(A.size_compressed):0;break;case"set-cookie":y=s.getSetCookieSize();x=A.getSetCookieSize();break;case"cookie":y=s.getReceivedCookieSize();x=A.getReceivedCookieSize();break;case"headers":break;case"url":y=s.url;x=A.url;break;case"respTime":y=s.respTime?Number(s.respTime):0;x=A.respTime?Number(A.respTime):0;break;case"etag":y=s.getEtag();x=A.getEtag();break;case"action":if(s.type==="cssimage"||s.type==="image"){y="smush.it"}if(A.type==="cssimage"||A.type==="image"){x="smush.it"}break;case"expires":y=s.expires||0;x=A.expires||0;break}if(y===x){if(s.id>A.id){return(u)?-1:1}if(s.idx){return(u)?-1:1}if(y',x='
    ',v='
    ';for(s in C){if(C.hasOwnProperty(s)&&C[s]){A=C[s];u='
    ";if(B.rules[s]!==undefined){D+=1}if(B.weights!==undefined&&B.weights[s]!==undefined){y+=''}t=(w%3);switch(t){case 0:z+=u;break;case 1:x+=u;break;case 2:v+=u;break}w+=1}}z+="
    ";x+="
    ";v+="";return'

    '+B.name+' Ruleset (includes '+parseInt(D,10)+" of "+parseInt(w,10)+' rules)

    '+z+""+x+""+v+'
    '+y+"
    "},genRulesetEditForm:function(s){var t="";t+='
    '+YSLOW.renderer.genRulesCheckbox(s)+'
    ';return t},initRulesetEditForm:function(K,t,F){var E,H,G,D,I,M,y,L,x,A,s,w,C,u=t.elements,v="",B=[],z=0,J=0;for(H=0;H'}z+=1}}s.innerHTML="(includes "+parseInt(z,10)+" of "+parseInt(J,10)+" rules)";M.innerHTML='';y.innerHTML='';L.innerHTML=F.name}else{M.innerHTML="";y.innerHTML="";L.innerHTML="New";s.innerHTML=""}x.innerHTML=v}};YSLOW.registerRenderer({id:"html",supports:{components:1,reportcard:1,stats:1,tools:1,rulesetEdit:1},genComponentsTable:function(t,E,x){var C,A,D,B,w={type:"TYPE",size:"SIZE
    (KB)",gzip:"GZIP
    (KB)","set-cookie":"COOKIE RECEIVED
    (bytes)",cookie:"COOKIE SENT
    (bytes)",headers:"HEADERS",url:"URL",expires:"EXPIRES
    (Y/M/D)",respTime:"RESPONSE
    TIME (ms)",etag:"ETAG",action:"ACTION"},z=false,v="",y="",s=0,u=0;if(E!==undefined&&w[E]===undefined){return""}if(YSLOW.renderer.bPrintable){E=YSLOW.renderer.sortBy;x=YSLOW.renderer.sortDesc}else{if(E===undefined||E==="type"){E="type";z=true}}t=YSLOW.renderer.sortComponents(t,E,x);v+='';for(C in w){if(w.hasOwnProperty(C)&&w[C]){if(YSLOW.renderer.bPrintable&&(C==="action"||C==="components"||C==="headers")){continue}v+="'+(E===C?(x?"↓":"↑"):"")+" "+w[C]+""}}}v+="";for(A=0;A";v+=y;y="";s=0;u=0;D=B.type}}y+=YSLOW.renderer.genComponentRow(w,B,(s%2===0?"even":"odd"),z);s+=1;u+=B.size}else{v+=YSLOW.renderer.genComponentRow(w,B,(A%2===0?"even":"odd"),false)}}if(y.length>0){v+='";v+=y}v+="
    '+D+" ("+s+')'+YSLOW.util.kbSize(u)+"
    '+D+" ("+s+')'+YSLOW.util.kbSize(u)+"
    ";return v},componentsView:function(y,t){var v,u=this.genComponentsTable(y,YSLOW.renderer.sortBy,false),w="in type column indicates the component is loaded after window onload event.",s="denotes 1x1 pixels image that may be image beacon",x="Components";if(YSLOW.doc){if(YSLOW.doc.components_legend){if(YSLOW.doc.components_legend.beacon){w=YSLOW.doc.components_legend.beacon}if(YSLOW.doc.components_legend.after_onload){s=YSLOW.doc.components_legend.after_onload}}if(YSLOW.doc.view_names&&YSLOW.doc.view_names.components){x=YSLOW.doc.view_names.components}}v='
    '+x+'The page has a total of '+y.length+' components and a total weight of '+YSLOW.util.kbSize(t)+' bytes
    '+u+'
    * '+w+"
    † "+s+"
    ";return v},reportcardPrintableView:function(v,t,y){var w,u,A,s,z,x='
    ";for(w=0;w"}}x+="
    Overall Grade: '+t+" (Ruleset applied: "+y.name+")
    '+s+'

    '+A.name+'

    '+A.message+"
    ";if(A.components&&A.components.length>0){x+='
      ';for(u=0;u"+A.components[u]+""}else{if(A.components[u].url!==undefined){x+="
    • "+YSLOW.util.briefUrl(A.components[u].url,60)+"
    • "}}}x+="

    "}x+="

    ";return x},getFilterCode:function(z,w,u,s){var y,t,x,A,D,E,v,C=w.length,B=[];for(t in z){if(z.hasOwnProperty(t)&&z[t]){B.push(t)}}B.sort();y='
    • ALL ('+C+')
    • FILTER BY:
    • ';for(x=0,A=B.length;x'+B[x].toUpperCase()+" ("+z[B[x]]+")"}D="http://yslow.org/scoremeter/?url="+encodeURIComponent(s)+"&grade="+u;for(x=0;x=0&&v<100){D+="&"+E.rule_id.toLowerCase()+"="+v}}D=encodeURIComponent(encodeURIComponent(D));s=encodeURIComponent(encodeURIComponent(s.slice(0,60)+(s.length>60?"...":"")));y+='";y+='";y+="
    ";return y},reportcardView:function(u){var y,J,H,G,z,t,x,N,D,K,M,L,s,w,A='
    ',I=u.getRulesetApplied(),C=u.getResults(),v=u.url,O="Grade",F="",E="",B={};if(YSLOW.doc){if(YSLOW.doc.view_names&&YSLOW.doc.view_names.grade){O=YSLOW.doc.view_names.grade}}y=YSLOW.util.prettyScore(u.getOverallScore());if(YSLOW.renderer.bPrintable){return this.reportcardPrintableView(C,y,I)}A+='
    '+O+'
    '+y+'
    Overall performance score '+Math.round(u.getOverallScore())+'Ruleset applied: '+I.name+'URL: '+YSLOW.util.briefUrl(v,100)+"
    ";for(J=0;J0){N+=" "}N+=z.category[G];if(B[z.category[G]]===undefined){B[z.category[G]]=0}B[z.category[G]]+=1}}if(N.length>0){F+=' class="'+N+'"'}F+=' onclick="javascript:document.ysview.onclickResult(event)">
    '+t+''+z.name+"
  • ";E+='
    ")}E+='">

    Grade '+t+" on "+z.name+"

    "+z.message+"
    ";if(z.components&&z.components.length>0){E+='

      ';for(H=0;H"+L+""}else{if(L.url!==undefined){E+="
    • ";s=z.rule_id.toLowerCase();if(z.rule_id.match("expires")){E+="("+YSLOW.util.prettyExpiresDate(L.expires)+") "}E+=YSLOW.util.prettyAnchor(L.url,L.url,undefined,true,120,undefined,L.type)+"
    • "}}}E+="

    "}E+="

    ";w=YSLOW.controller.getRule(z.rule_id);if(w){E+='

    '+(w.info||"** To be added **")+"

    ";if(w.url!==undefined){E+='

    »Read More

    "}}E+="
    "}}A+='
    '+this.getFilterCode(B,C,y,v)+'
      '+F+'
    '+E+'
    '+YSLOW.doc.copyright+"
    ";return A},statsView:function(t){var s="",u="Stats";if(YSLOW.doc){if(YSLOW.doc.view_names&&YSLOW.doc.view_names.stats){u=YSLOW.doc.view_names.stats}}s+='
    '+u+'The page has a total of '+t.PAGE.totalRequests+' HTTP requests and a total weight of '+YSLOW.util.kbSize(t.PAGE.totalSize)+" bytes with empty cache
    ";s+='
    WEIGHT GRAPHS
    ';s+='
    Empty Cache
    '+YSLOW.renderer.genStats(t,false)+"
    ";s+='
    Primed Cache
    '+YSLOW.renderer.genStats(t,true)+"
    ";s+="
    ";return s},toolsView:function(w){var v,u,t,s="",y="Tools",x="Click the Launch Tool link next to the tool you want to run to start the tool.";if(YSLOW.doc){if(YSLOW.doc.tools_desc){x=YSLOW.doc.tools_desc}if(YSLOW.doc.view_names&&YSLOW.doc.view_names.tools){y=YSLOW.doc.view_names.tools}}for(v=0;v"}s+="
    "+t.name+"-"+(t.short_desc||"Short text here explaining what are the main benefits of running this App")+"
    ";u='
    '+y+""+x+'
    '+s+"
    ";return u},rulesetEditView:function(F){var u,D,w,v,y='
    ',E,B,A=0,t=false,s,x,C="Rule Settings",z="Choose which ruleset better fit your specific needs. You can Save As an existing rule, based on an existing ruleset.";if(YSLOW.doc){if(YSLOW.doc.rulesettings_desc){z=YSLOW.doc.rulesettings_desc}if(YSLOW.doc.view_names&&YSLOW.doc.view_names.rulesetedit){C=YSLOW.doc.view_names.rulesetedit}}x=YSLOW.controller.getDefaultRulesetId();E='
    • STANDARD SETS
    • ';for(u in F){if(F.hasOwnProperty(u)&&F[u]){D=F[u];w="tab"+A;if(!t&&D.custom===true){E+='
    • CUSTOM SETS
    • ';t=true}E+='
    • '+D.name+"
    • ";A+=1}}E+='
    ';B='
    '+YSLOW.renderer.genRulesetEditForm(s)+"
    ";y+=E+B;v='
    '+C+""+z+"
    "+y+"
    ";return v},rulesetEditUpdateTab:function(K,s,E,t,C){var u,D,H,w,B,I,F,z,v,A,J,G,x,y=s.parentNode.parentNode.parentNode;if(y&&y.id==="settingsDiv"&&E.custom===true){u=y.firstChild;D=u.nextSibling;if(t<1){H=u.firstChild;while(H){w=H.className.indexOf("ruleset-");if(w!==-1){B=H.className.substring(w+8);w=B.indexOf(" ");if(w!==-1){B=B.substring(0,w)}if(E.id===B){w=H.id.indexOf("label");if(w!==-1){I=H.id.substring(w+5);if(H.className.indexOf("selected")!==-1){F={};F.currentTarget=J;K.ysview.onclickRuleset(F)}if(H.previousSibling&&H.previousSibling.id==="custom-set-title"&&H.nextSibling&&H.nextSibling.id==="create-ruleset"){z=H.previousSibling}u.removeChild(H);if(z){u.removeChild(z)}}break}else{J=H}}H=H.nextSibling}}else{H=u.lastChild;while(H){A=H.id.indexOf("label");if(A!==-1){v=H.id.substring(A+5);break}H=H.previousSibling}v=Number(v)+1;H=K.createElement("li");H.className="ruleset-"+E.id;H.id="label"+v;H.onclick=function(L){K.ysview.onclickRuleset(L)};H.innerHTML=''+E.name+"";u.insertBefore(H,u.lastChild);G=u.firstChild;while(G){if(G.id&&G.id==="custom-set-title"){z=G;break}G=G.nextSibling}if(!z){z=K.createElement("li");z.className="new-section header";z.id="custom-set-title";z.innerHTML="CUSTOM SETS";u.insertBefore(z,H)}if(C){x={};x.currentTarget=H;K.ysview.onclickRuleset(x)}}}},hasClassName:function(v,s){var t,u=v.split(" ");if(u){for(t=0;t";u+=""+w[v].type+"";u+=""+w[v].size+"";if(w[v].compressed===false){u+=""}else{u+=""+(w[v].size_compressed!==undefined?parseInt(w[v].size_compressed,10):"uncertain")+""}s=w[v].getSetCookieSize();if(s>0){u+=""+parseInt(s,10)+""}s=w[v].getReceivedCookieSize();if(s>0){u+=""+parseInt(s,10)+""}u+=""+encodeURI(w[v].url)+"";u+=""+w[v].expires+"";u+=""+w[v].respTime+"";u+=""+w[v].getEtag()+"";u+=""}u+="";return u},reportcardView:function(y){var v,t,A,w=y.getOverallScore(),u=YSLOW.util.prettyScore(w),z=y.getRulesetApplied(),x=y.getResults(),s='';s+='';for(v=0;v';s+=""+A.message+"";if(x.components&&x.components.length>0){s+="";for(t=0;t"+A.components[t]+""}else{if(A.components[t].url!==undefined){s+=""+A.components[t].url+""}}}s+=""}s+=""}s+="";return s},statsView:function(v){var u,y,t,x='',w='',s=YSLOW.peeler.types;for(u=0;u'}if((v.PAGE.totalObjCount[y])!==undefined){w+=''}}x+="";w+="";t=''+x+w+"";return t}});YSLOW.peeler={types:["doc","js","css","iframe","flash","cssimage","image","favicon","xhr","redirect","font"],NODETYPE:{ELEMENT:1,DOCUMENT:9},CSSRULE:{IMPORT_RULE:3,FONT_FACE_RULE:5},peel:function(s,t){},findDocuments:function(t){var A,D,w,B,x,y,s,E,C,u={};YSLOW.util.event.fire("peelProgress",{total_step:7,current_step:1,message:"Finding documents"});if(!t){return}if(!YSLOW.util.Preference.getPref("extensions.yslow.getFramesComponents",true)){u[t.URL]={document:t,type:"doc"};return u}B="doc";if(t.nodeType===this.NODETYPE.DOCUMENT){D=t;w=t.URL}else{if(t.nodeType===this.NODETYPE.ELEMENT&&t.nodeName.toLowerCase()==="frame"){D=t.contentDocument;w=t.src}else{if(t.nodeType===this.NODETYPE.ELEMENT&&t.nodeName.toLowerCase()==="iframe"){D=t.contentDocument;w=t.src;B="iframe";try{C=t.contentWindow;C=C&&C.parent;C=C&&C.document;C=C||t.ownerDocument;if(C&&C.URL===w){w=!t.getAttribute("src")?"":"about:blank"}}catch(v){YSLOW.util.dump(v)}}else{return u}}}u[w]={document:D,type:B};try{A=D.getElementsByTagName("iframe");for(x=0,y=A.length;x0){for(u=0;u0){for(u=0;u specify the information to display/log (basic|grade|stats|comps|all) [all]"," -f, --format specify the output results format (json|xml|plain|tap|junit) [json]"," -r, --ruleset specify the YSlow performance ruleset to be used (ydefault|yslow1|yblog) [ydefault]"," -b, --beacon specify an URL to log the results"," -d, --dict include dictionary of results fields"," -v, --verbose output beacon response information"," -t, --threshold for test formats, the threshold to test scores ([0-100]|[A-F]|{JSON}) [80]",' e.g.: -t B or -t 75 or -t \'{"overall": "B", "ycdn": "F", "yexpires": 85}\'',' -u, --ua "" specify the user agent string sent to server when the page requests resources'," -vp, --viewport specify page viewport size WxY, where W = width and H = height [400x300]",' -ch, --headers specify custom request headers, e.g.: -ch \'{"Cookie": "foo=bar"}\''," -c, --console output page console messages (0: none, 1: message, 2: message + line + source) [0]"," -n, --harfilename the name of the HAR file, if no name is supplied, no HAR is created",""," Examples:",""," phantomjs "+phantom.scriptName+" http://yslow.org"," phantomjs "+phantom.scriptName+" -i grade -f xml www.yahoo.com www.cnn.com www.nytimes.com"," phantomjs "+phantom.scriptName+' -info all --format plain --ua "MSIE 9.0" http://yslow.org'," phantomjs "+phantom.scriptName+" -i basic --rulseset yslow1 -d http://yslow.org"," phantomjs "+phantom.scriptName+" -i grade -b http://www.showslow.com/beacon/yslow/ -v yslow.org"," phantomjs --load-plugins=yes "+phantom.scriptName+" -vp 800x600 http://www.yahoo.com"," phantomjs "+phantom.scriptName+" -i grade -f tap -t 85 http://yslow.org",""].join("\n"));phantom.exit()}yslowArgs.dict=unaryArgs.dict;yslowArgs.verbose=unaryArgs.verbose;urls.forEach(function(a){var c=webpage.create();c.resources={};c.harresources=[];c.address=a;c.redirects=[];c.settings.webSecurityEnabled=false;c.onLoadStarted=function(){c.startTime=new Date()};c.onResourceRequested=function(d){c.resources[d.url]={request:d};d.starttime=d.time.getTime();c.harresources[d.id]={request:d,startReply:null,endReply:null}};c.onResourceReceived=function(e){if(e.stage==="start"){c.harresources[e.id].startReply=e}if(e.stage==="end"){c.harresources[e.id].endReply=e;if(e.status===301||e.status===302){var h;for(var d=0;d0){if(!n.exists(yslowArgs.harfilename)){n.write(yslowArgs.harfilename,JSON.stringify(har,undefined,4),"w")}}for(d in g){if(g.hasOwnProperty(d)){h=g[d].response;if(h){h.time=new Date(h.time)-e}}}f=function(){if(typeof YSLOW==="undefined"){YSLOW={}}YSLOW.DEBUG=true;YSLOW.registerRule=function(s){YSLOW.controller.addRule(s)};YSLOW.registerRuleset=function(s){YSLOW.controller.addRuleset(s)};YSLOW.registerRenderer=function(s){YSLOW.controller.addRenderer(s)};YSLOW.registerTool=function(s){YSLOW.Tools.addCustomTool(s)};YSLOW.addEventListener=function(t,u,s){YSLOW.util.event.addListener(t,u,s)};YSLOW.removeEventListener=function(s,t){return YSLOW.util.event.removeListener(s,t)};YSLOW.Error=function(s,t){this.name=s;this.message=t};YSLOW.Error.prototype={toString:function(){return this.name+"\n"+this.message}};YSLOW.version="3.1.8";YSLOW.ComponentSet=function(s,t){this.root_node=s;this.components=[];this.outstanding_net_request=0;this.component_info=[];this.onloadTimestamp=t;this.nextID=1;this.notified_fetch_done=false};YSLOW.ComponentSet.prototype={clear:function(){this.components=[];this.component_info=[];this.cleared=true;if(this.outstanding_net_request>0){YSLOW.util.dump("YSLOW.ComponentSet.Clearing component set before all net requests finish.")}},addComponent:function(v,w,t,y){var s,x,u;if(!v){if(!this.empty_url){this.empty_url=[]}this.empty_url[w]=(this.empty_url[w]||0)+1}if(v&&w){if(!YSLOW.ComponentSet.isValidProtocol(v)||!YSLOW.ComponentSet.isValidURL(v)){return s}v=YSLOW.util.makeAbsoluteUrl(v,t);v=YSLOW.util.escapeHtml(v);x=typeof this.component_info[v]!=="undefined";u=w==="doc";if(!x||u){this.component_info[v]={state:"NONE",count:x?this.component_info[v].count:0};s=new YSLOW.Component(v,w,this,y);if(s){s.id=this.nextID+=1;this.components[this.components.length]=s;if(!this.doc_comp&&u){this.doc_comp=s}if(this.component_info[v].state==="NONE"){this.component_info[v].state="REQUESTED";this.outstanding_net_request+=1}}else{this.component_info[v].state="ERROR";YSLOW.util.event.fire("componentFetchError")}}this.component_info[v].count+=1}return s},addComponentNoDuplicate:function(t,u,s){if(t&&u){t=YSLOW.util.escapeHtml(t);t=YSLOW.util.makeAbsoluteUrl(t,s);if(this.component_info[t]===undefined){return this.addComponent(t,u,s)}}},getComponentsByType:function(F,C,w){var y,x,D,v,G,A,u,z=this.components,E=this.component_info,s=[],B={};if(typeof C==="undefined"){C=!(YSLOW.util.Preference.getPref("excludeAfterOnload",true))}if(typeof w==="undefined"){w=!(YSLOW.util.Preference.getPref("excludeBeaconsFromLint",true))}if(typeof F==="string"){B[F]=1}else{for(y=0,D=F.length;y0){y=w.substr(0,u);for(v=0;v0){y.expires=new Date(y.headers.expires)}}if(y.type==="image"&&!u){if(typeof Image!==D){w=new Image()}else{w=document.createElement("img")}if(y.body.length){A="data:"+y.headers["content-type"]+";base64,"+YSLOW.util.base64Encode(y.body);B=1}else{A=y.url}w.onerror=function(){w.onerror=v;if(B){w.src=y.url}};w.onload=function(){w.onload=v;if(w&&w.width&&w.height){if(y.object_prop){y.object_prop.actual_width=w.width;y.object_prop.actual_height=w.height}else{y.object_prop={width:w.width,height:w.height,actual_width:w.width,actual_height:w.height}}if(w.width<2&&w.height<2){y.is_beacon=true}}};w.src=A}};YSLOW.Component.prototype.hasOldModifiedDate=function(){var s=Number(new Date()),t=this.headers["last-modified"];if(typeof t!=="undefined"){return((s-Number(new Date(t)))>(24*60*60*1000))}return false};YSLOW.Component.prototype.hasFarFutureExpiresOrMaxAge=function(){var v,t=Number(new Date()),u=YSLOW.util.Preference.getPref("minFutureExpiresSeconds",2*24*60*60),s=u*1000;if(typeof this.expires==="object"){v=Number(this.expires);if((v-t)>s){return true}}return false};YSLOW.Component.prototype.getEtag=function(){return this.headers.etag||""};YSLOW.Component.prototype.getMaxAge=function(){var t,u,s,v=this.headers["cache-control"];if(v){t=v.indexOf("max-age");if(t>-1){u=parseInt(v.substring(t+8),10);if(u>0){s=YSLOW.util.maxAgeToDate(u)}}}return s};YSLOW.Component.prototype.getSetCookieSize=function(){var u,s,t=0;if(this.headers&&this.headers["set-cookie"]){u=this.headers["set-cookie"].split("\n");if(u.length>0){for(s=0;s0){u=this.cookie.split("\n");if(u.length>0){for(s=0;ss.parent.onloadTimestamp;s.populateProperties(false,true);s.get_info_state="DONE";s.parent.onComponentGetInfoStateChange({comp:s,state:"DONE"})};if(u.request&&u.response){t(u.request,u.response)}};YSLOW.controller={rules:{},rulesets:{},onloadTimestamp:null,renderers:{},default_ruleset_id:"ydefault",run_pending:0,init:function(){var t,s,v,u;YSLOW.util.event.addListener("onload",function(w){this.onloadTimestamp=w.time;YSLOW.util.setTimer(function(){YSLOW.controller.run_pending_event()})},this);YSLOW.util.event.addListener("onUnload",function(w){this.run_pending=0;this.onloadTimestamp=null},this);t=YSLOW.util.Preference.getPrefList("customRuleset.",undefined);if(t&&t.length>0){for(s=0;s0){v=JSON.parse(u,null);v.custom=true;this.addRuleset(v)}}}this.default_ruleset_id=YSLOW.util.Preference.getPref("defaultRuleset","ydefault");this.loadRulePreference()},run:function(v,w,t){var x,s,u=v.document;if(!u||!u.location||u.location.href.indexOf("about:")===0||"undefined"===typeof u.location.hostname){if(!t){s="Please enter a valid website address before running YSlow.";YSLOW.ysview.openDialog(YSLOW.ysview.panel_doc,389,150,s,"","Ok")}return}if(!w.PAGE.loaded){this.run_pending={win:v,yscontext:w};return}YSLOW.util.event.fire("peelStart",undefined);x=YSLOW.peeler.peel(u,this.onloadTimestamp);w.component_set=x;YSLOW.util.event.fire("peelComplete",{component_set:x});x.notifyPeelDone()},run_pending_event:function(){if(this.run_pending){this.run(this.run_pending.win,this.run_pending.yscontext,false);this.run_pending=0}},lint:function(J,u,s){var v,z,H,y,A,B,I,G=[],E=[],F=0,D=0,w=this,x=w.rulesets,C=w.default_ruleset_id;if(s){G=x[s]}else{if(C&&x[C]){G=x[C]}else{for(H in x){if(x.hasOwnProperty(H)&&x[H]){G=x[H];break}}}}z=G.rules;for(H in z){if(z.hasOwnProperty(H)&&z[H]&&this.rules.hasOwnProperty(H)){try{v=this.rules[H];y=YSLOW.util.merge(v.config,z[H]);A=v.lint(J,u.component_set,y);B=(G.weights?G.weights[H]:undefined);if(B!==undefined){B=parseInt(B,10)}if(B===undefined||B<0||B>100){if(x.ydefault.weights[H]){B=x.ydefault.weights[H]}else{B=5}}A.weight=B;if(A.score!==undefined){if(typeof A.score!=="number"){I=parseInt(A.score,10);if(!isNaN(I)){A.score=I}}if(typeof A.score==="number"){D+=A.weight;if(!YSLOW.util.Preference.getPref("allowNegativeScore",false)){if(A.score<0){A.score=0}if(typeof A.score!=="number"){A.score=-1}}if(A.score!==0){F+=A.score*(typeof A.weight!=="undefined"?A.weight:1)}}}A.name=v.name;A.category=v.category;A.rule_id=H;E[E.length]=A}catch(t){YSLOW.util.dump("YSLOW.controller.lint: "+H,t);YSLOW.util.event.fire("lintError",{rule:H,message:t})}}}u.PAGE.overallScore=F/(D>0?D:1);u.result_set=new YSLOW.ResultSet(E,u.PAGE.overallScore,G);u.result_set.url=u.component_set.doc_comp.url;YSLOW.util.event.fire("lintResultReady",{yslowContext:u});return u.result_set},runTool:function(F,C,u){var I,y,E,x,A,t,D,v,H,G,z,B=YSLOW.Tools.getTool(F);try{if(typeof B==="object"){I=B.run(C.document,C.component_set,u);if(B.print_output){y="";if(typeof I==="object"){y=I.html}else{if(typeof I==="string"){y=I}}E=YSLOW.util.getNewDoc();z=E.body||E.documentElement;z.innerHTML=y;x=E.getElementsByTagName("head")[0];if(typeof I.css==="undefined"){t="chrome://yslow/content/yslow/tool.css";D=new XMLHttpRequest();D.open("GET",t,false);D.send(null);A=D.responseText}else{A=I.css}if(typeof A==="string"){v=E.createElement("style");v.setAttribute("type","text/css");v.appendChild(E.createTextNode(A));x.appendChild(v)}if(typeof I.js!=="undefined"){H=E.createElement("script");H.setAttribute("type","text/javascript");H.appendChild(E.createTextNode(I.js));x.appendChild(H)}if(typeof I.plot_component!=="undefined"&&I.plot_component===true){YSLOW.renderer.plotComponents(E,C)}}}else{G=F+" is not a tool.";YSLOW.util.dump(G);YSLOW.util.event.fire("toolError",{tool_id:F,message:G})}}catch(w){YSLOW.util.dump("YSLOW.controller.runTool: "+F,w);YSLOW.util.event.fire("toolError",{tool_id:F,message:w})}},render:function(w,s,v){var u=this.renderers[w],t="";if(u.supports[s]!==undefined&&u.supports[s]===1){switch(s){case"components":t=u.componentsView(v.comps,v.total_size);break;case"reportcard":t=u.reportcardView(v.result_set);break;case"stats":t=u.statsView(v.stats);break;case"tools":t=u.toolsView(v.tools);break;case"rulesetEdit":t=u.rulesetEditView(v.rulesets);break}}return t},getRenderer:function(s){return this.renderers[s]},addRule:function(u){var s,t,v=["id","name","config","info","lint"];if(YSLOW.doc.rules&&YSLOW.doc.rules[u.id]){t=YSLOW.doc.rules[u.id];if(t.name){u.name=t.name}if(t.info){u.info=t.info}}for(s=0;s0&&t){t.config.howfar=s}}};YSLOW.util={merge:function(t,s){var u,v={};for(u in t){if(t.hasOwnProperty(u)){v[u]=t[u]}}for(u in s){if(s.hasOwnProperty(u)){v[u]=s[u]}}return v},dump:function(){var s;if(!YSLOW.DEBUG){return}s=Array.prototype.slice.apply(arguments);s=s&&s.length===1?s[0]:s;try{if(typeof Firebug!=="undefined"&&Firebug.Console&&Firebug.Console.log){Firebug.Console.log(s)}else{if(typeof Components!=="undefined"&&Components.classes&&Components.interfaces){Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService).logStringMessage(JSON.stringify(s,null,2))}}}catch(u){try{console.log(s)}catch(t){}}},filter:function(v,w,t){var u,s=t?[]:{};for(u in v){if(v.hasOwnProperty(u)&&w(u,v[u])){s[t?s.length:u]=v[u]}}return s},expires_month:{Jan:1,Feb:2,Mar:3,Apr:4,May:5,Jun:6,Jul:7,Aug:8,Sep:9,Oct:10,Nov:11,Dec:12},prettyExpiresDate:function(s){var t;if(Object.prototype.toString.call(s)==="[object Date]"&&s.toString()!=="Invalid Date"&&!isNaN(s)){t=s.getMonth()+1;return s.getFullYear()+"/"+t+"/"+s.getDate()}else{if(!s){return"no expires"}}return"invalid date object"},maxAgeToDate:function(t){var s=new Date();s=s.getTime()+parseInt(t,10)*1000;return new Date(s)},plural:function(u,v){var t,s=u,w={are:["are","is"],s:["s",""],"do":["do","does"],num:[v,v]};for(t in w){if(w.hasOwnProperty(t)){s=s.replace(new RegExp("%"+t+"%","gm"),(v===1)?w[t][1]:w[t][0])}}return s},countExpressions:function(u){var s=0,t;t=u.indexOf("expression(");while(t!==-1){s+=1;t=u.indexOf("expression(",t+1)}return s},countAlphaImageLoaderFilter:function(x){var v,w,u,y,t=0,z=0,s={};v=x.indexOf("filter:");while(v!==-1){u=false;if(v>0&&x.charAt(v-1)==="_"){u=true}w=x.indexOf(";",v+7);if(w!==-1){y=x.substring(v+7,w);if(y.indexOf("AlphaImageLoader")!==-1){if(u){z+=1}else{t+=1}}}v=x.indexOf("filter:",v+1)}if(z>0){s.hackFilter=z}if(t>0){s.filter=t}return s},getHostname:function(t){var s=t.split("/")[2];return(s&&s.split(":")[0])||""},getUniqueDomains:function(y,w){var v,t,x,s={},u=[];for(v=0,t=y.length;v0.2){return false}return true},isETagGood:function(s){var u=/^[0-9a-f]+:([1-9a-f]|[0-9a-f]{2,})$/,t=/^[0-9a-f]+\-[0-9a-f]+\-[0-9a-f]+$/;if(!s){return true}s=s.replace(/^["']|["'][\s\S]*$/g,"");return !(t.test(s)||u.test(s))},getComponentType:function(s){var t="unknown";if(s&&typeof s==="string"){if(s==="text/html"||s==="text/plain"){t="doc"}else{if(s==="text/css"){t="css"}else{if(/javascript/.test(s)){t="js"}else{if(/flash/.test(s)){t="flash"}else{if(/image/.test(s)){t="image"}else{if(/font/.test(s)){t="font"}}}}}}}return t},base64Encode:function(x){var w,v,u,z,t="",y=0,s=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];for(w=0;w>2];t+=s[((v&3)<<4)|((u&240)>>4)];if(y>0){t+="="}else{t+=s[((u&15)<<2)|((z&192)>>6)]}if(y>1){t+="="}else{t+=s[(z&63)]}}return t},getXHR:function(){var s=0,v=null,t=["MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];if(typeof XMLHttpRequest==="function"){return new XMLHttpRequest()}for(s=0;s/g,">")},escapeQuotes:function(t,s){if(s==="single"){return t.replace(/\'/g,"\\'")}if(s==="double"){return t.replace(/\"/g,'\\"')}return t.replace(/\'/g,"\\'").replace(/\"/g,'\\"')},formatHeaderName:(function(){var s={"content-md5":"Content-MD5",dnt:"DNT",etag:"ETag",p3p:"P3P",te:"TE","www-authenticate":"WWW-Authenticate","x-att-deviceid":"X-ATT-DeviceId","x-cdn":"X-CDN","x-ua-compatible":"X-UA-Compatible","x-xss-protection":"X-XSS-Protection"};return function(u){var t=u.toLowerCase();if(s.hasOwnProperty(t)){return s[t]}else{return t.replace(/(^|-)([a-z])/g,function(v,w,x){return w+x.toUpperCase()})}}}()),mod:function(s,t){return Math.round(s-(Math.floor(s/t)*t))},briefUrl:function(u,s){var t,v,w,x;s=s||100;if(u===undefined){return""}t=u.indexOf("//");if(-1!==t){v=u.indexOf("?");if(-1!==v){u=u.substring(0,v)+"?..."}if(u.length>s){w=u.indexOf("/",t+2);x=u.lastIndexOf("/");if(-1!==w&&-1!==x&&w!==x){u=u.substring(0,w+1)+"..."+u.substring(x)}else{u=u.substring(0,s+1)+"..."}}}return u},prettyAnchor:function(A,t,v,u,y,s,B){var w,z="",x="",C=0;if(typeof t==="undefined"){t=A}if(typeof v==="undefined"){v=""}else{v=' class="'+v+'"'}if(typeof y==="undefined"){y=100}if(typeof s==="undefined"){s=1}B=(B)?' rel="'+B+'"':"";t=YSLOW.util.escapeHtml(t);A=YSLOW.util.escapeHtml(A);w=YSLOW.util.escapeQuotes(t,"double");if(u){A=YSLOW.util.briefUrl(A,y);z=' title="'+w+'"'}while(0"+A.substring(0,y);A=A.substring(y);C+=1;if(C>=s){if(0";break}else{x+=" "}}return x},kbSize:function(s){var t=s%(s>100?100:10);s-=t;return parseFloat(s/1000)+(0===(s%1000)?".0":"")+"K"},prettyTypes:{image:"Image",doc:"HTML/Text",cssimage:"CSS Image",css:"Stylesheet File",js:"JavaScript File",flash:"Flash Object",iframe:"IFrame",xhr:"XMLHttpRequest",redirect:"Redirect",favicon:"Favicon",unknown:"Unknown"},prettyType:function(s){return YSLOW.util.prettyTypes[s]},prettyScore:function(t){var s="F";if(!parseInt(t,10)&&t!==0){return t}if(t===-1){return"N/A"}if(t>=90){s="A"}else{if(t>=80){s="B"}else{if(t>=70){s="C"}else{if(t>=60){s="D"}else{if(t>=50){s="E"}}}}}return s},getResults:function(y,U){var Q,N,L,w,v,J,V,I,H,z,x,t,Y,S,K,u,G,F,A,C,P,M,D,B=/ "):"")}}return{score:L,message:B,components:t}}});YSLOW.registerRule({id:"yexpires",url:"http://developer.yahoo.com/performance/rules.html#expires",category:["server"],config:{points:11,howfar:172800,types:["css","js","image","cssimage","flash","favicon"]},lint:function(A,C,t){var z,v,B,u,y,w=parseInt(t.howfar,10)*1000,x=[],s=C.getComponentsByType(t.types);for(v=0,y=s.length;vz+w){continue}}x.push(s[v])}u=100-x.length*parseInt(t.points,10);return{score:u,message:(x.length>0)?YSLOW.util.plural("There %are% %num% static component%s%",x.length)+" without a far-future expiration date.":"",components:x}}});YSLOW.registerRule({id:"ycompress",url:"http://developer.yahoo.com/performance/rules.html#gzip",category:["server"],config:{min_filesize:500,types:["doc","iframe","xhr","js","css"],points:11},lint:function(z,A,t){var v,y,u,w,x=[],s=A.getComponentsByType(t.types);for(v=0,y=s.length;v0)?YSLOW.util.plural("There %are% %num% plain text component%s%",x.length)+" that should be sent compressed":"",components:x}}});YSLOW.registerRule({id:"ycsstop",url:"http://developer.yahoo.com/performance/rules.html#css_top",category:["css"],config:{points:10},lint:function(z,A,t){var v,y,u,w,s=A.getComponentsByType("css"),x=[];for(v=0,y=s.length;v0){u-=1+x.length*parseInt(t.points,10)}return{score:u,message:(x.length>0)?YSLOW.util.plural("There %are% %num% stylesheet%s%",x.length)+" found in the body of the document":"",components:x}}});YSLOW.registerRule({id:"yjsbottom",url:"http://developer.yahoo.com/performance/rules.html#js_bottom",category:["javascript"],config:{points:5},lint:function(z,A,t){var v,y,w,u,x=[],s=A.getComponentsByType("js");for(v=0,y=s.length;v0)?YSLOW.util.plural("There %are% %num% JavaScript script%s%",x.length)+" found in the head of the document":"",components:x}}});YSLOW.registerRule({id:"yexpressions",url:"http://developer.yahoo.com/performance/rules.html#css_expressions",category:["css"],config:{points:2},lint:function(A,D,t){var v,y,C,w,B=(D.inline&&D.inline.styles)||[],s=D.getComponentsByType("css"),x=[],u=100,z=0;for(v=0,y=s.length;v0){w.yexpressions=YSLOW.util.plural("%num% expression%s%",C);z+=C;x.push(w)}}for(v=0,y=B.length;v0){x.push("inline <style> tag #"+(v+1)+" ("+YSLOW.util.plural("%num% expression%s%",C)+")");z+=C}}if(z>0){u=90-z*t.points}return{score:u,message:z>0?"There is a total of "+YSLOW.util.plural("%num% expression%s%",z):"",components:x}}});YSLOW.registerRule({id:"yexternal",url:"http://developer.yahoo.com/performance/rules.html#external",category:["javascript","css"],config:{},lint:function(x,z,t){var v,w=z.inline,u=(w&&w.styles)||[],s=(w&&w.scripts)||[],y=[];if(u.length){v=YSLOW.util.plural("There is a total of %num% inline css",u.length);y.push(v)}if(s.length){v=YSLOW.util.plural("There is a total of %num% inline script%s%",s.length);y.push(v)}return{score:"n/a",message:"Only consider this if your property is a common user home page.",components:y}}});YSLOW.registerRule({id:"ydns",url:"http://developer.yahoo.com/performance/rules.html#dns_lookups",category:["content"],config:{max_domains:4,points:5},lint:function(A,C,s){var v,x,u,w=YSLOW.util,y=w.kbSize,z=w.plural,t=100,B=w.summaryByDomain(C.components,["size","size_compressed"],true);if(B.length>s.max_domains){t-=(B.length-s.max_domains)*s.points}if(B.length){for(v=0,x=B.length;v0?" ("+y(u.sum_size_compressed)+" GZip)":"")}}return{score:t,message:(B.length>s.max_domains)?z("The components are split over more than %num% domain%s%",s.max_domains):"",components:B}}});YSLOW.registerRule({id:"yminify",url:"http://developer.yahoo.com/performance/rules.html#minify",category:["javascript","css"],config:{points:10,types:["js","css"]},lint:function(C,E,t){var w,z,u,B,x,A=E.inline,D=(A&&A.styles)||[],v=(A&&A.scripts)||[],s=E.getComponentsByType(t.types),y=[];for(w=0,z=s.length;w0)?YSLOW.util.plural("There %are% %num% component%s% that can be minified",y.length):"",components:y}}});YSLOW.registerRule({id:"yredirects",url:"http://developer.yahoo.com/performance/rules.html#redirects",category:["content"],config:{points:10},lint:function(A,B,t){var w,z,x,u,y=[],v=YSLOW.util.briefUrl,s=B.getComponentsByType("redirect");for(w=0,z=s.length;w0)?YSLOW.util.plural("There %are% %num% redirect%s%",s.length):"",components:y}}});YSLOW.registerRule({id:"ydupes",url:"http://developer.yahoo.com/performance/rules.html#js_dupes",category:["javascript","css"],config:{points:5,types:["js","css"]},lint:function(A,B,u){var x,s,v,z,w={},y=[],t=B.getComponentsByType(u.types);for(x=0,z=t.length;x1){y.push(t[w[x].compindex])}}v=100-y.length*parseInt(u.points,10);return{score:v,message:(y.length>0)?YSLOW.util.plural("There %are% %num% duplicate component%s%",y.length):"",components:y}}});YSLOW.registerRule({id:"yetags",url:"http://developer.yahoo.com/performance/rules.html#etags",category:["server"],config:{points:11,types:["flash","js","css","cssimage","image","favicon"]},lint:function(A,B,t){var v,y,u,w,z,x=[],s=B.getComponentsByType(t.types);for(v=0,y=s.length;v0)?YSLOW.util.plural("There %are% %num% component%s% with misconfigured ETags",x.length):"",components:x}}});YSLOW.registerRule({id:"yxhr",url:"http://developer.yahoo.com/performance/rules.html#cacheajax",category:["content"],config:{points:5,min_cache_time:3600},lint:function(A,C,t){var w,B,z,u,y,v=parseInt(t.min_cache_time,10)*1000,x=[],s=C.getComponentsByType("xhr");for(w=0;wz+v){continue}}x.push(s[w])}u=100-x.length*parseInt(t.points,10);return{score:u,message:(x.length>0)?YSLOW.util.plural("There %are% %num% XHR component%s% that %are% not cacheable",x.length):"",components:x}}});YSLOW.registerRule({id:"yxhrmethod",url:"http://developer.yahoo.com/performance/rules.html#ajax_get",category:["server"],config:{points:5},lint:function(u,y,s){var t,v,x=[],w=y.getComponentsByType("xhr");for(t=0;t0)?YSLOW.util.plural("There %are% %num% XHR component%s% that %do% not use GET HTTP method",x.length):"",components:x}}});YSLOW.registerRule({id:"ymindom",url:"http://developer.yahoo.com/performance/rules.html#min_dom",category:["content"],config:{range:250,points:10,maxdom:900},lint:function(u,w,t){var s=w.domElementsCount,v=100;if(s>t.maxdom){v=99-Math.ceil((s-parseInt(t.maxdom,10))/parseInt(t.range,10))*parseInt(t.points,10)}return{score:v,message:(s>t.maxdom)?YSLOW.util.plural("There %are% %num% DOM element%s% on the page",s):"",components:[]}}});YSLOW.registerRule({id:"yno404",url:"http://developer.yahoo.com/performance/rules.html#no404",category:["content"],config:{points:5,types:["css","js","image","cssimage","flash","xhr","favicon"]},lint:function(z,A,t){var v,y,w,u,x=[],s=A.getComponentsByType(t.types);for(v=0,y=s.length;v0)?YSLOW.util.plural("There %are% %num% request%s% that %are% 404 Not Found",x.length):"",components:x}}});YSLOW.registerRule({id:"ymincookie",url:"http://developer.yahoo.com/performance/rules.html#cookie_size",category:["cookie"],config:{points:10,max_cookie_size:1000},lint:function(w,z,t){var y,v=z.cookies,s=(v&&v.length)||0,u="",x=100;if(s>t.max_cookie_size){y=Math.floor(s/t.max_cookie_size);x-=1+y*parseInt(t.points,10);u=YSLOW.util.plural("There %are% %num% byte%s% of cookies on this page",s)}return{score:x,message:u,components:[]}}});YSLOW.registerRule({id:"ycookiefree",url:"http://developer.yahoo.com/performance/rules.html#cookie_free",category:["cookie"],config:{points:5,types:["js","css","image","cssimage","flash","favicon"]},lint:function(C,D,v){var x,B,w,z,s,A=[],u=YSLOW.util.getHostname,y=u(D.doc_comp.url),t=D.getComponentsByType(v.types);for(x=0,B=t.length;x0)?YSLOW.util.plural("There %are% %num% component%s% that %are% not cookie-free",A.length):"",components:A}}});YSLOW.registerRule({id:"ynofilter",url:"http://developer.yahoo.com/performance/rules.html#no_filters",category:["css"],config:{points:5,halfpoints:2},lint:function(D,G,u){var w,A,v,x,C,z,F,E=(G.inline&&G.inline.styles)||[],t=G.getComponentsByType("css"),y=[],s=0,B=0;for(w=0,A=t.length;w0){t[w].yfilters=YSLOW.util.plural("%num% filter%s%",z);y.push(t[w])}}for(w=0,A=E.length;w0){y.push("inline <style> tag #"+(w+1)+" ("+YSLOW.util.plural("%num% filter%s%",z)+")")}}v=100-(s*u.points+B*u.halfpoints);return{score:v,message:(s+B)>0?"There is a total of "+YSLOW.util.plural("%num% filter%s%",s+B):"",components:y}}});YSLOW.registerRule({id:"yimgnoscale",url:"http://developer.yahoo.com/performance/rules.html#no_scale",category:["images"],config:{points:5},lint:function(u,z,s){var t,y,v,x=[],w=z.getComponentsByType("image");for(t=0;t0)?YSLOW.util.plural("There %are% %num% image%s% that %are% scaled down",x.length):"",components:x}}});YSLOW.registerRule({id:"yfavicon",url:"http://developer.yahoo.com/performance/rules.html#favicon",category:["images"],config:{points:5,size:2000,min_cache_time:3600},lint:function(A,C,t){var z,B,y,v,u,x=[],w=parseInt(t.min_cache_time,10)*1000,s=C.getComponentsByType("favicon");if(s.length){y=s[0];if(parseInt(y.status,10)===404){x.push("Favicon was not found")}if(y.size>t.size){x.push(YSLOW.util.plural("Favicon is more than %num% bytes",t.size))}B=y.expires;if(typeof B==="object"&&typeof B.getTime==="function"){z=new Date().getTime();u=B.getTime()>=z+w}if(!u){x.push("Favicon is not cacheable")}}v=100-x.length*parseInt(t.points,10);return{score:v,message:(x.length>0)?x.join("\n"):"",components:[]}}});YSLOW.registerRule({id:"yemptysrc",url:"http://developer.yahoo.com/performance/rules.html#emptysrc",category:["server"],config:{points:100},lint:function(z,C,t){var y,u,x,A=C.empty_url,w=[],v=[],s="",B=parseInt(t.points,10);u=100;if(A){for(y in A){if(A.hasOwnProperty(y)){x=A[y];u-=x*B;v.push(x+" "+y)}}s=v.join(", ")+YSLOW.util.plural(" component%s% with empty link were found.",v.length)}return{score:u,message:s,components:w}}});YSLOW.registerRuleset({id:"ydefault",name:"YSlow(V2)",rules:{ynumreq:{},ycdn:{},yemptysrc:{},yexpires:{},ycompress:{},ycsstop:{},yjsbottom:{},yexpressions:{},yexternal:{},ydns:{},yminify:{},yredirects:{},ydupes:{},yetags:{},yxhr:{},yxhrmethod:{},ymindom:{},yno404:{},ymincookie:{},ycookiefree:{},ynofilter:{},yimgnoscale:{},yfavicon:{}},weights:{ynumreq:8,ycdn:6,yemptysrc:30,yexpires:10,ycompress:8,ycsstop:4,yjsbottom:4,yexpressions:3,yexternal:4,ydns:3,yminify:4,yredirects:4,ydupes:4,yetags:2,yxhr:4,yxhrmethod:3,ymindom:3,yno404:4,ymincookie:3,ycookiefree:3,ynofilter:4,yimgnoscale:3,yfavicon:2}});YSLOW.registerRuleset({id:"yslow1",name:"Classic(V1)",rules:{ynumreq:{},ycdn:{},yexpires:{},ycompress:{},ycsstop:{},yjsbottom:{},yexpressions:{},yexternal:{},ydns:{},yminify:{types:["js"],check_inline:false},yredirects:{},ydupes:{types:["js"]},yetags:{}},weights:{ynumreq:8,ycdn:6,yexpires:10,ycompress:8,ycsstop:4,yjsbottom:4,yexpressions:3,yexternal:4,ydns:3,yminify:4,yredirects:4,ydupes:4,yetags:2}});YSLOW.registerRuleset({id:"yblog",name:"Small Site or Blog",rules:{ynumreq:{},yemptysrc:{},ycompress:{},ycsstop:{},yjsbottom:{},yexpressions:{},ydns:{},yminify:{},yredirects:{},ydupes:{},ymindom:{},yno404:{},ynofilter:{},yimgnoscale:{},yfavicon:{}},weights:{ynumreq:8,yemptysrc:30,ycompress:8,ycsstop:4,yjsbottom:4,yexpressions:3,ydns:3,yminify:4,yredirects:4,ydupes:4,ymindom:3,yno404:4,ynofilter:4,yimgnoscale:3,yfavicon:2}});var p={};p.getTLD=function(u){var t=u;var s=/\.(gov|ac|mil|net|org|co)\.\w\w$/i;if(u.match(s)){var v=/[\w]+\.[\w]+\.[\w]+$/i;t=u.match(v).toString()}else{var w=/[\w]+\.[\w]+$/i;t=u.match(w).toString()}return t};p.getSynchronouslyJavascripts=function(u){var t=[];for(var s=0;s0){for(var w=0;w=(t||0)}p.versionCompare=function(u,w){if(u===undefined){return true}u=u.split(".");var s=r(u[0],w[0]),t=r(u[1],w[1]),v=r(u[2],w[2]);return(!s||s&&!t||s&&t&&!v)};p.isSameDomainTLD=function(t,u,s){if((/^http/).test(s)){if(t===p.getTLD(YSLOW.util.getHostname(s))){return true}else{return false}}else{if(t===p.getTLD(YSLOW.util.getHostname(u))){return true}else{return false}}return false};YSLOW.registerRule({id:"cssprint",name:"Do not load print stylesheets, use @media type print instead",info:"Loading a specific stylesheet for printing slows down the page, even though it is not used",category:["css"],config:{points:20},url:"http://sitespeed.io/rules/#cssprint",lint:function(A,C,v){var y,u,w,s,z=[],x={},t=C.getComponentsByType("css"),B=A.getElementsByTagName("link");for(y=0,len=B.length;y0)?YSLOW.util.plural("There %are% %num% print css files included on the page, that should be @media query instead",z.length):"",components:z}}});YSLOW.registerRule({id:"ttfb",name:"Time to first byte",info:"It is important to have low time to the first byte to be able to render the page fast",category:["server"],config:{points:10,limitInMs:300,hurtEveryMs:100},url:"http://sitespeed.io/rules/#ttfb",lint:function(y,A,u){var x,w=parseInt(u.limitInMs,10),z=parseInt(u.hurtEveryMs,10),v,t,s=A.getComponentsByType("doc");for(x=0,len=s.length;xw){v=100-(Math.ceil((t-w)/z)*parseInt(u.points,10))}}if(v<0){v=0}return{score:v,message:(v<100)?"The TTFB is too slow:"+t+" ms. The limit is "+w+" ms and for every "+z+" ms points are removed":"",components:[""+t]}}});YSLOW.registerRule({id:"cssinheaddomain",name:"Load CSS in head from document domain",info:"Make sure css in head is loaded from same domain as document, in order to have a better user experience and minimize dns lookups",category:["css"],config:{points:10},url:"http://sitespeed.io/rules/#cssinheaddomain",lint:function(D,F,u){var A=D.getElementsByTagName("link"),t=F.getComponentsByType("css"),B,z,s,C={},w=[],x=[],v=100;z=YSLOW.util.getHostname(F.doc_comp.url);for(y=0,len=A.length;yy){continue}}w.push(s[v])}u=100-w.length*parseInt(t.points,10);B=(w.length>0)?YSLOW.util.plural("There %are% %num% static component%s%",w.length)+" without a future expiration date.":"";return{score:u,message:B,components:w}}});YSLOW.registerRule({id:"longexpirehead",name:"Have expires headers equals or longer than one year",info:"All static components of a page should have at least one year expire header. However, analythics scripts will not give you bad points.",url:"http://sitespeed.io/rules/#longexpires",category:["server"],config:{points:5,types:["css","js","image","cssimage","flash","favicon"],skip:["https://secure.gaug.es/track.js","https://ssl.google-analytics.com/ga.js","http://www.google-analytics.com/ga.js"]},lint:function(B,E,t){var A,v,C,u,y,D,x=[],z=[],w=31535000*1000,s=E.getComponentsByType(t.types);for(v=0,y=s.length;vA+w){continue}else{if(t.skip.indexOf(s[v].url)>1){z.push(s[v].url);continue}}}x.push(s[v])}u=100-x.length*parseInt(t.points,10);D=(x.length>0)?YSLOW.util.plural("There %are% %num% static component%s%",x.length)+" without a expire header equal or longer than one year.":"";D+=(z.length>0)?YSLOW.util.plural(" There %are% %num% static component%s% that are skipped from the score calculation",z.length)+":"+z:"";return{score:u,message:D,components:x}}});YSLOW.registerRule({id:"inlinecsswhenfewrequest",name:"Do not load css files when the page has few request",info:"When a page has few requests, it is better to inline the css, to make the page to start render as early as possible",category:["css"],config:{points:20,limit:15,types:["css","js","image","cssimage","flash","favicon"]},url:"http://sitespeed.io/rules/#inlinecsswhenfewrequest",lint:function(v,z,s){var y=z.getComponentsByType(s.types),t=z.getComponentsByType("css"),u="",w=100,x=[];if(y.length0){for(i=0,len=t.length;i1){for(i=0,len=y.length;is.max_css){x-=(u.length-s.max_css)*s.points_css;v="This page has "+YSLOW.util.plural("%num% external stylesheet%s%",u.length)+". Try combining them into fewer requests.";for(var t=0;ts.max_cssimages){x-=(u.length-s.max_cssimages)*s.points_cssimages;v="This page has "+YSLOW.util.plural("%num% external css image%s%",u.length)+". Try combining them into fewer request.";for(var t=0;tt.max_js){B="There "+YSLOW.util.plural("%are% %num% script%s%",x.length)+" loaded synchronously that could be combined into fewer requests.";u-=(x.length-t.max_js)*parseInt(t.points_js,10)}return{score:u,message:B,components:x}}});YSLOW.registerRule({id:"noduplicates",name:"Remove duplicate JS and CSS",info:"It is bad practice include the same js or css twice",category:["js","css"],config:{},url:"http://developer.yahoo.com/performance/rules.html#js_dupes",lint:function(D,E,u){var y,s,v,C,A,x={},B=[],t=E.getComponentsByType(["js","css"]),w=D.getElementsByTagName("script"),z=D.getElementsByTagName("link");for(y=0,C=w.length;y1){B.push(t[y])}}v=100-B.length*11;return{score:v,message:(B.length>0)?YSLOW.util.plural("There %are% %num% js/css file%s% included more than once on the page",B.length):"",components:B}}});YSLOW.registerRule({id:"mindom",name:"Reduce the number of DOM elements",info:"The number of dom elements are in correlation to if the page is fast or not",url:"http://developer.yahoo.com/performance/rules.html#min_dom",category:["content"],config:{range:250,points:10,maxdom:900},lint:function(u,w,t){var s=w.domElementsCount,v=100;if(s>t.maxdom){v=99-Math.ceil((s-parseInt(t.maxdom,10))/parseInt(t.range,10))*parseInt(t.points,10)}return{score:v,message:(s>t.maxdom)?YSLOW.util.plural("There %are% %num% DOM element%s% on the page",s):"",components:[""+s]}}});YSLOW.registerRule({id:"thirdpartyversions",name:"Always use latest versions of third party javascripts",info:"Unisng the latest versions, will make sure you have the fastest and hopefully leanest javascripts.",url:"http://sitespeed.io/rules/#thirdpartyversions",category:["js"],config:{points:10},lint:function(u,x,s){var t="",v,w=0;if(typeof jQuery=="function"){if(p.versionCompare(jQuery.fn.jquery,[2,0,0])){t="You are using an old version of JQuery: "+jQuery.fn.jquery+" Newer version is faster & better. Upgrade to the newest version from http://jquery.com/";w+=1}}v=100-w*parseInt(s.points,10);return{score:v,message:t,components:[]}}});YSLOW.registerRule({id:"avoidscalingimages",name:"Never scale images in HTML",info:"Always use the correct size for images to avoid that a browser download an image that is larger than necessary.",url:"http://sitespeed.io/rules/#avoidscalingimages",category:["images"],config:{reallyBadLimit:100},lint:function(B,C,t){var D="",u,y=[],x={},A=0,s=C.getComponentsByType("image"),z=B.getElementsByTagName("img");for(var w=0;w0){D=D+" "+v.src+" [browserWidth:"+v.clientWidth+" realImageWidth: "+v.naturalWidth+"]";x[v.src]=1;if((v.clientWidth+t.reallyBadLimit)0)?YSLOW.util.plural("You have %num% image%s% that %are% scaled in the HTML:"+D,y.length):"",components:y}}});YSLOW.registerRule({id:"redirects",name:"Never do redirects",info:"Avoid doing redirects, it will kill you web page on mobile.",url:"http://sitespeed.io/rules/#redirects",category:["content"],config:{points:10},lint:function(t,v,s){var u;u=100-v.redirects.length*parseInt(s.points,10);return{score:u,message:(v.redirects.length>0)?YSLOW.util.plural("There %are% %num% redirect%s%.",v.redirects.length)+" "+v.redirects:"",components:[]}}});YSLOW.registerRuleset({id:"sitespeed.io-desktop",name:"Sitespeed.io desktop rules",rules:{criticalpath:{},spof:{fontFaceInCssSpof:false,inlineFontFaceSpof:false},cssnumreq:{},cssimagesnumreq:{},jsnumreq:{},yemptysrc:{},ycompress:{},ycsstop:{},yjsbottom:{},yexpressions:{},ydns:{},yminify:{},redirects:{},noduplicates:{},yetags:{},yxhr:{},yxhrmethod:{},mindom:{},yno404:{},ymincookie:{},ycookiefree:{},ynofilter:{},avoidscalingimages:{},yfavicon:{},thirdpartyasyncjs:{},cssprint:{},cssinheaddomain:{},syncjsinhead:{},avoidfont:{},totalrequests:{},expiresmod:{},longexpirehead:{},nodnslookupswhenfewrequests:{},inlinecsswhenfewrequest:{},textcontent:{},thirdpartyversions:{}},weights:{criticalpath:15,spof:5,cssnumreq:8,cssimagesnumreq:8,jsnumreq:8,yemptysrc:30,ycompress:8,ycsstop:4,yjsbottom:4,yexpressions:3,ydns:3,yminify:4,redirects:4,noduplicates:4,yetags:2,yxhr:4,yxhrmethod:3,mindom:3,yno404:4,ymincookie:3,ycookiefree:3,ynofilter:4,avoidscalingimages:5,yfavicon:2,thirdpartyasyncjs:10,cssprint:3,cssinheaddomain:8,syncjsinhead:20,avoidfont:1,totalrequests:10,expiresmod:10,longexpirehead:5,nodnslookupswhenfewrequests:8,inlinecsswhenfewrequest:7,textcontent:1,thirdpartyversions:5}});YSLOW.registerRuleset({id:"sitespeed.io-mobile",name:"Sitespeed.io mobile rules",rules:{criticalpath:{},spof:{fontFaceInCssSpof:false,inlineFontFaceSpof:false},cssnumreq:{},cssimagesnumreq:{},jsnumreq:{},yemptysrc:{},ycompress:{},ycsstop:{},yjsbottom:{},yexpressions:{},ydns:{},yminify:{},redirects:{},noduplicates:{},yetags:{},yxhr:{},yxhrmethod:{},mindom:{},yno404:{},ymincookie:{},ycookiefree:{},ynofilter:{},avoidscalingimages:{},yfavicon:{},thirdpartyasyncjs:{},cssprint:{},cssinheaddomain:{},syncjsinhead:{},avoidfont:{},totalrequests:{},expiresmod:{},longexpirehead:{},nodnslookupswhenfewrequests:{},inlinecsswhenfewrequest:{},textcontent:{},thirdpartyversions:{}},weights:{criticalpath:20,spof:5,cssnumreq:8,cssimagesnumreq:8,jsnumreq:8,yemptysrc:30,ycompress:8,ycsstop:4,yjsbottom:4,yexpressions:3,ydns:3,yminify:4,redirects:15,noduplicates:4,yetags:2,yxhr:4,yxhrmethod:3,mindom:3,yno404:4,ymincookie:3,ycookiefree:3,ynofilter:4,avoidscalingimages:10,yfavicon:2,thirdpartyasyncjs:10,cssprint:3,cssinheaddomain:8,syncjsinhead:20,avoidfont:5,totalrequests:14,expiresmod:10,longexpirehead:5,nodnslookupswhenfewrequests:15,inlinecsswhenfewrequest:10,textcontent:1,thirdpartyversions:5}});YSLOW.registerRuleset({id:"sitespeed.io-desktop-http2.0",name:"Sitespeed.io desktop rules for HTTP 2.0",rules:{criticalpath:{},spof:{fontFaceInCssSpof:false,inlineFontFaceSpof:false},yemptysrc:{},ycompress:{},ycsstop:{},yjsbottom:{},yexpressions:{},ydns:{},yminify:{},redirects:{},noduplicates:{},yetags:{},yxhr:{},yxhrmethod:{},mindom:{},yno404:{},ymincookie:{},ycookiefree:{},ynofilter:{},avoidscalingimages:{},yfavicon:{},thirdpartyasyncjs:{},cssprint:{},cssinheaddomain:{},syncjsinhead:{},avoidfont:{},expiresmod:{},longexpirehead:{},textcontent:{},thirdpartyversions:{}},weights:{criticalpath:15,spof:5,yemptysrc:30,ycompress:8,ycsstop:4,yjsbottom:4,yexpressions:3,ydns:3,yminify:4,redirects:4,noduplicates:4,yetags:2,yxhr:4,yxhrmethod:3,mindom:3,yno404:4,ymincookie:3,ycookiefree:3,ynofilter:4,avoidscalingimages:5,yfavicon:2,thirdpartyasyncjs:10,cssprint:3,cssinheaddomain:8,syncjsinhead:20,avoidfont:1,expiresmod:10,longexpirehead:5,textcontent:1,thirdpartyversions:5}});YSLOW.ResultSet=function(u,t,s){this.ruleset_applied=s;this.overall_score=t;this.results=u};YSLOW.ResultSet.prototype={getResults:function(){return this.results},getRulesetApplied:function(){return this.ruleset_applied},getOverallScore:function(){return this.overall_score}};YSLOW.view=function(t,y){var w,v,x,s,u;this.panel_doc=t.document;this.buttonViews={};this.curButtonId="";this.panelNode=t.panelNode;this.loadCSS(this.panel_doc);w=this.panel_doc.createElement("div");w.id="toolbarDiv";w.innerHTML=this.getToolbarSource();w.style.display="block";v=this.panel_doc.createElement("div");v.style.display="block";x='

    text

    ';s=this.panel_doc.createElement("div");s.id="dialogDiv";s.innerHTML=x;s.style.display="none";this.modaldlg=s;this.tooltip=new YSLOW.view.Tooltip(this.panel_doc,t.panelNode);u=this.panel_doc.createElement("div");u.id="copyrightDiv";u.innerHTML=YSLOW.doc.copyright;this.copyright=u;if(t.panelNode){t.panelNode.id="yslowDiv";t.panelNode.appendChild(s);t.panelNode.appendChild(w);t.panelNode.appendChild(v);t.panelNode.appendChild(u)}this.viewNode=v;this.viewNode.id="viewDiv";this.viewNode.className="yui-skin-sam";this.yscontext=y;YSLOW.util.addEventListener(this.panelNode,"click",function(F){var A,B,z,G,C;var E=FBL.getContentView(t.document);var D=E.ysview.getElementByTagNameAndId(t.panelNode,"div","toolbarDiv");if(D){B=E.ysview.getElementByTagNameAndId(D,"li","helpLink");if(B){z=B.offsetLeft;G=B.offsetTop;C=B.offsetParent;while(C){z+=C.offsetLeft;G+=C.offsetTop;C=C.offsetParent}if(F.clientX>=z&&F.clientY>=G&&F.clientX"+A.name+"

    "+A.info,B.target)}}}});YSLOW.util.addEventListener(this.panelNode,"mouseout",function(A){var z=FBL.getContentView(t.document);z.ysview.tooltip.hide()});YSLOW.util.addEventListener(this.panel_doc.defaultView||this.panel_doc.parentWindow,"resize",function(B){var A=FBL.getContentView(t.document);var z=A.ysview.modaldlg;if(z&&z.style.display==="block"){z.style.display="none"}})};YSLOW.view.prototype={setDocument:function(s){this.panel_doc=s},loadCSS:function(){},addButtonView:function(s,u){var t=this.getButtonView(s);if(!t){t=this.panel_doc.createElement("div");t.style.display="none";this.viewNode.appendChild(t);this.buttonViews[s]=t}t.innerHTML=u;this.showButtonView(s)},clearAllButtonView:function(){var t=this.buttonViews,u=this.viewNode,s=function(w){if(t.hasOwnProperty(w)){u.removeChild(t[w]);delete t[w]}};s("ysPerfButton");s("ysCompsButton");s("ysStatsButton")},showButtonView:function(t){var s,u=this.getButtonView(t);if(!u){YSLOW.util.dump("ERROR: YSLOW.view.showButtonView: Couldn't find ButtonView '"+t+"'.");return}for(s in this.buttonViews){if(this.buttonViews.hasOwnProperty(s)&&s!==t){this.buttonViews[s].style.display="none"}}if(t==="ysPerfButton"){if(this.copyright){this.copyright.style.display="none"}}else{if(this.curButtonId==="ysPerfButton"){if(this.copyright){this.copyright.style.display="block"}}}u.style.display="block";this.curButtonId=t},getButtonView:function(s){return(this.buttonViews.hasOwnProperty(s)?this.buttonViews[s]:undefined)},setButtonView:function(s,u){var t=this.getButtonView(s);if(!t){YSLOW.util.dump("ERROR: YSLOW.view.setButtonView: Couldn't find ButtonView '"+s+"'.");return}t.innerHTML=u;this.showButtonView(s)},setSplashView:function(t,u,v){var y,x="Grade your web pages with YSlow",z="YSlow gives you:",w="
  • Grade based on the performance (you can define your own rules)
  • Summary of the Components in the page
  • Chart with statistics
  • Tools including Smush.It and JSLint
  • ",s="Learn more about YSlow and YDN";if(YSLOW.doc.splash){if(YSLOW.doc.splash.title){x=YSLOW.doc.splash.title}if(YSLOW.doc.splash.content){if(YSLOW.doc.splash.content.header){z=YSLOW.doc.splash.content.header}if(YSLOW.doc.splash.content.text){w=YSLOW.doc.splash.content.text}}if(YSLOW.doc.splash.more_info){s=YSLOW.doc.splash.more_info}}if(typeof v!=="undefined"){YSLOW.hideToolsInfo=v}else{v=YSLOW.hideToolsInfo}if(v){w=w.replace(/
  • Tools[^<]+<\/li>/,"")}y='

    '+x+'

    '+z+'

      '+w+"
    ";if(typeof t!=="undefined"){YSLOW.hideAutoRun=t}else{t=YSLOW.hideAutoRun}if(!t){y+=''}y+='
    ";this.addButtonView("panel_about",y)},genProgressView:function(){var s='

    Finding components in the page:

    Getting component information:

    start...
    ';this.setButtonView("panel_about",s)},updateProgressView:function(s,x){var w,z,A,y,B,t,u,v,C="";if(this.curButtonId==="panel_about"){B=this.getButtonView(this.curButtonId);if(s==="peel"){w=this.getElementByTagNameAndId(B,"div","peelprogress");z=this.getElementByTagNameAndId(B,"div","progbar");A=this.getElementByTagNameAndId(B,"div","progtext");C=x.message;y=(x.current_step*100)/x.total_step}else{if(s==="fetch"){w=this.getElementByTagNameAndId(B,"div","fetchprogress");z=this.getElementByTagNameAndId(B,"div","progbar2");A=this.getElementByTagNameAndId(B,"div","progtext2");C=x.last_component_url;y=(x.current*100)/x.total}else{if(s==="message"){A=this.getElementByTagNameAndId(B,"div","progtext2");if(A){A.innerHTML=x}return}else{return}}}}if(w&&z&&A){t=w.clientWidth;if(y<0){y=0}if(y>100){y=100}y=100-y;u=(t*y)/100;if(u>t){u=t}v=t-parseInt(u,10);z.style.width=parseInt(u,10)+"px";z.style.left=parseInt(v,10)+"px";A.innerHTML=C}},updateStatusBar:function(z){var B,u,C,v,s,t=YSLOW,w=t.util,y=t.view,A=w.Preference,x=this.yscontext;if(!x.PAGE.statusbar){x.PAGE.statusbar=true;if(!x.PAGE.overallScore){t.controller.lint(z,x)}if(!x.PAGE.totalSize){x.collectStats()}B=w.kbSize(x.PAGE.totalSize);u=w.prettyScore(x.PAGE.overallScore);y.setStatusBar(u,"yslow_status_grade");y.setStatusBar(B,"yslow_status_size");if(A.getPref("optinBeacon",false)){v=A.getPref("beaconInfo","basic"),s=A.getPref("beaconUrl","http://rtblab.pclick.yahoo.com/images/ysb.gif");C=w.getResults(x,v);w.sendBeacon(C,v,s)}}},getRulesetListSource:function(s){var w,u,v="",t=YSLOW.controller.getDefaultRulesetId();for(w in s){if(s[w]){v+='"}}return v},updateRulesetList:function(){var w,y,u,v=this.panel_doc.getElementsByTagName("select"),s=YSLOW.controller.getRegisteredRuleset(),t=this.getRulesetListSource(s),x=function(z){var A=FBL.getContentView(this.ownerDocument);A.ysview.onChangeRuleset(z)};for(w=0;wRulesets ";v+='
  • ';v+='";v+='";v+="";return v},show:function(t){var u="html",s="";t=t||this.yscontext.defaultview;if(this.yscontext.component_set===null){YSLOW.controller.run(window.top.content,this.yscontext,false);this.yscontext.defaultview=t}else{if(this.getButtonView(t)){this.showButtonView(t)}else{if("ysCompsButton"===t){s+=this.yscontext.genComponents(u);this.addButtonView("ysCompsButton",s)}else{if("ysStatsButton"===t){s+=this.yscontext.genStats(u);this.addButtonView("ysStatsButton",s);YSLOW.renderer.plotComponents(this.getButtonView("ysStatsButton"),this.yscontext)}else{if("ysToolButton"===t){s+=this.yscontext.genToolsView(u);this.addButtonView("ysToolButton",s)}else{s+=this.yscontext.genPerformance(u);this.addButtonView("ysPerfButton",s)}}}}this.panelNode.scrollTop=0;this.panelNode.scrollLeft=0;this.updateStatusBar(this.yscontext.document);this.updateToolbarSelection()}},updateToolbarSelection:function(){var s,t,u;switch(this.curButtonId){case"ysCompsButton":case"ysPerfButton":case"ysStatsButton":case"ysToolButton":s=this.getElementByTagNameAndId(this.panelNode,"li",this.curButtonId);if(s){if(s.className.indexOf("selected")!==-1){return}else{s.className+=" selected";if(s.previousSibling){s.previousSibling.className+=" off"}}}break;default:break}t=this.getElementByTagNameAndId(this.panelNode,"ul","toolbarLinks");u=t.firstChild;while(u){if(u.id!==this.curButtonId&&u.className.indexOf("selected")!==-1){this.unselect(u);if(u.previousSibling){YSLOW.view.removeClassName(u.previousSibling,"off")}}u=u.nextSibling}},showPerformance:function(){this.show("ysPerfButton")},showStats:function(){this.show("ysStatsButton")},showComponents:function(){this.show("ysCompsButton")},showTools:function(){this.show("ysToolButton")},showRuleSettings:function(){var s=this.yscontext.genRulesetEditView("html");this.addButtonView("ysRuleEditButton",s);this.panelNode.scrollTop=0;this.panelNode.scrollLeft=0;this.updateToolbarSelection()},runTest:function(){YSLOW.controller.run(window.top.content,this.yscontext,false)},setAutorun:function(s){YSLOW.util.Preference.setPref("extensions.yslow.autorun",s)},setAntiIframe:function(s){YSLOW.antiIframe=s},addCDN:function(B){var v,t,x=this,z=document,C=x.yscontext,D=YSLOW.util.Preference,y=D.getPref("cdnHostnames",""),s=x.panel_doc,u=s.getElementById("tab-label-list"),A=u.getElementsByTagName("li"),w=A.length;if(y){y=y.replace(/\s+/g,"").split(",");y.push(B);y=y.join()}else{y=B}D.setPref("extensions.yslow.cdnHostnames",y);for(v=0;v-1){t=u.id;break}}YSLOW.controller.lint(C.document,C);x.addButtonView("ysPerfButton",C.genPerformance("html"));YSLOW.view.restoreStatusBar(C);x.updateToolbarSelection();u=s.getElementById(t);x.onclickTabLabel({currentTarget:u},true)},onChangeRuleset:function(v){var w,t,x,y,s=YSLOW.util.getCurrentTarget(v),u=s.options[s.selectedIndex];YSLOW.controller.setDefaultRuleset(u.value);w=s.ownerDocument;t="Do you want to run the selected ruleset now?";x="Run Test";y=function(A){var z;w.ysview.closeDialog(w);if(w.yslowContext.component_set===null){YSLOW.controller.run(w.yslowContext.document.defaultView||w.yslowContext.document.parentWindow,w.yslowContext,false)}else{YSLOW.controller.lint(w.yslowContext.document,w.yslowContext)}z=w.yslowContext.genPerformance("html");w.ysview.addButtonView("ysPerfButton",z);w.ysview.panelNode.scrollTop=0;w.ysview.panelNode.scrollLeft=0;YSLOW.view.restoreStatusBar(w.yslowContext);w.ysview.updateToolbarSelection()};this.openDialog(w,389,150,t,undefined,x,y)},onclickTabLabel:function(s,y){var u,t,v,A,C,B,x,D=YSLOW.util.getCurrentTarget(s),z=D.parentNode,w=z.nextSibling;if(D.className.indexOf("selected")!==-1||D.id.indexOf("label")===-1){return false}if(z){u=z.firstChild;while(u){if(this.unselect(u)){t=u.id.substring(5);break}u=u.nextSibling}D.className+=" selected";v=D.id.substring(5);u=w.firstChild;while(u){x=u.id.substring(3);if(!A&&t&&x===t){if(u.className.indexOf("yui-hidden")===-1){u.className+=" yui-hidden"}A=true}if(!C&&v&&x===v){YSLOW.view.removeClassName(u,"yui-hidden");C=true;B=u}if((A||!t)&&(C||!v)){break}u=u.nextSibling}if(y===true&&C===true&&B){this.positionResultTab(B,w,D)}}return false},positionResultTab:function(t,s,z){var w,B,C,x=5,A=this.panel_doc,v=A.defaultView||A.parentWindow,u=v.offsetHeight?v.offsetHeight:v.innerHeight,D=z.offsetTop+t.offsetHeight;s.style.height=D+"px";t.style.position="absolute";t.style.left=z.offsetLeft+z.offsetWidth+"px";t.style.top=z.offsetTop+"px";w=t.offsetTop;B=t.offsetParent;while(B!==null){w+=B.offsetTop;B=B.offsetParent}if(wthis.panelNode.scrollTop+u){if(ww-this.panelNode.scrollTop){C=w-this.panelNode.scrollTop}this.panelNode.scrollTop+=C}}},onclickResult:function(s){YSLOW.util.preventDefault(s);return this.onclickTabLabel(s,true)},unselect:function(s){return YSLOW.view.removeClassName(s,"selected")},filterResult:function(B,s){var x,w,t,y,u,z,v,A=this.getButtonView("ysPerfButton");if(s==="all"){w=true}if(A){x=this.getElementByTagNameAndId(A,"ul","tab-label-list")}if(x){t=x.firstChild;v=x.nextSibling;u=v.firstChild;while(t){YSLOW.view.removeClassName(t,"first");if(w||t.className.indexOf(s)!==-1){t.style.display="block";if(y===undefined){y=u;z=t;YSLOW.view.removeClassName(u,"yui-hidden");t.className+=" first";if(t.className.indexOf("selected")===-1){t.className+=" selected"}t=t.nextSibling;u=u.nextSibling;continue}}else{t.style.display="none"}if(u.className.indexOf("yui-hidden")===-1){u.className+=" yui-hidden"}this.unselect(t);t=t.nextSibling;u=u.nextSibling}if(y){this.positionResultTab(y,v,z)}}},updateFilterSelection:function(u){var s,t=YSLOW.util.getCurrentTarget(u);YSLOW.util.preventDefault(u);if(t.className.indexOf("selected")!==-1){return}t.className+=" selected";s=t.parentNode.firstChild;while(s){if(s!==t&&this.unselect(s)){break}s=s.nextSibling}this.filterResult(t.ownerDocument,t.id)},onclickToolbarMenu:function(s){var w,u=YSLOW.util.getCurrentTarget(s),v=u.parentNode,t=v.parentNode;if(v.className.indexOf("selected")!==-1){return}v.className+=" selected";if(v.previousSibling){v.previousSibling.className+=" off"}if(t){w=t.firstChild;while(w){if(w!==v&&this.unselect(w)){if(w.previousSibling){YSLOW.view.removeClassName(w.previousSibling,"off")}break}w=w.nextSibling}}},expandCollapseComponentType:function(w,t){var u,v=YSLOW.controller.getRenderer("html"),s=this.getButtonView("ysCompsButton");if(s){u=this.getElementByTagNameAndId(s,"table","components-table");v.expandCollapseComponentType(w,u,t)}},expandAll:function(v){var t,u=YSLOW.controller.getRenderer("html"),s=this.getButtonView("ysCompsButton");if(s){t=this.getElementByTagNameAndId(s,"table","components-table");u.expandAllComponentType(v,t)}},regenComponentsTable:function(x,w,t){var u,v=YSLOW.controller.getRenderer("html"),s=this.getButtonView("ysCompsButton");if(s){u=this.getElementByTagNameAndId(s,"table","components-table");v.regenComponentsTable(x,u,w,t,this.yscontext.component_set)}},showComponentHeaders:function(u){var t,v,s=this.getButtonView("ysCompsButton");if(s){t=this.getElementByTagNameAndId(s,"tr",u);if(t){v=t.firstChild;if(t.style.display==="none"){t.style.display="table-row"}else{t.style.display="none"}}}},openLink:function(s){YSLOW.util.openLink(s)},openPopup:function(u,t,w,s,v){window.open(u,t||"_blank","width="+(w||626)+",height="+(s||436)+","+(v||"toolbar=0,status=1,location=1,resizable=1"))},runTool:function(s,t){YSLOW.controller.runTool(s,this.yscontext,t)},onclickRuleset:function(x){var u,t,s,w,y=YSLOW.util.getCurrentTarget(x),v=y.className.indexOf("ruleset-");YSLOW.util.preventDefault(x);if(v!==-1){t=y.className.indexOf(" ",v+8);if(t!==-1){u=y.className.substring(v+8,t)}else{u=y.className.substring(v+8)}s=this.getButtonView("ysRuleEditButton");if(s){w=this.getElementByTagNameAndId(s,"form","edit-form");YSLOW.renderer.initRulesetEditForm(y.ownerDocument,w,YSLOW.controller.getRuleset(u))}}return this.onclickTabLabel(x,false)},openSaveAsDialog:function(u,t){var s='',v="Save",w=function(D){var A,y,x,B,z,C=YSLOW.util.getCurrentTarget(D).ownerDocument;if(C.ysview.modaldlg){A=C.ysview.getElementByTagNameAndId(C.ysview.modaldlg,"input","saveas-name")}if(A){if(YSLOW.controller.checkRulesetName(A.value)===true){y=s+'
    '+A.value+" ruleset already exists.
    ";C.ysview.closeDialog(C);C.ysview.openDialog(C,389,150,y,"",v,w)}else{x=C.ysview.getButtonView("ysRuleEditButton");if(x){B=C.ysview.getElementByTagNameAndId(x,"form",t);z=C.createElement("input");z.type="hidden";z.name="saveas-name";z.value=A.value;B.appendChild(z);B.submit()}C.ysview.closeDialog(C)}}};this.openDialog(u,389,150,s,undefined,v,w)},openPrintableDialog:function(v){var u="Please run YSlow first before using Printable View.",t="Check which information you want to view or print
    ",s='
    ',w="Ok",x=function(A){var y,z=YSLOW.util.getCurrentTarget(A).ownerDocument,z=FBL.getContentView(z);aInputs=z.getElementsByName("print-type"),print_type={};for(y=0;y0){for(s=0;s0){if(L[G].className==="dialog-box"){I=L[G]}else{if(L[G].className==="dialog-text"){B=L[G]}else{if(L[G].className==="dialog-more-text"){A=L[G]}}}}}if(J&&I&&B&&A){B.innerHTML=(z?z:"");A.innerHTML=(y?y:"");t=J.getElementsByTagName("input");for(F=0;F0)?u:225)+"px";I.style.top=((C&&C>0)?C:80)+"px";J.style.left=this.panelNode.scrollLeft+"px";J.style.top=this.panelNode.scrollTop+"px";J.style.display="block";if(t.length>0){t[0].focus()}}},closeDialog:function(t){var s=this.modaldlg;s.style.display="none"},saveRuleset:function(w,t){var u,v=YSLOW.controller.getRenderer("html"),s=this.getButtonView("ysRuleEditButton");if(s){u=this.getElementByTagNameAndId(s,"form",t);v.saveRuleset(w,u)}},deleteRuleset:function(w,t){var u,v=YSLOW.controller.getRenderer("html"),s=this.getButtonView("ysRuleEditButton");if(s){u=this.getElementByTagNameAndId(s,"form",t);v.deleteRuleset(w,u)}},shareRuleset:function(x,v){var s,z,w,A,y,t=YSLOW.controller.getRenderer("html"),u=this.getButtonView("ysRuleEditButton");if(u){s=this.getElementByTagNameAndId(u,"form",v);z=t.getEditFormRulesetId(s);w=YSLOW.controller.getRuleset(z);if(w){A=YSLOW.Exporter.exportRuleset(w);if(A){y="";this.openDialog(x,389,150,y,"","Ok")}}}},createRuleset:function(u,t){var s,v,x=u.parentNode,w=x.parentNode,y=w.firstChild;while(y){this.unselect(y);y=y.nextSibling}s=this.getButtonView("ysRuleEditButton");if(s){v=this.getElementByTagNameAndId(s,"form",t);YSLOW.renderer.initRulesetEditForm(this.panel_doc,v)}},showHideHelp:function(){var s,t=this.getElementByTagNameAndId(this.panelNode,"div","toolbarDiv");if(t){s=this.getElementByTagNameAndId(t,"div","helpDiv")}if(s){if(s.style.visibility==="visible"){s.style.visibility="hidden"}else{s.style.visibility="visible"}}},smushIt:function(t,s){YSLOW.util.smushIt(s,function(y){var w,v,x,z,u="";if(y.error){u+="
    "+y.error+"
    "}else{x=YSLOW.util.getSmushUrl();z=YSLOW.util.makeAbsoluteUrl(y.dest,x);u+="
    Original size: "+y.src_size+" bytes
    Result size: "+y.dest_size+" bytes
    % Savings: "+y.percent+"%
    "}w='
    Image: '+YSLOW.util.briefUrl(s,250)+"
    ";v=u;t.ysview.openDialog(t,389,150,w,v,"Ok")})},checkAllRules:function(x,u,t){var v,s,w,y;if(typeof t!=="boolean"){return}s=this.getButtonView("ysRuleEditButton");if(s){w=this.getElementByTagNameAndId(s,"form",u);y=w.elements;for(v=0;vF||J>s){this.tooltip.style.display="none";return}H=A.offsetParent;while(H!==null){D+=H.offsetLeft;C+=H.offsetTop;H=H.offsetParent}D+=A.offsetLeft;C+=A.offsetTop;if(DG.ysview.panelNode.scrollTop+s)){this.tooltip.style.display="none";return}v=D+A.offsetWidth/2;u=C+A.offsetHeight/2;if(D+A.offsetWidth+E+w=G.ysview.panelNode.scrollTop)&&(C-E+J+E<=G.ysview.panelNode.scrollTop+s)){C=C-E;t="right top"}else{C+=A.offsetHeight-J;t="right bottom"}}else{if(C-J-E>=G.ysview.panelNode.scrollTop){C-=J+E;t="top"}else{C+=A.offsetHeight+E;t="bottom"}B=Math.floor(v-w/2);if((B>=G.ysview.panelNode.scrollLeft)&&(B+w<=G.ysview.panelNode.scrollLeft+F)){D=B}else{if(B0&&s&&s.length>0){v=u.className.split(" ");for(t=0;t0){A[s]=y[s]}E+=y[s]}}return{total_size:E,num_requests:t,count_obj:x,size_obj:y,canvas_data:A}},collectStats:function(){var s=this.computeStats();if(s!==undefined){this.PAGE.totalSize=s.total_size;this.PAGE.totalRequests=s.num_requests;this.PAGE.totalObjCount=s.count_obj;this.PAGE.totalObjSize=s.size_obj;this.PAGE.canvas_data.empty=s.canvas_data}s=this.computeStats(true);if(s){this.PAGE.totalSizePrimed=s.total_size;this.PAGE.totalRequestsPrimed=s.num_requests;this.PAGE.totalObjCountPrimed=s.count_obj;this.PAGE.totalObjSizePrimed=s.size_obj;this.PAGE.canvas_data.primed=s.canvas_data}},genPerformance:function(t,s){if(this.result_set===null){if(!s){s=this.document}YSLOW.controller.lint(s,this)}return YSLOW.controller.render(t,"reportcard",{result_set:this.result_set})},genStats:function(t){var s={};if(!this.PAGE.totalSize){this.collectStats()}s.PAGE=this.PAGE;return YSLOW.controller.render(t,"stats",{stats:s})},genComponents:function(s){if(!this.PAGE.totalSize){this.collectStats()}return YSLOW.controller.render(s,"components",{comps:this.component_set.components,total_size:this.PAGE.totalSize})},genToolsView:function(t){var s=YSLOW.Tools.getAllTools();return YSLOW.controller.render(t,"tools",{tools:s})},genRulesetEditView:function(s){return YSLOW.controller.render(s,"rulesetEdit",{rulesets:YSLOW.controller.getRegisteredRuleset()})}};YSLOW.renderer={sortBy:"type",sortDesc:false,bPrintable:false,colors:{doc:"#8963df",redirect:"#FC8C8C",iframe:"#FFDFDF",xhr:"#89631f",flash:"#8D4F5B",js:"#9fd0e8",css:"#aba5eb",cssimage:"#677ab8",image:"#d375cd",favicon:"#a26c00",unknown:"#888888"},reset:function(){this.sortBy="type";this.sortDesc=false},genStats:function(A,B){var x,y,u,t,D,z,s,w,v="",C=0;if(!A.PAGE){return""}if(B){x=A.PAGE.totalObjCountPrimed;y=A.PAGE.totalObjSizePrimed;u=A.PAGE.totalRequestsPrimed;C=A.PAGE.totalSizePrimed}else{x=A.PAGE.totalObjCount;y=A.PAGE.totalObjSize;u=A.PAGE.totalRequests;C=A.PAGE.totalSize}t=YSLOW.peeler.types;D=(B)?"primed":"empty";for(z=0;z
     
    '+x[s]+''+YSLOW.util.prettyType(s)+''+YSLOW.util.kbSize(y[s])+""}}w='
    HTTP Requests - '+u+'
    Total Weight - '+YSLOW.util.kbSize(C)+'
    '+v+"
    ";return w},plotComponents:function(s,t){if(typeof s!=="object"){return}this.plotOne(s,t.PAGE.canvas_data.empty,t.PAGE.totalSize,"comp-canvas-empty");this.plotOne(s,t.PAGE.canvas_data.primed,t.PAGE.totalSizePrimed,"comp-canvas-primed")},plotOne:function(C,v,B,A){var u,w,E,t,z,s,y,F,x,D=C.getElementsByTagName("canvas");for(w=0;w'+YSLOW.util.escapeHtml(s.headers[u])+""}}if(s.req_headers){t+='Request Headers';for(u in s.req_headers){if(s.req_headers.hasOwnProperty(u)&&s.req_headers[u]){t+=''+YSLOW.util.escapeHtml(YSLOW.util.formatHeaderName(u))+'

    '+YSLOW.util.escapeHtml(s.req_headers[u])+"

    "}}}t+="";return t},genComponentRow:function(y,x,t,w){var u,C,v,s,B,A,z;if(typeof t!=="string"){t=""}if(x.status>=400&&x.status<500){t+=" compError"}if(x.after_onload===true){t+=" afteronload"}u="compHeaders"+x.id;C='";for(v in y){if(y.hasOwnProperty(v)){s=v;B="";if(v==="type"){B+=x[v];if(x.is_beacon){B+=" †"}if(x.after_onload){B+=" *"}}else{if(v==="size"){B+=YSLOW.util.kbSize(x.size)}else{if(v==="url"){if(x.status>=400&&x.status<500){C+=''+x[v]+" (status: "+x.status+")";continue}else{B+=YSLOW.util.prettyAnchor(x[v],x[v],undefined,!YSLOW.renderer.bPrintable,100,1,x.type)}}else{if(v==="gzip"&&(x.compressed==="gzip"||x.compressed==="deflate")){B+=(x.size_compressed!==undefined?YSLOW.util.kbSize(x.size_compressed):"uncertain")}else{if(v==="set-cookie"){A=x.getSetCookieSize();B+=A>0?A:""}else{if(v==="cookie"){z=x.getReceivedCookieSize();B+=z>0?z:""}else{if(v==="etag"){B+=x.getEtag()}else{if(v==="expires"){B+=YSLOW.util.prettyExpiresDate(x.expires)}else{if(v==="headers"){if(YSLOW.renderer.bPrintable){continue}if(x.raw_headers&&x.raw_headers.length>0){B+="'}}else{if(v==="action"){if(YSLOW.renderer.bPrintable){continue}if(x.type==="cssimage"||x.type==="image"){if(x.response_type===undefined||x.response_type==="image"){B+="smush.it"}}}else{if(x[v]!==undefined){B+=x[v]}}}}}}}}}}}C+=''+B+""}}C+="";if(x.raw_headers&&x.raw_headers.length>0){C+=''+this.getComponentHeadersTable(x)+""}return C},componentSortCallback:function(s,A){var t,v,w,y="",x="",z=YSLOW.renderer.sortBy,u=YSLOW.renderer.sortDesc;switch(z){case"type":y=s.type;x=A.type;break;case"size":y=s.size?Number(s.size):0;x=A.size?Number(A.size):0;break;case"gzip":y=s.size_compressed?Number(s.size_compressed):0;x=A.size_compressed?Number(A.size_compressed):0;break;case"set-cookie":y=s.getSetCookieSize();x=A.getSetCookieSize();break;case"cookie":y=s.getReceivedCookieSize();x=A.getReceivedCookieSize();break;case"headers":break;case"url":y=s.url;x=A.url;break;case"respTime":y=s.respTime?Number(s.respTime):0;x=A.respTime?Number(A.respTime):0;break;case"etag":y=s.getEtag();x=A.getEtag();break;case"action":if(s.type==="cssimage"||s.type==="image"){y="smush.it"}if(A.type==="cssimage"||A.type==="image"){x="smush.it"}break;case"expires":y=s.expires||0;x=A.expires||0;break}if(y===x){if(s.id>A.id){return(u)?-1:1}if(s.idx){return(u)?-1:1}if(y',x='
    ',v='
    ';for(s in C){if(C.hasOwnProperty(s)&&C[s]){A=C[s];u='
    ";if(B.rules[s]!==undefined){D+=1}if(B.weights!==undefined&&B.weights[s]!==undefined){y+=''}t=(w%3);switch(t){case 0:z+=u;break;case 1:x+=u;break;case 2:v+=u;break}w+=1}}z+="
    ";x+="
    ";v+="";return'

    '+B.name+' Ruleset (includes '+parseInt(D,10)+" of "+parseInt(w,10)+' rules)

    '+z+""+x+""+v+'
    '+y+"
    "},genRulesetEditForm:function(s){var t="";t+='
    '+YSLOW.renderer.genRulesCheckbox(s)+'
    ';return t},initRulesetEditForm:function(K,t,F){var E,H,G,D,I,M,y,L,x,A,s,w,C,u=t.elements,v="",B=[],z=0,J=0;for(H=0;H'}z+=1}}s.innerHTML="(includes "+parseInt(z,10)+" of "+parseInt(J,10)+" rules)";M.innerHTML='';y.innerHTML='';L.innerHTML=F.name}else{M.innerHTML="";y.innerHTML="";L.innerHTML="New";s.innerHTML=""}x.innerHTML=v}};YSLOW.registerRenderer({id:"html",supports:{components:1,reportcard:1,stats:1,tools:1,rulesetEdit:1},genComponentsTable:function(t,E,x){var C,A,D,B,w={type:"TYPE",size:"SIZE
    (KB)",gzip:"GZIP
    (KB)","set-cookie":"COOKIE RECEIVED
    (bytes)",cookie:"COOKIE SENT
    (bytes)",headers:"HEADERS",url:"URL",expires:"EXPIRES
    (Y/M/D)",respTime:"RESPONSE
    TIME (ms)",etag:"ETAG",action:"ACTION"},z=false,v="",y="",s=0,u=0;if(E!==undefined&&w[E]===undefined){return""}if(YSLOW.renderer.bPrintable){E=YSLOW.renderer.sortBy;x=YSLOW.renderer.sortDesc}else{if(E===undefined||E==="type"){E="type";z=true}}t=YSLOW.renderer.sortComponents(t,E,x);v+='';for(C in w){if(w.hasOwnProperty(C)&&w[C]){if(YSLOW.renderer.bPrintable&&(C==="action"||C==="components"||C==="headers")){continue}v+="'+(E===C?(x?"↓":"↑"):"")+" "+w[C]+""}}}v+="";for(A=0;A";v+=y;y="";s=0;u=0;D=B.type}}y+=YSLOW.renderer.genComponentRow(w,B,(s%2===0?"even":"odd"),z);s+=1;u+=B.size}else{v+=YSLOW.renderer.genComponentRow(w,B,(A%2===0?"even":"odd"),false)}}if(y.length>0){v+='";v+=y}v+="
    '+D+" ("+s+')'+YSLOW.util.kbSize(u)+"
    '+D+" ("+s+')'+YSLOW.util.kbSize(u)+"
    ";return v},componentsView:function(y,t){var v,u=this.genComponentsTable(y,YSLOW.renderer.sortBy,false),w="in type column indicates the component is loaded after window onload event.",s="denotes 1x1 pixels image that may be image beacon",x="Components";if(YSLOW.doc){if(YSLOW.doc.components_legend){if(YSLOW.doc.components_legend.beacon){w=YSLOW.doc.components_legend.beacon}if(YSLOW.doc.components_legend.after_onload){s=YSLOW.doc.components_legend.after_onload}}if(YSLOW.doc.view_names&&YSLOW.doc.view_names.components){x=YSLOW.doc.view_names.components}}v='
    '+x+'The page has a total of '+y.length+' components and a total weight of '+YSLOW.util.kbSize(t)+' bytes
    '+u+'
    * '+w+"
    † "+s+"
    ";return v},reportcardPrintableView:function(v,t,y){var w,u,A,s,z,x='
    ";for(w=0;w"}}x+="
    Overall Grade: '+t+" (Ruleset applied: "+y.name+")
    '+s+'

    '+A.name+'

    '+A.message+"
    ";if(A.components&&A.components.length>0){x+='
      ';for(u=0;u"+A.components[u]+""}else{if(A.components[u].url!==undefined){x+="
    • "+YSLOW.util.briefUrl(A.components[u].url,60)+"
    • "}}}x+="

    "}x+="

    ";return x},getFilterCode:function(z,w,u,s){var y,t,x,A,D,E,v,C=w.length,B=[];for(t in z){if(z.hasOwnProperty(t)&&z[t]){B.push(t)}}B.sort();y='
    • ALL ('+C+')
    • FILTER BY:
    • ';for(x=0,A=B.length;x'+B[x].toUpperCase()+" ("+z[B[x]]+")"}D="http://yslow.org/scoremeter/?url="+encodeURIComponent(s)+"&grade="+u;for(x=0;x=0&&v<100){D+="&"+E.rule_id.toLowerCase()+"="+v}}D=encodeURIComponent(encodeURIComponent(D));s=encodeURIComponent(encodeURIComponent(s.slice(0,60)+(s.length>60?"...":"")));y+='";y+='";y+="
    ";return y},reportcardView:function(u){var y,J,H,G,z,t,x,N,D,K,M,L,s,w,A='
    ',I=u.getRulesetApplied(),C=u.getResults(),v=u.url,O="Grade",F="",E="",B={};if(YSLOW.doc){if(YSLOW.doc.view_names&&YSLOW.doc.view_names.grade){O=YSLOW.doc.view_names.grade}}y=YSLOW.util.prettyScore(u.getOverallScore());if(YSLOW.renderer.bPrintable){return this.reportcardPrintableView(C,y,I)}A+='
    '+O+'
    '+y+'
    Overall performance score '+Math.round(u.getOverallScore())+'Ruleset applied: '+I.name+'URL: '+YSLOW.util.briefUrl(v,100)+"
    ";for(J=0;J0){N+=" "}N+=z.category[G];if(B[z.category[G]]===undefined){B[z.category[G]]=0}B[z.category[G]]+=1}}if(N.length>0){F+=' class="'+N+'"'}F+=' onclick="javascript:document.ysview.onclickResult(event)">
    '+t+''+z.name+"
    ";E+='
    ")}E+='">

    Grade '+t+" on "+z.name+"

    "+z.message+"
    ";if(z.components&&z.components.length>0){E+='

      ';for(H=0;H"+L+""}else{if(L.url!==undefined){E+="
    • ";s=z.rule_id.toLowerCase();if(z.rule_id.match("expires")){E+="("+YSLOW.util.prettyExpiresDate(L.expires)+") "}E+=YSLOW.util.prettyAnchor(L.url,L.url,undefined,true,120,undefined,L.type)+"
    • "}}}E+="

    "}E+="

    ";w=YSLOW.controller.getRule(z.rule_id);if(w){E+='

    '+(w.info||"** To be added **")+"

    ";if(w.url!==undefined){E+='

    »Read More

    "}}E+="
    "}}A+='
    '+this.getFilterCode(B,C,y,v)+'
      '+F+'
    '+E+'
    '+YSLOW.doc.copyright+"
    ";return A},statsView:function(t){var s="",u="Stats";if(YSLOW.doc){if(YSLOW.doc.view_names&&YSLOW.doc.view_names.stats){u=YSLOW.doc.view_names.stats}}s+='
    '+u+'The page has a total of '+t.PAGE.totalRequests+' HTTP requests and a total weight of '+YSLOW.util.kbSize(t.PAGE.totalSize)+" bytes with empty cache
    ";s+='
    WEIGHT GRAPHS
    ';s+='
    Empty Cache
    '+YSLOW.renderer.genStats(t,false)+"
    ";s+='
    Primed Cache
    '+YSLOW.renderer.genStats(t,true)+"
    ";s+="
    ";return s},toolsView:function(w){var v,u,t,s="",y="Tools",x="Click the Launch Tool link next to the tool you want to run to start the tool.";if(YSLOW.doc){if(YSLOW.doc.tools_desc){x=YSLOW.doc.tools_desc}if(YSLOW.doc.view_names&&YSLOW.doc.view_names.tools){y=YSLOW.doc.view_names.tools}}for(v=0;v"}s+="
    "+t.name+"-"+(t.short_desc||"Short text here explaining what are the main benefits of running this App")+"
    ";u='
    '+y+""+x+'
    '+s+"
    ";return u},rulesetEditView:function(F){var u,D,w,v,y='
    ',E,B,A=0,t=false,s,x,C="Rule Settings",z="Choose which ruleset better fit your specific needs. You can Save As an existing rule, based on an existing ruleset.";if(YSLOW.doc){if(YSLOW.doc.rulesettings_desc){z=YSLOW.doc.rulesettings_desc}if(YSLOW.doc.view_names&&YSLOW.doc.view_names.rulesetedit){C=YSLOW.doc.view_names.rulesetedit}}x=YSLOW.controller.getDefaultRulesetId();E='
    • STANDARD SETS
    • ';for(u in F){if(F.hasOwnProperty(u)&&F[u]){D=F[u];w="tab"+A;if(!t&&D.custom===true){E+='
    • CUSTOM SETS
    • ';t=true}E+='
    • '+D.name+"
    • ";A+=1}}E+='
    ';B='
    '+YSLOW.renderer.genRulesetEditForm(s)+"
    ";y+=E+B;v='
    '+C+""+z+"
    "+y+"
    ";return v},rulesetEditUpdateTab:function(K,s,E,t,C){var u,D,H,w,B,I,F,z,v,A,J,G,x,y=s.parentNode.parentNode.parentNode;if(y&&y.id==="settingsDiv"&&E.custom===true){u=y.firstChild;D=u.nextSibling;if(t<1){H=u.firstChild;while(H){w=H.className.indexOf("ruleset-");if(w!==-1){B=H.className.substring(w+8);w=B.indexOf(" ");if(w!==-1){B=B.substring(0,w)}if(E.id===B){w=H.id.indexOf("label");if(w!==-1){I=H.id.substring(w+5);if(H.className.indexOf("selected")!==-1){F={};F.currentTarget=J;K.ysview.onclickRuleset(F)}if(H.previousSibling&&H.previousSibling.id==="custom-set-title"&&H.nextSibling&&H.nextSibling.id==="create-ruleset"){z=H.previousSibling}u.removeChild(H);if(z){u.removeChild(z)}}break}else{J=H}}H=H.nextSibling}}else{H=u.lastChild;while(H){A=H.id.indexOf("label");if(A!==-1){v=H.id.substring(A+5);break}H=H.previousSibling}v=Number(v)+1;H=K.createElement("li");H.className="ruleset-"+E.id;H.id="label"+v;H.onclick=function(L){K.ysview.onclickRuleset(L)};H.innerHTML=''+E.name+"";u.insertBefore(H,u.lastChild);G=u.firstChild;while(G){if(G.id&&G.id==="custom-set-title"){z=G;break}G=G.nextSibling}if(!z){z=K.createElement("li");z.className="new-section header";z.id="custom-set-title";z.innerHTML="CUSTOM SETS";u.insertBefore(z,H)}if(C){x={};x.currentTarget=H;K.ysview.onclickRuleset(x)}}}},hasClassName:function(v,s){var t,u=v.split(" ");if(u){for(t=0;t";u+=""+w[v].type+"";u+=""+w[v].size+"";if(w[v].compressed===false){u+=""}else{u+=""+(w[v].size_compressed!==undefined?parseInt(w[v].size_compressed,10):"uncertain")+""}s=w[v].getSetCookieSize();if(s>0){u+=""+parseInt(s,10)+""}s=w[v].getReceivedCookieSize();if(s>0){u+=""+parseInt(s,10)+""}u+=""+encodeURI(w[v].url)+"";u+=""+w[v].expires+"";u+=""+w[v].respTime+"";u+=""+w[v].getEtag()+"";u+=""}u+="";return u},reportcardView:function(y){var v,t,A,w=y.getOverallScore(),u=YSLOW.util.prettyScore(w),z=y.getRulesetApplied(),x=y.getResults(),s='';s+='';for(v=0;v';s+=""+A.message+"";if(x.components&&x.components.length>0){s+="";for(t=0;t"+A.components[t]+""}else{if(A.components[t].url!==undefined){s+=""+A.components[t].url+""}}}s+=""}s+=""}s+="";return s},statsView:function(v){var u,y,t,x='',w='',s=YSLOW.peeler.types;for(u=0;u'}if((v.PAGE.totalObjCount[y])!==undefined){w+=''}}x+="";w+="";t=''+x+w+"";return t}});YSLOW.peeler={types:["doc","js","css","iframe","flash","cssimage","image","favicon","xhr","redirect","font"],NODETYPE:{ELEMENT:1,DOCUMENT:9},CSSRULE:{IMPORT_RULE:3,FONT_FACE_RULE:5},peel:function(s,t){},findDocuments:function(t){var A,D,w,B,x,y,s,E,C,u={};YSLOW.util.event.fire("peelProgress",{total_step:7,current_step:1,message:"Finding documents"});if(!t){return}if(!YSLOW.util.Preference.getPref("extensions.yslow.getFramesComponents",true)){u[t.URL]={document:t,type:"doc"};return u}B="doc";if(t.nodeType===this.NODETYPE.DOCUMENT){D=t;w=t.URL}else{if(t.nodeType===this.NODETYPE.ELEMENT&&t.nodeName.toLowerCase()==="frame"){D=t.contentDocument;w=t.src}else{if(t.nodeType===this.NODETYPE.ELEMENT&&t.nodeName.toLowerCase()==="iframe"){D=t.contentDocument;w=t.src;B="iframe";try{C=t.contentWindow;C=C&&C.parent;C=C&&C.document;C=C||t.ownerDocument;if(C&&C.URL===w){w=!t.getAttribute("src")?"":"about:blank"}}catch(v){YSLOW.util.dump(v)}}else{return u}}}u[w]={document:D,type:B};try{A=D.getElementsByTagName("iframe");for(x=0,y=A.length;x0){for(u=0;u0){for(u=0;u