41 lines
19 KiB
JavaScript
41 lines
19 KiB
JavaScript
|
/*
|
||
|
* QRious v4.0.2
|
||
|
* Copyright (C) 2017 Alasdair Mercer
|
||
|
* Copyright (C) 2010 Tom Zerucha
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*
|
||
|
* Copyright (C) 2017 Alasdair Mercer, !ninja
|
||
|
*
|
||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
|
* of this software and associated documentation files (the "Software"), to deal
|
||
|
* in the Software without restriction, including without limitation the rights
|
||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
|
* copies of the Software, and to permit persons to whom the Software is
|
||
|
* furnished to do so, subject to the following conditions:
|
||
|
*
|
||
|
* The above copyright notice and this permission notice shall be included in all
|
||
|
* copies or substantial portions of the Software.
|
||
|
*
|
||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||
|
* SOFTWARE.
|
||
|
*/
|
||
|
!function($,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):$.QRious=e()}(this,function(){"use strict";var $=function(){},e=Object.prototype.hasOwnProperty,t=Array.prototype.slice;function x($,x,i){i=t.call(arguments,2);for(var s,n,_=0,a=i.length;_<a;_++)for(s in n=i[_])(!$||e.call(n,s))&&(x[s]=n[s])}var i=function e(t,i,s,n){var _,a,r,o=this;return"string"!=typeof t&&(n=s,s=i,i=t,t=null),"function"!=typeof i&&(n=s,s=i,i=function(){return o.apply(this,arguments)}),x(!1,i,o,n),i.prototype=(_=o.prototype,a=s,"function"==typeof Object.create?r=Object.create(_):($.prototype=_,r=new $,$.prototype=null),a&&x(!0,r,a),r),i.prototype.constructor=i,i.class_=t||o.class_,i.super_=o,i};function s(){}s.class_="Nevis",s.super_=Object,s.extend=i;var n=s,_=n.extend(function($,e,t){this.qrious=$,this.element=e,this.element.qrious=$,this.enabled=Boolean(t)},{draw:function($){},getElement:function(){return this.enabled||(this.enabled=!0,this.render()),this.element},getModuleSize:function($){var e=this.qrious,t=e.padding||0;return Math.max(1,Math.floor((e.size-2*t)/$.width))},getOffset:function($){var e=this.qrious,t=e.padding;if(null!=t)return t;var x=this.getModuleSize($);return Math.max(0,Math.floor((e.size-x*$.width)/2))},render:function($){this.enabled&&(this.resize(),this.reset(),this.draw($))},reset:function(){},resize:function(){}}),a=_.extend({draw:function($){var e,t,x=this.qrious,i=this.getModuleSize($),s=this.getOffset($),n=this.element.getContext("2d");for(e=0,n.fillStyle=x.foreground,n.globalAlpha=x.foregroundAlpha;e<$.width;e++)for(t=0;t<$.width;t++)$.buffer[t*$.width+e]&&n.fillRect(i*e+s,i*t+s,i,i)},reset:function(){var $=this.qrious,e=this.element.getContext("2d"),t=$.size;e.lineWidth=1,e.clearRect(0,0,t,t),e.fillStyle=$.background,e.globalAlpha=$.backgroundAlpha,e.fillRect(0,0,t,t)},resize:function(){var $=this.element;$.width=$.height=this.qrious.size}}),r=n.extend(null,{BLOCK:[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28]}),o=n.extend(null,{BLOCKS:[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],FINAL_FORMAT:[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],LEVELS:{L:1,M:2
|