-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
745 lines (730 loc) · 30.1 KB
/
Copy pathindex.html
File metadata and controls
745 lines (730 loc) · 30.1 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
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
<script type="text/javascript">
var gk_isXlsx = false;
var gk_xlsxFileLookup = {};
var gk_fileData = {};
function filledCell(cell) {
return cell !== '' && cell != null;
}
function loadFileData(filename) {
if (gk_isXlsx && gk_xlsxFileLookup[filename]) {
try {
var workbook = XLSX.read(gk_fileData[filename], { type: 'base64' });
var firstSheetName = workbook.SheetNames[0];
var worksheet = workbook.Sheets[firstSheetName];
// Convert sheet to JSON to filter blank rows
var jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, blankrows: false, defval: '' });
// Filter out blank rows (rows where all cells are empty, null, or undefined)
var filteredData = jsonData.filter(row => row.some(filledCell));
// Heuristic to find the header row by ignoring rows with fewer filled cells than the next row
var headerRowIndex = filteredData.findIndex((row, index) =>
row.filter(filledCell).length >= filteredData[index + 1]?.filter(filledCell).length
);
// Fallback
if (headerRowIndex === -1 || headerRowIndex > 25) {
headerRowIndex = 0;
}
// Convert filtered JSON back to CSV
var csv = XLSX.utils.aoa_to_sheet(filteredData.slice(headerRowIndex)); // Create a new sheet from filtered array of arrays
csv = XLSX.utils.sheet_to_csv(csv, { header: 1 });
return csv;
} catch (e) {
console.error(e);
return "";
}
}
return gk_fileData[filename] || "";
}
</script><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>Dexhune Info</title>
<link rel="icon" type="image/png" href="./assets/dexhuneLogo.png">
<script type="text/javascript">
var gk_isXlsx = false;
var gk_xlsxFileLookup = {};
var gk_fileData = {};
function filledCell(cell) {
return cell !== '' && cell != null;
}
function loadFileData(filename) {
if (gk_isXlsx && gk_xlsxFileLookup[filename] && typeof XLSX !== 'undefined') {
try {
var workbook = XLSX.read(gk_fileData[filename], { type: 'base64' });
var firstSheetName = workbook.SheetNames[0];
var worksheet = workbook.Sheets[firstSheetName];
var jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, blankrows: false, defval: '' });
var filteredData = jsonData.filter(row => row.some(filledCell));
var headerRowIndex = filteredData.findIndex((row, index) =>
row.filter(filledCell).length >= filteredData[index + 1]?.filter(filledCell).length
);
if (headerRowIndex === -1 || headerRowIndex > 25) {
headerRowIndex = 0;
}
var csv = XLSX.utils.aoa_to_sheet(filteredData.slice(headerRowIndex));
csv = XLSX.utils.sheet_to_csv(csv, { header: 1 });
return csv;
} catch (e) {
console.error('Error in loadFileData:', e);
return "";
}
}
return gk_fileData[filename] || "";
}
</script>
<style>
:root {
--bg-light: #e0e0e0;
--bg-dark: #333333;
--mesh-light: #d8d8d8;
--mesh-dark: #3c3c3c;
--text-light: #000000;
--text-dark: #ffffff;
--card-bg: rgba(147, 112, 219, 0.2);
--status-green: #32cd32;
--status-orange: #ffa500;
--status-red: #ff0000;
--modal-bg-light: #ffffff;
--modal-bg-dark: #1a1a1a;
--panel-bg-light: rgba(64, 64, 64, 0.2);
--panel-bg-dark: rgba(216, 216, 216, 0.2);
}
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
min-height: 100vh;
touch-action: manipulation;
display: flex;
flex-direction: column;
background-color: var(--bg-light);
color: var(--text-light);
}
body.dark-mode {
background-color: var(--bg-dark);
color: var(--text-dark);
}
.mesh-pattern {
background-size: 20px 20px;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
body:not(.dark-mode) .mesh-pattern {
background-image: linear-gradient(var(--mesh-light) 1px, transparent 1px), linear-gradient(90deg, var(--mesh-light) 1px, transparent 1px);
}
body.dark-mode .mesh-pattern {
background-image: linear-gradient(var(--mesh-dark) 1px, transparent 1px), linear-gradient(90deg, var(--mesh-dark) 1px, transparent 1px);
}
.container {
display: flex;
flex-direction: column;
gap: 10px;
width: 100%;
max-width: 960px;
margin: 10px auto;
flex: 1;
text-align: center;
justify-content: center;
align-items: center;
}
.panel {
padding: 10px;
border-radius: 5px;
overflow: hidden;
background-color: var(--panel-bg-light);
margin: 0 auto;
width: 100%;
max-width: 960px;
}
body.dark-mode .panel {
background-color: var(--panel-bg-dark);
}
.logo-container {
text-align: center;
margin-bottom: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.logo {
width: 100px;
height: auto;
display: block;
}
.welcome-text {
text-align: center;
}
.welcome-text h1 {
font-size: 36px;
margin: 10px 0;
}
.welcome-text p {
font-size: 16px;
margin: 0 0 10px 0;
}
.welcome-text .projects-intro {
font-size: 10px;
margin: 0 0 10px 0;
}
.welcome-text .legend-title {
font-size: 12px;
opacity: 0.15;
margin: 10px 0;
}
.welcome-text .legend-status {
font-size: 8px;
opacity: 0.45;
margin: 0 0 10px 0;
}
.cards-panel {
display: flex;
justify-content: center;
margin: 0 auto;
width: 100%;
max-width: 960px;
}
.cards-panel > .grid-container {
display: grid;
grid-template-columns: repeat(3, minmax(120px, 1fr));
gap: 15px;
justify-content: center;
width: fit-content;
}
.card {
background-color: var(--card-bg);
border-radius: 8px;
padding: 10px;
cursor: pointer;
font-size: 14px;
text-align: center;
user-select: none;
touch-action: manipulation;
width: 120px;
height: 140px;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}
.card-title {
margin: 8px 0;
font-weight: bold;
}
.card-status {
width: 60px;
height: 60px;
margin: 8px auto;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}
.social-links {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 20px;
margin: 0;
text-align: center;
}
.social-links h2 {
margin: 0 0 10px 0;
flex: 0 0 100%;
text-align: center;
}
.social-links a {
display: inline-block;
margin: 0;
color: inherit;
text-decoration: underline;
}
.theme-toggle-container {
display: flex;
justify-content: center;
margin: 10px auto 0;
}
#theme-toggle {
width: 40px;
height: 40px;
border-radius: 50%;
border: none;
cursor: pointer;
font-size: 20px;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(255, 255, 255, 0.2);
touch-action: manipulation;
}
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
justify-content: center;
align-items: center;
z-index: 1000;
}
.modal-content {
max-width: 600px;
width: 90%;
padding: 20px;
border-radius: 8px;
text-align: center;
font-size: 16px;
line-height: 1.5;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
position: relative;
background-color: var(--modal-bg-light);
color: var(--text-light);
}
body.dark-mode .modal-content {
background-color: var(--modal-bg-dark);
color: var(--text-dark);
}
.modal-section {
margin-bottom: 20px;
}
.modal-header {
opacity: 0.7;
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
}
.modal-links a {
display: inline;
margin: 5px 0;
color: inherit;
text-decoration: underline;
padding: 0;
}
.card-link-button {
background-color: var(--card-bg);
border-radius: 8px;
padding: 10px;
cursor: pointer;
font-size: 14px;
text-align: center;
user-select: none;
touch-action: manipulation;
width: 120px;
height: 40px;
box-sizing: border-box;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
color: inherit;
font-weight: bold;
margin: 5px;
}
.close {
position: absolute;
top: 10px;
right: 10px;
font-size: 24px;
cursor: pointer;
user-select: none;
padding: 15px;
line-height: 1;
z-index: 1001;
display: flex;
align-items: center;
justify-content: center;
}
@media (min-width: 768px) {
.container {
width: 960px;
max-width: 960px;
display: grid;
grid-template-rows: minmax(0, 90px) minmax(0, 150px) minmax(0, 30px) minmax(0, auto) minmax(0, 10px) minmax(0, 110px);
gap: 10px;
padding: 10px;
box-sizing: border-box;
}
.logo-panel {
grid-row: 1;
padding-bottom: 0;
margin: 0;
}
.welcome-panel {
grid-row: 2;
margin: 0;
padding: 15px 15px 15px 15px;
}
.welcome-buffer {
display: none;
}
.welcome-buffer.desktop {
display: block;
height: 30px;
grid-row: 3;
}
.cards-panel {
grid-row: 4;
display: flex;
justify-content: center;
align-items: center;
margin: 0 auto;
padding: 10px;
width: 100%;
max-width: 960px;
min-height: 160px;
}
.cards-panel > .grid-container {
display: grid;
grid-template-columns: repeat(3, minmax(120px, 1fr));
gap: 15px;
justify-content: center;
align-items: center;
width: fit-content;
}
.spacer {
grid-row: 5;
height: 10px;
}
.social-panel {
grid-row: 6;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 0;
padding: 10px;
}
.card {
width: 120px;
height: 140px;
}
.social-links {
width: auto;
height: auto;
}
.logo-container {
margin-bottom: 0;
}
}
</style>
</head>
<body>
<div class="mesh-pattern"></div>
<div class="container">
<div class="panel logo-panel">
<div class="logo-container">
<img src="./assets/dexhuneLogo.png" alt="Logo" class="logo">
</div>
</div>
<div class="panel welcome-panel">
<div class="welcome-text">
<h1>Welcome!</h1>
<p>Dexhune is building AMM, Orderbook and Stablecoin usecases on the EVM!</p>
<p class="projects-intro">Below are a number of projects we're working on!</p>
<h2 class="legend-title">Legend</h2>
<p class="legend-status">🟢 Complete 🟠 In Progress 🔴 Still Drafting</p>
</div>
</div>
<div class="welcome-buffer desktop"></div>
<div class="panel cards-panel">
<div class="grid-container" id="cardContainer">
<!-- Cards will be dynamically inserted here -->
</div>
</div>
<div class="spacer"></div>
<div class="panel social-panel">
<div class="social-links">
<h2>Peng Protocol 2025</h2>
<a href="https://t.me/dexhune" target="_blank">Telegram</a>
<a href="https://github.com/orgs/Peng-Protocol/repositories" target="_blank">GitHub</a>
<a href="https://x.com/Dexhune" target="_blank">X (Twitter)</a>
</div>
<div class="theme-toggle-container">
<button id="theme-toggle">☀️</button>
</div>
</div>
</div>
<script>
const toggleButton = document.getElementById('theme-toggle');
const body = document.body;
const cardContainer = document.getElementById('cardContainer');
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
let isDark = prefersDark;
let isToggling = false;
let modalStack = [];
const cardData = [
{
title: "Token Registry",
description: "A registry for storing all tokens an address has, allows on-chain global fetches. Goes hand-in-hand with <a href=\"https://github.com/GenericMage/CoinClash/blob/main/Type-A/Documentation/CCGlobalizerDocs.md\" target=\"_blank\">Globalizer</a>. And can be integrated with various Dexhune Variants.",
links: '<a href="https://github.com/Peng-Protocol/TokenRegistry" target="_blank">Github</a>',
statusImage: './assets/dexhuneStatusGreen.png'
},
{
title: "CoinClash",
description: "An AMM Orderbook hybrid based on <a href=\"https://github.com/Peng-Protocol/Dexhune-SS/tree/main/ShockSpace\" target=\"_blank\">Dexhune-SS</a>. CC Type-A is a fork of SS that enables limit/range orders to a Uni-v2 LP from which it derives price. Type-B implements a novel \"Debt Looping\" System to facilitate leverage via Uniswap v2 and AAVE.",
links: '<a href="https://github.com/Peng-Protocol/CoinClash" target="_blank">Github</a>',
statusImage: './assets/dexhuneStatusYellow.png'
},
{
title: "Dexhune-SS",
description: "An AMM Orderbook hybrid for permissionless leverage trading with any asset on EVM chains.",
links: '<a href="https://github.com/Peng-Protocol/Dexhune-SS/tree/main/ShockSpace" target="_blank">Github</a>',
statusImage: './assets/dexhuneStatusYellow.png'
},
{
title: "Immaterium",
description: "A fully on-chain paid subscription system with distributed moderation.",
links: '<a href="https://github.com/Peng-Protocol/Immaterium/tree/main" target="_blank">Github</a>',
statusImage: './assets/dexhuneStatusYellow.png'
},
{
title: "Dexhune-P",
description: "An AMM Orderbook hybrid.",
links: '<a href="https://github.com/Peng-Protocol/Dexhune-P" target="_blank">Github</a>',
statusImage: './assets/dexhuneStatusYellow.png'
},
{
title: "Dexhune Markets",
description: "A small contract for storing \"approved\" tokens which are allowed for viewing via a user-side frontend, demonstrates the elimination of server side apps in relation to global state. Can be paired with a DAO or some other system for moderation. The frontend will use Dexhune's extensive historical data types to create a truly decentralized charting dApp.",
links: '<a href="https://github.com/Peng-Protocol/Dexhune-SS/blob/main/Auxiliary/DexhuneMarkets.sol" target="_blank">Github</a>',
statusImage: './assets/dexhuneStatusYellow.png'
},
{
title: "Chainmail",
description: "A fully end-to-end encrypted blockchain messaging dApp, with newsletter and social media elements integrating a novel distributed moderation system.",
links: "None",
statusImage: './assets/dexhuneStatusRed.png'
},
{
title: "Mysterium",
description: "A decentralized relayer network for ERC-4337 user-ops. Enables \"Routines\" and automated conditional calls via \"subsidy\" accounts for gas payments.",
links: "None",
statusImage: './assets/dexhuneStatusRed.png'
},
{
title: "Webway",
description: "A private (but optionally moderated) transfer and swap system using ZK-SNARKS.",
links: "None",
statusImage: './assets/dexhuneStatusRed.png'
},
{
title: "Autodeployer",
description: "A fun little dApp for creating stable-meme-coins.",
links: "None",
statusImage: './assets/dexhuneStatusRed.png'
},
{
title: "Dredger Lobby",
description: "A middle-ware system for creating p2p marketplaces with decentralized moderation and longitudinal review mechanisms.",
links: "None",
statusImage: './assets/dexhuneStatusRed.png'
},
{
title: "Dexhune Token",
description: "A demonstration of \"holder cell\" arrays for storing holder addresses on-chain, based on <a href=\"https://github.com/Peng-Protocol/Dexhune-P/blob/main/LAU/LinkGold.sol\" target=\"_blank\">Link Gold</a>. Eliminates the need for off-chain holder fetches. Will be mintable up to \"maxSupply\", all mints will go to a \"poolManager\" contract which will use the mint revenue to create two-sided Dexhune-SS or CoinClash liquidity deposits, all rewards from the pool will be distributed to Dexhune holders. Former holders of <a href=\"https://mint.dexhune.eth.limo\" target=\"_blank\">Peng NFTs</a>, will be eligible for conversion of their holdings at 1:10 ratio.",
links: "None",
statusImage: './assets/dexhuneStatusRed.png'
},
{
title: "MailNames",
description: "A domain name system for <button class=\"card-link-button\" data-title=\"Chainmail\">Chainmail</button> that will enable free mints of domain names with a one year allowance. To extend the allowance period by another year the retainer must \"check-in\". Check-ins will be free. Prospective buyers will be able to create offers to buy a name from an existing retainer.",
links: "None",
statusImage: './assets/dexhuneStatusRed.png'
},
{
title: "Preferro",
description: "A blockchain domain name management system that will allow users to lock a given domain name for a period of time. While the name is locked it will not be transferable, rather the original retainer/holder will be able to change the content of the base name and create new subnames, but existing subnames cannot be changed. The aim is to create immutable frontend applications, with upgrades being handled through the issuance of a new subname.",
links: "None",
statusImage: './assets/dexhuneStatusRed.png'
},
{
title: "Net Concordance",
description: "A P2P sub-network for storing, transforming, and delivering files using deterministic file hashing. A key utility for <button class=\"card-link-button\" data-title=\"Immaterium\">Immaterium</button>. The system will use a fee market for initial storage of files, with additional time paid for by users via access fee micro/macropayments.",
links: "None",
statusImage: './assets/dexhuneStatusRed.png'
},
{
title: "Super-Concordance",
description: "A P2P sub-network integrating IPFS for storing and presenting static webpages, similar fee setup as <button class=\"card-link-button\" data-title=\"Net Concordance\">Net Concordance</button>.",
links: "None",
statusImage: './assets/dexhuneStatusRed.png'
}
];
function setTheme(isDark) {
if (isToggling) return;
isToggling = true;
setTimeout(() => {
if (isDark) {
body.classList.remove('light-mode');
body.classList.add('dark-mode');
toggleButton.textContent = '☀️';
} else {
body.classList.remove('dark-mode');
body.classList.add('light-mode');
toggleButton.textContent = '🌙';
}
isToggling = false;
}, 200);
}
function closeModal(modalDiv) {
try {
if (!modalDiv) {
console.warn('Attempted to close undefined modal');
return;
}
console.log('Closing modal');
modalDiv.style.display = 'none';
modalDiv.remove();
modalStack = modalStack.filter(item => item.modal !== modalDiv);
if (modalStack.length > 0) {
console.log('Showing previous modal:', modalStack[modalStack.length - 1].title);
modalStack[modalStack.length - 1].modal.style.display = 'flex';
}
} catch (e) {
console.error('Error closing modal:', e);
}
}
function showModal(title, description, links, zIndex = 1000) {
try {
console.log('Opening modal for:', title);
const modalDiv = document.createElement('div');
modalDiv.className = 'modal';
modalDiv.style.zIndex = zIndex;
modalDiv.innerHTML = `
<div class="modal-content">
<span class="close">×</span>
<div class="modal-section">
<div class="modal-header">Description</div>
<p>${description}</p>
</div>
<div class="modal-section">
<div class="modal-header">Links</div>
<div class="modal-links">${links}</div>
</div>
</div>
`;
document.body.appendChild(modalDiv);
modalDiv.style.display = 'flex';
const closeButton = modalDiv.querySelector('.close');
const modalLinksDiv = modalDiv.querySelector('.modal-links');
const modalDescription = modalDiv.querySelector('.modal-section p');
// Handle close button
const handleClose = (e) => {
e.preventDefault();
e.stopPropagation();
closeModal(modalDiv);
};
closeButton.addEventListener('click', handleClose);
closeButton.addEventListener('touchstart', handleClose, { passive: false });
// Handle outside click/tap
const handleOutsideClick = (e) => {
if (e.target === modalDiv) {
closeModal(modalDiv);
}
};
modalDiv.addEventListener('click', handleOutsideClick);
modalDiv.addEventListener('touchstart', handleOutsideClick, { passive: true });
// Handle card-link buttons
modalDescription.querySelectorAll('.card-link-button').forEach(button => {
const linkedTitle = button.getAttribute('data-title');
const handleCardLinkButton = (e) => {
e.preventDefault();
e.stopPropagation();
console.log('Clicked card-link-button:', linkedTitle);
const linkedCard = cardData.find(card => card.title === linkedTitle);
if (linkedCard) {
closeModal(modalDiv);
showModal(linkedCard.title, linkedCard.description, linkedCard.links, zIndex + 10);
} else {
console.warn('Card-link-button target not found:', linkedTitle);
}
};
button.addEventListener('click', handleCardLinkButton);
button.addEventListener('touchstart', handleCardLinkButton, { passive: false });
});
modalStack.push({ modal: modalDiv, title, description, links });
} catch (e) {
console.error('Error showing modal:', title, e);
}
}
function createCard({ title, description, links, statusImage }) {
try {
const card = document.createElement('div');
card.className = 'card';
card.innerHTML = `
<div class="card-title">${title}</div>
<div class="card-status" style="background-image: url('${statusImage}');"></div>
`;
let touchTimeout;
const handleCardInteraction = (e) => {
e.stopPropagation();
if (modalStack.length > 0) {
modalStack[modalStack.length - 1].modal.style.display = 'none';
}
showModal(title, description, links);
};
card.addEventListener('click', handleCardInteraction);
card.addEventListener('touchstart', (e) => {
e.stopPropagation();
touchTimeout = setTimeout(() => handleCardInteraction(e), 200);
}, { passive: true });
card.addEventListener('touchend', (e) => {
e.stopPropagation();
clearTimeout(touchTimeout);
}, { passive: true });
card.addEventListener('touchmove', (e) => {
e.stopPropagation();
clearTimeout(touchTimeout);
}, { passive: true });
return card;
} catch (e) {
console.error('Error creating card:', title, e);
return null;
}
}
window.addEventListener('load', () => {
try {
console.log('Starting card creation...');
cardData.forEach((data, index) => {
console.log(`Creating card ${index + 1}: ${data.title}`);
const card = createCard(data);
if (card) {
cardContainer.appendChild(card);
} else {
console.warn(`Failed to create card for: ${data.title}`);
}
});
console.log('Card creation completed.');
toggleButton.addEventListener('click', (e) => {
e.stopPropagation();
if (!isToggling) {
isDark = !isDark;
setTheme(isDark);
}
});
toggleButton.addEventListener('touchstart', (e) => {
e.preventDefault();
e.stopPropagation();
if (!isToggling) {
isDark = !isDark;
setTheme(isDark);
}
}, { passive: false });
} catch (e) {
console.error('Error in window.load event:', e);
}
});
setTheme(isDark);
</script>
</body>
</html>