blob: 68b9de904fa428b35275119f35665329677b3d31 [file] [log] [blame]
(function(){function f(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}var h="closure_uid_"+(1E9*Math.random()>>>0),k=0;function l(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b};function m(a,b){this.b={};this.a=[];this.g=this.c=0;var c=arguments.length;if(1<c){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)n(this,arguments[d],arguments[d+1])}else if(a){if(a instanceof m)d=p(a),c=a.h();else{var c=[],e=0;for(d in a)c[e++]=d;d=c;c=l(a)}for(e=0;e<d.length;e++)n(this,d[e],c[e])}}m.prototype.h=function(){q(this);for(var a=[],b=0;b<this.a.length;b++)a.push(this.b[this.a[b]]);return a};function p(a){q(a);return a.a.concat()}
m.prototype.clear=function(){this.b={};this.g=this.c=this.a.length=0};function q(a){if(a.c!=a.a.length){for(var b=0,c=0;b<a.a.length;){var d=a.a[b];r(a.b,d)&&(a.a[c++]=d);b++}a.a.length=c}if(a.c!=a.a.length){for(var e={},c=b=0;b<a.a.length;)d=a.a[b],r(e,d)||(a.a[c++]=d,e[d]=1),b++;a.a.length=c}}function n(a,b,c){r(a.b,b)||(a.c++,a.a.push(b),a.g++);a.b[b]=c}m.prototype.forEach=function(a,b){for(var c=p(this),d=0;d<c.length;d++){var e=c[d];a.call(b,r(this.b,e)?this.b[e]:void 0,e,this)}};
m.prototype.clone=function(){return new m(this)};function r(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function t(a){if("function"==typeof a.h)return a.h();if("string"==typeof a)return a.split("");var b=f(a);if("array"==b||"object"==b&&"number"==typeof a.length){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return l(a)};function u(a){this.a=new m;a&&v(this,a)}function w(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+(a[h]||(a[h]=++k)):b.substr(0,1)+a}function v(a,b){for(var c=t(b),d=c.length,e=0;e<d;e++){var g=c[e];n(a.a,w(g),g)}}u.prototype.removeAll=function(a){a=t(a);for(var b=a.length,c=0;c<b;c++){var d=this.a,e=w(a[c]);r(d.b,e)&&(delete d.b[e],d.c--,d.g++,d.a.length>2*d.c&&q(d))}};u.prototype.clear=function(){this.a.clear()};u.prototype.contains=function(a){a=w(a);return r(this.a.b,a)};
u.prototype.h=function(){return this.a.h()};u.prototype.clone=function(){return new u(this)};google.load("visualization","1.0",{packages:["corechart"]});function y(a){window.console&&console.error(a)}
function z(){this.a=[];this.g=new u;this.b=this.c=null;this.s={width:900,height:255,colors:["#4ECDC4","#556270","#C7F464"],legend:{position:"bottom"},hAxis:{format:"MMM d, y hh:mma",gridlines:{color:"#F2F2F2"},baselineColor:"#E5E5E5"},vAxis:{format:"#.###%",minValue:0,viewWindowMode:"explicit",viewWindow:{min:0},gridlines:{color:"#F2F2F2"},baselineColor:"#E5E5E5"},chartArea:{left:60,top:20,width:800},pointSize:2}}function A(a){var b={};b.f=new u([a]);b.evaluate=function(b){return b(a)};return b}
function B(a){var b={};b.f=new u;for(var c=0;c<a.length;c++)v(b.f,a[c].f);b.evaluate=function(b){for(var c=0,g=0;g<a.length;g++)c+=a[g].evaluate(b);return c};return b}function C(a,b){var c={};c.f=new u;v(c.f,a.f);v(c.f,b.f);c.evaluate=function(c){var e=b.evaluate(c);return 0==e?0:a.evaluate(c)/e};return c}function D(a,b){return C(a,B([a,b]))}
function E(){var a=new z;F(a,"Resources not loaded because of fetch failures","fetch-failure",C(A("serf_fetch_failure_count"),A("serf_fetch_request_count")));F(a,"Resources not rewritten because domain wasn't authorized","not-authorized",D(A("resource_url_domain_rejections"),A("resource_url_domain_acceptances")));F(a,"Resources not rewritten because of restrictive Cache-Control headers","cache-control",D(A("num_cache_control_not_rewritable_resources"),A("num_cache_control_rewritable_resources")));
var b=B([A("cache_backend_misses"),A("cache_backend_hits")]);F(a,"Cache misses","cache-miss",C(A("cache_backend_misses"),b));F(a,"Cache lookups that were expired","cache-expired",C(A("cache_expirations"),b));F(a,"CSS files not rewritten because of parse errors","css-error",D(A("css_filter_parse_failures"),A("css_filter_blocks_rewritten")));F(a,"JavaScript minification failures","js-error",D(A("javascript_minification_failures"),A("javascript_blocks_minified")));var b=B([A("image_rewrites"),A("image_rewrites_dropped_nosaving_resize"),
A("image_rewrites_dropped_nosaving_noresize")]),c=B([A("image_norewrites_high_resolution"),A("image_rewrites_dropped_decode_failure"),A("image_rewrites_dropped_due_to_load"),A("image_rewrites_dropped_mime_type_unknown"),A("image_rewrites_dropped_server_write_fail")]);F(a,"Image rewrite failures","image-error",D(c,b));b=new Date;G(a,new Date(b-864E5),b);return a}var H=["pagespeed","startConsole"],I=this;H[0]in I||!I.execScript||I.execScript("var "+H[0]);
for(var J;H.length&&(J=H.shift());){var K;if(K=!H.length)K=void 0!==E;K?I[J]=E:I[J]?I=I[J]:I=I[J]={}}function F(a,b,c,d){var e={};e.title=b;e.o="https://developers.google.com/speed/pagespeed/module/console#"+c;e.value=d;e.u=a.a.length;e.i=null;e.j=null;e.l=null;e.m=null;a.a.push(e);v(a.g,d.f)}function L(a,b,c){var d=pagespeedStatisticsUrl+"?json",d=d+("&start_time="+b.getTime()),d=d+("&end_time="+c.getTime()),d=d+"&granularity=60000&var_titles=";for(b=0;b<a.length;b++)d+=a[b]+",";return d}
function G(a,b,c){var d=new XMLHttpRequest;b=L(a.g.h(),b,c);d.onreadystatechange=function(){if(4==this.readyState)if(200!=this.status||1>this.responseText.length||"{"!=this.responseText[0])y("XHR request failed.");else{var b=JSON.parse(this.responseText);M(a,b)}};d.open("GET",b);d.send()}
function M(a,b){a.c=b.variables;a.b=b.timestamps;N(a.b,a.c);for(var c=0;c<a.a.length;c++){for(var d=[],e=0;e<a.b.length;e++)d.push(a.a[c].value.evaluate(function(a){return function(b){if(b in a)return a[b][e];y("JSON data missing required variable.");return 0}}(a.c)));a.a[c].i=d[d.length-1];a.a[c].j=a.a[c].i;a.a[c].l=P(a.a[c].title,a.b,d)}a.a.sort(function(a,b){return b.j-a.j});for(c=0;c<a.a.length;c++)Q(a,a.a[c])}
function N(a,b){for(var c in b)a.length!=b[c].length&&y("JSON response is malformed. ("+a.length+" != "+b[c].length+")")}function P(a,b,c){var d=new google.visualization.DataTable;d.addColumn("datetime","Time");d.addColumn("number",a);for(var e=0;e<b.length;e++)d.addRow([new Date(b[e]),c[e]]);0==d.getNumberOfRows()&&y("Data failed to load for graph "+a);return d}
function Q(a,b){var c=google.visualization.LineChart,d=b.title,e=b.i,g=b.o,O=b.u,x=document.createElement("div");x.setAttribute("class","pagespeed-widgets");x.appendChild(R(d,e,g,O));d=document.createElement("div");d.setAttribute("class","pagespeed-graph");x.appendChild(d);document.getElementById("pagespeed-graphs-container").appendChild(x);b.m=new c(d);b.m.draw(b.l,a.s)}
function R(a,b,c,d){var e=document.createElement("div");e.setAttribute("class","pagespeed-widgets-topbar");var g=document.createElement("span");g.setAttribute("class","pagespeed-title");g.setAttribute("id","pagespeed-title"+d);g.appendChild(document.createTextNode(a+": "+(100*b).toFixed(2)+"% ("));a=document.createElement("a");a.setAttribute("href",c);a.appendChild(document.createTextNode("doc"));g.appendChild(a);g.appendChild(document.createTextNode(")"));e.appendChild(g);return e};})();