public/plugins/jquery/jquery-qrcode/jquery.qrcode.min.js

(完整代码) 15KB

(function(v){function y(a){this.mode=r.MODE_8BIT_BYTE;this.data=a;this.parsedData=[];a=0;for(var b=this.data.length;a<b;a++){var c=[],d=this.data.charCodeAt(a);65536<d?(c[0]=240|(d&1835008)>>>18,c[1]=128|(d&258048)>>>12,c[2]=128|(d&4032)>>>6,c[3]=128|d&63):2048<d?(c[0]=224|(d&61440)>>>12,c[1]=128|(d&4032)>>>6,c[2]=128|d&63):128<d?(c[0]=192|(d&1984)>>>6,c[1]=128|d&63):c[0]=d;this.parsedData.push(c)}this.parsedData=Array.prototype.concat.apply([],this.parsedData);this.parsedData.length!=this.data.length&&
(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function t(a,b){this.typeNumber=a;this.errorCorrectLevel=b;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function w(a,b){if(void 0==a.length)throw Error(a.length+"/"+b);for(var c=0;c<a.length&&0==a[c];)c++;this.num=Array(a.length-c+b);for(b=0;b<a.length-c;b++)this.num[b]=a[b+c]}function u(a,b){this.totalCount=a;this.dataCount=b}function x(){this.buffer=[];this.length=0}y.prototype=
{getLength:function(a){return this.parsedData.length},write:function(a){for(var b=0;b<this.parsedData.length;b++)a.put(this.parsedData[b],8)}};t.prototype={addData:function(a){a=new y(a);this.dataList.push(a);this.dataCache=null},isDark:function(a,b){if(0>a||this.moduleCount<=a||0>b||this.moduleCount<=b)throw Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){var a;for(a=1;40>a;a++){for(var b=u.getRSBlocks(a,this.errorCorrectLevel),
c=new x,d=0,e=0;e<b.length;e++)d+=b[e].dataCount;for(e=0;e<this.dataList.length;e++)b=this.dataList[e],c.put(b.mode,4),c.put(b.getLength(),l.getLengthInBits(b.mode,a)),b.write(c);if(c.getLengthInBits()<=8*d)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,b){this.moduleCount=4*this.typeNumber+17;this.modules=Array(this.moduleCount);for(var c=0;c<this.moduleCount;c++){this.modules[c]=Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++)this.modules[c][d]=
null}this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(a,b);7<=this.typeNumber&&this.setupTypeNumber(a);null==this.dataCache&&(this.dataCache=t.createData(this.typeNumber,this.errorCorrectLevel,this.dataList));this.mapData(this.dataCache,b)},setupPositionProbePattern:function(a,b){for(var c=-1;7>=c;c++)if(!(-1>=a+c||this.moduleCount<=
a+c))for(var d=-1;7>=d;d++)-1>=b+d||this.moduleCount<=b+d||(this.modules[a+c][b+d]=0<=c&&6>=c&&(0==d||6==d)||0<=d&&6>=d&&(0==c||6==c)||2<=c&&4>=c&&2<=d&&4>=d?!0:!1)},getBestMaskPattern:function(){for(var a=0,b=0,c=0;8>c;c++){this.makeImpl(!0,c);var d=l.getLostPoint(this);if(0==c||a>d)a=d,b=c}return b},createMovieClip:function(a,b,c){a=a.createEmptyMovieClip(b,c);this.make();for(b=0;b<this.modules.length;b++){c=1*b;for(var d=0;d<this.modules[b].length;d++){var e=1*d;this.modules[b][d]&&(a.beginFill(0,
100),a.moveTo(e,c),a.lineTo(e+1,c),a.lineTo(e+1,c+1),a.lineTo(e,c+1),a.endFill())}}return a},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(a=8;a<this.moduleCount-8;a++)null==this.modules[6][a]&&(this.modules[6][a]=0==a%2)},setupPositionAdjustPattern:function(){for(var a=l.getPatternPosition(this.typeNumber),b=0;b<a.length;b++)for(var c=0;c<a.length;c++){var d=a[b],e=a[c];if(null==this.modules[d][e])for(var h=-2;2>=h;h++)for(var g=
-2;2>=g;g++)this.modules[d+h][e+g]=-2==h||2==h||-2==g||2==g||0==h&&0==g?!0:!1}},setupTypeNumber:function(a){for(var b=l.getBCHTypeNumber(this.typeNumber),c=0;18>c;c++){var d=!a&&1==(b>>c&1);this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(c=0;18>c;c++)d=!a&&1==(b>>c&1),this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d},setupTypeInfo:function(a,b){b=l.getBCHTypeInfo(this.errorCorrectLevel<<3|b);for(var c=0;15>c;c++){var d=!a&&1==(b>>c&1);6>c?this.modules[c][8]=d:8>c?this.modules[c+
1][8]=d:this.modules[this.moduleCount-15+c][8]=d}for(c=0;15>c;c++)d=!a&&1==(b>>c&1),8>c?this.modules[8][this.moduleCount-c-1]=d:9>c?this.modules[8][15-c-1+1]=d:this.modules[8][15-c-1]=d;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,h=0,g=this.moduleCount-1;0<g;g-=2)for(6==g&&g--;;){for(var f=0;2>f;f++)if(null==this.modules[d][g-f]){var m=!1;h<a.length&&(m=1==(a[h]>>>e&1));l.getMask(b,d,g-f)&&(m=!m);this.modules[d][g-f]=m;e--; -1==e&&(h++,e=7)}d+=
c;if(0>d||this.moduleCount<=d){d-=c;c=-c;break}}}};t.PAD0=236;t.PAD1=17;t.createData=function(a,b,c){b=u.getRSBlocks(a,b);for(var d=new x,e=0;e<c.length;e++){var h=c[e];d.put(h.mode,4);d.put(h.getLength(),l.getLengthInBits(h.mode,a));h.write(d)}for(e=a=0;e<b.length;e++)a+=b[e].dataCount;if(d.getLengthInBits()>8*a)throw Error("code length overflow. ("+d.getLengthInBits()+">"+8*a+")");for(d.getLengthInBits()+4<=8*a&&d.put(0,4);0!=d.getLengthInBits()%8;)d.putBit(!1);for(;!(d.getLengthInBits()>=8*a);){d.put(t.PAD0,
8);if(d.getLengthInBits()>=8*a)break;d.put(t.PAD1,8)}return t.createBytes(d,b)};t.createBytes=function(a,b){for(var c=0,d=0,e=0,h=Array(b.length),g=Array(b.length),f=0;f<b.length;f++){var m=b[f].dataCount,n=b[f].totalCount-m,d=Math.max(d,m),e=Math.max(e,n);h[f]=Array(m);for(var k=0;k<h[f].length;k++)h[f][k]=255&a.buffer[k+c];c+=m;k=l.getErrorCorrectPolynomial(n);m=(new w(h[f],k.getLength()-1)).mod(k);g[f]=Array(k.getLength()-1);for(k=0;k<g[f].length;k++)n=k+m.getLength()-g[f].length,g[f][k]=0<=n?
m.get(n):0}for(k=f=0;k<b.length;k++)f+=b[k].totalCount;a=Array(f);for(k=c=0;k<d;k++)for(f=0;f<b.length;f++)k<h[f].length&&(a[c++]=h[f][k]);for(k=0;k<e;k++)for(f=0;f<b.length;f++)k<g[f].length&&(a[c++]=g[f][k]);return a};for(var r={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},l={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,
86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var b=
a<<10;0<=l.getBCHDigit(b)-l.getBCHDigit(l.G15);)b^=l.G15<<l.getBCHDigit(b)-l.getBCHDigit(l.G15);return(a<<10|b)^l.G15_MASK},getBCHTypeNumber:function(a){for(var b=a<<12;0<=l.getBCHDigit(b)-l.getBCHDigit(l.G18);)b^=l.G18<<l.getBCHDigit(b)-l.getBCHDigit(l.G18);return a<<12|b},getBCHDigit:function(a){for(var b=0;0!=a;)b++,a>>>=1;return b},getPatternPosition:function(a){return l.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case 0:return 0==(b+c)%2;case 1:return 0==b%2;case 2:return 0==
c%3;case 3:return 0==(b+c)%3;case 4:return 0==(Math.floor(b/2)+Math.floor(c/3))%2;case 5:return 0==b*c%2+b*c%3;case 6:return 0==(b*c%2+b*c%3)%2;case 7:return 0==(b*c%3+(b+c)%2)%2;default:throw Error("bad maskPattern:"+a);}},getErrorCorrectPolynomial:function(a){for(var b=new w([1],0),c=0;c<a;c++)b=b.multiply(new w([1,p.gexp(c)],0));return b},getLengthInBits:function(a,b){if(1<=b&&10>b)switch(a){case r.MODE_NUMBER:return 10;case r.MODE_ALPHA_NUM:return 9;case r.MODE_8BIT_BYTE:return 8;case r.MODE_KANJI:return 8;
default:throw Error("mode:"+a);}else if(27>b)switch(a){case r.MODE_NUMBER:return 12;case r.MODE_ALPHA_NUM:return 11;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 10;default:throw Error("mode:"+a);}else if(41>b)switch(a){case r.MODE_NUMBER:return 14;case r.MODE_ALPHA_NUM:return 13;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 12;default:throw Error("mode:"+a);}else throw Error("type:"+b);},getLostPoint:function(a){for(var b=a.getModuleCount(),c=0,d=0;d<b;d++)for(var e=0;e<b;e++){for(var h=
0,g=a.isDark(d,e),f=-1;1>=f;f++)if(!(0>d+f||b<=d+f))for(var m=-1;1>=m;m++)0>e+m||b<=e+m||0==f&&0==m||g!=a.isDark(d+f,e+m)||h++;5<h&&(c+=3+h-5)}for(d=0;d<b-1;d++)for(e=0;e<b-1;e++)if(h=0,a.isDark(d,e)&&h++,a.isDark(d+1,e)&&h++,a.isDark(d,e+1)&&h++,a.isDark(d+1,e+1)&&h++,0==h||4==h)c+=3;for(d=0;d<b;d++)for(e=0;e<b-6;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(c+=40);for(e=0;e<b;e++)for(d=0;d<b-6;d++)a.isDark(d,e)&&!a.isDark(d+
1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(c+=40);for(e=h=0;e<b;e++)for(d=0;d<b;d++)a.isDark(d,e)&&h++;return c+Math.abs(100*h/b/b-50)/5*10}},p={glog:function(a){if(1>a)throw Error("glog("+a+")");return p.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return p.EXP_TABLE[a]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},q=0;8>q;q++)p.EXP_TABLE[q]=1<<q;for(q=8;256>q;q++)p.EXP_TABLE[q]=p.EXP_TABLE[q-4]^p.EXP_TABLE[q-5]^p.EXP_TABLE[q-
6]^p.EXP_TABLE[q-8];for(q=0;255>q;q++)p.LOG_TABLE[p.EXP_TABLE[q]]=q;w.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var b=Array(this.getLength()+a.getLength()-1),c=0;c<this.getLength();c++)for(var d=0;d<a.getLength();d++)b[c+d]^=p.gexp(p.glog(this.get(c))+p.glog(a.get(d)));return new w(b,0)},mod:function(a){if(0>this.getLength()-a.getLength())return this;for(var b=p.glog(this.get(0))-p.glog(a.get(0)),c=Array(this.getLength()),
d=0;d<this.getLength();d++)c[d]=this.get(d);for(d=0;d<a.getLength();d++)c[d]^=p.gexp(p.glog(a.get(d))+b);return(new w(c,0)).mod(a)}};u.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,
2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,
25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,
74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,
45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,
151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];u.getRSBlocks=
function(a,b){var c=u.getRsBlockTable(a,b);if(void 0==c)throw Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+b);a=c.length/3;b=[];for(var d=0;d<a;d++)for(var e=c[3*d+0],h=c[3*d+1],g=c[3*d+2],f=0;f<e;f++)b.push(new u(h,g));return b};u.getRsBlockTable=function(a,b){switch(b){case 1:return u.RS_BLOCK_TABLE[4*(a-1)+0];case 0:return u.RS_BLOCK_TABLE[4*(a-1)+1];case 3:return u.RS_BLOCK_TABLE[4*(a-1)+2];case 2:return u.RS_BLOCK_TABLE[4*(a-1)+3]}};x.prototype={get:function(a){return 1==(this.buffer[Math.floor(a/
8)]>>>7-a%8&1)},put:function(a,b){for(var c=0;c<b;c++)this.putBit(1==(a>>>b-c-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0);a&&(this.buffer[b]|=128>>>this.length%8);this.length++}};v.fn.qrcode=function(a){function b(a,b,c,g,f,m,n){this.beginPath();0<f?this.moveTo(c+n,g):this.moveTo(c-n,g);this.arcTo(c+f,g,c+f,g+m,n);this.arcTo(c+f,g+m,c,g+m,n);this.arcTo(c,g+m,c,g,n);0<f?this.arcTo(c,g,c+n,g,n):this.arcTo(c,
g,c-n,g,n);this.strokeStyle=a;this.fillStyle=b;this.stroke();this.fill()}"string"===typeof a&&(a={text:a});a=v.extend({},{render:"canvas",width:256,height:256,typeNumber:-1,correctLevel:2,margin:10,strokeStyle:"#666",fillStyle:"#fff",background:"#ffffff",foreground:"#000000",imgsrc:"",onload:function(){}},a);var c=function(){var c=this,e=new t(a.typeNumber,a.correctLevel);e.addData(a.text);e.make();var h=document.createElement("canvas");h.width=a.width;h.height=a.height;var g=h.getContext("2d"),f=
(a.width-2*a.margin)/e.getModuleCount(),m=(a.height-2*a.margin)/e.getModuleCount();g.fillStyle=a.background||"#fff";g.fillRect(0,0,a.width,a.height);for(var n=0;n<e.getModuleCount();n++)for(var k=0;k<e.getModuleCount();k++)g.fillStyle=e.isDark(n,k)?a.foreground:a.background,g.fillRect(Math.round(k*f+a.margin),Math.round(n*m+a.margin),Math.ceil((k+1)*f)-Math.floor(k*f),Math.ceil((n+1)*f)-Math.floor(n*f));if(a.imgsrc){var l=.4*(a.width-2*a.margin),p=.3*(a.height-2*a.margin);a.imgWidth=a.imgWidth||a.width/
4.7;a.imgHeight=a.imgHeight||a.height/4.7;var q=new Image;q.src=a.imgsrc;q.onload=function(){var d=this.width,e=this.height,f;d>l&&(f=parseFloat(l/d),d=l,e=parseInt(e*f));e>p&&(f=parseFloat(p/e),e=p,d=parseInt(d*f));f=(a.width-d)/2;var k=(a.height-e)/2;b.call(g,a.strokeStyle,a.fillStyle,f-3,k-3,d+6,e+6,6);g.drawImage(q,f,k,d,e);a.onload&&a.onload.call(c,h)}}return h};return this.each(function(){var d;if("canvas"==a.render)d=c.call(this);else{var b=new t(a.typeNumber,a.correctLevel);b.addData(a.text);
b.make();d=v("<table></table>").css("width",a.width+"px").css("height",a.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",a.background);for(var h=a.width/b.getModuleCount(),g=a.height/b.getModuleCount(),f=0;f<b.getModuleCount();f++)for(var l=v("<tr></tr>").css("height",g+"px").appendTo(d),n=0;n<b.getModuleCount();n++)v("<td></td>").css("width",h+"px").css("background-color",b.isDark(f,n)?a.foreground:a.background).appendTo(l);a.imgsrc&&(a.imgWidth=a.imgWidth||
a.width/4.7,a.imgHeight=a.imgHeight||a.height/4.7,b=v("<img>").attr("src",a.imgsrc).css("width",a.imgWidth).css("height",a.imgHeight).css("position","absolute").css("left",(a.width-a.imgWidth)/2).css("top",(a.height-a.imgHeight)/2),d=v('<div style="position:relative;"></div>').append(d).append(b))}v(d).appendTo(this);a.imgsrc||"canvas"==a.render&&a.onload&&a.onload.call(this,d)})}})(window.jQuery || window.Zepto);

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。