No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
img.src = url; | img.src = url; | ||
const footer = document.querySelector(" | const footer = document.querySelector(".mw-body-footer"); | ||
footer.appendChild(img); | footer.appendChild(img); | ||
}).catch(console.error); | }).catch(console.error); |
Revision as of 14:21, 20 February 2023
/* Any JavaScript here will be loaded for all users on every page load. */
(function () {
const libQR = document.createElement("script");
libQR.addEventListener("load", function () {
QRCode.toDataURL(location.href).then(function (url) {
const img = document.createElement("img");
img.style.maxWidth = "100%";
img.style.height = "auto";
img.style.display = "block";
img.style.clear = "both";
img.style.margin = "auto";
img.title = "QR code for this page";
img.src = url;
const footer = document.querySelector(".mw-body-footer");
footer.appendChild(img);
}).catch(console.error);
});
libQR.src = "https://cdn.jsdelivr.net/npm/qrcode@1.4.4/build/qrcode.min.js";
document.body.appendChild(libQR);
})();