-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
72 lines (72 loc) · 2.88 KB
/
index.html
File metadata and controls
72 lines (72 loc) · 2.88 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A simple, fast QR code generator. Create QR codes instantly for URLs, text, WiFi, SEPA, PayPal and more.">
<meta name="author" content="Jan-Stefan (GottZ) Janetzky">
<meta name="keywords" content="QR, QR Code, Generator, QRCode Generator, QR Code Generator, PayPal, SEPA, GiroCode">
<meta name="color-scheme" content="dark light">
<meta name="theme-color" content="#24a33c" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#3cb856" media="(prefers-color-scheme: dark)">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="QR Generator">
<link rel="manifest" href="./manifest.json">
<link rel="apple-touch-icon" href="./icons/icon-192.png">
<title>QR Generator</title>
<link rel="stylesheet" href="./style.css">
<script src="./ce.js"></script>
<script src="./qrcode.js"></script>
</head>
<body>
<noscript>
<div class="container">
<div class="card" style="text-align: center; padding: 40px;">
<h1>JavaScript Required</h1>
<p>This QR generator runs entirely in your browser and requires JavaScript to function.</p>
</div>
</div>
</noscript>
<script src="./script.js"></script>
<script>
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("./sw.js").catch(() => {});
let _ut;
navigator.serviceWorker.addEventListener("message", (e) => {
if (e.data?.type !== "UPDATE_AVAILABLE") return;
clearTimeout(_ut);
_ut = setTimeout(() => {
if (document.querySelector(".update-toast")) return;
const t = ce("div.update-toast", document.body);
ce("span", t, { textContent: "Update available" });
const b = ce("button", t, { textContent: "Reload" });
b.addEventListener("click", () => location.reload());
}, 500);
});
}
// Install prompt
let _ip;
window.addEventListener("beforeinstallprompt", (e) => {
e.preventDefault();
_ip = e;
if (document.querySelector(".install-toast")) return;
const t = ce("div.install-toast", document.body);
ce("span", t, { textContent: "Install as app" });
const b = ce("button", t, { textContent: "Install" });
b.addEventListener("click", async () => {
t.remove();
_ip.prompt();
await _ip.userChoice;
_ip = null;
});
const d = ce("button.dismiss", t, { textContent: "\u00d7" });
d.addEventListener("click", () => t.remove());
});
window.addEventListener("appinstalled", () => {
_ip = null;
document.querySelector(".install-toast")?.remove();
});
</script>
</body>
</html>