-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathjustice.mapped.min.js
More file actions
2 lines (2 loc) · 7.23 KB
/
Copy pathjustice.mapped.min.js
File metadata and controls
2 lines (2 loc) · 7.23 KB
1
2
"use strict";!function(){var a=".justice{position:fixed;bottom:0;left:0;right:0;background:black;padding:0 10px 10px 10px;box-sizing:border-box;font-size:12px;font-family:monospace;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;z-index:2147483647;-webkit-transition:400ms ease-in-out;transition:400ms ease-in-out}@media (min-width: 1235px){.justice{padding-bottom:10px;}}.justice.closed{-webkit-transform:translateY(100%);-ms-transform:translateY(100%);transform:translateY(100%)}.justice .justice-metric-wrap{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:wrap;-ms-flex-flow:wrap;flex-flow:wrap;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between}.justice .justice-metric{height:40px;display:inline-block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;margin:10px 10px 0 0}.justice .justice-metric.chart{width:300px}.justice .justice-title{text-transform:uppercase;padding:3px 0.5em 3px 3px;color:#dfdfdf}.justice .justice-text{color:#dfdfdf;font-weight:600}.justice .justice-text.pass{color:#419ba3}.justice .justice-text.warn{color:#d4ca3d}.justice .justice-text.fail{color:#ce452d}.justice .justice-toggle{width:20px;height:20px;background-color:black;position:absolute;right:0;top:-20px;opacity:0.5;border-top-left-radius:50%;-webkit-transition:400ms ease-in-out;transition:400ms ease-in-out}@media only screen and (min-device-pixel-ratio: 1.1){.justice .justice-toggle{width:40px;height:40px;top:-40px;}}.justice .justice-toggle:after{content:'';position:absolute;width:50%;height:50%;border-radius:100%;margin:5px;background-color:#dfdfdf;-webkit-transition:400ms ease-in-out;transition:400ms ease-in-out}@media only screen and (min-device-pixel-ratio: 1.1){.justice .justice-toggle:after{margin:10px;}}.justice.closed .justice-toggle{opacity:1}.justice.closed .justice-toggle:after{background-color:#419ba3}",b=document.createElement("style");if(document.getElementsByTagName("head")[0].appendChild(b),b.styleSheet)b.styleSheet.disabled||(b.styleSheet.cssText=a);else try{b.innerHTML=a}catch(c){b.innerText=a}}();var Justice=function(){function a(a){var b={},a=a||{};for(var c in X)b[c]=X[c];for(var c in a)b[c]=a[c];return b}function b(a,b,c){for(var d in a.metrics)b[d]=c[d]}function c(){return P.loadEventStart-P.navigationStart}function d(){return P.domComplete-P.domLoading}function e(){return P.domInteractive-P.domLoading}function f(){var a=0;return window.chrome&&window.chrome.loadTimes?(a=1e3*window.chrome.loadTimes().firstPaintTime,a-=1e3*window.chrome.loadTimes().startLoadTime,a.toFixed(0)):"number"==typeof window.performance.timing.msFirstPaint?(a=window.performance.timing.msFirstPaint,a-=window.performance.timing.navigationStart,a.toFixed(0)):"¯\\_(ツ)_/¯"}function g(){return performance.getEntries?performance.getEntries().length:"¯\\_(ツ)_/¯"}function h(){return P.responseStart-P.connectEnd}function i(a){if(U){var b=(a-U)/1e3,c=1/b,d=Math.floor(c>60?60:c);S=d,T.push([d,d]),T.length>M&&T.shift(),U=a}else U=a}function j(a,b){var c="";return c=a>b?"fail":a>b*Y.warnThreshold?"warn":"pass"}function k(a,b,c){var d=b.collector(),e=j(d,c);return['<div class="'+H+'-metric" id="'+b.id+'">','<span class="'+H+'-title">'+b.label+": </span>",'<span class="'+H+"-text "+e+'">'+d+b.unitLabel+"</span>","</div>"].join("")}function l(a){var b=[];for(var c in $){var d=k(c,$[c],Y.metrics[c].budget);b.push(d)}return'<div id="'+H+'-text-metrics" class="'+H+'-metric-wrap">'+b.join("")+"</div>"}function m(){var a=Y.showFPS?['<div class="'+H+'-metric chart">','<span class="'+H+'-title">FPS: </span>','<canvas id="'+H+'-fps" class="'+H+'-canvas" height="'+J+'" width="'+I+'"></canvas>',"</div>"].join(""):"";return a}function n(a,b){a.clearRect(0,0,b.width,b.height),q(a),o(a),p(a)}function o(a){var b=10;a.font="600 "+b+"px sans-serif",a.fillStyle=E,a.fillText(0,0,J),a.fillStyle=F,a.fillText(30,0,J/2+b/2),a.fillStyle=G,a.fillText(60,0,0+b)}function p(a){var b=a.createLinearGradient(0,J,0,0);b.addColorStop(0,E),b.addColorStop(.25,E),b.addColorStop(.5,F),b.addColorStop(1,G),a.strokeStyle=b,a.fillStyle=b}function q(a){for(var b=0;3>b;b++){var c=J/2*b+.5-(2===b?1:0);a.beginPath(),a.moveTo(.5+L,c),a.lineTo(I+.5,c),a.lineWidth=1,a.strokeStyle=D,a.stroke()}}function r(a){var b=null;return"spline"===a?b=t:"dots"===a&&(b=s),b}function s(a,b,c){n(a,b);for(var d=0;d<c.length;d++){var e=(60-c[d][1])*K;a.fillRect(c.length-d+L,e,1.5,1.5)}}function t(a,b,c){n(a,b),a.beginPath();var d=c.length>0?c[c.length]:0;a.moveTo(0,d);for(var e=0;e<c.length;e++){var f=0===e?0:e,g=(60-c[e][1])*K;a.lineTo(c.length-f+L,g)}a.lineWidth=1,a.stroke()}function u(){V=document.getElementById(H+"-fps"),W=V.getContext("2d")}function v(){var a=z();Q=document.createElement("div"),Q.id=H,Q.classList.add(H),Q.classList.add(a),document.body.appendChild(Q),Q=document.getElementById(H),Q.innerHTML=['<div id="'+H+'-toggle" class="'+H+'-toggle"></div>',l(),m()].join(""),Y.showFPS&&u(),x()}function w(){var a=l($),b=document.getElementById(H+"-text-metrics");b.innerHTML=a}function x(){document.getElementById(H+"-toggle").onclick=function(){var a=document.getElementById(H);a.className.match(" closed")?(a.className=a.className.replace(" closed",""),y("open")):(a.className+=" closed",y("closed"))}}function y(a){window.localStorage&&window.localStorage.setItem(H+"-state",a)}function z(){return window.localStorage?window.localStorage.getItem(H+"-state")||"open":void 0}function A(a){O++,Y.showFPS&&(i(a),R(W,V,T)),null===N?N=a:a-N>3e3&&(N=a,w()),window.requestAnimationFrame(A)}function B(c){P=window.performance.timing,Y=a(c),b(Y,$,Z),v(),R=r(Y.chartType),window.requestAnimationFrame(A)}var C=C||{};C.theme={"bg-color":"rgb(0, 0, 0)","label-color":"rgb(223, 223, 223)","pass-color":"rgb(65, 155, 163)","warn-color":"rgb(212, 202, 61)","fail-color":"rgb(206, 69, 45)"};var D="rgb(48, 48, 48)",E=C.theme["fail-color"],F=C.theme["warn-color"],G=C.theme["pass-color"],H="justice",I=300,J=40,K=J/60,L=20,M=I-L,N=0,O=0,P=null,Q=null,R=null,S=0,T=[],U=null,V=null,W=null,X={metrics:{TTFB:{budget:200},domInteractive:{budget:250},domComplete:{budget:800},firstPaint:{budget:1e3},pageLoad:{budget:2e3},requests:{budget:6}},"interface":{position:"fixed",placement:"bottom"},warnThreshold:.8,chartType:"spline",showFPS:!0},Y={},Z={pageLoad:{id:H+"-load",label:"Load",unitLabel:"ms",collector:c},firstPaint:{id:H+"-paint",label:"Paint",unitLabel:"ms",collector:f},TTFB:{id:H+"-ttfb",label:"TTFB",unitLabel:"ms",collector:h},domComplete:{id:H+"-complete",label:"Complete",unitLabel:"ms",collector:d},domInteractive:{id:H+"-interactive",label:"Interactive",unitLabel:"ms",collector:e},requests:{id:H+"-requests",label:"Requests",unitLabel:"",collector:g}},$={};return{init:function(a){"performance"in window&&"timing"in window.performance?"complete"===document.readyState?B(a,"already loaded"):window.onload=function(){B(a)}:console.log("Justice: performance api not supported in this browser, initialization stopped.")}}}();
//# sourceMappingURL=justice.mapped.min.js.map