-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest10.html
More file actions
567 lines (497 loc) · 45.9 KB
/
test10.html
File metadata and controls
567 lines (497 loc) · 45.9 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
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>iChat Liquid Final (Typing)</title>
<script src="https://unpkg.com/peerjs@1.4.7/dist/peerjs.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-body: #eef2f5;
--glass-bg: rgba(255, 255, 255, 0.65);
--glass-border: rgba(255, 255, 255, 0.5);
--text-main: #1d1d1f;
--text-sub: #86868b;
--primary: #007AFF;
--primary-grad: linear-gradient(135deg, #007AFF, #00C6FF);
--bubble-me: #007AFF;
--bubble-them: #ffffff;
--bubble-text-me: #ffffff;
--bubble-text-them: #1d1d1f;
--input-bg: rgba(255, 255, 255, 0.7);
--danger: #FF3B30;
--menu-bg: rgba(255, 255, 255, 0.85);
--badge-red: #FF3B30;
/* Blob Colors */
--blob-1: #a8c0ff;
--blob-2: #3f2b96;
--blob-3: #007AFF;
}
[data-theme="dark"] {
--bg-body: #0f0f12;
--glass-bg: rgba(30, 30, 35, 0.70);
--glass-border: rgba(255, 255, 255, 0.1);
--text-main: #f5f5f7;
--text-sub: #a1a1a6;
--primary: #0A84FF;
--bubble-me: #0A84FF;
--bubble-them: #2c2c2e;
--bubble-text-me: #ffffff;
--bubble-text-them: #ffffff;
--input-bg: rgba(44, 44, 46, 0.7);
--menu-bg: rgba(40, 40, 45, 0.9);
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; }
body {
background: var(--bg-body); height: 100vh; overflow: hidden;
display: flex; justify-content: center; align-items: center; transition: background 0.3s ease;
}
/* --- SCROLLBAR --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120, 120, 120, 0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 120, 120, 0.4); }
/* LIQUID BACKGROUND */
.liquid-bg { position: absolute; width: 100%; height: 100%; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.6; animation: float 25s infinite alternate; transition: background 0.5s ease; }
.orb:nth-child(1) { top: -10%; left: -10%; width: 60vw; height: 60vw; background: var(--blob-1); }
.orb:nth-child(2) { bottom: -20%; right: -10%; width: 50vw; height: 50vw; background: var(--blob-2); animation-delay: -5s; }
.orb:nth-child(3) { top: 40%; left: 40%; width: 30vw; height: 30vw; background: var(--blob-3); animation-delay: -10s; }
@keyframes float { 0% { transform: translate(0,0); } 100% { transform: translate(30px, -30px); } }
/* APP CONTAINER */
.app-container {
width: 95vw; height: 92vh; max-width: 1400px;
background: var(--glass-bg); backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
border: 1px solid var(--glass-border); border-radius: 24px;
box-shadow: 0 20px 60px rgba(0,0,0,0.1);
display: grid;
grid-template-columns: 300px 1fr 300px;
grid-template-rows: 100%;
overflow: hidden; position: relative;
transition: background 0.3s;
}
/* SIDEBARS */
.sidebar-left, .sidebar-right {
display: flex; flex-direction: column;
background: rgba(255,255,255,0.02);
border-right: 1px solid var(--glass-border);
border-left: 1px solid var(--glass-border);
overflow: hidden; height: 100%;
}
.sidebar-right { border-left: 1px solid var(--glass-border); border-right: none; }
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0; }
/* WIDGETS */
.widget-zone {
padding: 15px; display: flex; flex-direction: column; gap: 15px;
min-height: 80px; flex-shrink: 0; transition: 0.3s;
}
body.editing .widget-zone { background: rgba(0, 122, 255, 0.05); border: 2px dashed var(--primary); border-radius: 12px; margin: 10px; }
.widget-card { background: var(--input-bg); border-radius: 20px; padding: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); transition: transform 0.2s; cursor: pointer; user-select: none; }
.widget-card.holding { transform: scale(0.95); opacity: 0.8; }
.editing .widget-card { cursor: grab; animation: wiggle 0.3s infinite alternate; border: 2px dashed var(--primary); z-index: 100; }
.editing .widget-card:active { cursor: grabbing; }
@keyframes wiggle { from { transform: rotate(-1deg); } to { transform: rotate(1deg); } }
.clock-time { font-size: 38px; font-weight: 200; color: var(--text-main); line-height: 1; letter-spacing: -1px; text-align: center; }
.clock-date { font-size: 13px; color: var(--primary); font-weight: 600; text-transform: uppercase; margin-top: 5px; text-align: center; }
.cal-month { font-size: 14px; font-weight: 700; color: var(--text-main); margin-bottom: 10px; text-transform: capitalize; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; font-size: 11px; text-align: center; }
.cal-day { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--text-main); transition: 0.2s; }
.cal-day.today { background: var(--primary); color: white; font-weight: bold; }
body:not(.editing) .cal-day:not(.empty):not(.today):hover { background: rgba(0,122,255,0.1); color: var(--primary); }
/* SEARCH AREA */
.search-area { padding: 0 15px 15px 15px; flex-shrink: 0; display: flex; gap: 5px; }
.contact-list { flex: 1; overflow-y: auto; padding: 10px; }
/* CHAT AREA */
.chat-main { flex: 1; display: flex; flex-direction: column; background: rgba(255,255,255,0.02); height: 100%; position: relative; overflow: hidden; }
.chat-top { height: 70px; padding: 0 20px; display: flex; align-items: center; background: rgba(255,255,255,0.05); border-bottom: 1px solid var(--glass-border); flex-shrink: 0; position: relative; justify-content: space-between; }
.chat-header-content { flex: 1; display: flex; align-items: center; }
.chat-name-header { font-size: 16px; font-weight: 600; color: var(--text-main); }
/* TYPING INDICATOR */
.chat-status-box { display: flex; flex-direction: column; justify-content: center; margin-left: 10px; }
.chat-status { font-size: 12px; color: var(--text-sub); }
.typing-indicator {
font-size: 11px; color: var(--primary); font-weight: 600;
display: none; animation: pulse 1.5s infinite;
}
.typing-indicator.show { display: block; }
@keyframes pulse { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }
.widget-done-btn { display: none; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--primary-grad); color: white; border: none; padding: 6px 20px; border-radius: 20px; font-weight: 600; font-size: 13px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,122,255,0.3); animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 50; }
body.editing .widget-done-btn { display: block; }
.messages-wrap { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.msg-bubble { max-width: 80%; padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.4; position: relative; animation: slideUp 0.3s ease; display: flex; flex-direction: column; cursor: pointer; }
.msg-bubble.me { align-self: flex-end; background: var(--bubble-me); color: var(--bubble-text-me); border-bottom-right-radius: 4px; }
.msg-bubble.them { align-self: flex-start; background: var(--bubble-them); color: var(--bubble-text-them); border-bottom-left-radius: 4px; }
.msg-img { max-width: 100%; border-radius: 12px; margin-bottom: 5px; cursor: zoom-in; }
.msg-file { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.1); padding: 10px; border-radius: 10px; text-decoration: none; color: inherit; font-size: 13px; }
.quote-box { border-left: 3px solid rgba(255,255,255,0.5); background: rgba(0,0,0,0.1); padding: 5px 8px; border-radius: 4px; margin-bottom: 5px; font-size: 11px; display: flex; flex-direction: column; opacity: 0.9; }
.msg-meta { font-size: 10px; margin-top: 4px; opacity: 0.7; text-align: right; display: flex; justify-content: flex-end; gap: 4px; }
.ticks.read { color: #55efc4; }
.chat-input-wrapper { flex-shrink: 0; display: flex; flex-direction: column; background: rgba(255,255,255,0.05); border-top: 1px solid var(--glass-border); }
.reply-preview-bar { padding: 10px 20px; background: rgba(120,120,120,0.1); border-bottom: 1px solid var(--glass-border); display: none; justify-content: space-between; align-items: center; animation: slideUp 0.2s; }
.reply-preview-bar.show { display: flex; }
.reply-content { border-left: 3px solid var(--primary); padding-left: 10px; font-size: 12px; color: var(--text-main); }
.chat-input-area { padding: 20px; display: flex; gap: 10px; align-items: center; }
.attach-btn { width: 40px; height: 40px; border-radius: 50%; background: rgba(120,120,120,0.2); color: var(--text-main); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.input-std { width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid transparent; background: var(--input-bg); font-size: 13px; outline: none; color: var(--text-main); }
.send-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
/* MENUS & MODALS */
#menu-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9990; display: none; }
.glass-menu { position: fixed; z-index: 9999; display: none; padding: 8px; background: var(--menu-bg); backdrop-filter: blur(25px); border-radius: 16px; border: 1px solid var(--glass-border); box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3); gap: 10px; }
.menu-row { display: flex; align-items: center; gap: 5px; }
.menu-icon-btn { background: transparent; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; color: var(--text-main); font-size: 11px; padding: 8px 15px; border-radius: 10px; }
.menu-icon-btn:hover { background: rgba(120,120,120,0.1); }
.menu-icon-btn svg { width: 22px; height: 22px; margin-bottom: 4px; }
.menu-icon-btn.edit { color: var(--primary); } .menu-icon-btn.del { color: var(--danger); }
.theme-toggle-wrapper { display: flex; align-items: center; gap: 8px; cursor: pointer; background: rgba(120,120,120,0.15); padding: 4px; border-radius: 30px; position: relative; width: 64px; height: 32px; margin-right: 10px; }
.toggle-icon { font-size: 14px; z-index: 2; flex: 1; text-align: center; opacity: 0.5; }
.toggle-icon.active { opacity: 1; }
.toggle-circle { position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; background: white; border-radius: 50%; transition: transform 0.3s; }
[data-theme="dark"] .toggle-circle { transform: translateX(32px); background: #333; }
.profile-modal, .confirm-modal, .alert-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9); width: 320px; background: var(--menu-bg); backdrop-filter: blur(30px); border-radius: 24px; padding: 25px; border: 1px solid var(--glass-border); z-index: 10000; box-shadow: 0 20px 60px rgba(0,0,0,0.3); text-align: center; display: none; }
.profile-modal.show, .confirm-modal.show, .alert-modal.show { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal-avatar { width: 80px; height: 80px; margin: 0 auto 15px; border-radius: 50%; background: var(--primary-grad); display: flex; align-items: center; justify-content: center; font-size: 30px; color: white; transition: transform 0.3s; }
.modal-avatar:hover { transform: scale(1.1); }
.modal-input { width: 100%; padding: 12px; margin-bottom: 10px; border-radius: 14px; border: 1px solid rgba(120,120,120,0.2); background: rgba(255,255,255,0.5); backdrop-filter: blur(5px); text-align: center; font-size: 16px; color: var(--text-main); outline: none; }
.modal-btn { width: 100%; padding: 12px; margin-top: 8px; border-radius: 12px; border: none; cursor: pointer; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s; }
.btn-primary { background: var(--primary-grad); color: white; box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3); }
.btn-regen { background: rgba(255, 59, 48, 0.1); color: var(--danger); border: 1px solid rgba(255, 59, 48, 0.2); }
.btn-close { background: rgba(120, 120, 120, 0.1); color: var(--text-main); }
.id-copy-box { background: rgba(120,120,120,0.1); padding: 12px; border-radius: 12px; margin: 15px 0; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-family: monospace; font-size: 13px; color: var(--text-main); }
.copy-feedback { font-size: 11px; color: var(--primary); font-weight: 600; opacity: 0; transition: 0.3s; margin-right: 5px;}
.copy-feedback.show { opacity: 1; }
.profile-trigger { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 5px; border-radius: 12px; transition: 0.2s; flex: 1; position: relative; }
.profile-trigger:hover { background: rgba(120,120,120,0.1); }
.my-avatar-small { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-grad); color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 18px; box-shadow: 0 4px 10px rgba(0,122,255,0.3); }
.contact-item { display: flex; align-items: center; padding: 12px; border-radius: 14px; margin-bottom: 4px; cursor: pointer; transition: 0.2s; }
.contact-item.active { background: var(--input-bg); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.c-info { flex: 1; margin-left: 12px; overflow: hidden; }
.c-name { font-weight: 600; color: var(--text-main); font-size: 14px; }
.c-last { font-size: 12px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;}
.unread-badge { background: var(--badge-red); color: white; border-radius: 10px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-left: 5px; }
.three-dots { padding: 8px; border-radius: 50%; color: var(--text-sub); cursor: pointer; }
.color-row { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
.color-picker-wrap { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; border: 2px solid white; cursor: pointer; position: relative; }
.color-input { width: 150%; height: 150%; position: absolute; top: -25%; left: -25%; border: none; cursor: pointer; }
@media(max-width: 900px) {
.app-container { grid-template-columns: 100%; width: 100%; height: 100%; border-radius: 0; }
.sidebar-left, .sidebar-right { position: absolute; width: 100%; height: 100%; z-index: 10; transform: translateX(0); background: var(--bg-body); transition: 0.3s; }
.sidebar-left.hide, .sidebar-right.hide { transform: translateX(-100%); }
.sidebar-right { display: none; }
.back-btn { display: block; margin-right: 10px; cursor: pointer; font-size: 20px; color: var(--text-main); }
}
.back-btn { display: none; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
</style>
</head>
<body>
<div class="liquid-bg"><div class="orb"></div><div class="orb"></div><div class="orb"></div></div>
<div id="menu-overlay" onclick="closeAllMenus()"></div>
<input type="file" id="file-input" style="display: none;" onchange="handleFileSelect(this)">
<div id="msg-menu" class="glass-menu">
<div class="menu-row">
<button class="menu-icon-btn" onclick="triggerReplyMsg()" style="color:var(--text-main)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 17 4 12 9 7"></polyline><path d="M20 18v-2a4 4 0 0 0-4-4H4"></path></svg> Rispondi</button>
<div style="width:1px; height:30px; background:var(--glass-border)"></div>
<button id="btn-edit-msg" class="menu-icon-btn edit" onclick="triggerEditMsg()"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>Modifica</button>
<button class="menu-icon-btn del" onclick="triggerDeleteMsg()"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>Elimina</button>
</div>
</div>
<div id="contact-menu" class="glass-menu">
<div class="menu-row">
<button class="menu-icon-btn edit" onclick="triggerRenameContact()"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>Rinomina</button>
<div style="width:1px; height:30px; background:var(--glass-border)"></div>
<button class="menu-icon-btn del" onclick="triggerDeleteContact()"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>Elimina</button>
</div>
</div>
<div id="profile-modal" class="profile-modal">
<div class="modal-avatar" id="modal-avatar-text">IO</div>
<input type="text" id="modal-name-input" class="modal-input" placeholder="Il tuo nome">
<div class="color-row">
<div class="color-picker-wrap" style="background:var(--blob-1)"><input type="color" class="color-input" id="cp-1" onchange="updateColor(1, this.value)"></div>
<div class="color-picker-wrap" style="background:var(--blob-2)"><input type="color" class="color-input" id="cp-2" onchange="updateColor(2, this.value)"></div>
<div class="color-picker-wrap" style="background:var(--blob-3)"><input type="color" class="color-input" id="cp-3" onchange="updateColor(3, this.value)"></div>
</div>
<div style="margin-top:5px; font-size:10px; color:var(--text-sub); cursor:pointer;" onclick="resetColors()">Reset Colori</div>
<button class="modal-btn" id="edit-widgets-btn" style="background:rgba(120,120,120,0.2); color:var(--text-main);" onclick="toggleWidgetEditMode()">Modifica Widget</button>
<p style="font-size:11px; color:var(--text-sub); margin-top:10px;">ID Personale (Tocca per copiare)</p>
<div class="id-copy-box" onclick="copyId()">
<span id="modal-id" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;">...</span>
<div style="display:flex; align-items:center;">
<span class="copy-feedback" id="copy-fb">Copiato!</span>
<span id="copy-icon">📋</span>
</div>
</div>
<button class="modal-btn btn-primary" onclick="saveProfileName()">Salva Modifiche</button>
<button class="modal-btn btn-regen" onclick="triggerRegenId()">Rigenera Identità</button>
<button class="modal-btn btn-close" onclick="closeAllMenus()">Chiudi</button>
</div>
<div id="confirm-modal" class="profile-modal confirm-modal">
<h3 style="margin-bottom:10px; color:var(--text-main);">Attenzione</h3>
<p id="confirm-msg" style="font-size:14px; color:var(--text-sub); margin-bottom:20px;">Sei sicuro?</p>
<button class="modal-btn btn-primary" id="confirm-yes">Conferma</button>
<button class="modal-btn btn-close" onclick="closeAllMenus()">Annulla</button>
</div>
<div id="alert-modal" class="profile-modal alert-modal">
<h3 style="margin-bottom:10px; color:var(--text-main);">Avviso</h3>
<p id="alert-msg" style="font-size:14px; color:var(--text-sub); margin-bottom:20px;">...</p>
<button class="modal-btn btn-primary" onclick="closeAllMenus()">OK</button>
</div>
<div class="app-container">
<div class="sidebar-left" id="sidebar-left">
<div class="sidebar-header">
<div class="profile-trigger" onclick="openProfileModal()">
<div class="my-avatar-small" id="my-avatar-small">IO</div>
<div class="my-name-display" id="my-name-display">Caricamento...</div>
</div>
</div>
<div class="widget-zone" id="zone-left" ondrop="drop(event)" ondragover="allowDrop(event)">
<div class="widget-card clock-widget" id="widget-clock" draggable="false" ondragstart="drag(event)" onmousedown="startWidgetPress(this)" onmouseup="cancelWidgetPress(this)" onmouseleave="cancelWidgetPress(this)" oncontextmenu="return false;">
<div class="clock-time" id="clock-time">00:00</div>
<div class="clock-date" id="clock-date">Lun 1 Gen</div>
</div>
</div>
<div style="padding:15px; display:flex; gap:5px;">
<input id="add-id" class="input-std" placeholder="ID Amico...">
<button onclick="addContact()" class="send-btn" style="width:40px; height:40px; border-radius:12px;">+</button>
</div>
<div class="contact-list" id="contact-list"></div>
</div>
<div class="chat-main">
<div class="chat-top">
<div class="widget-done-btn" onclick="toggleWidgetEditMode()">Fine Modifica</div>
<div class="chat-header-content">
<div class="back-btn" onclick="toggleSidebar()">←</div>
<div class="chat-info">
<div class="chat-name-header" id="chat-name">Seleziona una chat</div>
<div class="chat-status-box">
<div class="chat-status" id="chat-status"></div>
<div class="typing-indicator" id="typing-indicator">Sta scrivendo...</div>
</div>
</div>
</div>
<div class="theme-toggle-wrapper" onclick="toggleTheme()">
<div class="toggle-icon active">☀️</div>
<div class="toggle-icon">🌙</div>
<div class="toggle-circle"></div>
</div>
</div>
<div class="messages-wrap" id="msg-container">
<div style="text-align:center; margin-top:50px; color:var(--text-sub); font-size:12px;">
Tieni premuto (0.25s) per opzioni.<br>AES-256 Encrypted.
</div>
</div>
<div class="chat-input-wrapper">
<div id="reply-bar" class="reply-preview-bar">
<div class="reply-content">
<div id="reply-label" style="font-weight:700; margin-bottom:2px; color:var(--primary)">Risposta a:</div>
<div id="reply-text-preview" style="opacity:0.8; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:200px;">...</div>
</div>
<button style="background:none;border:none;cursor:pointer;color:var(--text-sub);font-size:16px;" onclick="cancelReplyOrEdit()">✕</button>
</div>
<div class="chat-input-area">
<button class="attach-btn" onclick="document.getElementById('file-input').click()"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"></path></svg></button>
<input type="text" class="input-std" id="msg-input" placeholder="Scrivi un messaggio..." onkeypress="checkEnter(event)" oninput="handleTyping()">
<button class="send-btn" onclick="sendText()" id="btn-send">➤</button>
</div>
</div>
</div>
<div class="sidebar-right" id="sidebar-right">
<div class="sidebar-header"><span style="font-weight:600; color:var(--text-main);">Info & Widgets</span></div>
<div class="widget-zone" id="zone-right" ondrop="drop(event)" ondragover="allowDrop(event)">
<div class="widget-card calendar-widget" id="widget-cal" onmousedown="startWidgetPress(this)" onmouseup="cancelWidgetPress(this)" onmouseleave="cancelWidgetPress(this)" oncontextmenu="return false;">
<div class="cal-month" id="cal-month">Gennaio</div>
<div class="cal-grid" id="cal-grid"></div>
</div>
</div>
</div>
</div>
<script>
const APP = "liquid_final_typing_v15_";
const SECRET_KEY = "MySuperSecretKeyForAES256";
let myId = localStorage.getItem(APP+'id');
let contacts = JSON.parse(localStorage.getItem(APP+'contacts')) || {};
let myProfile = JSON.parse(localStorage.getItem(APP+'profile')) || { name: "Io" };
let theme = localStorage.getItem(APP+'theme') || 'light';
let customColors = JSON.parse(localStorage.getItem(APP+'colors')) || {};
let widgetPos = JSON.parse(localStorage.getItem(APP+'widgets')) || { clock: 'zone-left', cal: 'zone-right' };
let peer, conn, activeChat = null;
let selectedMsgId = null, selectedContactId = null;
let replyingToMsg = null;
let editingMsgId = null;
let pressTimer, widgetPressTimer, typingTimer;
let isEditMode = false;
if(!myId) { myId = Math.random().toString(36).substr(2, 6); localStorage.setItem(APP+'id', myId); }
document.documentElement.setAttribute('data-theme', theme);
applySavedColors();
applyWidgetPositions();
updateProfileUI();
renderContacts();
initPeer();
startClock();
renderCalendar();
function encrypt(text) { return CryptoJS.AES.encrypt(text, SECRET_KEY).toString(); }
function decrypt(cipher) { try { return CryptoJS.AES.decrypt(cipher, SECRET_KEY).toString(CryptoJS.enc.Utf8); } catch(e) { return "[Errore]"; } }
function initPeer() { peer = new Peer(myId); peer.on('connection', c => handleConn(c)); }
function handleConn(c) { c.on('open', () => { if(!contacts[c.peer]) { contacts[c.peer]={nick:"Utente",msgs:[],unread:0,lastActive:Date.now()}; save(); renderContacts(); } syncOfflineMessages(c); if(activeChat===c.peer) { conn=c; updateStatus("Online 🟢"); sendReadReceipt(c.peer); } }); c.on('data', d => handleData(d, c.peer)); c.on('close', () => { if(activeChat===c.peer) { conn=null; updateStatus("Offline ⚪"); } }); }
function syncOfflineMessages(c) { contacts[c.peer]?.msgs.forEach(m => { if(m.from==='me' && m.status==='sent') { const payload = { type: 'msg', id: m.id, text: encrypt(m.text), msgType: m.msgType||'text', fileName: m.fileName, quote: m.quote ? { author: m.quote.author, text: encrypt(m.quote.text) } : null }; c.send(payload); } }); }
function handleData(d, pid) {
if(!contacts[pid]) contacts[pid] = { nick: "Nuovo ("+pid+")", msgs: [], unread: 0, lastActive: Date.now() };
if(d.type==='msg') {
if(contacts[pid].msgs.some(x=>x.id===d.id)) return;
const decryptedText = decrypt(d.text);
const quoteData = d.quote ? { author: d.quote.author, text: decrypt(d.quote.text) } : null;
const msg = { id:d.id, text: decryptedText, msgType:d.msgType||'text', fileName:d.fileName||'', quote: quoteData, from:'them', time:getTime(), edited:false, status:'read' };
contacts[pid].msgs.push(msg); contacts[pid].lastActive=Date.now();
if(conn && conn.open) conn.send({type:'delivered', id:d.id});
if(activeChat===pid) { renderMsg(msg); sendReadReceipt(pid); } else { contacts[pid].unread=(contacts[pid].unread||0)+1; renderContacts(); }
}
else if(d.type==='typing') {
if(activeChat === pid) {
const el = document.getElementById('typing-indicator');
el.classList.add('show');
clearTimeout(window.typingTimeoutRemote);
window.typingTimeoutRemote = setTimeout(() => el.classList.remove('show'), 2000);
}
}
else if(d.type==='account_deleted') {
contacts[pid].nick = "🚫 Account Eliminato";
save(); renderContacts();
if(activeChat === pid) document.getElementById('chat-name').innerText = "🚫 Account Eliminato";
}
else if(d.type==='delivered') { const m=contacts[pid].msgs.find(x=>x.id===d.id); if(m && m.status==='sent') { m.status='delivered'; save(); if(activeChat===pid) refreshChatUI(); } }
else if(d.type==='receipt') markAsRead(pid);
else if(d.type==='delete') { deleteLocalMsg(pid, d.id); }
else if(d.type==='edit') { editLocalMsg(pid, d.id, decrypt(d.text)); }
save();
}
// --- TYPING ---
function handleTyping() {
if(conn && conn.open) {
conn.send({type: 'typing'});
}
}
// --- MESSAGING ---
function handleFileSelect(inp) { const f=inp.files[0]; if(!f)return; if(f.size>2.5*1024*1024) return showCustomAlert("Max 2.5MB"); const r=new FileReader(); r.onload=e=>sendMessage(f.type.startsWith('image/')?'image':'file', e.target.result, f.name); r.readAsDataURL(f); inp.value=''; }
function sendMessage(type, content, fileName='') {
if(!activeChat) return;
const id=Date.now().toString(36);
let quoteData = null;
if(replyingToMsg) {
let qText = replyingToMsg.text;
if(replyingToMsg.msgType === 'image') qText = "📷 Immagine";
else if(replyingToMsg.msgType === 'file') qText = "📎 " + replyingToMsg.fileName;
quoteData = { text: qText, author: replyingToMsg.from === 'me' ? 'Tu' : contacts[activeChat].nick };
}
const msg = { id, text:content, msgType:type, fileName, quote:quoteData, from:'me', time:getTime(), edited:false, status:'sent' };
contacts[activeChat].msgs.push(msg); contacts[activeChat].lastActive=Date.now();
renderMsg(msg); save();
if(conn && conn.open) {
conn.send({type:'msg', id, text: encrypt(content), msgType:type, fileName, quote: quoteData ? {author:quoteData.author, text:encrypt(quoteData.text)}:null});
}
renderContacts(); cancelReplyOrEdit();
}
function sendText() {
const txt=document.getElementById('msg-input').value.trim();
if(!txt)return;
if(editingMsgId) { completeEdit(txt); return; }
sendMessage('text', txt);
document.getElementById('msg-input').value='';
}
function triggerEditMsg() {
const m=contacts[activeChat].msgs.find(x=>x.id===selectedMsgId);
if(m.msgType!=='text') { showCustomAlert("Solo testo modificabile"); closeAllMenus(); return; }
editingMsgId = selectedMsgId;
document.getElementById('msg-input').value = m.text;
document.getElementById('msg-input').focus();
document.getElementById('reply-label').innerText = "Modifica Messaggio:";
document.getElementById('reply-text-preview').innerText = m.text;
document.getElementById('reply-bar').classList.add('show');
closeAllMenus();
}
function completeEdit(newTxt) {
const m = contacts[activeChat].msgs.find(x => x.id === editingMsgId);
if(m) {
m.text = newTxt; m.edited = true; save();
if(conn && conn.open) conn.send({type:'edit', id:editingMsgId, text: encrypt(newTxt)});
refreshChatUI();
}
cancelReplyOrEdit();
}
function cancelReplyOrEdit() { replyingToMsg=null; editingMsgId=null; document.getElementById('msg-input').value=''; document.getElementById('reply-bar').classList.remove('show'); }
function renderMsg(msg) {
const div = document.createElement('div');
div.className = `msg-bubble ${msg.from}`;
div.id = `msg-${msg.id}`;
let quoteHtml = msg.quote ? `<div class="quote-box"><div class="quote-author">${msg.quote.author}</div><div class="quote-text">${escapeHtml(msg.quote.text)}</div></div>` : '';
let content = msg.msgType==='image' ? `<img src="${msg.text}" class="msg-img">` : (msg.msgType==='file' ? `<a href="${msg.text}" download="${msg.fileName}" class="msg-file"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="24" height="24"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path></svg>${msg.fileName}</a>` : `<span class="txt">${escapeHtml(msg.text)}</span>`);
let meta = `<div class="msg-meta">${msg.time}${msg.edited?' • Mod':''}${msg.from==='me'?`<span class="ticks ${msg.status}">${getTicks(msg.status)}</span>`:''}</div>`;
div.innerHTML = quoteHtml + content + meta;
// ENABLE MENU FOR EVERYONE
div.onmousedown = e => startPress(e, msg.id, div);
div.onmouseup = () => cancelPress(div);
div.ontouchstart = e => startPress(e.touches[0], msg.id, div);
div.ontouchend = () => cancelPress(div);
div.oncontextmenu = e => { e.preventDefault(); return false; };
const c = document.getElementById('msg-container'); c.appendChild(div); c.scrollTop = c.scrollHeight;
}
function startPress(e, id, el) {
if(document.getElementById('msg-menu').style.display==='flex')return;
el.classList.add('holding');
pressTimer=setTimeout(()=>{
el.classList.remove('holding');
selectedMsgId=id;
const m = contacts[activeChat].msgs.find(x => x.id === id);
// Hide Edit if message is from them
document.getElementById('btn-edit-msg').style.display = m.from === 'them' ? 'none' : 'flex';
showMenuAt('msg-menu', e, el);
}, 250);
}
// --- WIDGET ---
function startWidgetPress(el) { if(isEditMode) return; el.classList.add('holding'); widgetPressTimer = setTimeout(() => { el.classList.remove('holding'); toggleWidgetEditMode(); }, 250); }
function cancelWidgetPress(el) { el.classList.remove('holding'); clearTimeout(widgetPressTimer); }
function toggleWidgetEditMode() { isEditMode=!isEditMode; document.body.classList.toggle('editing', isEditMode); document.querySelectorAll('.widget-card').forEach(el => { el.setAttribute('draggable', isEditMode); if(isEditMode) { el.onmousedown=null; el.onmouseup=null; el.onmouseleave=null; el.ondragstart=e=>drag(e); } else { el.onmousedown=function(){startWidgetPress(this)}; el.onmouseup=function(){cancelWidgetPress(this)}; el.onmouseleave=function(){cancelWidgetPress(this)}; el.ondragstart=null; } }); if(isEditMode) closeAllMenus(); }
// --- UI HELPERS ---
function cancelPress(el) { el.classList.remove('holding'); clearTimeout(pressTimer); }
function showMenuAt(mid, e, trg) { if(navigator.vibrate) navigator.vibrate(50); const m=document.getElementById(mid); const r=trg.getBoundingClientRect(); m.style.top=(r.bottom+5)+'px'; m.style.left=r.left+'px'; m.style.display='flex'; document.getElementById('menu-overlay').style.display='block'; }
function triggerReplyMsg() { const m = contacts[activeChat].msgs.find(x => x.id === selectedMsgId); replyingToMsg = m; let pt = m.text; if(m.msgType === 'image') pt = "📷 Immagine"; if(m.msgType === 'file') pt = "📎 " + m.fileName; document.getElementById('reply-label').innerText = "Risposta a:"; document.getElementById('reply-text-preview').innerText = pt; document.getElementById('reply-bar').classList.add('show'); document.getElementById('msg-input').focus(); closeAllMenus(); }
function triggerDeleteMsg() { if(conn && conn.open) conn.send({type:'delete', id:selectedMsgId}); deleteLocalMsg(activeChat, selectedMsgId); closeAllMenus(); }
function triggerRenameContact() { const n=prompt("Nome:", contacts[selectedContactId].nick); if(n) { contacts[selectedContactId].nick=n; save(); renderContacts(); if(activeChat===selectedContactId) document.getElementById('chat-name').innerText=n; } closeAllMenus(); }
function triggerDeleteContact() { showCustomConfirm("Eliminare chat?", () => { delete contacts[selectedContactId]; save(); renderContacts(); if(activeChat === selectedContactId) location.reload(); }); }
function showContactMenu(e, id) { e.stopPropagation(); selectedContactId=id; showMenuAt('contact-menu', e, e.target); }
function closeAllMenus() { document.querySelectorAll('.glass-menu, .profile-modal, .confirm-modal, .alert-modal, #menu-overlay').forEach(el=>{el.style.display='none'; el.classList.remove('show');}); }
function showCustomConfirm(msg, cb) { document.getElementById('menu-overlay').style.display='block'; const m = document.getElementById('confirm-modal'); document.getElementById('confirm-msg').innerText = msg; m.style.display='block'; setTimeout(()=>m.classList.add('show'),10); document.getElementById('confirm-yes').onclick = () => { cb(); closeAllMenus(); }; }
function showCustomAlert(msg) { document.getElementById('menu-overlay').style.display='block'; const m = document.getElementById('alert-modal'); document.getElementById('alert-msg').innerText = msg; m.style.display='block'; setTimeout(()=>m.classList.add('show'),10); }
function allowDrop(e) { e.preventDefault(); }
function drag(e) { e.dataTransfer.setData("text", e.target.id); }
function drop(e) { e.preventDefault(); const d=e.dataTransfer.getData("text"); e.target.closest('.widget-zone')?.appendChild(document.getElementById(d)); widgetPos={clock:document.getElementById('widget-clock').parentElement.id, cal:document.getElementById('widget-cal').parentElement.id}; localStorage.setItem(APP+'widgets', JSON.stringify(widgetPos)); }
function applyWidgetPositions() { if(widgetPos.clock) document.getElementById(widgetPos.clock).appendChild(document.getElementById('widget-clock')); if(widgetPos.cal) document.getElementById(widgetPos.cal).appendChild(document.getElementById('widget-cal')); }
function startClock() { setInterval(() => { const n=new Date(); document.getElementById('clock-time').innerText=n.toLocaleTimeString([],{hour:'2-digit',minute:'2-digit'}); document.getElementById('clock-date').innerText=n.toLocaleDateString('it-IT',{weekday:'short',day:'numeric',month:'short'}); }, 1000); }
function renderCalendar() { const n=new Date(); const m=["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"]; document.getElementById('cal-month').innerText=m[n.getMonth()]; const g=document.getElementById('cal-grid'); g.innerHTML=''; ['L','M','M','G','V','S','D'].forEach(d=>g.innerHTML+=`<div>${d}</div>`); const fd=new Date(n.getFullYear(),n.getMonth(),1).getDay()||7; for(let i=1;i<fd;i++)g.innerHTML+=`<div></div>`; for(let i=1;i<=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();i++) g.innerHTML+=`<div class="cal-day ${i===n.getDate()?'today':''}">${i}</div>`; }
function openProfileModal() { document.getElementById('menu-overlay').style.display='block'; const m=document.getElementById('profile-modal'); m.style.display='block'; setTimeout(()=>m.classList.add('show'),10); document.getElementById('modal-avatar-text').innerText=myProfile.name[0]; document.getElementById('modal-name-input').value=myProfile.name; document.getElementById('modal-id').innerText=myId; document.getElementById('cp-1').value=customColors['--blob-1']||'#a8c0ff'; document.getElementById('cp-2').value=customColors['--blob-2']||'#3f2b96'; document.getElementById('cp-3').value=customColors['--blob-3']||'#007AFF'; }
function saveProfileName() { const v=document.getElementById('modal-name-input').value; if(v) { myProfile.name=v; localStorage.setItem(APP+'profile',JSON.stringify(myProfile)); updateProfileUI(); closeAllMenus(); } }
function updateProfileUI() { document.getElementById('my-avatar-small').innerText=myProfile.name[0]; document.getElementById('my-name-display').innerText=myProfile.name; }
function updateColor(i,c) { const v=`--blob-${i}`; document.documentElement.style.setProperty(v,c); customColors[v]=c; localStorage.setItem(APP+'colors',JSON.stringify(customColors)); }
function resetColors() { localStorage.removeItem(APP+'colors'); customColors={}; document.documentElement.style=''; openProfileModal(); }
function applySavedColors() { for(const [k,v] of Object.entries(customColors)) document.documentElement.style.setProperty(k,v); }
function toggleTheme() { theme=theme==='light'?'dark':'light'; document.documentElement.setAttribute('data-theme',theme); localStorage.setItem(APP+'theme',theme); }
function triggerRegenId() { showCustomConfirm("Sicuro? Avviserò i contatti.", () => { if(peer && peer.connections) { for (let id in peer.connections) { peer.connections[id].forEach(conn => { if(conn.open) conn.send({type: 'account_deleted'}); }); } } setTimeout(() => { localStorage.clear(); location.reload(); }, 500); }); }
function deleteLocalMsg(pid, mid) { const idx=contacts[pid].msgs.findIndex(x=>x.id===mid); if(idx!==-1) contacts[pid].msgs.splice(idx,1); save(); if(activeChat===pid) refreshChatUI(); }
function editLocalMsg(pid, mid, txt) { const m=contacts[pid].msgs.find(x=>x.id===mid); if(m) { m.text=txt; m.edited=true; save(); if(activeChat===pid) refreshChatUI(); } }
function refreshChatUI() { const c=document.getElementById('msg-container'); c.innerHTML=''; contacts[activeChat].msgs.forEach(renderMsg); c.scrollTop=c.scrollHeight; }
function getTicks(s) { return s==='read'?'✓✓':(s==='delivered'?'✓✓':'✓'); }
function sendReadReceipt(pid) { if(conn && conn.open) conn.send({type:'receipt'}); }
function markAsRead(pid) { contacts[pid].msgs.forEach(m=>{if(m.from==='me')m.status='read'}); save(); if(activeChat===pid) refreshChatUI(); }
function openChat(id) { activeChat=id; document.getElementById('sidebar-left').classList.add('hide'); document.getElementById('chat-name').innerText=contacts[id].nick; updateStatus("Connessione..."); if(contacts[id].unread) { contacts[id].unread=0; save(); renderContacts(); } refreshChatUI(); if(conn) conn.close(); conn=peer.connect(id); handleConn(conn); }
function renderContacts() { const l=document.getElementById('contact-list'); l.innerHTML=''; Object.keys(contacts).sort((a,b)=>(contacts[b].lastActive||0)-(contacts[a].lastActive||0)).forEach(k=>{ const act=activeChat===k?'active':''; const last=contacts[k].msgs.slice(-1)[0]; const txt=last?(last.msgType==='image'?'📷 Immagine':(last.msgType==='file'?'📎 File':last.text)):''; const un=contacts[k].unread||0; const d=document.createElement('div'); d.className=`contact-item ${act}`; d.innerHTML=`<div class="my-avatar-small" style="width:35px;height:35px;font-size:14px;background:#ccc;">${contacts[k].nick[0]}</div><div class="c-info"><div class="c-top-row"><span class="c-name">${contacts[k].nick}</span>${un>0?`<div class="unread-badge">${un}</div>`:''}</div><div class="c-last">${escapeHtml(txt)}</div></div><div class="three-dots" onclick="showContactMenu(event, '${k}')">⋮</div>`; d.onclick=(e)=>{if(!e.target.classList.contains('three-dots'))openChat(k)}; l.appendChild(d); }); }
function addContact() { const id=document.getElementById('add-id').value.trim(); if(id&&!contacts[id]&&id!==myId) { contacts[id]={nick:"Amico",msgs:[],unread:0,lastActive:Date.now()}; save(); renderContacts(); document.getElementById('add-id').value=''; } }
function save() { localStorage.setItem(APP+'contacts', JSON.stringify(contacts)); }
function copyId() { navigator.clipboard.writeText(myId); document.getElementById('copy-fb').classList.add('show'); setTimeout(()=>document.getElementById('copy-fb').classList.remove('show'), 2000); }
function checkEnter(e) { if(e.key==='Enter') sendText(); }
function getTime() { return new Date().toLocaleTimeString([], {hour:'2-digit', minute:'2-digit'}); }
function updateStatus(s) { document.getElementById('chat-status').innerText=s; }
function escapeHtml(t) { return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"); }
function toggleSidebar() { document.getElementById('sidebar-left').classList.toggle('hide'); }
</script>
</body>
</html>