1function QRCodeGenerator(element, qrcode_object) { 2 if (element == undefined || typeof qrcode_object.url == undefined) { return; } 3 console.log(element, qrcode_object); 4 5 let qrcode; 6 try { 7 // https://qr-code-styling.com 8 qrcode = new QRCodeStyling({ 9 width: qrcode_object.width, 10 height: qrcode_object.height, 11 margin: 0, 12 data: qrcode_object.url, 13 image: qrcode_object.logo, 14 imageOptions: { hideBackgroundDots: true, imageSize: 0.5, margin: 5 }, 15 qrOptions: { 16 typeNumber: "0", 17 mode: "Byte", 18 errorCorrectionLevel: "Q", 19 }, 20 dotsOptions: { 21 type: qrcode_object.dotsType, 22 color: qrcode_object.darkcolor, 23 }, 24 dotsOptionsHelper: { 25 colorType: { single: true, gradient: false }, 26 gradient: { 27 linear: true, 28 radial: false, 29 color1: qrcode_object.darkcolor, 30 color2: qrcode_object.darkcolor, 31 rotation: "0", 32 }, 33 }, 34 cornersSquareOptions: { 35 type: qrcode_object.cornersSquareType, 36 color: qrcode_object.darkcolor, 37 }, 38 cornersSquareOptionsHelper: { 39 colorType: { single: true, gradient: false }, 40 gradient: { 41 linear: true, 42 radial: false, 43 color1: qrcode_object.darkcolor, 44 color2: qrcode_object.darkcolor, 45 rotation: "0", 46 }, 47 }, 48 cornersDotOptions: { 49 type: qrcode_object.cornersDotType, 50 color: qrcode_object.darkcolor, 51 }, 52 cornersDotOptionsHelper: { 53 colorType: { single: true, gradient: false }, 54 gradient: { 55 linear: true, 56 radial: false, 57 color1: qrcode_object.darkcolor, 58 color2: qrcode_object.darkcolor, 59 rotation: "0", 60 }, 61 }, 62 backgroundOptions: { color: qrcode_object.backgroundcolor }, 63 backgroundOptionsHelper: { 64 colorType: { single: true, gradient: false }, 65 gradient: { 66 linear: true, 67 radial: false, 68 color1: qrcode_object.backgroundcolor, 69 color2: qrcode_object.backgroundcolor, 70 rotation: "0", 71 }, 72 }, 73 }); 74 console.log("qrcode", qrcode); 75 let b64 = null; 76 // // https://github.com/kozakdenys/qr-code-styling/blob/master/README.md#qrcodestyling-methods 77 // qrcode.append(element); 78 // https://github.com/kozakdenys/qr-code-styling/blob/master/README.md#qrcodestyling-methods 79 qrcode.getRawData("png").then((blob) => { 80 var reader = new FileReader(); 81 reader.readAsDataURL(blob); 82 return new Promise((resolve) => { 83 reader.onloadend = function () { 84 b64 = reader.result; 85 // console.log(b64); 86 var img = document.createElement("img"); 87 img.src = b64; 88 // console.log("element", element); 89 // return resolve(element.appendChild(img)); 90 91 var html = `<a href="${qrcode_object.url}" target="_blank"><img src="${img.src}" alt="QR Code" width="150" height="150" /></a>`; 92 // element.innerHTML = html; 93 // console.log("element", element); 94 95 element.html(html); 96 console.log("QR Code", element); 97 return resolve(element); 98 }; 99 }); 100 }); 101 } catch (error) { 102 console.log(error); 103 qrcode = document.createElement("img"); 104 qrcode.src = 105 "https://emailreceipts.io/qr?d=150&t=" + encodeURI(qrcode_object.url); 106 // qrcode.width = "150px"; 107 // qrcode.height = "150px"; 108 // // element.appendChild(qrcode); 109 // element.html(qrcode); 110 111 var html = `<a href="${qrcode_object.url}" target="_blank"><img src="${qrcode.src}" alt="QR Code" width="150" height="150" /></a>`; 112 // element.innerHTML = html; 113 // console.log("element", element); 114 115 element.html(html); 116 console.log("QR Code", element); 117 } 118}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.