From 3cce646c2d4f5040ea568673632ff8ff0d6bb99a Mon Sep 17 00:00:00 2001 From: Michael Mrowetz Date: Mon, 2 Feb 2015 21:38:56 -0500 Subject: [PATCH] fix typo --- dist/performanceBookmarklet.js | 2 +- dist/performanceBookmarklet.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/performanceBookmarklet.js b/dist/performanceBookmarklet.js index ec20599..61ceb98 100644 --- a/dist/performanceBookmarklet.js +++ b/dist/performanceBookmarklet.js @@ -845,7 +845,7 @@ onIFrameLoaded(function(){ }), "fileType"); var fileExtensionCountHostExt = getItemCount(requestsOnly.map(function(currR, i, arr){ - return (currR.initiatorType || currR.fileExtension) + " " + (currR.isRequestToHost ? "(host)" : "(extenal)"); + return (currR.initiatorType || currR.fileExtension) + " " + (currR.isRequestToHost ? "(host)" : "(external)"); }), "fileType"); var requestsByDomain = getItemCount(requestsOnly.map(function(currR, i, arr){ diff --git a/dist/performanceBookmarklet.min.js b/dist/performanceBookmarklet.min.js index 28db960..a2982d6 100644 --- a/dist/performanceBookmarklet.min.js +++ b/dist/performanceBookmarklet.min.js @@ -1,2 +1,2 @@ /*https://github.com/nurun/performance-bookmarklet by Michael Mrowetz @MicMro*/ -!function(){"use strict";var a,b,c,d,e,f,g,h,i,j="body {overflow: hidden; background: #fff; font:normal 12px/18px sans-serif; color:#333;} * {box-sizing:border-box;} svg {font:normal 12px/18px sans-serif;} #perfbook-holder {overflow: hidden; width:100%; padding:1em 2em 3em;} #perfbook-content {position:relative;} .perfbook-close {position:absolute; top:0; right:0; padding:1em; z-index:1; background:transparent; border:0; cursor:pointer;} .full-width {width:100%;} h1 {font:bold 18px/18px sans-serif; margin:1em 0; color:#666;} .text-right {text-align: right;} .text-left {text-align: left;} .tiles-holder {margin: 2em -18px 1em 0; display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-flex-flow: row wrap; flex-flow: row wrap; } .summary-tile { flex-grow: 1; width:250px; background:#ddd; padding: 1em; margin:0 18px 1em 0; color:#666; text-align:center;} .summary-tile dt {font-weight:bold; font-size:16px; display:block; line-height:1.2em; min-height:2.9em; padding:0 0 0.5em;} .summary-tile dd {font-weight:bold; line-height:60px; margin:0;} .summary-tile-appendix {float:left; clear:both; width:100%; font-size:10px; line-height:1.1em; color:#666;} .summary-tile-appendix dt {float:left; clear:both;} .summary-tile-appendix dd {float:left; margin:0 0 0 1em;} .pie-charts-holder {margin: 0 -72px 0 0; display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-flex-flow: row wrap; flex-flow: row wrap;} .pie-chart-holder {flex-grow: 1; width:400px; max-width: 600px; margin: 0 72px 0 0;} .pie-chart-holder h1 {min-height:2em;} .pie-chart {width:100%;} .table-holder {overflow-x:auto} .table-holder table {float:left; width:100%; font-size:12px; line-height:18px;} .table-holder th { padding:0 0.5em 0 0;} .table-holder td {padding:0 0.5em 0 0;} .water-fall-holder {margin: 25px 0; fill:#ccc;} .water-fall-chart {width:100%; background:#f0f5f0;} .water-fall-chart .marker-holder {width:100%;} .water-fall-chart .line-holder {stroke-width:1; stroke: #aac;} .water-fall-chart .line-holder.active {stroke: #009; stroke-width:2;} .water-fall-chart .labels {width:100%;} .water-fall-chart .labels .inner-label {pointer-events: none;} .water-fall-chart .time-block.active {opacity: 0.8;} .water-fall-chart .line-end, .water-fall-chart .line-start {display: none; stroke-width:1; stroke-opacity:0.5; stroke: #000;} .water-fall-chart .line-end.active, .water-fall-chart .line-start.active {display: block;} .time-scale line {stroke:#0cc; stroke-width:1;} .time-scale text {font-weight:bold;} .navigation-timing {} .resource-timing .chart-holder {} ",k=[];if(window.performance&&void 0!==window.performance.getEntriesByType)a=window.performance.getEntriesByType("resource"),c=window.performance.getEntriesByType("mark"),d=window.performance.getEntriesByType("measure");else{if(!window.performance||void 0===window.performance.webkitGetEntriesByType)return void alert("Oups, looks like this browser does not support the Resource Timing API\ncheck http://caniuse.com/#feat=resource-timing to see the ones supporting it \n\n");a=window.performance.webkitGetEntriesByType("resource"),c=window.performance.webkitGetEntriesByType("mark"),d=window.performance.webkitGetEntriesByType("measure")}if(!window.performance.timing)return void alert("Oups, looks like this browser does not support performance timing");if(e=window.performance.timing,e.loadEventEnd-e.navigationStart<0)return void alert("Page is still loading - please try again when page is loaded.");b=a.filter(function(a){return!a.name.match(/http[s]?\:\/\/nurun.github.io\/performance-bookmarklet\/.*/)}).map(function(a){var b,c,d,e=0===a.name.indexOf("http");e?(b=a.name.match(/:\/\/(.[^/]+)([^?]*)\??(.*)/),c=b[2].split("/").pop(),d=c.substr((Math.max(0,c.lastIndexOf("."))||1/0)+1)):(b=["",location.host],d=a.name.split(":")[0]);var f={name:a.name,domain:b[1],initiatorType:a.initiatorType||d||"SourceMap or Not Defined",fileExtension:d||"XHR or Not Defined",loadtime:a.duration,isRequestToHost:b[1]===location.host};for(var g in a)"function"!=typeof a[g]&&(f[g]=a[g]);return a.requestStart&&(f.requestStartDelay=a.requestStart-a.startTime,f.dns=a.domainLookupEnd-a.domainLookupStart,f.tcp=a.connectEnd-a.connectStart,f.ttfb=a.responseStart-a.startTime,f.requestDuration=a.responseStart-a.requestStart),a.secureConnectionStart&&(f.ssl=a.connectEnd-a.secureConnectionStart),f}),k.push({name:"All loaded resources",data:b,columns:["name","domain","initiatorType","fileExtension","loadtime","isRequestToHost","requestStartDelay","dns","tcp","ttfb","requestDuration","ssl"]});var l=function(a,b,c){b=b||{};var d=document.createElement(a);for(var e in b)"text"!=e&&(d[e]=b[e]);return b.text?d.textContent=b.text:b.html&&(d.innerHTML=b.html),b["class"]&&(d.className=b["class"]),d.style.cssText=c||"",d},m=function(a,b,c){var d=document.createElementNS("http://www.w3.org/2000/svg",a);b=b||{};for(var e in b)"text"!=e&&d.setAttributeNS(null,e,b[e]);return d.textContent=b.text||"",d.style.cssText=c||"",d},n=function(a,b,c){return m("text",{fill:"#111",y:b,text:a},(c||"")+" text-shadow:0 0 4px #fff;")},o=function(a){var b=m("svg:svg",{},"visibility:hidden;");b.appendChild(a),g.body.appendChild(b);var c=a.getBBox().width;return b.parentNode.removeChild(b),c},p=function(a,b,c){for(var d=[a||"0123456789ABCDEF",b||"0123456789ABCDEF",c||"0123456789ABCDEF"],e="#",f=0,g=0;6>g;g++)f=Math.floor(g/2),e+=d[f].split("")[Math.floor(Math.random()*d[f].length)];return e},q=function(a,b){return-1!==a.indexOf(b,a.length-b.length)},r=function(a,b){var c=b||"#d6d6d7";switch(a){case"css":c="#c5efaf";break;case"iframe":c="#85b3f2";break;case"img":c="#c98dfd";break;case"script":c="#feb06a";break;case"link":c="#6c7385";break;case"xmlhttprequest":c="#efef70"}return c},s=function(a,b){var c,d={},e=[];a.forEach(function(a){d[a]=d[a]?d[a]+1:1});for(var f in d)c={},c[b||"key"]=f,c.count=d[f],e.push(c);return e.sort(function(a,b){return a.countTLD',g||"0")),n.appendChild(k('Requests to Host',f||"0")),n.appendChild(k('TLD & Subdomain Requests',d||"0")),n.appendChild(k("Total",e.loadEventEnd-e.navigationStart+"ms",40)),n.appendChild(k("Time to First Byte",e.responseStart-e.navigationStart+"ms",40)),n.appendChild(k('DOM Content Loading',e.domContentLoadedEventStart-e.domLoading+"ms",40)),n.appendChild(k('DOM Processing',e.domComplete-e.domLoading+"ms",40)),n.appendChild(k('Slowest Call',''+Math.floor(h[0].duration)+"ms",40)),n.appendChild(k("Average Call",j+"ms",40));var o=l("dl",{"class":"summary-tile-appendix"});m(o,'TLD:',location.host.split(".").slice(-2).join(".")),m(o,"Host:",location.host),m(o,"document.domain:",document.domain),n.appendChild(o),i.appendChild(n)}),w(function(){var a={pageLoadTime:e.loadEventEnd-e.navigationStart,output:[]},b=e.navigationStart;for(var f in e)e[f]&&"number"==typeof e[f]&&(a[f]=e[f]-b,a.output.push({name:f,"time (ms)":e[f]-b}));a.output.sort(function(a,b){return(a["time (ms)"]||0)-(b["time (ms)"]||0)});var g=function(a,b,c,d){return{name:a,start:b,end:c,total:"number"!=typeof b||"number"!=typeof c?void 0:c-b,colour:d}};a.blocks=[g("total",0,a.pageLoadTime,"#ccc"),g("ttfb",a.navigationStart,a.responseStart,"#bbb"),g("unload",a.unloadEventStart,a.unloadEventEnd,"#909"),g("redirect",a.redirectStart,a.redirectEnd,"#009"),g("App cache",a.fetchStart,a.domainLookupStart,"#099"),g("DNS",a.domainLookupStart,a.domainLookupEnd,"#090"),g("TCP",a.connectStart,a.connectEnd,"#990"),g("Request",a.requestStart,a.responseStart,"#c90"),g("Response",a.responseStart,a.responseEnd,"#6c0"),g("DOM Processing",a.domLoading,a.domComplete,"#9cc"),g("domContentLoaded Event",a.domContentLoadedEventStart,a.domContentLoadedEventEnd,"#c33"),g("Onload Event",a.loadEventStart,a.loadEventEnd,"#cf3")],a.secureConnectionStart&&a.blocks.push(g("SSL",a.connectStart,a.secureConnectionStart,"#990")),a.msFirstPaint&&a.blocks.push(g("msFirstPaint Event",a.msFirstPaint,a.msFirstPaint,"#c33")),a.domInteractive&&a.blocks.push(g("domInteractive Event",a.domInteractive,a.domInteractive,"#c33")),d.forEach(function(b){a.blocks.push(g("measure:"+b.name,Math.round(b.startTime),Math.round(b.startTime+b.duration),"#f00"))});var h=function(){var b=a.pageLoadTime/100,d=a.blocks.filter(function(a){return"number"==typeof a.start&&"number"==typeof a.total}).sort(function(a,b){return(a.start||0)-(b.start||0)}),e=c.length>0?c.reduce(function(a,b){return Math.max("number"==typeof a?a:0,o(n(b.name,"0")))}):0,f=25*(d.length+1),g=f+e+35,h=l("div",{"class":"navigation-timing water-fall-holder chart-holder"}),j=m("svg:svg",{height:Math.floor(g),"class":"water-fall-chart"}),k=m("g",{"class":"labels"}),p=m("line",{x1:"0",y1:"0",x2:"0",y2:f,"class":"line-end"}),q=m("line",{x1:"0",y1:"0",x2:"0",y2:f,"class":"line-start"}),r=function(a){var b=a.target;u(b,"active");var c=b.x.baseVal.valueInSpecifiedUnits+b.width.baseVal.valueInSpecifiedUnits+"%",d=b.x.baseVal.valueInSpecifiedUnits+"%";p.x1.baseVal.valueAsString=c,p.x2.baseVal.valueAsString=c,q.x1.baseVal.valueAsString=d,q.x2.baseVal.valueAsString=d,u(p,"active"),u(q,"active"),b.parentNode.appendChild(p),b.parentNode.appendChild(q)},s=function(a){v(a.target,"active"),v(p,"active"),v(q,"active")},t=function(a,c,d,e,f,g){var h=m("rect",{width:a/b+"%",height:c,x:d/b+"%",y:e,fill:f,"class":"time-block"});return g&&h.appendChild(m("title",{text:g})),h.addEventListener("mouseover",r),h.addEventListener("mouseout",s),h},w=function(){for(var b=m("g",{"class":"time-scale full-width"}),c=0,d=a.pageLoadTime/1e3,e=100/d;d>=c;c++){var g=n(c+"sec",f);c>d-.2?(g.setAttribute("x",e*c-.5+"%"),g.setAttribute("text-anchor","end")):g.setAttribute("x",e*c+.5+"%");var h=m("line",{x1:e*c+"%",y1:"0",x2:e*c+"%",y2:f});b.appendChild(h),b.appendChild(g)}return b},x=function(){var a=m("g",{transform:"scale(1, 1)","class":"marker-holder"});return c.forEach(function(d,e){var g=m("g",{"class":"mark-holder"}),h=m("g",{"class":"line-holder"}),i=d.startTime/b;d.x=i;var j=n(d.name,f+25);j.setAttribute("writing-mode","tb"),j.setAttribute("x",i+"%"),j.setAttribute("stroke",""),h.appendChild(m("line",{x1:i+"%",y1:"0px",x2:i+"%",y2:f})),c[e-1]&&d.x-c[e-1].x<1&&(j.setAttribute("x",c[e-1].x+1+"%"),d.x=c[e-1].x+1),h.appendChild(m("line",{x1:i+"%",y1:f,x2:d.x+"%",y2:f+23})),g.addEventListener("mouseover",function(){u(h,"active"),g.parentNode.appendChild(g)}),g.addEventListener("mouseout",function(){v(h,"active")}),g.appendChild(m("title",{text:d.name+" ("+Math.round(d.startTime)+"ms)"})),g.appendChild(h),g.appendChild(j),a.appendChild(g)}),a};j.appendChild(w()),j.appendChild(x()),d.forEach(function(a,c){var d=a.total||1,e=25*c;j.appendChild(t(d,25,a.start||.001,e,a.colour,a.name+" ("+a.start+"ms - "+a.end+"ms | total: "+a.total+"ms)"));var f=n(a.name+" ("+a.total+"ms)",e+18);(a.total||1)/b>10?(f.setAttribute("class","inner-label"),f.setAttribute("x",(a.start||.001)/b+.5+"%"),f.setAttribute("width",d/b+"%")):(a.start||.001)/b+d/b<80?f.setAttribute("x",(a.start||.001)/b+d/b+.5+"%"):(f.setAttribute("x",(a.start||.001)/b-.5+"%"),f.setAttribute("text-anchor","end")),k.appendChild(f)}),j.appendChild(k),h.appendChild(l("h1",{text:"Navigation Timing"})),h.appendChild(j),i.appendChild(h)};h(),k=k.concat([{name:"Navigation Timeline",data:a.blocks,columns:["name","start","end","total"]},{name:"Navigation Events",data:a.output},{name:"Marks",data:c,columns:["name","startTime","duration"]}])}),w(function(){function a(a,b){var c=m("svg:svg",{viewBox:"0 0 "+b+" "+b,"class":"pie-chart"},"max-height:"+(.98*window.innerWidth-64)/3+"px;"),d=2*Math.PI/100,e=0,f=function(a,b,c,f,h){var i=b/2,j=e+(c*d-.001),k=e+(c/2*d-.001),l=i+i*Math.sin(e),p=i-i*Math.cos(e),q=i+i*Math.sin(j),r=i-i*Math.cos(j),s=i+.85*i*Math.sin(k),t=i-.85*i*Math.cos(k),u=j-e>Math.PI?1:0,v="M "+i+","+i+" L "+l+","+p+" A "+i+","+i+" 0 "+u+" 1 "+q+","+r+" Z",w=m("path",{id:a,d:v,fill:h});if(w.appendChild(m("title",{text:f})),w.addEventListener("mouseover",function(a){a.target.style.opacity="0.5",g.getElementById(a.target.getAttribute("id")+"-table").style.backgroundColor="#ccc"}),w.addEventListener("mouseout",function(a){a.target.style.opacity="1",g.getElementById(a.target.getAttribute("id")+"-table").style.backgroundColor="transparent"}),e=j,c>10){var x=n(f,t);return k0?c.reduce(function(a,b){return Math.max("number"==typeof a?a:0,o(n(b.name,"0")))}):0,g=25*(e.length+1),h=g+f+35,j=l("div",{"class":"resource-timing water-fall-holder chart-holder"}),k=m("svg:svg",{height:Math.floor(h),"class":"water-fall-chart"}),p=m("g",{"class":"labels"}),q=m("line",{x1:"0",y1:"0",x2:"0",y2:g,"class":"line-end"}),r=m("line",{x1:"0",y1:"0",x2:"0",y2:g,"class":"line-start"}),s=function(a){var b=a.target;u(b,"active");var c=b.x.baseVal.valueInSpecifiedUnits+b.width.baseVal.valueInSpecifiedUnits+"%",d=b.x.baseVal.valueInSpecifiedUnits+"%";q.x1.baseVal.valueAsString=c,q.x2.baseVal.valueAsString=c,r.x1.baseVal.valueAsString=d,r.x2.baseVal.valueAsString=d,u(q,"active"),u(r,"active"),b.parentNode.appendChild(q),b.parentNode.appendChild(r)},t=function(a){v(a.target,"active"),v(q,"active"),v(r,"active")},w=function(a,b,c,e,f,g,h){var i,j=m("rect",{width:a/d+"%",height:b-1,x:c/d+"%",y:e,fill:f,"class":h&&h.length>0?"time-block":"segment"});return g&&j.appendChild(m("title",{text:g})),j.addEventListener("mouseover",s),j.addEventListener("mouseout",t),h&&h.length>0?(i=m("g"),i.appendChild(j),h.forEach(function(a){a.total>0&&a.start&&i.appendChild(w(a.total,8,a.start||.001,e,a.colour,a.name+" ("+Math.round(a.start)+"ms - "+Math.round(a.end)+"ms | total: "+Math.round(a.total)+"ms)"))}),i):j},x=function(){for(var b=m("g",{"class":"time-scale full-width"}),c=0,d=a/1e3,e=100/d;d>=c;c++){var f=n(c+"sec",g);c>d-.2?(f.setAttribute("x",e*c-.5+"%"),f.setAttribute("text-anchor","end")):f.setAttribute("x",e*c+.5+"%");var h=m("line",{x1:e*c+"%",y1:"0",x2:e*c+"%",y2:g});b.appendChild(h),b.appendChild(f)}return b},y=function(){var a=m("g",{transform:"scale(1, 1)","class":"marker-holder"});return c.forEach(function(b,e){var f=m("g",{"class":"mark-holder"}),h=m("g",{"class":"line-holder"}),i=b.startTime/d;b.x=i;var j=n(b.name,g+25);j.setAttribute("writing-mode","tb"),j.setAttribute("x",i+"%"),j.setAttribute("stroke",""),h.appendChild(m("line",{x1:i+"%",y1:0,x2:i+"%",y2:g})),c[e-1]&&b.x-c[e-1].x<1&&(j.setAttribute("x",c[e-1].x+1+"%"),b.x=c[e-1].x+1),h.appendChild(m("line",{x1:i+"%",y1:g,x2:b.x+"%",y2:g+23})),j.addEventListener("mouseover",function(){u(h,"active"),f.parentNode.appendChild(f)}),j.addEventListener("mouseout",function(){v(h,"active")}),f.appendChild(m("title",{text:b.name+" ("+Math.round(b.startTime)+"ms)"})),f.appendChild(h),f.appendChild(j),a.appendChild(f)}),a};k.appendChild(x()),k.appendChild(y()),e.forEach(function(a,b){var c=a.total||1,e=25*b;k.appendChild(w(c,25,a.start||.001,e,a.colour,a.name+" ("+a.start+"ms - "+a.end+"ms | total: "+a.total+"ms)",a.segments));var f=n(a.name+" ("+a.total+"ms)",e+20);(a.total||1)/d>10&&o(f)<200?(f.setAttribute("class","inner-label"),f.setAttribute("x",(a.start||.001)/d+.5+"%"),f.setAttribute("width",c/d+"%")):(a.start||.001)/d+c/d<80?f.setAttribute("x",(a.start||.001)/d+c/d+.5+"%"):(f.setAttribute("x",(a.start||.001)/d-.5+"%"),f.setAttribute("text-anchor","end")),f.style.opacity=a.name.match(/js.map$/)?"0.5":"1",p.appendChild(f)}),k.appendChild(p),j.appendChild(l("h1",{text:"Resource Timing"})),j.appendChild(k),i.appendChild(j)};h(a.loadDuration,a.blocks)}),w(function(){g.body.appendChild(h),f.style.height=h.clientHeight+"px"}),k.forEach(function(a){a.data.length>0&&console.table&&(console.log("\n\n\n"+a.name+":"),console.table(a.data,a.columns))})}(); \ No newline at end of file +!function(){"use strict";var a,b,c,d,e,f,g,h,i,j="body {overflow: hidden; background: #fff; font:normal 12px/18px sans-serif; color:#333;} * {box-sizing:border-box;} svg {font:normal 12px/18px sans-serif;} #perfbook-holder {overflow: hidden; width:100%; padding:1em 2em 3em;} #perfbook-content {position:relative;} .perfbook-close {position:absolute; top:0; right:0; padding:1em; z-index:1; background:transparent; border:0; cursor:pointer;} .full-width {width:100%;} h1 {font:bold 18px/18px sans-serif; margin:1em 0; color:#666;} .text-right {text-align: right;} .text-left {text-align: left;} .tiles-holder {margin: 2em -18px 1em 0; display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-flex-flow: row wrap; flex-flow: row wrap; } .summary-tile { flex-grow: 1; width:250px; background:#ddd; padding: 1em; margin:0 18px 1em 0; color:#666; text-align:center;} .summary-tile dt {font-weight:bold; font-size:16px; display:block; line-height:1.2em; min-height:2.9em; padding:0 0 0.5em;} .summary-tile dd {font-weight:bold; line-height:60px; margin:0;} .summary-tile-appendix {float:left; clear:both; width:100%; font-size:10px; line-height:1.1em; color:#666;} .summary-tile-appendix dt {float:left; clear:both;} .summary-tile-appendix dd {float:left; margin:0 0 0 1em;} .pie-charts-holder {margin: 0 -72px 0 0; display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-flex-flow: row wrap; flex-flow: row wrap;} .pie-chart-holder {flex-grow: 1; width:400px; max-width: 600px; margin: 0 72px 0 0;} .pie-chart-holder h1 {min-height:2em;} .pie-chart {width:100%;} .table-holder {overflow-x:auto} .table-holder table {float:left; width:100%; font-size:12px; line-height:18px;} .table-holder th { padding:0 0.5em 0 0;} .table-holder td {padding:0 0.5em 0 0;} .water-fall-holder {margin: 25px 0; fill:#ccc;} .water-fall-chart {width:100%; background:#f0f5f0;} .water-fall-chart .marker-holder {width:100%;} .water-fall-chart .line-holder {stroke-width:1; stroke: #aac;} .water-fall-chart .line-holder.active {stroke: #009; stroke-width:2;} .water-fall-chart .labels {width:100%;} .water-fall-chart .labels .inner-label {pointer-events: none;} .water-fall-chart .time-block.active {opacity: 0.8;} .water-fall-chart .line-end, .water-fall-chart .line-start {display: none; stroke-width:1; stroke-opacity:0.5; stroke: #000;} .water-fall-chart .line-end.active, .water-fall-chart .line-start.active {display: block;} .time-scale line {stroke:#0cc; stroke-width:1;} .time-scale text {font-weight:bold;} .navigation-timing {} .resource-timing .chart-holder {} ",k=[];if(window.performance&&void 0!==window.performance.getEntriesByType)a=window.performance.getEntriesByType("resource"),c=window.performance.getEntriesByType("mark"),d=window.performance.getEntriesByType("measure");else{if(!window.performance||void 0===window.performance.webkitGetEntriesByType)return void alert("Oups, looks like this browser does not support the Resource Timing API\ncheck http://caniuse.com/#feat=resource-timing to see the ones supporting it \n\n");a=window.performance.webkitGetEntriesByType("resource"),c=window.performance.webkitGetEntriesByType("mark"),d=window.performance.webkitGetEntriesByType("measure")}if(!window.performance.timing)return void alert("Oups, looks like this browser does not support performance timing");if(e=window.performance.timing,e.loadEventEnd-e.navigationStart<0)return void alert("Page is still loading - please try again when page is loaded.");b=a.filter(function(a){return!a.name.match(/http[s]?\:\/\/nurun.github.io\/performance-bookmarklet\/.*/)}).map(function(a){var b,c,d,e=0===a.name.indexOf("http");e?(b=a.name.match(/:\/\/(.[^/]+)([^?]*)\??(.*)/),c=b[2].split("/").pop(),d=c.substr((Math.max(0,c.lastIndexOf("."))||1/0)+1)):(b=["",location.host],d=a.name.split(":")[0]);var f={name:a.name,domain:b[1],initiatorType:a.initiatorType||d||"SourceMap or Not Defined",fileExtension:d||"XHR or Not Defined",loadtime:a.duration,isRequestToHost:b[1]===location.host};for(var g in a)"function"!=typeof a[g]&&(f[g]=a[g]);return a.requestStart&&(f.requestStartDelay=a.requestStart-a.startTime,f.dns=a.domainLookupEnd-a.domainLookupStart,f.tcp=a.connectEnd-a.connectStart,f.ttfb=a.responseStart-a.startTime,f.requestDuration=a.responseStart-a.requestStart),a.secureConnectionStart&&(f.ssl=a.connectEnd-a.secureConnectionStart),f}),k.push({name:"All loaded resources",data:b,columns:["name","domain","initiatorType","fileExtension","loadtime","isRequestToHost","requestStartDelay","dns","tcp","ttfb","requestDuration","ssl"]});var l=function(a,b,c){b=b||{};var d=document.createElement(a);for(var e in b)"text"!=e&&(d[e]=b[e]);return b.text?d.textContent=b.text:b.html&&(d.innerHTML=b.html),b["class"]&&(d.className=b["class"]),d.style.cssText=c||"",d},m=function(a,b,c){var d=document.createElementNS("http://www.w3.org/2000/svg",a);b=b||{};for(var e in b)"text"!=e&&d.setAttributeNS(null,e,b[e]);return d.textContent=b.text||"",d.style.cssText=c||"",d},n=function(a,b,c){return m("text",{fill:"#111",y:b,text:a},(c||"")+" text-shadow:0 0 4px #fff;")},o=function(a){var b=m("svg:svg",{},"visibility:hidden;");b.appendChild(a),g.body.appendChild(b);var c=a.getBBox().width;return b.parentNode.removeChild(b),c},p=function(a,b,c){for(var d=[a||"0123456789ABCDEF",b||"0123456789ABCDEF",c||"0123456789ABCDEF"],e="#",f=0,g=0;6>g;g++)f=Math.floor(g/2),e+=d[f].split("")[Math.floor(Math.random()*d[f].length)];return e},q=function(a,b){return-1!==a.indexOf(b,a.length-b.length)},r=function(a,b){var c=b||"#d6d6d7";switch(a){case"css":c="#c5efaf";break;case"iframe":c="#85b3f2";break;case"img":c="#c98dfd";break;case"script":c="#feb06a";break;case"link":c="#6c7385";break;case"xmlhttprequest":c="#efef70"}return c},s=function(a,b){var c,d={},e=[];a.forEach(function(a){d[a]=d[a]?d[a]+1:1});for(var f in d)c={},c[b||"key"]=f,c.count=d[f],e.push(c);return e.sort(function(a,b){return a.countTLD',g||"0")),n.appendChild(k('Requests to Host',f||"0")),n.appendChild(k('TLD & Subdomain Requests',d||"0")),n.appendChild(k("Total",e.loadEventEnd-e.navigationStart+"ms",40)),n.appendChild(k("Time to First Byte",e.responseStart-e.navigationStart+"ms",40)),n.appendChild(k('DOM Content Loading',e.domContentLoadedEventStart-e.domLoading+"ms",40)),n.appendChild(k('DOM Processing',e.domComplete-e.domLoading+"ms",40)),n.appendChild(k('Slowest Call',''+Math.floor(h[0].duration)+"ms",40)),n.appendChild(k("Average Call",j+"ms",40));var o=l("dl",{"class":"summary-tile-appendix"});m(o,'TLD:',location.host.split(".").slice(-2).join(".")),m(o,"Host:",location.host),m(o,"document.domain:",document.domain),n.appendChild(o),i.appendChild(n)}),w(function(){var a={pageLoadTime:e.loadEventEnd-e.navigationStart,output:[]},b=e.navigationStart;for(var f in e)e[f]&&"number"==typeof e[f]&&(a[f]=e[f]-b,a.output.push({name:f,"time (ms)":e[f]-b}));a.output.sort(function(a,b){return(a["time (ms)"]||0)-(b["time (ms)"]||0)});var g=function(a,b,c,d){return{name:a,start:b,end:c,total:"number"!=typeof b||"number"!=typeof c?void 0:c-b,colour:d}};a.blocks=[g("total",0,a.pageLoadTime,"#ccc"),g("ttfb",a.navigationStart,a.responseStart,"#bbb"),g("unload",a.unloadEventStart,a.unloadEventEnd,"#909"),g("redirect",a.redirectStart,a.redirectEnd,"#009"),g("App cache",a.fetchStart,a.domainLookupStart,"#099"),g("DNS",a.domainLookupStart,a.domainLookupEnd,"#090"),g("TCP",a.connectStart,a.connectEnd,"#990"),g("Request",a.requestStart,a.responseStart,"#c90"),g("Response",a.responseStart,a.responseEnd,"#6c0"),g("DOM Processing",a.domLoading,a.domComplete,"#9cc"),g("domContentLoaded Event",a.domContentLoadedEventStart,a.domContentLoadedEventEnd,"#c33"),g("Onload Event",a.loadEventStart,a.loadEventEnd,"#cf3")],a.secureConnectionStart&&a.blocks.push(g("SSL",a.connectStart,a.secureConnectionStart,"#990")),a.msFirstPaint&&a.blocks.push(g("msFirstPaint Event",a.msFirstPaint,a.msFirstPaint,"#c33")),a.domInteractive&&a.blocks.push(g("domInteractive Event",a.domInteractive,a.domInteractive,"#c33")),d.forEach(function(b){a.blocks.push(g("measure:"+b.name,Math.round(b.startTime),Math.round(b.startTime+b.duration),"#f00"))});var h=function(){var b=a.pageLoadTime/100,d=a.blocks.filter(function(a){return"number"==typeof a.start&&"number"==typeof a.total}).sort(function(a,b){return(a.start||0)-(b.start||0)}),e=c.length>0?c.reduce(function(a,b){return Math.max("number"==typeof a?a:0,o(n(b.name,"0")))}):0,f=25*(d.length+1),g=f+e+35,h=l("div",{"class":"navigation-timing water-fall-holder chart-holder"}),j=m("svg:svg",{height:Math.floor(g),"class":"water-fall-chart"}),k=m("g",{"class":"labels"}),p=m("line",{x1:"0",y1:"0",x2:"0",y2:f,"class":"line-end"}),q=m("line",{x1:"0",y1:"0",x2:"0",y2:f,"class":"line-start"}),r=function(a){var b=a.target;u(b,"active");var c=b.x.baseVal.valueInSpecifiedUnits+b.width.baseVal.valueInSpecifiedUnits+"%",d=b.x.baseVal.valueInSpecifiedUnits+"%";p.x1.baseVal.valueAsString=c,p.x2.baseVal.valueAsString=c,q.x1.baseVal.valueAsString=d,q.x2.baseVal.valueAsString=d,u(p,"active"),u(q,"active"),b.parentNode.appendChild(p),b.parentNode.appendChild(q)},s=function(a){v(a.target,"active"),v(p,"active"),v(q,"active")},t=function(a,c,d,e,f,g){var h=m("rect",{width:a/b+"%",height:c,x:d/b+"%",y:e,fill:f,"class":"time-block"});return g&&h.appendChild(m("title",{text:g})),h.addEventListener("mouseover",r),h.addEventListener("mouseout",s),h},w=function(){for(var b=m("g",{"class":"time-scale full-width"}),c=0,d=a.pageLoadTime/1e3,e=100/d;d>=c;c++){var g=n(c+"sec",f);c>d-.2?(g.setAttribute("x",e*c-.5+"%"),g.setAttribute("text-anchor","end")):g.setAttribute("x",e*c+.5+"%");var h=m("line",{x1:e*c+"%",y1:"0",x2:e*c+"%",y2:f});b.appendChild(h),b.appendChild(g)}return b},x=function(){var a=m("g",{transform:"scale(1, 1)","class":"marker-holder"});return c.forEach(function(d,e){var g=m("g",{"class":"mark-holder"}),h=m("g",{"class":"line-holder"}),i=d.startTime/b;d.x=i;var j=n(d.name,f+25);j.setAttribute("writing-mode","tb"),j.setAttribute("x",i+"%"),j.setAttribute("stroke",""),h.appendChild(m("line",{x1:i+"%",y1:"0px",x2:i+"%",y2:f})),c[e-1]&&d.x-c[e-1].x<1&&(j.setAttribute("x",c[e-1].x+1+"%"),d.x=c[e-1].x+1),h.appendChild(m("line",{x1:i+"%",y1:f,x2:d.x+"%",y2:f+23})),g.addEventListener("mouseover",function(){u(h,"active"),g.parentNode.appendChild(g)}),g.addEventListener("mouseout",function(){v(h,"active")}),g.appendChild(m("title",{text:d.name+" ("+Math.round(d.startTime)+"ms)"})),g.appendChild(h),g.appendChild(j),a.appendChild(g)}),a};j.appendChild(w()),j.appendChild(x()),d.forEach(function(a,c){var d=a.total||1,e=25*c;j.appendChild(t(d,25,a.start||.001,e,a.colour,a.name+" ("+a.start+"ms - "+a.end+"ms | total: "+a.total+"ms)"));var f=n(a.name+" ("+a.total+"ms)",e+18);(a.total||1)/b>10?(f.setAttribute("class","inner-label"),f.setAttribute("x",(a.start||.001)/b+.5+"%"),f.setAttribute("width",d/b+"%")):(a.start||.001)/b+d/b<80?f.setAttribute("x",(a.start||.001)/b+d/b+.5+"%"):(f.setAttribute("x",(a.start||.001)/b-.5+"%"),f.setAttribute("text-anchor","end")),k.appendChild(f)}),j.appendChild(k),h.appendChild(l("h1",{text:"Navigation Timing"})),h.appendChild(j),i.appendChild(h)};h(),k=k.concat([{name:"Navigation Timeline",data:a.blocks,columns:["name","start","end","total"]},{name:"Navigation Events",data:a.output},{name:"Marks",data:c,columns:["name","startTime","duration"]}])}),w(function(){function a(a,b){var c=m("svg:svg",{viewBox:"0 0 "+b+" "+b,"class":"pie-chart"},"max-height:"+(.98*window.innerWidth-64)/3+"px;"),d=2*Math.PI/100,e=0,f=function(a,b,c,f,h){var i=b/2,j=e+(c*d-.001),k=e+(c/2*d-.001),l=i+i*Math.sin(e),p=i-i*Math.cos(e),q=i+i*Math.sin(j),r=i-i*Math.cos(j),s=i+.85*i*Math.sin(k),t=i-.85*i*Math.cos(k),u=j-e>Math.PI?1:0,v="M "+i+","+i+" L "+l+","+p+" A "+i+","+i+" 0 "+u+" 1 "+q+","+r+" Z",w=m("path",{id:a,d:v,fill:h});if(w.appendChild(m("title",{text:f})),w.addEventListener("mouseover",function(a){a.target.style.opacity="0.5",g.getElementById(a.target.getAttribute("id")+"-table").style.backgroundColor="#ccc"}),w.addEventListener("mouseout",function(a){a.target.style.opacity="1",g.getElementById(a.target.getAttribute("id")+"-table").style.backgroundColor="transparent"}),e=j,c>10){var x=n(f,t);return k0?c.reduce(function(a,b){return Math.max("number"==typeof a?a:0,o(n(b.name,"0")))}):0,g=25*(e.length+1),h=g+f+35,j=l("div",{"class":"resource-timing water-fall-holder chart-holder"}),k=m("svg:svg",{height:Math.floor(h),"class":"water-fall-chart"}),p=m("g",{"class":"labels"}),q=m("line",{x1:"0",y1:"0",x2:"0",y2:g,"class":"line-end"}),r=m("line",{x1:"0",y1:"0",x2:"0",y2:g,"class":"line-start"}),s=function(a){var b=a.target;u(b,"active");var c=b.x.baseVal.valueInSpecifiedUnits+b.width.baseVal.valueInSpecifiedUnits+"%",d=b.x.baseVal.valueInSpecifiedUnits+"%";q.x1.baseVal.valueAsString=c,q.x2.baseVal.valueAsString=c,r.x1.baseVal.valueAsString=d,r.x2.baseVal.valueAsString=d,u(q,"active"),u(r,"active"),b.parentNode.appendChild(q),b.parentNode.appendChild(r)},t=function(a){v(a.target,"active"),v(q,"active"),v(r,"active")},w=function(a,b,c,e,f,g,h){var i,j=m("rect",{width:a/d+"%",height:b-1,x:c/d+"%",y:e,fill:f,"class":h&&h.length>0?"time-block":"segment"});return g&&j.appendChild(m("title",{text:g})),j.addEventListener("mouseover",s),j.addEventListener("mouseout",t),h&&h.length>0?(i=m("g"),i.appendChild(j),h.forEach(function(a){a.total>0&&a.start&&i.appendChild(w(a.total,8,a.start||.001,e,a.colour,a.name+" ("+Math.round(a.start)+"ms - "+Math.round(a.end)+"ms | total: "+Math.round(a.total)+"ms)"))}),i):j},x=function(){for(var b=m("g",{"class":"time-scale full-width"}),c=0,d=a/1e3,e=100/d;d>=c;c++){var f=n(c+"sec",g);c>d-.2?(f.setAttribute("x",e*c-.5+"%"),f.setAttribute("text-anchor","end")):f.setAttribute("x",e*c+.5+"%");var h=m("line",{x1:e*c+"%",y1:"0",x2:e*c+"%",y2:g});b.appendChild(h),b.appendChild(f)}return b},y=function(){var a=m("g",{transform:"scale(1, 1)","class":"marker-holder"});return c.forEach(function(b,e){var f=m("g",{"class":"mark-holder"}),h=m("g",{"class":"line-holder"}),i=b.startTime/d;b.x=i;var j=n(b.name,g+25);j.setAttribute("writing-mode","tb"),j.setAttribute("x",i+"%"),j.setAttribute("stroke",""),h.appendChild(m("line",{x1:i+"%",y1:0,x2:i+"%",y2:g})),c[e-1]&&b.x-c[e-1].x<1&&(j.setAttribute("x",c[e-1].x+1+"%"),b.x=c[e-1].x+1),h.appendChild(m("line",{x1:i+"%",y1:g,x2:b.x+"%",y2:g+23})),j.addEventListener("mouseover",function(){u(h,"active"),f.parentNode.appendChild(f)}),j.addEventListener("mouseout",function(){v(h,"active")}),f.appendChild(m("title",{text:b.name+" ("+Math.round(b.startTime)+"ms)"})),f.appendChild(h),f.appendChild(j),a.appendChild(f)}),a};k.appendChild(x()),k.appendChild(y()),e.forEach(function(a,b){var c=a.total||1,e=25*b;k.appendChild(w(c,25,a.start||.001,e,a.colour,a.name+" ("+a.start+"ms - "+a.end+"ms | total: "+a.total+"ms)",a.segments));var f=n(a.name+" ("+a.total+"ms)",e+20);(a.total||1)/d>10&&o(f)<200?(f.setAttribute("class","inner-label"),f.setAttribute("x",(a.start||.001)/d+.5+"%"),f.setAttribute("width",c/d+"%")):(a.start||.001)/d+c/d<80?f.setAttribute("x",(a.start||.001)/d+c/d+.5+"%"):(f.setAttribute("x",(a.start||.001)/d-.5+"%"),f.setAttribute("text-anchor","end")),f.style.opacity=a.name.match(/js.map$/)?"0.5":"1",p.appendChild(f)}),k.appendChild(p),j.appendChild(l("h1",{text:"Resource Timing"})),j.appendChild(k),i.appendChild(j)};h(a.loadDuration,a.blocks)}),w(function(){g.body.appendChild(h),f.style.height=h.clientHeight+"px"}),k.forEach(function(a){a.data.length>0&&console.table&&(console.log("\n\n\n"+a.name+":"),console.table(a.data,a.columns))})}(); \ No newline at end of file