You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
20 KiB
2 lines
20 KiB
4 years ago
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{1104:function(e,t,n){"use strict";t.a=n.p+"i18n/languages.653339f.json"},1105:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return c}));var i=n(86),o=n.n(i);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const r={bgColor:"#d00",textColor:"#fff",fontFamily:"sans-serif",fontWeight:"bold",isUp:!1,isLeft:!1};class c{constructor(e={}){o()(this,"browser",{ff:void 0!==window.InstallTrigger,opera:!!window.opera||navigator.userAgent.includes("Opera")}),o()(this,"params",void 0),o()(this,"canvas",void 0),o()(this,"baseImage",void 0),o()(this,"context",void 0),o()(this,"icons",void 0),o()(this,"isReady",!1),o()(this,"readyCb",()=>{}),this.params=a(a({},r),e),this.icons=c.getIcons(),this.canvas=document.createElement("canvas"),this.baseImage=document.createElement("img");const t=this.icons[this.icons.length-1];t.hasAttribute("href")?(this.baseImage.setAttribute("crossOrigin","anonymous"),this.baseImage.onload=()=>{this.canvas.height=this.baseImage.height>0?this.baseImage.height:32,this.canvas.width=this.baseImage.width>0?this.baseImage.width:32,this.context=this.canvas.getContext("2d"),this.ready()},this.baseImage.setAttribute("src",t.getAttribute("href"))):(this.canvas.height=this.baseImage.height=32,this.canvas.width=this.baseImage.width=32,this.context=this.canvas.getContext("2d"),this.ready())}reset(){this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.drawImage(this.baseImage,0,0,this.canvas.width,this.canvas.height)}options(e,t){const n={n:"number"==typeof e?Math.abs(e):e,len:(""+e).length,x:.4,y:.4,w:.6,h:.6};return t.isUp&&(n.y<.6?n.y=n.y-.4:n.y=n.y-2*n.y+(1-n.w)),t.isLeft&&(n.x<.6?n.x=n.x-.4:n.x=n.x-2*n.x+(1-n.h)),n.x=this.canvas.width*n.x,n.y=this.canvas.height*n.y,n.w=this.canvas.width*n.w,n.h=this.canvas.height*n.h,n}circle(e,t){const n=a(a({},this.params),t),i=this.options(e,n);let o=!1;2===i.len?(i.x=i.x-.4*i.w,i.w=1.4*i.w,o=!0):i.len>=3&&(i.x=i.x-.65*i.w,i.w=1.65*i.w,o=!0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.drawImage(this.baseImage,0,0,this.canvas.width,this.canvas.height),this.context.beginPath();const s=Math.floor(i.h*(i.n>99?.85:1))+"px";if(this.context.font=`${n.fontWeight} ${s} ${n.fontFamily}`,this.context.textAlign="center",o?(this.context.moveTo(i.x+i.w/2,i.y),this.context.lineTo(i.x+i.w-i.h/2,i.y),this.context.quadraticCurveTo(i.x+i.w,i.y,i.x+i.w,i.y+i.h/2),this.context.lineTo(i.x+i.w,i.y+i.h-i.h/2),this.context.quadraticCurveTo(i.x+i.w,i.y+i.h,i.x+i.w-i.h/2,i.y+i.h),this.context.lineTo(i.x+i.h/2,i.y+i.h),this.context.quadraticCurveTo(i.x,i.y+i.h,i.x,i.y+i.h-i.h/2),this.context.lineTo(i.x,i.y+i.h/2),this.context.quadraticCurveTo(i.x,i.y,i.x+i.h/2,i.y)):this.context.arc(i.x+i.w/2,i.y+i.h/2,i.h/2,0,2*Math.PI),this.context.fillStyle=n.bgColor,this.context.fill(),this.context.closePath(),this.context.beginPath(),this.context.stroke(),this.context.fillStyle=n.textColor,"number"==typeof i.n&&i.n>999){const e=(i.n>9999?9:Math.floor(i.n/1e3))+"k+";this.context.fillText(e,Math.floor(i.x+i.w/2),Math.floor(i.y+i.h-.2*i.h))}else this.context.fillText(""+i.n,Math.floor(i.x+i.w/2),Math.floor(i.y+i.h-.15*i.h));this.context.closePath()}ready(){this.isReady||(this.isReady=!0,this.readyCb())}setIcon(t){e(()=>{this.setIconSrc(t.toDataURL("image/png"))})}setIconSrc(e){if(this.browser.ff||this.browser.opera){const t=this.icons[this.icons.length-1],n=window.document.createElement("link");this.icons=[n],n.setAttribute("rel","icon"),n.setAttribute("type","image/png"),win
|
||
|
//# sourceMappingURL=init.js.map
|