@@ -0,0 +1,22 @@
|
||||
(function () {
|
||||
if (typeof QRCode === "undefined") return;
|
||||
|
||||
var nodes = document.querySelectorAll("[data-qr]");
|
||||
Array.prototype.forEach.call(nodes, function (el) {
|
||||
var text = (el.getAttribute("data-qr") || "").trim();
|
||||
if (!text) return;
|
||||
el.innerHTML = "";
|
||||
try {
|
||||
new QRCode(el, {
|
||||
text: text,
|
||||
width: 96,
|
||||
height: 96,
|
||||
colorDark: "#000000",
|
||||
colorLight: "#ffffff",
|
||||
correctLevel: QRCode.CorrectLevel.M,
|
||||
});
|
||||
} catch (err) {
|
||||
// ignore render errors; keep empty box
|
||||
}
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user