annotate index.html @ 14:1fbe0b098f0f

Adjust styling - max 256px - 8px padding - plain line instead of hr (more precise margin)
author nanaya <me@nanaya.net>
date Wed, 11 Sep 2024 21:27:58 +0900
parents a8e0607093f3
children d6a6c128cd5a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
1 <!doctype html>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
2 <head>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
3 <meta charset="utf-8">
5
461c6e7dea56 Better mobile handling
nanaya <me@myconan.net>
parents: 4
diff changeset
4 <meta name="viewport" content="width=device-width, initial-scale=1.0">
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
5 <title>QR Code Generator</title>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
6
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
7 <style type="text/css">
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
8 * {
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
9 box-sizing: border-box;
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
10 }
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
11
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
12 html {
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
13 height: 100%;
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
14 margin: 0;
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
15 padding: 0;
7
896b7f28d3ad Fix styles
nanaya <me@nanaya.pro>
parents: 5
diff changeset
16 font-family: Arial, sans-serif;
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
17 font-size: 12px;
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
18 }
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
19
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
20 body {
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
21 margin: 0;
14
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
22 padding: 8px;
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
23 height: 100%;
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
24 }
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
25
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
26 .inputbox {
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
27 width: 100%;
14
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
28 margin-bottom: 8px;
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
29 resize: vertical;
7
896b7f28d3ad Fix styles
nanaya <me@nanaya.pro>
parents: 5
diff changeset
30 font-family: Courier New, monospace;
5
461c6e7dea56 Better mobile handling
nanaya <me@myconan.net>
parents: 4
diff changeset
31 /* prevent ios zoom */
461c6e7dea56 Better mobile handling
nanaya <me@myconan.net>
parents: 4
diff changeset
32 font-size: 16px;
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
33 }
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
34
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
35 .page {
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
36 width: 100%;
7
896b7f28d3ad Fix styles
nanaya <me@nanaya.pro>
parents: 5
diff changeset
37 min-height: 100%;
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
38 max-width: 600px;
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
39 margin: 0 auto;
14
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
40 display: grid;
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
41 grid-template-rows: 1fr auto;
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
42 gap: 8px;
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
43 }
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
44
14
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
45 .page__footer {
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
46 border-top: 1px solid #333;
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
47 padding-top: 8px;
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
48 }
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
49
1
30cd1768611b Hide when box is empty
nanaya <me@myconan.net>
parents: 0
diff changeset
50 .outputbox {
14
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
51 max-width: 256px;
1
30cd1768611b Hide when box is empty
nanaya <me@myconan.net>
parents: 0
diff changeset
52 }
30cd1768611b Hide when box is empty
nanaya <me@myconan.net>
parents: 0
diff changeset
53
11
70cfc091b2aa Less oversized things
nanaya <me@nanaya.pro>
parents: 10
diff changeset
54 .outputbox > canvas {
70cfc091b2aa Less oversized things
nanaya <me@nanaya.pro>
parents: 10
diff changeset
55 display: none;
70cfc091b2aa Less oversized things
nanaya <me@nanaya.pro>
parents: 10
diff changeset
56 }
70cfc091b2aa Less oversized things
nanaya <me@nanaya.pro>
parents: 10
diff changeset
57
10
09146b1bfb65 Large code
nanaya <me@nanaya.pro>
parents: 9
diff changeset
58 .outputbox > img {
09146b1bfb65 Large code
nanaya <me@nanaya.pro>
parents: 9
diff changeset
59 max-width: 100%;
09146b1bfb65 Large code
nanaya <me@nanaya.pro>
parents: 9
diff changeset
60 }
09146b1bfb65 Large code
nanaya <me@nanaya.pro>
parents: 9
diff changeset
61
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
62 .title {
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
63 font-size: 16px;
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
64 }
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
65 </style>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
66 </head>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
67 <body>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
68 <div class="page">
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
69 <div class="page__main">
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
70 <h1>QR Code Generator</h1>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
71
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
72 <p>
2
f27dbbc6e978 Now with debounce
nanaya <me@myconan.net>
parents: 1
diff changeset
73 Type something and get its QR code (almost) immediately.
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
74 </p>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
75
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
76 <textarea class="inputbox js-qr-input" rows="4" autofocus></textarea>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
77
1
30cd1768611b Hide when box is empty
nanaya <me@myconan.net>
parents: 0
diff changeset
78 <div class="outputbox js-qr-output"></div>
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
79 </div>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
80
14
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
81 <div class="page__footer">
12
a8e0607093f3 Fix url
nanaya <me@nanaya.pro>
parents: 11
diff changeset
82 <a href="https://hg.sr.ht/~nanaya/qr-html">Source</a>
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
83 </div>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
84 </div>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
85
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
86 <script src="qrcode.min.js"></script>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
87
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
88 <script>
9
5998f1f51877 Simplify selector
nanaya <me@nanaya.pro>
parents: 8
diff changeset
89 var inputDom = document.querySelector(".js-qr-input")
5998f1f51877 Simplify selector
nanaya <me@nanaya.pro>
parents: 8
diff changeset
90 var outputDom = document.querySelector(".js-qr-output")
14
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
91 var qr = new QRCode(outputDom, { correctLevel: QRCode.CorrectLevel.L, width: 256, height: 256 })
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
92
4
cc0a5142a56f Now without lodash
nanaya <me@myconan.net>
parents: 3
diff changeset
93 var runTimeout = null
cc0a5142a56f Now without lodash
nanaya <me@myconan.net>
parents: 3
diff changeset
94
3
6875be47fb24 Now with less jquery
nanaya <me@myconan.net>
parents: 2
diff changeset
95 var refreshCode = function() {
6875be47fb24 Now with less jquery
nanaya <me@myconan.net>
parents: 2
diff changeset
96 var text = inputDom.value
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
97
14
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
98 if (text === "") {
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
99 outputDom.style.display = 'none';
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
100 } else {
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
101 outputDom.style.display = 'block';
2
f27dbbc6e978 Now with debounce
nanaya <me@myconan.net>
parents: 1
diff changeset
102 qr.makeCode(text)
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
103 }
2
f27dbbc6e978 Now with debounce
nanaya <me@myconan.net>
parents: 1
diff changeset
104 }
f27dbbc6e978 Now with debounce
nanaya <me@myconan.net>
parents: 1
diff changeset
105
14
1fbe0b098f0f Adjust styling
nanaya <me@nanaya.net>
parents: 12
diff changeset
106 inputDom.addEventListener('input', refreshCode)
3
6875be47fb24 Now with less jquery
nanaya <me@myconan.net>
parents: 2
diff changeset
107 refreshCode()
0
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
108 </script>
6b5cab0b3f91 Initial
nanaya <me@myconan.net>
parents:
diff changeset
109 </body>