|
|
@ -27,8 +27,8 @@
|
|
|
|
namespace app {
|
|
|
|
namespace app {
|
|
|
|
|
|
|
|
|
|
|
|
function initialize(): void {
|
|
|
|
function initialize(): void {
|
|
|
|
getElem("loading").style.display = "none";
|
|
|
|
getElem("loading").hidden = true;
|
|
|
|
getElem("loaded").style.removeProperty("display");
|
|
|
|
getElem("loaded").hidden = false;
|
|
|
|
let elems = document.querySelectorAll("input[type=number], input[type=text], textarea");
|
|
|
|
let elems = document.querySelectorAll("input[type=number], input[type=text], textarea");
|
|
|
|
for (let el of elems) {
|
|
|
|
for (let el of elems) {
|
|
|
|
if (el.id.indexOf("version-") != 0)
|
|
|
|
if (el.id.indexOf("version-") != 0)
|
|
|
@ -46,11 +46,10 @@ namespace app {
|
|
|
|
const bitmapOutput: boolean = getInput("output-format-bitmap").checked;
|
|
|
|
const bitmapOutput: boolean = getInput("output-format-bitmap").checked;
|
|
|
|
const scaleRow : HTMLElement = getElem("scale-row");
|
|
|
|
const scaleRow : HTMLElement = getElem("scale-row");
|
|
|
|
let download = getElem("download") as HTMLAnchorElement;
|
|
|
|
let download = getElem("download") as HTMLAnchorElement;
|
|
|
|
|
|
|
|
scaleRow.hidden = !bitmapOutput;
|
|
|
|
if (bitmapOutput) {
|
|
|
|
if (bitmapOutput) {
|
|
|
|
scaleRow.style.removeProperty("display");
|
|
|
|
|
|
|
|
download.download = "qr-code.png";
|
|
|
|
download.download = "qr-code.png";
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
scaleRow.style.display = "none";
|
|
|
|
|
|
|
|
download.download = "qr-code.svg";
|
|
|
|
download.download = "qr-code.svg";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
download.removeAttribute("href");
|
|
|
|
download.removeAttribute("href");
|
|
|
@ -58,7 +57,7 @@ namespace app {
|
|
|
|
// Reset output images in case of early termination
|
|
|
|
// Reset output images in case of early termination
|
|
|
|
const canvas = getElem("qrcode-canvas") as HTMLCanvasElement;
|
|
|
|
const canvas = getElem("qrcode-canvas") as HTMLCanvasElement;
|
|
|
|
const svg = (document.getElementById("qrcode-svg") as Element) as SVGElement;
|
|
|
|
const svg = (document.getElementById("qrcode-svg") as Element) as SVGElement;
|
|
|
|
canvas.style.display = "none";
|
|
|
|
canvas.hidden = true;
|
|
|
|
svg.style.display = "none";
|
|
|
|
svg.style.display = "none";
|
|
|
|
|
|
|
|
|
|
|
|
// Returns a QrCode.Ecc object based on the radio buttons in the HTML form.
|
|
|
|
// Returns a QrCode.Ecc object based on the radio buttons in the HTML form.
|
|
|
@ -94,7 +93,7 @@ namespace app {
|
|
|
|
if (scale <= 0 || scale > 30)
|
|
|
|
if (scale <= 0 || scale > 30)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
drawCanvas(qr, scale, border, lightColor, darkColor, canvas);
|
|
|
|
drawCanvas(qr, scale, border, lightColor, darkColor, canvas);
|
|
|
|
canvas.style.removeProperty("display");
|
|
|
|
canvas.hidden = false;
|
|
|
|
download.href = canvas.toDataURL("image/png");
|
|
|
|
download.href = canvas.toDataURL("image/png");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const code: string = toSvgString(qr, border, lightColor, darkColor);
|
|
|
|
const code: string = toSvgString(qr, border, lightColor, darkColor);
|
|
|
|