-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqrapp.min.js.map
7 lines (7 loc) · 11.2 KB
/
qrapp.min.js.map
1
2
3
4
5
6
7
{
"version": 3,
"sources": ["qrapp.js"],
"sourcesContent": ["/* \n * QR Code generator demo (JavaScript)\n * \n * Copyright (c) Project Nayuki. (MIT License)\n * https://www.nayuki.io/page/qr-code-generator-library\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n * - The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * - The Software is provided \"as is\", without warranty of any kind, express or\n * implied, including but not limited to the warranties of merchantability,\n * fitness for a particular purpose and noninfringement. In no event shall the\n * authors or copyright holders be liable for any claim, damages or other\n * liability, whether in an action of contract, tort or otherwise, arising from,\n * out of or in connection with the Software or the use or other dealings in the\n * Software.\n */\n\n\"use strict\";\nvar app = new function() {\n\n\tfunction initialize() {\n\t\tvar elems = document.querySelectorAll(\"input[type=number], textarea\");\n\t\tfor (var i = 0; i < elems.length; i++) {\n\t\t\tif (elems[i].id.indexOf(\"version-\") != 0)\n\t\t\t\telems[i].oninput = redrawQrCode;\n\t\t}\n\t\telems = document.querySelectorAll(\"input[type=radio], input[type=checkbox]\");\n\t\tfor (var i = 0; i < elems.length; i++)\n\t\t\telems[i].onchange = redrawQrCode;\n\t\tredrawQrCode();\n\t}\n\n\n\tfunction redrawQrCode() {\n\t\t// Show/hide rows based on bitmap/vector image output\n\t\tvar bitmapOutput = document.getElementById(\"output-format-bitmap\").checked;\n\t\tvar scaleRow = document.getElementById(\"scale-row\");\n\t\tvar svgXmlRow = document.getElementById(\"svg-xml-row\");\n\t\tif (bitmapOutput) {\n\t\t\tscaleRow.style.removeProperty(\"display\");\n\t\t\tsvgXmlRow.style.display = \"none\";\n\t\t} else {\n\t\t\tscaleRow.style.display = \"none\";\n\t\t\tsvgXmlRow.style.removeProperty(\"display\");\n\t\t}\n\t\tvar svgXml = document.getElementById(\"svg-xml-output\");\n\t\tsvgXml.value = \"\";\n\n\t\t// Reset output images in case of early termination\n\t\tvar canvas = document.getElementById(\"qrcode-canvas\");\n\t\tvar svg = document.getElementById(\"qrcode-svg\");\n\t\tcanvas.style.display = \"none\";\n\t\tsvg.style.display = \"none\";\n\n\t\t// Returns a QrCode.Ecc object based on the radio buttons in the HTML form.\n\t\tfunction getInputErrorCorrectionLevel() {\n\t\t\tif (document.getElementById(\"errcorlvl-medium\").checked)\n\t\t\t\treturn window.qrgen.QrCode.Ecc.MEDIUM;\n\t\t\telse if (document.getElementById(\"errcorlvl-quartile\").checked)\n\t\t\t\treturn window.qrgen.QrCode.Ecc.QUARTILE;\n\t\t\telse if (document.getElementById(\"errcorlvl-high\").checked)\n\t\t\t\treturn window.qrgen.QrCode.Ecc.HIGH;\n\t\t\telse // In case no radio button is depressed\n\t\t\t\treturn window.qrgen.QrCode.Ecc.LOW;\n\t\t}\n\n\t\t// Get form inputs and compute QR Code\n\t\tvar ecl = getInputErrorCorrectionLevel();\n\t\tvar text = document.getElementById(\"text-input\").value;\n\t\tvar segs = window.qrgen.QrSegment.makeSegments(text);\n\t\tvar minVer = parseInt(document.getElementById(\"version-min-input\").value, 10);\n\t\tvar maxVer = parseInt(document.getElementById(\"version-max-input\").value, 10);\n\t\tvar mask = parseInt(document.getElementById(\"mask-input\").value, 10);\n\t\tvar boostEcc = document.getElementById(\"boost-ecc-input\").checked;\n\t\tvar qr = window.qrgen.QrCode.encodeSegments(segs, ecl, minVer, maxVer, mask, boostEcc);\n\n\t\t// Draw image output\n\t\tvar border = parseInt(document.getElementById(\"border-input\").value, 10);\n\t\tif (border < 0 || border > 100)\n\t\t\treturn;\n\t\tif (bitmapOutput) {\n\t\t\tvar scale = parseInt(document.getElementById(\"scale-input\").value, 10);\n\t\t\tif (scale <= 0 || scale > 30)\n\t\t\t\treturn;\n\t\t\tqr.drawCanvas(scale, border, canvas);\n\t\t\tcanvas.style.removeProperty(\"display\");\n\t\t} else {\n\t\t\tvar code = qr.toSvgString(border);\n\t\t\tsvg.setAttribute(\"viewBox\", / viewBox=\"([^\"]*)\"/.exec(code)[1]);\n\t\t\tsvg.querySelector(\"path\").setAttribute(\"d\", / d=\"([^\"]*)\"/.exec(code)[1]);\n\t\t\tsvg.style.removeProperty(\"display\");\n\t\t\tsvgXml.value = qr.toSvgString(border);\n\t\t}\n\n\t\t// Returns a string to describe the given list of segments.\n\t\tfunction describeSegments(segs) {\n\t\t\tif (segs.length == 0)\n\t\t\t\treturn \"none\";\n\t\t\telse if (segs.length == 1) {\n\t\t\t\tvar mode = segs[0].mode;\n\t\t\t\tvar Mode = window.qrgen.QrSegment.Mode;\n\t\t\t\tif (mode == Mode.NUMERIC) return \"numeric\";\n\t\t\t\tif (mode == Mode.ALPHANUMERIC) return \"alphanumeric\";\n\t\t\t\tif (mode == Mode.BYTE) return \"byte\";\n\t\t\t\tif (mode == Mode.KANJI) return \"kanji\";\n\t\t\t\treturn \"unknown\";\n\t\t\t} else\n\t\t\t\treturn \"multiple\";\n\t\t}\n\n\t\t// Returns the number of Unicode code points in the given UTF-16 string.\n\t\tfunction countUnicodeChars(str) {\n\t\t\tvar result = 0;\n\t\t\tfor (var i = 0; i < str.length; i++, result++) {\n\t\t\t\tvar c = str.charCodeAt(i);\n\t\t\t\tif (c < 0xD800 || c >= 0xE000)\n\t\t\t\t\tcontinue;\n\t\t\t\telse if (0xD800 <= c && c < 0xDC00 && i + 1 < str.length) { // High surrogate\n\t\t\t\t\ti++;\n\t\t\t\t\tvar d = str.charCodeAt(i);\n\t\t\t\t\tif (0xDC00 <= d && d < 0xE000) // Low surrogate\n\t\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tthrow \"Invalid UTF-16 string\";\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\t// Show the QR Code symbol's statistics as a string\n\t\tvar stats = \"QR Code version = \" + qr.version + \", \";\n\t\tstats += \"mask pattern = \" + qr.mask + \", \";\n\t\tstats += \"character count = \" + countUnicodeChars(text) + \",\\n\";\n\t\tstats += \"encoding mode = \" + describeSegments(segs) + \", \";\n\t\tstats += \"error correction = level \" + \"LMQH\".charAt(qr.errorCorrectionLevel.ordinal) + \", \";\n\t\tstats += \"data bits = \" + window.qrgen.QrSegment.getTotalBits(segs, qr.version) + \".\";\n\t\tdocument.getElementById(\"statistics-output\").textContent = stats;\n\t}\n\n\n\tthis.handleVersionMinMax = function(which) {\n\t\tvar minElem = document.getElementById(\"version-min-input\");\n\t\tvar maxElem = document.getElementById(\"version-max-input\");\n\t\tvar minVal = parseInt(minElem.value, 10);\n\t\tvar maxVal = parseInt(maxElem.value, 10);\n\t\tminVal = Math.max(Math.min(minVal, window.qrgen.QrCode.MAX_VERSION), window.qrgen.QrCode.MIN_VERSION);\n\t\tmaxVal = Math.max(Math.min(maxVal, window.qrgen.QrCode.MAX_VERSION), window.qrgen.QrCode.MIN_VERSION);\n\t\tif (which == \"min\" && minVal > maxVal)\n\t\t\tmaxVal = minVal;\n\t\telse if (which == \"max\" && maxVal < minVal)\n\t\t\tminVal = maxVal;\n\t\tminElem.value = minVal.toString();\n\t\tmaxElem.value = maxVal.toString();\n\t\tredrawQrCode();\n\t}\n\n\tinitialize();\n};\n\n\n(function(global, factory) {\n\t\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n\t\t\ttypeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t\t\t(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.qrapp = app));\n\t\t\t})(this, (function(exports) {\n\n\t\tObject.defineProperty(exports, '__esModule', {\n\t\t\tvalue: true\n\t\t});\n\t}));"],
"mappings": "aAwBA,IAAI,IAAM,IAAI,UAAW,CAExB,SAASA,GAAa,CAErB,QADIC,EAAQ,SAAS,iBAAiB,8BAA8B,EAC3DC,E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,MAAQ,GAAG,EACrG,GAAG,KAAO,SAASE,EAAS,CAE7B,OAAO,eAAeA,EAAS,aAAc,CAC5C,MAAO,EACR,CAAC,CACF,CAAE",
"names": ["initialize", "elems", "i", "redrawQrCode", "bitmapOutput", "scaleRow", "svgXmlRow", "svgXml", "canvas", "svg", "getInputErrorCorrectionLevel", "ecl", "text", "segs", "minVer", "maxVer", "mask", "boostEcc", "qr", "border", "scale", "code", "describeSegments", "mode", "Mode", "countUnicodeChars", "str", "result", "c", "d", "stats", "which", "minElem", "maxElem", "minVal", "maxVal", "global", "factory", "exports"]
}