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
24 KiB
2 lines
24 KiB
3 years ago
|
!function(a){"use strict";function u(r,t,e,n){var o=a(e,t);o.addData(r),o.make(),n=n||0;var i=o.getModuleCount(),h=o.getModuleCount()+2*n;this.text=r,this.level=t,this.version=e,this.moduleCount=h,this.isDark=function(r,t){return t-=n,!((r-=n)<0||i<=r||t<0||i<=t)&&o.isDark(r,t)},this.addBlank=function(a,u,f,c){var s=this.isDark,l=1/h;this.isDark=function(r,t){var e=t*l,n=r*l,o=e+l,i=n+l;return s(r,t)&&(o<a||f<e||i<u||c<n)}}}function g(r,t,e,n,o){e=Math.max(1,e||1),n=Math.min(40,n||40);for(var i=e;i<=n;i+=1)try{return new u(r,t,i,o)}catch(r){}}function i(r,t,e){d(e.background).is("img")?t.drawImage(e.background,0,0,e.size,e.size):e.background&&(t.fillStyle=e.background,t.fillRect(e.left,e.top,e.size,e.size));var n=e.mode;1===n||2===n?function(r,t,e){var n=e.size,o="bold "+e.mSize*n+"px "+e.fontname,i=d("<canvas/>")[0].getContext("2d");i.font=o;var a=i.measureText(e.label).width,u=e.mSize,f=a/n,c=(1-f)*e.mPosX,s=(1-u)*e.mPosY,l=c+f,h=s+u;1===e.mode?r.addBlank(0,s-.01,n,h+.01):r.addBlank(c-.01,s-.01,.01+l,h+.01),t.fillStyle=e.fontcolor,t.font=o,t.fillText(e.label,c*n,s*n+.75*e.mSize*n)}(r,t,e):3!==n&&4!==n||function(r,t,e){var n=e.size,o=e.image.naturalWidth||1,i=e.image.naturalHeight||1,a=e.mSize,u=a*o/i,f=(1-u)*e.mPosX,c=(1-a)*e.mPosY,s=f+u,l=c+a;3===e.mode?r.addBlank(0,c-.01,n,l+.01):r.addBlank(f-.01,c-.01,.01+s,l+.01),t.drawImage(e.image,f*n,c*n,u*n,a*n)}(r,t,e)}function c(r,t,e,n,o,i,a,u){r.isDark(a,u)&&t.rect(n,o,i,i)}function s(r,t,e,n,o,i,a,u){var f=r.isDark,c=n+i,s=o+i,l=e.radius*i,h=a-1,g=a+1,d=u-1,v=u+1,p=f(a,u),w=f(h,d),m=f(h,u),y=f(h,v),k=f(a,v),T=f(g,v),b=f(g,u),C=f(g,d),B=f(a,d);p?function(r,t,e,n,o,i,a,u,f,c){a?r.moveTo(t+i,e):r.moveTo(t,e),u?(r.lineTo(n-i,e),r.arcTo(n,e,n,o,i)):r.lineTo(n,e),f?(r.lineTo(n,o-i),r.arcTo(n,o,t,o,i)):r.lineTo(n,o),c?(r.lineTo(t+i,o),r.arcTo(t,o,t,e,i)):r.lineTo(t,o),a?(r.lineTo(t,e+i),r.arcTo(t,e,n,e,i)):r.lineTo(t,e)}(t,n,o,c,s,l,!m&&!B,!m&&!k,!b&&!k,!b&&!B):function(r,t,e,n,o,i,a,u,f,c){a&&(r.moveTo(t+i,e),r.lineTo(t,e),r.lineTo(t,e+i),r.arcTo(t,e,t+i,e,i)),u&&(r.moveTo(n-i,e),r.lineTo(n,e),r.lineTo(n,e+i),r.arcTo(n,e,n-i,e,i)),f&&(r.moveTo(n-i,o),r.lineTo(n,o),r.lineTo(n,o-i),r.arcTo(n,o,n-i,o,i)),c&&(r.moveTo(t+i,o),r.lineTo(t,o),r.lineTo(t,o-i),r.arcTo(t,o,t+i,o,i))}(t,n,o,c,s,l,m&&B&&w,m&&k&&y,b&&k&&T,b&&B&&C)}function e(r,t){var e=g(t.text,t.ecLevel,t.minVersion,t.maxVersion,t.quiet);if(!e)return null;var n=d(r).data("qrcode",e),o=n[0].getContext("2d");return i(e,o,t),function(r,t,e){var n,o,i=r.moduleCount,a=e.size/i,u=c;for(l&&0<e.radius&&e.radius<=.5&&(u=s),t.beginPath(),n=0;n<i;n+=1)for(o=0;o<i;o+=1){u(r,t,e,e.left+o*a,e.top+n*a,a,n,o)}if(d(e.fill).is("img")){t.strokeStyle="rgba(0,0,0,0.5)",t.lineWidth=2,t.stroke();var f=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",t.fill(),t.globalCompositeOperation=f,t.clip(),t.drawImage(e.fill,0,0,e.size,e.size),t.restore()}else t.fillStyle=e.fill,t.fill()}(e,o,t),n}function t(r){return e(d("<canvas/>").attr("width",r.size).attr("height",r.size),r)}function n(r){return o&&"canvas"===r.render?t(r):o&&"image"===r.render?function(r){return d("<img/>").attr("src",t(r)[0].toDataURL("image/png"))}(r):function(r){var t=g(r.text,r.ecLevel,r.minVersion,r.maxVersion,r.quiet);if(!t)return null;var e,n,o=r.size,i=r.background,a=Math.floor,u=t.moduleCount,f=a(o/u),c=a(.5*(o-f*u)),s={position:"relative",left:0,top:0,padding:0,margin:0,width:o,height:o},l={position:"absolute",padding:0,margin:0,width:f,height:f,"background-color":r.fill},h=d("<div/>").data("qrcode",t).css(s);for(i&&h.css("background-color",i),e=0;e<u;e+=1)for(n=0;n<u;n+=1)t.isDark(e,n)&&d("<div/>").css(l).css({left:c+n*f,top:c+e*f}).appendTo(h);return h}(r)}var r,d=jQuery,o=(r=document.createElement("canvas"),Boolean(r.getContext&&r.getContext("2d"))),l="[object Opera]"!==Object.prototype.toString.call(window.opera),f={render:"canvas",minVersion:1,maxVersion:40,ecLevel:"L",left:0,top:0,size:200,fill:"#000",background:null,text:"no text",radius:0,quiet:0,mode:0,mSize:.1,mPosX:.5,mPosY:.5,label:"no label",fontname:"sans",fontcolor:"#000",image:null};d.f
|