-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
256 lines (217 loc) · 7.49 KB
/
index.html
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Annexe d'Identité</title>
<link rel="icon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🍒</text></svg>">
<link rel="stylesheet" href="https://d4llo.github.io/CatTag/scotch.min.css">
<style>
* {
box-sizing: border-box;
}
body {
font-family: Arial, Helvetica, Sans-Serif;
}
.card {
font-size: 12px;
width: 85.6mm;
height: 53.98mm;
position: relative;
background-color: white;
line-height: 1;
}
.card:after {
content: '';
position: absolute;
top: 2mm;
right: 2mm;
width: 15mm;
height: 15mm;
pointer-events: none;
background-repeat: no-repeat;
z-index: 99;
background-size: 15mm;
}
.solidaires .card:after {
background-image: url("https://raw.githubusercontent.com/D4llo/CatTag/main/logo_solidaires.svg");
background-size: 25mm;
width: 25mm;
height: 15mm;
}
.cgt .card:after {
background-image: url("https://www.cgt.fr/favicons/apple-icon-152x152.png")
}
.fsu .card:after {
background-image: url("https://fsu.fr/wp-content/uploads/2019/04/fav_fsu114.jpg")
}
.attac .card:after {
background-image: url("https://france.attac.org/squelettes/favicons/apple-touch-icon-152x152.png")
}
.ldh .card:after {
background-image: url("https://www.ldh-france.org/wp-content/themes/ldh2018/library/images/apple-icon-touch.png")
}
.card th {
text-align: right;
width: 33%;
}
.card th,
.card td {
padding: 4px;
vertical-align: middle;
}
.card input {
width: 100%;
margin-right: 1px;
margin-bottom: 1px;
padding: 1px;
}
.card table {
position: absolute;
bottom: 0;
}
.card tbody tr:nth-child(2n) {
background-color: inherit;
}
.cards_wrapper {
display: grid;
place-items: center;
}
#cards {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 2px;
background: black;
border: 2px solid black;
}
@media print {
/* https://stackoverflow.com/a/356123/1248177 */
.no-print,
.no-print * {
display: none !important;
}
/* https://stackoverflow.com/questions/21485581/css-hide-placeholder-on-print */
::-webkit-input-placeholder {
/* WebKit browsers */
color: transparent;
}
:-moz-placeholder {
/* Mozilla Firefox 4 to 18 */
color: transparent;
}
::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: transparent;
}
:-ms-input-placeholder {
/* Internet Explorer 10+ */
color: transparent;
}
input {
border: 0 !important;
border-style: none !important;
border-bottom: 1px solid #000!important;
border-radius: 0!important;
}
/* https://stackoverflow.com/questions/6670151/how-can-i-force-browsers-to-print-background-images-in-css */
* {
-webkit-print-color-adjust: exact !important;
/* Chrome, Safari 6 – 15.3, Edge */
color-adjust: exact !important;
/* Firefox 48 – 96 */
print-color-adjust: exact !important;
/* Firefox 97+, Safari 15.4+ */
}
}
</style>
</head>
<body>
<header class="no-print" style="display: grid; place-items: center;">
<h1>Annexe d'Identité</h1>
</header>
<div class="no-print">
<label for="organization">Sélectionner une organisation</label>
<select name="organization" id="organization">
<option value="solidaires">Solidaires</option>
<option value="cgt">CGT</option>
<option value="fsu">FSU</option>
<option value="attac">Attac</option>
<option value="ldh">LDH</option>
</select>
<label for="synchronize">Synchroniser avec la 1<sup>ère</sup> carte</label><br>
<button typ="button" name="synchronize" id="synchronize">Synchroniser</button><br>
<div style="display: grid; place-items: center;">
<button typ="button" id="print" name="print">Imprimer</button>
</div>
<hr>
</div>
<div class="cards_wrapper">
<div id="cards" class="solidaires">
<div class="card">
<table>
<tbody>
<tr>
<th>Groupe sanguin</th>
<td><input type="text" placeholder="A+" style="display: inline-block; width: 50%;"></td>
</tr>
<tr>
<th>Prénom</th>
<td><input type="text" placeholder="Manu"></td>
</tr>
<tr>
<th>Nom</th>
<td><input type="text" placeholder="Macron"></td>
</tr>
<tr>
<th>Allergies</th>
<td><input type="text" placeholder="Démocratie"></td>
</tr>
<tr>
<th>Traitement</th>
<td><input type="text" placeholder="Paracétamol"></td>
</tr>
<tr>
<th>Avocat·e</th>
<td><input type="text" placeholder="Dupond-Moretti 0821061973"></td>
</tr>
<tr>
<th>Contact</th>
<td><input type="text" placeholder="Brigitte 062106"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<footer style="text-align: center">
Fait avec ✊ par <a href="https://solidairesinformatique.org/">Solidaires Informatique</a>
</footer>
<script>
const wrapper = document.querySelector('#cards');
document.querySelector("#organization").onclick = (e) => {
const option = e.target.value;
resetLogo(option);
}
const resetLogo = (logo) => {
wrapper.classList.value = "";
wrapper.classList.add(logo);
}
document.querySelector("#print").onclick = () => {
window.print();
}
document.querySelector("#synchronize").onclick = () => {
const heads = Array.from(document.querySelectorAll(".card:first-child input")).map(x => x.value);
const tail = document.querySelectorAll(".card:not(:first-child) input");
tail.forEach((input, i) => {
input.value = heads[i % heads.length]
})
}
const cardHtml = document.querySelector('.card').outerHTML;
for(let i = 0; i < 7; i++) {
wrapper.innerHTML += cardHtml;
}
</script>
</body>
</html>