-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
29 lines (25 loc) · 931 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
document.addEventListener("DOMContentLoaded", function () {
// Get the query parameter from the URL
const params = new URLSearchParams(window.location.search);
const text = params.get("text");
console.log("Text received:", text);
if (text) {
if (text.trim() !== "") {
console.log("Generating QR code for:", text);
// Create the QR code
const qrcode = new QRCode(document.getElementById("qrcode"), {
text: text,
width: 250,
height: 250,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
});
console.log("QR code generated successfully!");
} else {
document.body.innerText = "The selected text is empty.";
}
} else {
document.body.innerText = "No text selected.";
}
});