tiddlywiki-production
Version:
a non-linear personal web notebook
1 lines • 60.9 kB
JavaScript
$tw.preloadTiddler({"title":"$:/plugins/tiddlywiki/qrcode","name":"QR Code","description":"QR Code generator","author":"Zeno Zeng","list":"readme usage examples license","version":"5.1.22","plugin-type":"plugin","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/plugins/tiddlywiki/qrcode/MakeContactQR\":{\"title\":\"$:/plugins/tiddlywiki/qrcode/MakeContactQR\",\"tags\":\"$:/tags/MakeQR\",\"caption\":\"Contact\",\"text\":\"\\\\define wifi-url()\\nWIFI:wifi name;T:WPA;S:SSID;P:password;\\n\\\\end\\n\\n\\\\define image(firstname,lastname,address,tel,email)\\n<img src=<<makeqr text:\\\"\\\"\\\"MECARD:N:$lastname$,$firstname$;ADR:$address$;TEL:$tel$;EMAIL:$email$;;\\\"\\\"\\\" size:\\\"350\\\">>/>\\n\\\\end\\n\\n! Enter the contact details\\n\\nFirst name: <$edit-text tiddler=\\\"$:/config/plugins/tiddlywiki/qrcode/contact/firstname\\\" tag=\\\"input\\\" default=\\\"\\\"/>\\n\\nLast name: <$edit-text tiddler=\\\"$:/config/plugins/tiddlywiki/qrcode/contact/lastname\\\" tag=\\\"input\\\" default=\\\"\\\"/>\\n\\nAddress: <$edit-text tiddler=\\\"$:/config/plugins/tiddlywiki/qrcode/contact/address\\\" tag=\\\"input\\\" default=\\\"\\\"/>\\n\\nTelephone: <$edit-text tiddler=\\\"$:/config/plugins/tiddlywiki/qrcode/contact/tel\\\" tag=\\\"input\\\" default=\\\"\\\"/>\\n\\nEmail: <$edit-text tiddler=\\\"$:/config/plugins/tiddlywiki/qrcode/contact/email\\\" tag=\\\"input\\\" default=\\\"\\\"/>\\n\\n! Here is your QR code\\n\\n<$macrocall $name=\\\"image\\\" firstname={{$:/config/plugins/tiddlywiki/qrcode/contact/firstname}} lastname={{$:/config/plugins/tiddlywiki/qrcode/contact/lastname}} address={{$:/config/plugins/tiddlywiki/qrcode/contact/address}} tel={{$:/config/plugins/tiddlywiki/qrcode/contact/tel}} email={{$:/config/plugins/tiddlywiki/qrcode/contact/email}}/>\\n\"},\"$:/plugins/tiddlywiki/qrcode/MakeGenericQR\":{\"title\":\"$:/plugins/tiddlywiki/qrcode/MakeGenericQR\",\"tags\":\"$:/tags/MakeQR\",\"caption\":\"Generic\",\"text\":\"\\\\define image(content)\\n<img src=<<makeqr text:\\\"\\\"\\\"$content$\\\"\\\"\\\" size:\\\"350\\\">>/>\\n\\\\end\\n\\n! Enter the details\\n\\nYou can also use this form to encode URLs.\\n\\n<$edit-text tiddler=\\\"$:/config/plugins/tiddlywiki/qrcode/generic\\\" default=\\\"\\\" class=\\\"tc-edit-texteditor\\\"/>\\n\\n! Here is your QR code\\n\\n<$macrocall $name=\\\"image\\\" content={{$:/config/plugins/tiddlywiki/qrcode/generic}}/>\\n\"},\"$:/plugins/tiddlywiki/qrcode/MakeWifiQR\":{\"title\":\"$:/plugins/tiddlywiki/qrcode/MakeWifiQR\",\"tags\":\"$:/tags/MakeQR\",\"caption\":\"Wifi\",\"text\":\"\\\\define wifi-url()\\nWIFI:T:WPA;S:SSID;P:password;;\\n\\\\end\\n\\n\\\\define image(network,encryption,ssid,password)\\n<img src=<<makeqr text:\\\"\\\"\\\"WIFI:T:$encryption$;S:$ssid$;P:$password$;;\\\"\\\"\\\" size:\\\"350\\\">>/>\\n\\\\end\\n\\n! Enter the details of your wifi network\\n\\nEncryption: <$select tiddler=\\\"$:/config/plugins/tiddlywiki/qrcode/wifi/encryption\\\" default=\\\"none\\\">\\n<option value=\\\"none\\\">None</option>\\n<option value=\\\"WEP\\\">WEP</option>\\n<option value=\\\"WPA\\\">WPA</option>\\n<option value=\\\"WPA2\\\">WPA2</option>\\n</$select>\\n\\nSSID: <$edit-text tiddler=\\\"$:/config/plugins/tiddlywiki/qrcode/wifi/ssid\\\" tag=\\\"input\\\" default=\\\"\\\"/>\\n\\nPassword: <$edit-text tiddler=\\\"$:/config/plugins/tiddlywiki/qrcode/wifi/password\\\" tag=\\\"input\\\" default=\\\"\\\"/>\\n\\n! Here is your QR code\\n\\n<$macrocall $name=\\\"image\\\" network={{$:/config/plugins/tiddlywiki/qrcode/wifi/network}} encryption={{$:/config/plugins/tiddlywiki/qrcode/wifi/encryption}} ssid={{$:/config/plugins/tiddlywiki/qrcode/wifi/ssid}} password={{$:/config/plugins/tiddlywiki/qrcode/wifi/password}}/>\\n\"},\"$:/plugins/tiddlywiki/qrcode/ViewToolbarButton\":{\"title\":\"$:/plugins/tiddlywiki/qrcode/ViewToolbarButton\",\"tags\":\"$:/tags/ViewToolbar\",\"list-before\":\"$:/core/ui/Buttons/close\",\"caption\":\"{{$:/plugins/tiddlywiki/qrcode/icon}}\",\"short-caption\":\"QR code\",\"description\":\"Generate QR code for this tiddler\",\"text\":\"\\\\whitespace trim\\n<span class=\\\"tc-popup-keep\\\">\\n<$button popup=<<qualify \\\"$:/state/popup/qrcode\\\">> tooltip={{$:/plugins/tiddlywiki/qrcode/ViewToolbarButton!!description}} aria-label={{$:/plugins/tiddlywiki/qrcode/ViewToolbarButton!!short-caption}} class=<<tv-config-toolbar-class>> class=<<tv-config-toolbar-class>> selectedClass=\\\"tc-selected\\\">\\n<$list filter=\\\"[<tv-config-toolbar-icons>match[yes]]\\\">\\n{{$:/plugins/tiddlywiki/qrcode/icon}}\\n</$list>\\n<$list filter=\\\"[<tv-config-toolbar-text>match[yes]]\\\">\\n<span class=\\\"tc-btn-text\\\">\\n<$text text=\\\" \\\"/>\\n<$text text={{$:/plugins/tiddlywiki/qrcode/ViewToolbarButton!!short-caption}}/>\\n</span>\\n</$list>\\n</$button>\\n</span>\\n<$reveal state=<<qualify \\\"$:/state/popup/qrcode\\\">> type=\\\"popup\\\" position=\\\"below\\\" animate=\\\"yes\\\">\\n\\n<div class=\\\"tc-drop-down\\\">\\n\\n{{$:/plugins/tiddlywiki/qrcode/ViewToolbarButton||description}}\\n\\n<$set name=\\\"tv-config-toolbar-icons\\\" value=\\\"yes\\\">\\n\\n<$set name=\\\"tv-config-toolbar-text\\\" value=\\\"yes\\\">\\n\\n<$set name=\\\"tv-config-toolbar-class\\\" value=\\\"tc-btn-invisible\\\">\\n\\n<$set name=\\\"targetTiddler\\\" value=<<currentTiddler>>>\\n\\n<$list filter=\\\"[all[shadows+tiddlers]tag[$:/tags/ViewToolbarButton/QRcode]!has[draft.of]]\\\">\\n\\n<$button popup=<<qualify \\\"$:/state/popup/qrcode/type\\\">> class=\\\"tc-btn-invisible\\\" selectedClass=\\\"tc-selected\\\">\\n\\n<$action-sendmessage $message=\\\"tm-modal\\\" $param=<<currentTiddler>> currentTiddler=<<targetTiddler>>/>\\n\\n<$transclude field=\\\"caption\\\" mode=\\\"inline\\\"/>\\n\\n</$button>\\n\\n</$list>\\n\\n</$set>\\n\\n</$set>\\n\\n</$set>\\n\\n</$set>\\n\\n</div>\\n\\n</$reveal>\\n\"},\"$:/plugins/tiddlywiki/qrcode/ViewToolbarButton/Raw\":{\"title\":\"$:/plugins/tiddlywiki/qrcode/ViewToolbarButton/Raw\",\"tags\":\"$:/tags/ViewToolbarButton/QRcode\",\"caption\":\"Raw content of this tiddler\",\"subtitle\":\"QR code of raw tiddler content\",\"text\":\"\\\\define image()\\n<img src=<<makeqr text:\\\"\\\"\\\"$(content)$\\\"\\\"\\\" size:\\\"350\\\">>/>\\n\\\\end\\n\\n<$set name=\\\"content\\\" value={{!!text}}>\\n<<image>>\\n</$set>\\n\"},\"$:/plugins/tiddlywiki/qrcode/ViewToolbarButton/Rendered\":{\"title\":\"$:/plugins/tiddlywiki/qrcode/ViewToolbarButton/Rendered\",\"tags\":\"$:/tags/ViewToolbarButton/QRcode\",\"caption\":\"Rendered content of this tiddler\",\"subtitle\":\"QR code of rendered tiddler content\",\"text\":\"\\\\define image()\\n<img src=<<makeqr text:\\\"\\\"\\\"$(content)$\\\"\\\"\\\" size:\\\"350\\\">>/>\\n\\\\end\\n\\n<$wikify name=\\\"content\\\" text={{!!text}} type=\\\"text\\\" mode=\\\"block\\\" output=\\\"formattedtext\\\">\\n<<image>>\\n</$wikify>\\n\"},\"$:/plugins/tiddlywiki/qrcode/ViewToolbarButton/URL\":{\"title\":\"$:/plugins/tiddlywiki/qrcode/ViewToolbarButton/URL\",\"tags\":\"$:/tags/ViewToolbarButton/QRcode\",\"caption\":\"URL of this tiddler\",\"subtitle\":\"QR code of URL of this tiddler\",\"text\":\"\\\\define image()\\n<img src=<<makeqr text:\\\"\\\"\\\"$(url)$#$(hash)$\\\"\\\"\\\" size:\\\"350\\\">>/>\\n\\\\end\\n\\n<$set name=\\\"url\\\" value={{$:/info/url/full}}>\\n<$set name=\\\"hash\\\" filter=\\\"[<currentTiddler>encodeuricomponent[]]\\\" select=\\\"0\\\">\\n<<image>>\\n</$set>\\n</$set>\\n\"},\"$:/plugins/tiddlywiki/qrcode/styles\":{\"title\":\"$:/plugins/tiddlywiki/qrcode/styles\",\"tags\":\"[[$:/tags/Stylesheet]]\",\"text\":\"\\\\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline\\n\\n.tc-drop-down .tc-qrcode-drop-down img {\\n\\twidth: 100%;\\n\\theight: 100%;\\n}\\n\"},\"$:/plugins/tiddlywiki/qrcode/examples\":{\"title\":\"$:/plugins/tiddlywiki/qrcode/examples\",\"text\":\"<<tabs \\\"[all[shadows+tiddlers]tag[$:/tags/MakeQR]!has[draft.of]]\\\" \\\"$:/plugins/tiddlywiki/qrcode/MakeGenericQR\\\">>\"},\"$:/plugins/tiddlywiki/qrcode/readme\":{\"title\":\"$:/plugins/tiddlywiki/qrcode/readme\",\"text\":\"The QR code plugin provides a macro that enables any text to be rendered as a [[QR code|https://en.wikipedia.org/wiki/QR_code]]. QR codes are a type of 2-dimensional bar code that encodes arbitrary data: text, numbers, links. QR code readers are available or built-in for smartphones, making them a convenient means to transfer information between devices\\n\\nThe QR code plugin adds the following features to TiddlyWiki:\\n\\n* A new [[makeqr Macro]] that renders specified text as a QR code image that can be displayed or printed\\n* A new toolbar button that can display several QR code renderings of the content of a tiddler:\\n** Raw content\\n** Rendered, formatted content\\n** URL of tiddler\\n\\nThe QR code plugin is based on the library [[qrcode.js by Zeno Zeng|https://github.com/zenozeng/node-yaqrcode]].\"},\"$:/plugins/tiddlywiki/qrcode/usage\":{\"title\":\"$:/plugins/tiddlywiki/qrcode/usage\",\"text\":\"! `makeqr` Macro\\n\\nThe <<.def makeqr>> [[macro|Macros]] converts text data into an image of the corresponding QR code. The image is returned as [[base64-encoded data URI|https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs]].\\n\\n!! Parameters\\n\\n;text\\n: The text to encode\\n;size\\n: The size of the image in pixels (defaults to 500)\\n;errorCorrectLevel\\n: Determines the amount of error correction applied to the image; see below (defaults to \\\"M\\\").\\n;fallback\\n: The fallback image to be returned in case of an error (see below)\\n\\nThe conversion will fail if the text is too long and/or complex and the macro will return the provided fallback image. If no fallback image is provided then an error image is generated.\\n\\nThe error correction level is a [[QR code feature|http://www.qrcode.com/en/about/error_correction.html]]:\\n\\n<<<\\nQR Code has error correction capability to restore data if the code is dirty or damaged. ... Level Q or H may be selected for factory environment where QR Code get dirty, whereas Level L may be selected for clean environment with the large amount of data. Typically, Level M (15%) is most frequently selected.\\n<<<\\n\\n!! Examples\\n\\nMaking a QR code for a simple string of text:\\n\\n```\\n<<makeqr \\\"Hello there!\\\">>\\n```\\n\\nMaking a QR code for the URL field of the current tiddler:\\n\\n```\\n<$macrocall $name=\\\"makeqr\\\" text={{!!url}}/>\\n```\\n\\nMaking a QR code for the URL of the current wiki:\\n\\n```\\n<$macrocall $name=\\\"makeqr\\\" text={{$:/info/url/full}}/>\\n```\\n\"},\"$:/plugins/tiddlywiki/qrcode/qrcode.js\":{\"text\":\"//---------------------------------------------------------------------\\n//\\n// QR Code Generator for JavaScript\\n//\\n// Copyright (c) 2009 Kazuhiko Arase\\n//\\n// URL: http://www.d-project.com/\\n//\\n// Licensed under the MIT license:\\n//\\thttp://www.opensource.org/licenses/mit-license.php\\n//\\n// The word 'QR Code' is registered trademark of\\n// DENSO WAVE INCORPORATED\\n//\\thttp://www.denso-wave.com/qrcode/faqpatent-e.html\\n//\\n//---------------------------------------------------------------------\\n\\n//---------------------------------------------------------------------\\n// qrcode\\n//---------------------------------------------------------------------\\n\\n/**\\n * qrcode\\n * @param typeNumber 1 to 40\\n * @param errorCorrectLevel 'L','M','Q','H'\\n */\\nvar qrcode = function(typeNumber, errorCorrectLevel) {\\n\\n var PAD0 = 0xEC;\\n var PAD1 = 0x11;\\n\\n var _typeNumber = typeNumber;\\n var _errorCorrectLevel = QRErrorCorrectLevel[errorCorrectLevel];\\n var _modules = null;\\n var _moduleCount = 0;\\n var _dataCache = null;\\n var _dataList = new Array();\\n\\n var _this = {};\\n\\n var makeImpl = function(test, maskPattern) {\\n\\n\\t_moduleCount = _typeNumber * 4 + 17;\\n\\t_modules = function(moduleCount) {\\n\\t var modules = new Array(moduleCount);\\n\\t for (var row = 0; row < moduleCount; row += 1) {\\n\\t\\tmodules[row] = new Array(moduleCount);\\n\\t\\tfor (var col = 0; col < moduleCount; col += 1) {\\n\\t\\t modules[row][col] = null;\\n\\t\\t}\\n\\t }\\n\\t return modules;\\n\\t}(_moduleCount);\\n\\n\\tsetupPositionProbePattern(0, 0);\\n\\tsetupPositionProbePattern(_moduleCount - 7, 0);\\n\\tsetupPositionProbePattern(0, _moduleCount - 7);\\n\\tsetupPositionAdjustPattern();\\n\\tsetupTimingPattern();\\n\\tsetupTypeInfo(test, maskPattern);\\n\\n\\tif (_typeNumber >= 7) {\\n\\t setupTypeNumber(test);\\n\\t}\\n\\n\\tif (_dataCache == null) {\\n\\t _dataCache = createData(_typeNumber, _errorCorrectLevel, _dataList);\\n\\t}\\n\\n\\tmapData(_dataCache, maskPattern);\\n };\\n\\n var setupPositionProbePattern = function(row, col) {\\n\\n\\tfor (var r = -1; r <= 7; r += 1) {\\n\\n\\t if (row + r <= -1 || _moduleCount <= row + r) continue;\\n\\n\\t for (var c = -1; c <= 7; c += 1) {\\n\\n\\t\\tif (col + c <= -1 || _moduleCount <= col + c) continue;\\n\\n\\t\\tif ( (0 <= r && r <= 6 && (c == 0 || c == 6) )\\n\\t\\t || (0 <= c && c <= 6 && (r == 0 || r == 6) )\\n\\t\\t || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) {\\n\\t\\t _modules[row + r][col + c] = true;\\n\\t\\t} else {\\n\\t\\t _modules[row + r][col + c] = false;\\n\\t\\t}\\n\\t }\\n\\t}\\n };\\n\\n var getBestMaskPattern = function() {\\n\\n\\tvar minLostPoint = 0;\\n\\tvar pattern = 0;\\n\\n\\tfor (var i = 0; i < 8; i += 1) {\\n\\n\\t makeImpl(true, i);\\n\\n\\t var lostPoint = QRUtil.getLostPoint(_this);\\n\\n\\t if (i == 0 || minLostPoint > lostPoint) {\\n\\t\\tminLostPoint = lostPoint;\\n\\t\\tpattern = i;\\n\\t }\\n\\t}\\n\\n\\treturn pattern;\\n };\\n\\n var setupTimingPattern = function() {\\n\\n\\tfor (var r = 8; r < _moduleCount - 8; r += 1) {\\n\\t if (_modules[r][6] != null) {\\n\\t\\tcontinue;\\n\\t }\\n\\t _modules[r][6] = (r % 2 == 0);\\n\\t}\\n\\n\\tfor (var c = 8; c < _moduleCount - 8; c += 1) {\\n\\t if (_modules[6][c] != null) {\\n\\t\\tcontinue;\\n\\t }\\n\\t _modules[6][c] = (c % 2 == 0);\\n\\t}\\n };\\n\\n var setupPositionAdjustPattern = function() {\\n\\n\\tvar pos = QRUtil.getPatternPosition(_typeNumber);\\n\\n\\tfor (var i = 0; i < pos.length; i += 1) {\\n\\n\\t for (var j = 0; j < pos.length; j += 1) {\\n\\n\\t\\tvar row = pos[i];\\n\\t\\tvar col = pos[j];\\n\\n\\t\\tif (_modules[row][col] != null) {\\n\\t\\t continue;\\n\\t\\t}\\n\\n\\t\\tfor (var r = -2; r <= 2; r += 1) {\\n\\n\\t\\t for (var c = -2; c <= 2; c += 1) {\\n\\n\\t\\t\\tif (r == -2 || r == 2 || c == -2 || c == 2\\n\\t\\t\\t || (r == 0 && c == 0) ) {\\n\\t\\t\\t _modules[row + r][col + c] = true;\\n\\t\\t\\t} else {\\n\\t\\t\\t _modules[row + r][col + c] = false;\\n\\t\\t\\t}\\n\\t\\t }\\n\\t\\t}\\n\\t }\\n\\t}\\n };\\n\\n var setupTypeNumber = function(test) {\\n\\n\\tvar bits = QRUtil.getBCHTypeNumber(_typeNumber);\\n\\n\\tfor (var i = 0; i < 18; i += 1) {\\n\\t var mod = (!test && ( (bits >> i) & 1) == 1);\\n\\t _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;\\n\\t}\\n\\n\\tfor (var i = 0; i < 18; i += 1) {\\n\\t var mod = (!test && ( (bits >> i) & 1) == 1);\\n\\t _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;\\n\\t}\\n };\\n\\n var setupTypeInfo = function(test, maskPattern) {\\n\\n\\tvar data = (_errorCorrectLevel << 3) | maskPattern;\\n\\tvar bits = QRUtil.getBCHTypeInfo(data);\\n\\n\\t// vertical\\n\\tfor (var i = 0; i < 15; i += 1) {\\n\\n\\t var mod = (!test && ( (bits >> i) & 1) == 1);\\n\\n\\t if (i < 6) {\\n\\t\\t_modules[i][8] = mod;\\n\\t } else if (i < 8) {\\n\\t\\t_modules[i + 1][8] = mod;\\n\\t } else {\\n\\t\\t_modules[_moduleCount - 15 + i][8] = mod;\\n\\t }\\n\\t}\\n\\n\\t// horizontal\\n\\tfor (var i = 0; i < 15; i += 1) {\\n\\n\\t var mod = (!test && ( (bits >> i) & 1) == 1);\\n\\n\\t if (i < 8) {\\n\\t\\t_modules[8][_moduleCount - i - 1] = mod;\\n\\t } else if (i < 9) {\\n\\t\\t_modules[8][15 - i - 1 + 1] = mod;\\n\\t } else {\\n\\t\\t_modules[8][15 - i - 1] = mod;\\n\\t }\\n\\t}\\n\\n\\t// fixed module\\n\\t_modules[_moduleCount - 8][8] = (!test);\\n };\\n\\n var mapData = function(data, maskPattern) {\\n\\n\\tvar inc = -1;\\n\\tvar row = _moduleCount - 1;\\n\\tvar bitIndex = 7;\\n\\tvar byteIndex = 0;\\n\\tvar maskFunc = QRUtil.getMaskFunction(maskPattern);\\n\\n\\tfor (var col = _moduleCount - 1; col > 0; col -= 2) {\\n\\n\\t if (col == 6) col -= 1;\\n\\n\\t while (true) {\\n\\n\\t\\tfor (var c = 0; c < 2; c += 1) {\\n\\n\\t\\t if (_modules[row][col - c] == null) {\\n\\n\\t\\t\\tvar dark = false;\\n\\n\\t\\t\\tif (byteIndex < data.length) {\\n\\t\\t\\t dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1);\\n\\t\\t\\t}\\n\\n\\t\\t\\tvar mask = maskFunc(row, col - c);\\n\\n\\t\\t\\tif (mask) {\\n\\t\\t\\t dark = !dark;\\n\\t\\t\\t}\\n\\n\\t\\t\\t_modules[row][col - c] = dark;\\n\\t\\t\\tbitIndex -= 1;\\n\\n\\t\\t\\tif (bitIndex == -1) {\\n\\t\\t\\t byteIndex += 1;\\n\\t\\t\\t bitIndex = 7;\\n\\t\\t\\t}\\n\\t\\t }\\n\\t\\t}\\n\\n\\t\\trow += inc;\\n\\n\\t\\tif (row < 0 || _moduleCount <= row) {\\n\\t\\t row -= inc;\\n\\t\\t inc = -inc;\\n\\t\\t break;\\n\\t\\t}\\n\\t }\\n\\t}\\n };\\n\\n var createBytes = function(buffer, rsBlocks) {\\n\\n\\tvar offset = 0;\\n\\n\\tvar maxDcCount = 0;\\n\\tvar maxEcCount = 0;\\n\\n\\tvar dcdata = new Array(rsBlocks.length);\\n\\tvar ecdata = new Array(rsBlocks.length);\\n\\n\\tfor (var r = 0; r < rsBlocks.length; r += 1) {\\n\\n\\t var dcCount = rsBlocks[r].dataCount;\\n\\t var ecCount = rsBlocks[r].totalCount - dcCount;\\n\\n\\t maxDcCount = Math.max(maxDcCount, dcCount);\\n\\t maxEcCount = Math.max(maxEcCount, ecCount);\\n\\n\\t dcdata[r] = new Array(dcCount);\\n\\n\\t for (var i = 0; i < dcdata[r].length; i += 1) {\\n\\t\\tdcdata[r][i] = 0xff & buffer.getBuffer()[i + offset];\\n\\t }\\n\\t offset += dcCount;\\n\\n\\t var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);\\n\\t var rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);\\n\\n\\t var modPoly = rawPoly.mod(rsPoly);\\n\\t ecdata[r] = new Array(rsPoly.getLength() - 1);\\n\\t for (var i = 0; i < ecdata[r].length; i += 1) {\\n\\t\\tvar modIndex = i + modPoly.getLength() - ecdata[r].length;\\n\\t\\tecdata[r][i] = (modIndex >= 0)? modPoly.getAt(modIndex) : 0;\\n\\t }\\n\\t}\\n\\n\\tvar totalCodeCount = 0;\\n\\tfor (var i = 0; i < rsBlocks.length; i += 1) {\\n\\t totalCodeCount += rsBlocks[i].totalCount;\\n\\t}\\n\\n\\tvar data = new Array(totalCodeCount);\\n\\tvar index = 0;\\n\\n\\tfor (var i = 0; i < maxDcCount; i += 1) {\\n\\t for (var r = 0; r < rsBlocks.length; r += 1) {\\n\\t\\tif (i < dcdata[r].length) {\\n\\t\\t data[index] = dcdata[r][i];\\n\\t\\t index += 1;\\n\\t\\t}\\n\\t }\\n\\t}\\n\\n\\tfor (var i = 0; i < maxEcCount; i += 1) {\\n\\t for (var r = 0; r < rsBlocks.length; r += 1) {\\n\\t\\tif (i < ecdata[r].length) {\\n\\t\\t data[index] = ecdata[r][i];\\n\\t\\t index += 1;\\n\\t\\t}\\n\\t }\\n\\t}\\n\\n\\treturn data;\\n };\\n\\n var createData = function(typeNumber, errorCorrectLevel, dataList) {\\n\\n\\tvar rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);\\n\\n\\tvar buffer = qrBitBuffer();\\n\\n\\tfor (var i = 0; i < dataList.length; i += 1) {\\n\\t var data = dataList[i];\\n\\t buffer.put(data.getMode(), 4);\\n\\t buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) );\\n\\t data.write(buffer);\\n\\t}\\n\\n\\t// calc num max data.\\n\\tvar totalDataCount = 0;\\n\\tfor (var i = 0; i < rsBlocks.length; i += 1) {\\n\\t totalDataCount += rsBlocks[i].dataCount;\\n\\t}\\n\\n\\tif (buffer.getLengthInBits() > totalDataCount * 8) {\\n\\t throw new Error('code length overflow. ('\\n\\t\\t\\t + buffer.getLengthInBits()\\n\\t\\t\\t + '>'\\n\\t\\t\\t + totalDataCount * 8\\n\\t\\t\\t + ')');\\n\\t}\\n\\n\\t// end code\\n\\tif (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {\\n\\t buffer.put(0, 4);\\n\\t}\\n\\n\\t// padding\\n\\twhile (buffer.getLengthInBits() % 8 != 0) {\\n\\t buffer.putBit(false);\\n\\t}\\n\\n\\t// padding\\n\\twhile (true) {\\n\\n\\t if (buffer.getLengthInBits() >= totalDataCount * 8) {\\n\\t\\tbreak;\\n\\t }\\n\\t buffer.put(PAD0, 8);\\n\\n\\t if (buffer.getLengthInBits() >= totalDataCount * 8) {\\n\\t\\tbreak;\\n\\t }\\n\\t buffer.put(PAD1, 8);\\n\\t}\\n\\n\\treturn createBytes(buffer, rsBlocks);\\n };\\n\\n _this.addData = function(data) {\\n\\tvar newData = qr8BitByte(data);\\n\\t_dataList.push(newData);\\n\\t_dataCache = null;\\n };\\n\\n _this.isDark = function(row, col) {\\n\\tif (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {\\n\\t throw new Error(row + ',' + col);\\n\\t}\\n\\treturn _modules[row][col];\\n };\\n\\n _this.getModuleCount = function() {\\n\\treturn _moduleCount;\\n };\\n\\n _this.make = function() {\\n\\tmakeImpl(false, getBestMaskPattern() );\\n };\\n\\n _this.createTableTag = function(cellSize, margin) {\\n\\n\\tcellSize = cellSize || 2;\\n\\tmargin = (typeof margin == 'undefined')? cellSize * 4 : margin;\\n\\n\\tvar qrHtml = '';\\n\\n\\tqrHtml += '<table style=\\\"';\\n\\tqrHtml += ' border-width: 0px; border-style: none;';\\n\\tqrHtml += ' border-collapse: collapse;';\\n\\tqrHtml += ' padding: 0px; margin: ' + margin + 'px;';\\n\\tqrHtml += '\\\">';\\n\\tqrHtml += '<tbody>';\\n\\n\\tfor (var r = 0; r < _this.getModuleCount(); r += 1) {\\n\\n\\t qrHtml += '<tr>';\\n\\n\\t for (var c = 0; c < _this.getModuleCount(); c += 1) {\\n\\t\\tqrHtml += '<td style=\\\"';\\n\\t\\tqrHtml += ' border-width: 0px; border-style: none;';\\n\\t\\tqrHtml += ' border-collapse: collapse;';\\n\\t\\tqrHtml += ' padding: 0px; margin: 0px;';\\n\\t\\tqrHtml += ' width: ' + cellSize + 'px;';\\n\\t\\tqrHtml += ' height: ' + cellSize + 'px;';\\n\\t\\tqrHtml += ' background-color: ';\\n\\t\\tqrHtml += _this.isDark(r, c)? '#000000' : '#ffffff';\\n\\t\\tqrHtml += ';';\\n\\t\\tqrHtml += '\\\"/>';\\n\\t }\\n\\n\\t qrHtml += '</tr>';\\n\\t}\\n\\n\\tqrHtml += '</tbody>';\\n\\tqrHtml += '</table>';\\n\\n\\treturn qrHtml;\\n };\\n\\n _this.createImgTag = function(cellSize, margin, size) {\\n\\n\\tcellSize = cellSize || 2;\\n\\tmargin = (typeof margin == 'undefined')? cellSize * 4 : margin;\\n\\n\\tvar min = margin;\\n\\tvar max = _this.getModuleCount() * cellSize + margin;\\n\\n\\treturn createImgTag(size, size, function(x, y) {\\n\\t if (min <= x && x < max && min <= y && y < max) {\\n\\t\\tvar c = Math.floor( (x - min) / cellSize);\\n\\t\\tvar r = Math.floor( (y - min) / cellSize);\\n\\t\\treturn _this.isDark(r, c)? 0 : 1;\\n\\t } else {\\n\\t\\treturn 1;\\n\\t }\\n\\t} );\\n };\\n\\n return _this;\\n};\\n\\n//---------------------------------------------------------------------\\n// qrcode.stringToBytes\\n//---------------------------------------------------------------------\\n\\nqrcode.stringToBytes = function(s) {\\n var bytes = new Array();\\n for (var i = 0; i < s.length; i += 1) {\\n\\tvar c = s.charCodeAt(i);\\n\\tbytes.push(c & 0xff);\\n }\\n return bytes;\\n};\\n\\n//---------------------------------------------------------------------\\n// qrcode.createStringToBytes\\n//---------------------------------------------------------------------\\n\\n/**\\n * @param unicodeData base64 string of byte array.\\n * [16bit Unicode],[16bit Bytes], ...\\n * @param numChars\\n */\\nqrcode.createStringToBytes = function(unicodeData, numChars) {\\n\\n // create conversion map.\\n\\n var unicodeMap = function() {\\n\\n\\tvar bin = base64DecodeInputStream(unicodeData);\\n\\tvar read = function() {\\n\\t var b = bin.read();\\n\\t if (b == -1) throw new Error();\\n\\t return b;\\n\\t};\\n\\n\\tvar count = 0;\\n\\tvar unicodeMap = {};\\n\\twhile (true) {\\n\\t var b0 = bin.read();\\n\\t if (b0 == -1) break;\\n\\t var b1 = read();\\n\\t var b2 = read();\\n\\t var b3 = read();\\n\\t var k = String.fromCharCode( (b0 << 8) | b1);\\n\\t var v = (b2 << 8) | b3;\\n\\t unicodeMap[k] = v;\\n\\t count += 1;\\n\\t}\\n\\tif (count != numChars) {\\n\\t throw new Error(count + ' != ' + numChars);\\n\\t}\\n\\n\\treturn unicodeMap;\\n }();\\n\\n var unknownChar = '?'.charCodeAt(0);\\n\\n return function(s) {\\n\\tvar bytes = new Array();\\n\\tfor (var i = 0; i < s.length; i += 1) {\\n\\t var c = s.charCodeAt(i);\\n\\t if (c < 128) {\\n\\t\\tbytes.push(c);\\n\\t } else {\\n\\t\\tvar b = unicodeMap[s.charAt(i)];\\n\\t\\tif (typeof b == 'number') {\\n\\t\\t if ( (b & 0xff) == b) {\\n\\t\\t\\t// 1byte\\n\\t\\t\\tbytes.push(b);\\n\\t\\t } else {\\n\\t\\t\\t// 2bytes\\n\\t\\t\\tbytes.push(b >>> 8);\\n\\t\\t\\tbytes.push(b & 0xff);\\n\\t\\t }\\n\\t\\t} else {\\n\\t\\t bytes.push(unknownChar);\\n\\t\\t}\\n\\t }\\n\\t}\\n\\treturn bytes;\\n };\\n};\\n\\n//---------------------------------------------------------------------\\n// QRMode\\n//---------------------------------------------------------------------\\n\\nvar QRMode = {\\n MODE_NUMBER :\\t\\t1 << 0,\\n MODE_ALPHA_NUM : \\t1 << 1,\\n MODE_8BIT_BYTE : \\t1 << 2,\\n MODE_KANJI :\\t\\t1 << 3\\n};\\n\\n//---------------------------------------------------------------------\\n// QRErrorCorrectLevel\\n//---------------------------------------------------------------------\\n\\nvar QRErrorCorrectLevel = {\\n L : 1,\\n M : 0,\\n Q : 3,\\n H : 2\\n};\\n\\n//---------------------------------------------------------------------\\n// QRMaskPattern\\n//---------------------------------------------------------------------\\n\\nvar QRMaskPattern = {\\n PATTERN000 : 0,\\n PATTERN001 : 1,\\n PATTERN010 : 2,\\n PATTERN011 : 3,\\n PATTERN100 : 4,\\n PATTERN101 : 5,\\n PATTERN110 : 6,\\n PATTERN111 : 7\\n};\\n\\n//---------------------------------------------------------------------\\n// QRUtil\\n//---------------------------------------------------------------------\\n\\nvar QRUtil = function() {\\n\\n var PATTERN_POSITION_TABLE = [\\n\\t[],\\n\\t[6, 18],\\n\\t[6, 22],\\n\\t[6, 26],\\n\\t[6, 30],\\n\\t[6, 34],\\n\\t[6, 22, 38],\\n\\t[6, 24, 42],\\n\\t[6, 26, 46],\\n\\t[6, 28, 50],\\n\\t[6, 30, 54],\\n\\t[6, 32, 58],\\n\\t[6, 34, 62],\\n\\t[6, 26, 46, 66],\\n\\t[6, 26, 48, 70],\\n\\t[6, 26, 50, 74],\\n\\t[6, 30, 54, 78],\\n\\t[6, 30, 56, 82],\\n\\t[6, 30, 58, 86],\\n\\t[6, 34, 62, 90],\\n\\t[6, 28, 50, 72, 94],\\n\\t[6, 26, 50, 74, 98],\\n\\t[6, 30, 54, 78, 102],\\n\\t[6, 28, 54, 80, 106],\\n\\t[6, 32, 58, 84, 110],\\n\\t[6, 30, 58, 86, 114],\\n\\t[6, 34, 62, 90, 118],\\n\\t[6, 26, 50, 74, 98, 122],\\n\\t[6, 30, 54, 78, 102, 126],\\n\\t[6, 26, 52, 78, 104, 130],\\n\\t[6, 30, 56, 82, 108, 134],\\n\\t[6, 34, 60, 86, 112, 138],\\n\\t[6, 30, 58, 86, 114, 142],\\n\\t[6, 34, 62, 90, 118, 146],\\n\\t[6, 30, 54, 78, 102, 126, 150],\\n\\t[6, 24, 50, 76, 102, 128, 154],\\n\\t[6, 28, 54, 80, 106, 132, 158],\\n\\t[6, 32, 58, 84, 110, 136, 162],\\n\\t[6, 26, 54, 82, 110, 138, 166],\\n\\t[6, 30, 58, 86, 114, 142, 170]\\n ];\\n var G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);\\n var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0);\\n var G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);\\n\\n var _this = {};\\n\\n var getBCHDigit = function(data) {\\n\\tvar digit = 0;\\n\\twhile (data != 0) {\\n\\t digit += 1;\\n\\t data >>>= 1;\\n\\t}\\n\\treturn digit;\\n };\\n\\n _this.getBCHTypeInfo = function(data) {\\n\\tvar d = data << 10;\\n\\twhile (getBCHDigit(d) - getBCHDigit(G15) >= 0) {\\n\\t d ^= (G15 << (getBCHDigit(d) - getBCHDigit(G15) ) );\\n\\t}\\n\\treturn ( (data << 10) | d) ^ G15_MASK;\\n };\\n\\n _this.getBCHTypeNumber = function(data) {\\n\\tvar d = data << 12;\\n\\twhile (getBCHDigit(d) - getBCHDigit(G18) >= 0) {\\n\\t d ^= (G18 << (getBCHDigit(d) - getBCHDigit(G18) ) );\\n\\t}\\n\\treturn (data << 12) | d;\\n };\\n\\n _this.getPatternPosition = function(typeNumber) {\\n\\treturn PATTERN_POSITION_TABLE[typeNumber - 1];\\n };\\n\\n _this.getMaskFunction = function(maskPattern) {\\n\\n\\tswitch (maskPattern) {\\n\\n\\t case QRMaskPattern.PATTERN000 :\\n\\t\\treturn function(i, j) { return (i + j) % 2 == 0; };\\n\\t case QRMaskPattern.PATTERN001 :\\n\\t\\treturn function(i, j) { return i % 2 == 0; };\\n\\t case QRMaskPattern.PATTERN010 :\\n\\t\\treturn function(i, j) { return j % 3 == 0; };\\n\\t case QRMaskPattern.PATTERN011 :\\n\\t\\treturn function(i, j) { return (i + j) % 3 == 0; };\\n\\t case QRMaskPattern.PATTERN100 :\\n\\t\\treturn function(i, j) { return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; };\\n\\t case QRMaskPattern.PATTERN101 :\\n\\t\\treturn function(i, j) { return (i * j) % 2 + (i * j) % 3 == 0; };\\n\\t case QRMaskPattern.PATTERN110 :\\n\\t\\treturn function(i, j) { return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; };\\n\\t case QRMaskPattern.PATTERN111 :\\n\\t\\treturn function(i, j) { return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; };\\n\\n\\t\\tdefault :\\n\\t\\tthrow new Error('bad maskPattern:' + maskPattern);\\n\\t}\\n };\\n\\n _this.getErrorCorrectPolynomial = function(errorCorrectLength) {\\n\\tvar a = qrPolynomial([1], 0);\\n\\tfor (var i = 0; i < errorCorrectLength; i += 1) {\\n\\t a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0) );\\n\\t}\\n\\treturn a;\\n };\\n\\n _this.getLengthInBits = function(mode, type) {\\n\\n\\tif (1 <= type && type < 10) {\\n\\n\\t // 1 - 9\\n\\n\\t switch(mode) {\\n\\t\\tcase QRMode.MODE_NUMBER \\t: return 10;\\n\\t\\tcase QRMode.MODE_ALPHA_NUM \\t: return 9;\\n\\t\\tcase QRMode.MODE_8BIT_BYTE\\t: return 8;\\n\\t\\tcase QRMode.MODE_KANJI\\t\\t: return 8;\\n\\t\\t default :\\n\\t\\t throw new Error('mode:' + mode);\\n\\t }\\n\\n\\t} else if (type < 27) {\\n\\n\\t // 10 - 26\\n\\n\\t switch(mode) {\\n\\t\\tcase QRMode.MODE_NUMBER \\t: return 12;\\n\\t\\tcase QRMode.MODE_ALPHA_NUM \\t: return 11;\\n\\t\\tcase QRMode.MODE_8BIT_BYTE\\t: return 16;\\n\\t\\tcase QRMode.MODE_KANJI\\t\\t: return 10;\\n\\t\\t default :\\n\\t\\t throw new Error('mode:' + mode);\\n\\t }\\n\\n\\t} else if (type < 41) {\\n\\n\\t // 27 - 40\\n\\n\\t switch(mode) {\\n\\t\\tcase QRMode.MODE_NUMBER \\t: return 14;\\n\\t\\tcase QRMode.MODE_ALPHA_NUM\\t: return 13;\\n\\t\\tcase QRMode.MODE_8BIT_BYTE\\t: return 16;\\n\\t\\tcase QRMode.MODE_KANJI\\t\\t: return 12;\\n\\t\\t default :\\n\\t\\t throw new Error('mode:' + mode);\\n\\t }\\n\\n\\t} else {\\n\\t throw new Error('type:' + type);\\n\\t}\\n };\\n\\n _this.getLostPoint = function(qrcode) {\\n\\n\\tvar moduleCount = qrcode.getModuleCount();\\n\\n\\tvar lostPoint = 0;\\n\\n\\t// LEVEL1\\n\\n\\tfor (var row = 0; row < moduleCount; row += 1) {\\n\\t for (var col = 0; col < moduleCount; col += 1) {\\n\\n\\t\\tvar sameCount = 0;\\n\\t\\tvar dark = qrcode.isDark(row, col);\\n\\n\\t\\tfor (var r = -1; r <= 1; r += 1) {\\n\\n\\t\\t if (row + r < 0 || moduleCount <= row + r) {\\n\\t\\t\\tcontinue;\\n\\t\\t }\\n\\n\\t\\t for (var c = -1; c <= 1; c += 1) {\\n\\n\\t\\t\\tif (col + c < 0 || moduleCount <= col + c) {\\n\\t\\t\\t continue;\\n\\t\\t\\t}\\n\\n\\t\\t\\tif (r == 0 && c == 0) {\\n\\t\\t\\t continue;\\n\\t\\t\\t}\\n\\n\\t\\t\\tif (dark == qrcode.isDark(row + r, col + c) ) {\\n\\t\\t\\t sameCount += 1;\\n\\t\\t\\t}\\n\\t\\t }\\n\\t\\t}\\n\\n\\t\\tif (sameCount > 5) {\\n\\t\\t lostPoint += (3 + sameCount - 5);\\n\\t\\t}\\n\\t }\\n\\t};\\n\\n\\t// LEVEL2\\n\\n\\tfor (var row = 0; row < moduleCount - 1; row += 1) {\\n\\t for (var col = 0; col < moduleCount - 1; col += 1) {\\n\\t\\tvar count = 0;\\n\\t\\tif (qrcode.isDark(row, col) ) count += 1;\\n\\t\\tif (qrcode.isDark(row + 1, col) ) count += 1;\\n\\t\\tif (qrcode.isDark(row, col + 1) ) count += 1;\\n\\t\\tif (qrcode.isDark(row + 1, col + 1) ) count += 1;\\n\\t\\tif (count == 0 || count == 4) {\\n\\t\\t lostPoint += 3;\\n\\t\\t}\\n\\t }\\n\\t}\\n\\n\\t// LEVEL3\\n\\n\\tfor (var row = 0; row < moduleCount; row += 1) {\\n\\t for (var col = 0; col < moduleCount - 6; col += 1) {\\n\\t\\tif (qrcode.isDark(row, col)\\n\\t\\t && !qrcode.isDark(row, col + 1)\\n\\t\\t && qrcode.isDark(row, col + 2)\\n\\t\\t && qrcode.isDark(row, col + 3)\\n\\t\\t && qrcode.isDark(row, col + 4)\\n\\t\\t && !qrcode.isDark(row, col + 5)\\n\\t\\t && qrcode.isDark(row, col + 6) ) {\\n\\t\\t lostPoint += 40;\\n\\t\\t}\\n\\t }\\n\\t}\\n\\n\\tfor (var col = 0; col < moduleCount; col += 1) {\\n\\t for (var row = 0; row < moduleCount - 6; row += 1) {\\n\\t\\tif (qrcode.isDark(row, col)\\n\\t\\t && !qrcode.isDark(row + 1, col)\\n\\t\\t && qrcode.isDark(row + 2, col)\\n\\t\\t && qrcode.isDark(row + 3, col)\\n\\t\\t && qrcode.isDark(row + 4, col)\\n\\t\\t && !qrcode.isDark(row + 5, col)\\n\\t\\t && qrcode.isDark(row + 6, col) ) {\\n\\t\\t lostPoint += 40;\\n\\t\\t}\\n\\t }\\n\\t}\\n\\n\\t// LEVEL4\\n\\n\\tvar darkCount = 0;\\n\\n\\tfor (var col = 0; col < moduleCount; col += 1) {\\n\\t for (var row = 0; row < moduleCount; row += 1) {\\n\\t\\tif (qrcode.isDark(row, col) ) {\\n\\t\\t darkCount += 1;\\n\\t\\t}\\n\\t }\\n\\t}\\n\\n\\tvar ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;\\n\\tlostPoint += ratio * 10;\\n\\n\\treturn lostPoint;\\n };\\n\\n return _this;\\n}();\\n\\n//---------------------------------------------------------------------\\n// QRMath\\n//---------------------------------------------------------------------\\n\\nvar QRMath = function() {\\n\\n var EXP_TABLE = new Array(256);\\n var LOG_TABLE = new Array(256);\\n\\n // initialize tables\\n for (var i = 0; i < 8; i += 1) {\\n\\tEXP_TABLE[i] = 1 << i;\\n }\\n for (var i = 8; i < 256; i += 1) {\\n\\tEXP_TABLE[i] = EXP_TABLE[i - 4]\\n\\t ^ EXP_TABLE[i - 5]\\n\\t ^ EXP_TABLE[i - 6]\\n\\t ^ EXP_TABLE[i - 8];\\n }\\n for (var i = 0; i < 255; i += 1) {\\n\\tLOG_TABLE[EXP_TABLE[i] ] = i;\\n }\\n\\n var _this = {};\\n\\n _this.glog = function(n) {\\n\\n\\tif (n < 1) {\\n\\t throw new Error('glog(' + n + ')');\\n\\t}\\n\\n\\treturn LOG_TABLE[n];\\n };\\n\\n _this.gexp = function(n) {\\n\\n\\twhile (n < 0) {\\n\\t n += 255;\\n\\t}\\n\\n\\twhile (n >= 256) {\\n\\t n -= 255;\\n\\t}\\n\\n\\treturn EXP_TABLE[n];\\n };\\n\\n return _this;\\n}();\\n\\n//---------------------------------------------------------------------\\n// qrPolynomial\\n//---------------------------------------------------------------------\\n\\nfunction qrPolynomial(num, shift) {\\n\\n if (typeof num.length == 'undefined') {\\n\\tthrow new Error(num.length + '/' + shift);\\n }\\n\\n var _num = function() {\\n\\tvar offset = 0;\\n\\twhile (offset < num.length && num[offset] == 0) {\\n\\t offset += 1;\\n\\t}\\n\\tvar _num = new Array(num.length - offset + shift);\\n\\tfor (var i = 0; i < num.length - offset; i += 1) {\\n\\t _num[i] = num[i + offset];\\n\\t}\\n\\treturn _num;\\n }();\\n\\n var _this = {};\\n\\n _this.getAt = function(index) {\\n\\treturn _num[index];\\n };\\n\\n _this.getLength = function() {\\n\\treturn _num.length;\\n };\\n\\n _this.multiply = function(e) {\\n\\n\\tvar num = new Array(_this.getLength() + e.getLength() - 1);\\n\\n\\tfor (var i = 0; i < _this.getLength(); i += 1) {\\n\\t for (var j = 0; j < e.getLength(); j += 1) {\\n\\t\\tnum[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i) ) + QRMath.glog(e.getAt(j) ) );\\n\\t }\\n\\t}\\n\\n\\treturn qrPolynomial(num, 0);\\n };\\n\\n _this.mod = function(e) {\\n\\n\\tif (_this.getLength() - e.getLength() < 0) {\\n\\t return _this;\\n\\t}\\n\\n\\tvar ratio = QRMath.glog(_this.getAt(0) ) - QRMath.glog(e.getAt(0) );\\n\\n\\tvar num = new Array(_this.getLength() );\\n\\tfor (var i = 0; i < _this.getLength(); i += 1) {\\n\\t num[i] = _this.getAt(i);\\n\\t}\\n\\n\\tfor (var i = 0; i < e.getLength(); i += 1) {\\n\\t num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i) ) + ratio);\\n\\t}\\n\\n\\t// recursive call\\n\\treturn qrPolynomial(num, 0).mod(e);\\n };\\n\\n return _this;\\n};\\n\\n//---------------------------------------------------------------------\\n// QRRSBlock\\n//---------------------------------------------------------------------\\n\\nvar QRRSBlock = function() {\\n\\n\\n // [1: [L, M, Q, H], ..]\\n var 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]];\\n\\n var qrRSBlock = function(totalCount, dataCount) {\\n\\tvar _this = {};\\n\\t_this.totalCount = totalCount;\\n\\t_this.dataCount = dataCount;\\n\\treturn _this;\\n };\\n\\n var _this = {};\\n\\n var getRsBlockTable = function(typeNumber, errorCorrectLevel) {\\n\\n\\tswitch(errorCorrectLevel) {\\n\\t case QRErrorCorrectLevel.L :\\n\\t\\treturn RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];\\n\\t case QRErrorCorrectLevel.M :\\n\\t\\treturn RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];\\n\\t case QRErrorCorrectLevel.Q :\\n\\t\\treturn RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];\\n\\t case QRErrorCorrectLevel.H :\\n\\t\\treturn RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];\\n\\t\\tdefault :\\n\\t\\treturn undefined;\\n\\t}\\n };\\n\\n _this.getRSBlocks = function(typeNumber, errorCorrectLevel) {\\n\\n\\tvar rsBlock = getRsBlockTable(typeNumber, errorCorrectLevel);\\n\\n\\tif (typeof rsBlock == 'undefined') {\\n\\t throw new Error('bad rs block @ typeNumber:' + typeNumber +\\n\\t\\t\\t '/errorCorrectLevel:' + errorCorrectLevel);\\n\\t}\\n\\n\\tvar length = rsBlock.length / 3;\\n\\n\\tvar list = new Array();\\n\\n\\tfor (var i = 0; i < length; i += 1) {\\n\\n\\t var count = rsBlock[i * 3 + 0];\\n\\t var totalCount = rsBlock[i * 3 + 1];\\n\\t var dataCount = rsBlock[i * 3 + 2];\\n\\n\\t for (var j = 0; j < count; j += 1) {\\n\\t\\tlist.push(qrRSBlock(totalCount, dataCount) );\\n\\t }\\n\\t}\\n\\n\\treturn list;\\n };\\n\\n return _this;\\n}();\\n\\n//---------------------------------------------------------------------\\n// qrBitBuffer\\n//---------------------------------------------------------------------\\n\\nvar qrBitBuffer = function() {\\n\\n var _buffer = new Array();\\n var _length = 0;\\n\\n var _this = {};\\n\\n _this.getBuffer = function() {\\n\\treturn _buffer;\\n };\\n\\n _this.getAt = function(index) {\\n\\tvar bufIndex = Math.floor(index / 8);\\n\\treturn ( (_buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1;\\n };\\n\\n _this.put = function(num, length) {\\n\\tfor (var i = 0; i < length; i += 1) {\\n\\t _this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1);\\n\\t}\\n };\\n\\n _this.getLengthInBits = function() {\\n\\treturn _length;\\n };\\n\\n _this.putBit = function(bit) {\\n\\n\\tvar bufIndex = Math.floor(_length / 8);\\n\\tif (_buffer.length <= bufIndex) {\\n\\t _buffer.push(0);\\n\\t}\\n\\n\\tif (bit) {\\n\\t _buffer[bufIndex] |= (0x80 >>> (_length % 8) );\\n\\t}\\n\\n\\t_length += 1;\\n };\\n\\n return _this;\\n};\\n\\n//---------------------------------------------------------------------\\n// qr8BitByte\\n//---------------------------------------------------------------------\\n\\nvar qr8BitByte = function(data) {\\n\\n var _mode = QRMode.MODE_8BIT_BYTE;\\n var _data = data;\\n var _parsedData = [];\\n\\n var _this = {};\\n\\n\\n // Added to support UTF-8 Characters\\n for (var i = 0, l = _data.length; i < l; i++) {\\n\\tvar byteArray = [];\\n\\tvar code = _data.charCodeAt(i);\\n\\n\\tif (code > 0x10000) {\\n\\t byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);\\n\\t byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);\\n\\t byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);\\n\\t byteArray[3] = 0x80 | (code & 0x3F);\\n\\t} else if (code > 0x800) {\\n\\t byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);\\n\\t byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);\\n\\t byteArray[2] = 0x80 | (code & 0x3F);\\n\\t} else if (code > 0x80) {\\n\\t byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);\\n\\t byteArray[1] = 0x80 | (code & 0x3F);\\n\\t} else {\\n\\t byteArray[0] = code;\\n\\t}\\n\\n // Fix Unicode corruption bug\\n _parsedData.push(byteArray);\\n }\\n\\n _parsedData = Array.prototype.concat.apply([], _parsedData);\\n\\n if (_parsedData.length != _data.length) {\\n\\t_parsedData.unshift(191);\\n\\t_parsedData.unshift(187);\\n\\t_parsedData.unshift(239);\\n }\\n\\n var _bytes = _parsedData;\\n\\n _this.getMode = function() {\\n\\treturn _mode;\\n };\\n\\n _this.getLength = function(buffer) {\\n\\treturn _bytes.length;\\n };\\n\\n _this.write = function(buffer) {\\n\\tfor (var i = 0; i < _bytes.length; i += 1) {\\n\\t buffer.put(_bytes[i], 8);\\n\\t}\\n };\\n\\n return _this;\\n};\\n\\n//=====================================================================\\n// GIF Support etc.\\n//\\n\\n//---------------------------------------------------------------------\\n// byteArrayOutputStream\\n//---------------------------------------------------------------------\\n\\nvar byteArrayOutputStream = function() {\\n\\n var _bytes = new Array();\\n\\n var _this = {};\\n\\n _this.writeByte = function(b) {\\n\\t_bytes.push(b & 0xff);\\n };\\n\\n _this.writeShort = function(i) {\\n\\t_this.writeByte(i);\\n\\t_this.writeByte(i >>> 8);\\n };\\n\\n _this.writeBytes = function(b, off, len) {\\n\\toff = off || 0;\\n\\tlen = len || b.length;\\n\\tfor (var i = 0; i < len; i += 1) {\\n\\t _this.writeByte(b[i + off]);\\n\\t}\\n };\\n\\n _this.writeString = function(s) {\\n\\tfor (var i = 0; i < s.length; i += 1) {\\n\\t _this.writeByte(s.charCodeAt(i) );\\n\\t}\\n };\\n\\n _this.toByteArray = function() {\\n\\treturn _bytes;\\n };\\n\\n _this.toString = function() {\\n\\tvar s = '';\\n\\ts += '[';\\n\\tfor (var i = 0; i < _bytes.length; i += 1) {\\n\\t if (i > 0) {\\n\\t\\ts += ',';\\n\\t }\\n\\t s += _bytes[i];\\n\\t}\\n\\ts += ']';\\n\\treturn s;\\n };\\n\\n return _this;\\n};\\n\\n//---------------------------------------------------------------------\\n// base64EncodeOutputStream\\n//---------------------------------------------------------------------\\n\\nvar base64EncodeOutputStream = function() {\\n\\n var _buffer = 0;\\n var _buflen = 0;\\n var _length = 0;\\n var _base64 = '';\\n\\n var _this = {};\\n\\n var writeEncoded = function(b) {\\n\\t_base64 += String.fromCharCode(encode(b & 0x3f) );\\n };\\n\\n var encode = function(n) {\\n\\tif (n < 0) {\\n\\t // error.\\n\\t} else if (n < 26) {\\n\\t return 0x41 + n;\\n\\t} else if (n < 52) {\\n\\t return 0x61 + (n - 26);\\n\\t} else if (n < 62) {\\n\\t return 0x30 + (n - 52);\\n\\t} else if (n == 62) {\\n\\t return 0x2b;\\n\\t} else if (n == 63) {\\n\\t return 0x2f;\\n\\t}\\n\\tthrow new Error('n:' + n);\\n };\\n\\n _this.writeByte = function(n) {\\n\\n\\t_buffer = (_buffer << 8) | (n & 0xff);\\n\\t_buflen += 8;\\n\\t_length += 1;\\n\\n\\twhile (_buflen >= 6) {\\n\\t writeEncoded(_buffer >>> (_buflen - 6) );\\n\\t _buflen -= 6;\\n\\t}\\n };\\n\\n _this.flush = function() {\\n\\n\\tif (_buflen > 0) {\\n\\t writeEncoded(_buffer << (6 - _buflen) );\\n\\t _buffer = 0;\\n\\t _buflen = 0;\\n\\t}\\n\\n\\tif (_length % 3 != 0) {\\n\\t // padding\\n\\t var padlen = 3 - _length % 3;\\n\\t for (var i = 0; i < padlen; i += 1) {\\n\\t\\t_base64 += '=';\\n\\t }\\n\\t}\\n };\\n\\n _this.toString = function() {\\n\\treturn _base64;\\n };\\n\\n return _this;\\n};\\n\\n//---------------------------------------------------------------------\\n// base64DecodeInputStream\\n//---------------------------------------------------------------------\\n\\nvar base64DecodeInputStream = function(str) {\\n\\n var _str = str;\\n var _pos = 0;\\n var _buffer = 0;\\n var _buflen = 0;\\n\\n var _this = {};\\n\\n _this.read = function() {\\n\\n\\twhile (_buflen < 8) {\\n\\n\\t if (_pos >= _str.length) {\\n\\t\\tif (_buflen == 0) {\\n\\t\\t return -1;\\n\\t\\t}\\n\\t\\tthrow new Error('unexpected end of file./' + _buflen);\\n\\t }\\n\\n\\t var c = _str.charAt(_pos);\\n\\t _pos += 1;\\n\\n\\t if (c == '=') {\\n\\t\\t_buflen = 0;\\n\\t\\treturn -1;\\n\\t } else if (c.match(/^\\\\s$/) ) {\\n\\t\\t// ignore if whitespace.\\n\\t\\tcontinue;\\n\\t }\\n\\n\\t _buffer = (_buffer << 6) | decode(c.charCodeAt(0) );\\n\\t _buflen += 6;\\n\\t}\\n\\n\\tvar n = (_buffer >>> (_buflen - 8) ) & 0xff;\\n\\t_buflen -= 8;\\n\\treturn n;\\n };\\n\\n var decode = function(c) {\\n\\tif (0x41 <= c && c <= 0x5a) {\\n\\t return c - 0x41;\\n\\t} else if (0x61 <= c && c <= 0x7a) {\\n\\t return c - 0x61 + 26;\\n\\t} else if (0x30 <= c && c <= 0x39) {\\n\\t return c - 0x30 + 52;\\n\\t} else if (c == 0x2b) {\\n\\t return 62;\\n\\t} else if (c == 0x2f) {\\n\\t return 63;\\n\\t} else {\\n\\t throw new Error('c:' + c);\\n\\t}\\n };\\n\\n return _this;\\n};\\n\\n//---------------------------------------------------------------------\\n// gifImage (B/W)\\n//---------------------------------------------------------------------\\n\\nvar gifImage = function(width, height) {\\n\\n var _width = width;\\n var _height = height;\\n var _data = new Array(width * height);\\n\\n var _this = {};\\n\\n _this.setPixel = function(x, y, pixel) {\\n\\t_data[y * _width + x] = pixel;\\n };\\n\\n _this.write = function(out) {\\n\\n\\t//---------------------------------\\n\\t// GIF Signature\\n\\n\\tout.writeString('GIF87a');\\n\\n\\t//---------------------------------\\n\\t// Screen Descriptor\\n\\n\\tout.writeShort(_width);\\n\\tout.writeShort(_height);\\n\\n\\tout.writeByte(0x80); // 2bit\\n\\tout.writeByte(0);\\n\\tout.writeByte(0);\\n\\n\\t//---------------------------------\\n\\t// Global Color Map\\n\\n\\t// black\\n\\tout.writeByte(0x00);\\n\\tout.writeByte(0x00);\\n\\tout.writeByte(0x00);\\n\\n\\t// white\\n\\tout.writeByte(0xff);\\n\\tout.writeByte(0xff);\\n\\tout.writeByte(0xff);\\n\\n\\t//---------------------------------\\n\\t// Image Descriptor\\n\\n\\tout.writeString(',');\\n\\tout.writeShort(0);\\n\\tout.writeShort(0);\\n\\tout.writeShort(_width);\\n\\tout.writeShort(_height);\\n\\tout.writeByte(0);\\n\\n\\t//---------------------------------\\n\\t// Local Color Map\\n\\n\\t//---------------------------------\\n\\t// Raster Data\\n\\n\\tvar lzwMinCodeSize = 2;\\n\\tvar raster = getLZWRaster(lzwMinCodeSize);\\n\\n\\tout.writeByte(lzwMinCodeSize);\\n\\n\\tvar offset = 0;\\n\\n\\twhile (raster.length - offset > 255) {\\n\\t out.writeByte(255);\\n\\t out.writeBytes(raster, offset, 255);\\n\\t offset += 255;\\n\\t}\\n\\n\\tout.writeByte(raster.length - offset);\\n\\tout.writeBytes(raster, offset, raster.length - offset);\\n\\tou