-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
795 lines (699 loc) · 21.6 KB
/
Copy pathindex.html
File metadata and controls
795 lines (699 loc) · 21.6 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
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Projects - SillyLittleTech</title>
<script>
/* ensure theme attribute is present early to avoid FOUC */ (function () {
try {
const t = localStorage.getItem("theme");
if (t) document.documentElement.dataset.theme = t;
} catch (e) { console.warn(e); }
})();
</script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap"
/>
<style>
:root {
--bg-color: #ffffff;
--text-color: #1a1a1a;
--card-bg: #f5f5f5;
--card-hover: #e8e8e8;
--border-color: #e0e0e0;
--shadow: rgba(0, 0, 0, 0.1);
--accent-color: #667eea;
}
[data-theme="dark"] {
--bg-color: #1a1a1a;
--text-color: #ffffff;
--card-bg: #2d2d2d;
--card-hover: #3a3a3a;
--border-color: #404040;
--shadow: rgba(0, 0, 0, 0.3);
--accent-color: #8b9dff;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family:
"Lexend",
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
"Helvetica Neue",
Arial,
sans-serif;
font-size: 18px;
background-color: var(--bg-color);
color: var(--text-color);
transition:
background-color 0.18s ease,
color 0.18s ease;
min-height: 100vh;
line-height: 1.6;
display: flex;
align-items: center;
justify-content: center;
padding: 40px 20px;
padding-bottom: 120px;
}
.container {
max-width: 1200px;
width: 100%;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 60px;
align-items: center;
}
.left-section {
display: flex;
flex-direction: column;
gap: 24px;
}
.right-section {
display: flex;
flex-direction: column;
}
.profile {
display: flex;
align-items: center;
gap: 20px;
margin-bottom: 10px;
}
.avatar {
width: 80px;
height: 80px;
border-radius: 50%;
overflow: hidden;
border: 4px solid var(--border-color);
background: var(--card-bg);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
color: var(--text-color);
}
.name {
font-size: 36px;
font-weight: 700;
line-height: 1.2;
}
.description {
font-size: 1.125rem;
color: var(--text-color);
opacity: 0.95;
line-height: 1.6;
font-weight: 600;
}
.back-link {
display: inline-block;
color: var(--accent-color);
text-decoration: none;
font-weight: 500;
}
.back-link:hover {
text-decoration: underline;
}
.links {
display: flex;
flex-direction: column;
gap: 16px;
max-height: 60vh;
overflow-y: auto;
padding-right: 4px;
}
.link-button {
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 18px;
background: linear-gradient(
180deg,
color-mix(in srgb, var(--card-bg) 98%, black 2%),
var(--card-bg)
);
border: 1px solid var(--border-color);
border-radius: 10px;
text-decoration: none;
color: var(--text-color);
font-weight: 700;
font-size: 15px;
transition:
transform 0.25s ease,
box-shadow 0.25s ease,
background 0.18s ease;
box-shadow: 0 6px 20px rgba(10, 10, 10, 0.04);
width: 100%;
text-align: left;
font-family: inherit;
cursor: pointer;
overflow: hidden;
}
.link-button:hover {
background: var(--card-hover);
transform: translateY(-6px);
box-shadow: 0 18px 42px rgba(0, 0, 0, 0.09);
}
.link-title {
flex: 1;
text-align: left;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.link-main {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
flex: 1;
}
.link-icon {
width: 20px;
height: 20px;
border-radius: 4px;
object-fit: cover;
flex-shrink: 0;
}
.link-subtitle {
font-size: 12px;
opacity: 0.8;
color: var(--text-color);
margin-left: 12px;
min-width: 0;
flex: 0 1 auto;
white-space: nowrap;
overflow: hidden;
text-overflow: clip;
}
@media (min-width: 769px) {
.link-subtitle {
text-overflow: ellipsis;
}
}
/* Non-featured items are hidden by default and revealed when expanded */
.link-item-extra {
display: none;
}
.link-item-extra.visible {
display: flex;
animation: fadeSlideIn 0.22s ease forwards;
}
@keyframes fadeSlideIn {
from {
opacity: 0;
transform: translateY(-6px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* "List all" / "Show fewer" toggle button */
.list-all-btn {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 11px 18px;
background: transparent;
border: 1px dashed var(--border-color);
border-radius: 10px;
color: var(--accent-color);
font-family: inherit;
font-weight: 600;
font-size: 14px;
cursor: pointer;
transition:
background 0.18s ease,
border-color 0.18s ease,
color 0.18s ease;
width: 100%;
margin-top: 4px;
}
.list-all-btn:hover {
background: var(--card-bg);
border-color: var(--accent-color);
}
.list-all-btn .btn-arrow {
transition: transform 0.22s ease;
display: inline-block;
}
.list-all-btn.expanded .btn-arrow {
transform: rotate(180deg);
}
/* Divider between featured and extra items */
.extras-divider {
display: none;
align-items: center;
gap: 10px;
font-size: 11px;
font-weight: 600;
opacity: 0.45;
letter-spacing: 0.06em;
text-transform: uppercase;
margin: 4px 0;
}
.extras-divider.visible {
display: flex;
}
.extras-divider::before,
.extras-divider::after {
content: '';
flex: 1;
height: 1px;
background: var(--border-color);
}
.theme-toggle {
position: fixed;
top: 20px;
right: 20px;
background: var(--card-bg);
border: 2px solid var(--border-color);
border-radius: 50%;
width: 50px;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 1000;
transition:
transform 0.18s ease,
background 0.18s ease,
box-shadow 0.18s ease;
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}
.theme-toggle:hover {
background: var(--card-hover);
transform: rotate(12deg);
}
.theme-toggle svg {
width: 24px;
height: 24px;
color: var(--text-color);
}
.sun-icon { display: none; }
.moon-icon { display: block; }
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
/* Modal Styles */
.modal-overlay {
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 2000;
opacity: 0;
pointer-events: none;
transition: opacity 0.2s ease;
backdrop-filter: blur(2px);
}
.modal-overlay.active {
opacity: 1;
pointer-events: auto;
}
.modal-content {
background: var(--card-bg);
padding: 30px;
border-radius: 16px;
border: 1px solid var(--border-color);
max-width: 450px;
width: 90%;
box-shadow: 0 10px 40px var(--shadow);
transform: translateY(-20px) scale(0.95);
transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
position: relative;
color: var(--text-color);
}
.modal-overlay.active .modal-content {
transform: translateY(0) scale(1);
}
.modal-close {
position: absolute;
top: 16px;
right: 20px;
background: none;
border: none;
color: var(--text-color);
cursor: pointer;
font-size: 28px;
line-height: 1;
opacity: 0.6;
transition: opacity 0.2s, transform 0.2s;
}
.modal-close:hover {
opacity: 1;
transform: scale(1.1);
}
.modal-title {
font-size: 22px;
font-weight: 700;
margin-bottom: 16px;
padding-right: 30px;
color: var(--accent-color);
}
.modal-body {
font-size: 16px;
opacity: 0.9;
line-height: 1.6;
white-space: pre-wrap;
}
footer.site-footer {
position: fixed;
left: 0;
right: 0;
bottom: 0;
background: var(--card-bg);
border-top: 1px solid var(--border-color);
padding: 10px 16px;
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
footer.site-footer a {
color: var(--text-color);
text-decoration: none;
font-weight: 600;
}
.footer-inner {
text-align: center;
}
.footer-copyright {
font-size: 12px;
opacity: 0.85;
margin-top: 4px;
}
@media (max-width: 768px) {
body {
align-items: flex-start;
padding: 30px 16px;
padding-bottom: 120px;
}
.container {
grid-template-columns: 1fr;
gap: 40px;
}
.name {
font-size: 28px;
}
.theme-toggle {
width: 45px;
height: 45px;
top: 15px;
right: 15px;
}
.link-subtitle {
margin-left: 12px;
position: relative;
}
.link-subtitle::after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 48px;
background: linear-gradient(
to right,
transparent,
var(--card-bg)
);
pointer-events: none;
}
}
</style>
</head>
<body>
<button class="theme-toggle" id="themeToggle" aria-label="Toggle theme">
<svg class="sun-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
<svg class="moon-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
</button>
<div class="container">
<div class="left-section">
<a href="https://sillylittle.tech" class="back-link">← Back to Home</a>
<div class="profile">
<div class="avatar">
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="16 18 22 12 16 6"></polyline>
<polyline points="8 6 2 12 8 18"></polyline>
</svg>
</div>
<h1 class="name">Projects</h1>
</div>
<p class="description">
Open-source tools and templates built and hosted by SillyLittleTech.
</p>
</div>
<div class="right-section">
<div class="links" id="linksContainer">
<!-- Links are loaded from projects.json -->
</div>
</div>
</div>
<!-- Modal Overlay -->
<div class="modal-overlay" id="infoModal" aria-hidden="true">
<div class="modal-content">
<button class="modal-close" id="closeModal" aria-label="Close modal">×</button>
<div class="modal-title" id="modalTitle">Project Info</div>
<div class="modal-body" id="modalBody"></div>
</div>
</div>
<footer class="site-footer">
<div class="footer-inner">
<a href="https://sillylittle.tech">SillyLittleTech</a>
<div class="footer-copyright">
© 2026 SillyLittleTech.<br />
Fiscally sponsored by The Hack Foundation (d.b.a. Hack Club), a
501(c)(3) nonprofit (EIN: 81-2908499).
</div>
</div>
</footer>
<script>
(function () {
const html = document.documentElement;
function getSavedTheme() {
try { return localStorage.getItem('theme'); } catch (e) { console.warn(e); return null; }
}
function saveTheme(t) {
try { localStorage.setItem('theme', t); } catch (e) { console.warn(e); }
}
function applyTheme(t) {
if (!t) return;
html.dataset.theme = t;
}
function detectSystem() {
try {
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
} catch (e) { console.warn(e); return 'light'; }
}
function toggleTheme() {
const current = html.dataset.theme || 'light';
const next = current === 'light' ? 'dark' : 'light';
applyTheme(next);
saveTheme(next);
}
function getSafeIconPath(iconPath) {
if (typeof iconPath !== 'string') return '';
const normalized = iconPath.trim();
if (!normalized.startsWith('/assets/')) return '';
if (normalized.includes('..')) return '';
return normalized;
}
const CF_RESIZE_PREFIX =
'https://sillylittle.tech/cdn-cgi/image/format=auto,quality=75,width=40/';
const PROJECTS_ORIGIN = 'https://projects.sillylittle.tech';
function isAllowedExternalIconUrl(url) {
try {
const u = new URL(url);
if (u.protocol !== 'https:') return false;
const host = u.hostname.toLowerCase();
return (
host === 'projects.sillylittle.tech' ||
host === 'raw.githubusercontent.com'
);
} catch (e) {
return false;
}
}
function toOptimizedIconSrc(iconPath) {
const repoPath = getSafeIconPath(iconPath);
if (repoPath) {
return CF_RESIZE_PREFIX + PROJECTS_ORIGIN + repoPath;
}
if (typeof iconPath !== 'string') return '';
const trimmed = iconPath.trim();
if (!isAllowedExternalIconUrl(trimmed)) return '';
return CF_RESIZE_PREFIX + trimmed;
}
// Modal Logic
const modal = document.getElementById('infoModal');
const modalTitle = document.getElementById('modalTitle');
const modalBody = document.getElementById('modalBody');
const closeBtn = document.getElementById('closeModal');
function openModal(title, text) {
modalTitle.textContent = title;
modalBody.textContent = text;
modal.classList.add('active');
modal.setAttribute('aria-hidden', 'false');
}
function closeModal() {
modal.classList.remove('active');
modal.setAttribute('aria-hidden', 'true');
}
if (closeBtn) closeBtn.addEventListener('click', closeModal);
if (modal) modal.addEventListener('click', function(e) {
if (e.target === modal) closeModal(); // close when clicking the dark overlay
});
function buildLinkCard(link, extraClass) {
// If 'easy' is explicitly false, it triggers a modal instead of navigating
const isComplex = link.easy === false;
// Use <button> for modal triggers and <a> for regular links
const element = document.createElement(isComplex ? 'button' : 'a');
element.className = 'link-button' + (extraClass ? ' ' + extraClass : '');
if (isComplex) {
element.setAttribute('type', 'button');
element.addEventListener('click', function(e) {
e.preventDefault();
// Trigger the modal with the title and easyText fallback
openModal(link.title || 'Project Info', link.easyText || "No additional information provided.");
});
} else {
element.href = link.url || '#';
if (link.target) element.target = link.target;
}
const main = document.createElement('span');
main.className = 'link-main';
const iconSrc = toOptimizedIconSrc(link.icon);
if (iconSrc) {
const icon = document.createElement('img');
icon.className = 'link-icon';
icon.src = iconSrc;
icon.alt = '';
icon.setAttribute('aria-hidden', 'true');
icon.loading = 'lazy';
icon.decoding = 'async';
main.appendChild(icon);
}
const title = document.createElement('span');
title.className = 'link-title';
const titleText = link.title || link.url || 'Link';
title.textContent = titleText;
title.title = titleText;
main.appendChild(title);
element.appendChild(main);
if (link.subtitle) {
const subtitle = document.createElement('span');
subtitle.className = 'link-subtitle';
subtitle.textContent = link.subtitle;
subtitle.title = link.subtitle;
element.appendChild(subtitle);
}
return element;
}
function renderLinks(containerSelector, jsonPath) {
const container = document.querySelector(containerSelector);
if (!container) return;
fetch(jsonPath)
.then(function (res) {
if (!res.ok) throw new Error('Failed to load ' + jsonPath);
return res.json();
})
.then(function (links) {
container.innerHTML = '';
// 'featured' defaults to false. It only goes in the top list if explicitly set to true.
const featured = links.filter(function (l) { return l.featured === true; });
const extras = links.filter(function (l) { return l.featured !== true; });
// Render featured items
featured.forEach(function (link) {
container.appendChild(buildLinkCard(link, ''));
});
// Only add the divider + extras + toggle if there are non-featured items
if (extras.length > 0) {
const divider = document.createElement('div');
divider.className = 'extras-divider';
divider.setAttribute('aria-hidden', 'true');
divider.textContent = 'More projects';
container.appendChild(divider);
extras.forEach(function (link) {
const card = buildLinkCard(link, 'link-item-extra');
container.appendChild(card);
});
const btn = document.createElement('button');
btn.className = 'list-all-btn';
btn.setAttribute('aria-expanded', 'false');
btn.innerHTML =
'List all projects <span class="btn-arrow" aria-hidden="true">▼</span>';
btn.addEventListener('click', function () {
const expanded = btn.getAttribute('aria-expanded') === 'true';
const nextState = !expanded;
btn.setAttribute('aria-expanded', String(nextState));
btn.classList.toggle('expanded', nextState);
const extraCards = container.querySelectorAll('.link-item-extra');
extraCards.forEach(function (card) {
card.classList.toggle('visible', nextState);
});
divider.classList.toggle('visible', nextState);
btn.innerHTML = nextState
? 'Show fewer <span class="btn-arrow" aria-hidden="true">▼</span>'
: 'List all projects <span class="btn-arrow" aria-hidden="true">▼</span>';
// Scroll the newly revealed items into view smoothly
if (nextState) {
setTimeout(function () {
btn.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}, 50);
}
});
container.appendChild(btn);
}
})
.catch(function (err) {
console.error('Error rendering links:', err);
container.innerHTML =
'<p style="opacity:0.7;font-size:14px;">Could not load projects: ' +
(err && err.message ? err.message : 'unknown error') + '</p>';
});
}
function init() {
const saved = getSavedTheme();
const theme = saved || detectSystem();
applyTheme(theme);
if (!saved) saveTheme(theme);
const btn = document.getElementById('themeToggle');
if (btn) btn.addEventListener('click', toggleTheme);
renderLinks('#linksContainer', 'projects.json');
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();
</script>
</body>
</html>