-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomics.html
More file actions
161 lines (147 loc) · 6.36 KB
/
Copy pathcomics.html
File metadata and controls
161 lines (147 loc) · 6.36 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>GunkyZone — Comics</title>
<link href="https://fonts.googleapis.com/css2?family=VT323&family=Share+Tech+Mono&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #020202; --border: #1a1a1a; --text: #d4c0c0;
--accent: #9b0000; --font-disp: 'VT323', monospace;
}
body {
background: var(--bg); color: var(--text); font-family: var(--font-disp); padding: 20px;
}
@keyframes terminalOn {
0% { opacity: 0; transform: scaleY(0.95) scaleX(0.95); filter: brightness(3) contrast(2); }
20% { opacity: 1; transform: scaleY(1.02) scaleX(1.02); filter: brightness(1.5) contrast(1.5); }
40% { opacity: 0.8; transform: scaleY(0.98) scaleX(0.98); filter: brightness(1.2); }
60% { opacity: 1; transform: scaleY(1.01) scaleX(1.01); filter: brightness(1.1); }
80% { opacity: 0.9; transform: scaleY(0.99) scaleX(0.99); filter: brightness(1.05); }
100% { opacity: 1; transform: none; filter: none; }
}
.site-wrapper { max-width: 900px; margin: 0 auto; animation: terminalOn 0.4s ease-out forwards; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; margin-top: 40px; }
.comic-card { border: 1px solid var(--border); background: #050505; cursor: pointer; transition: 0.2s; }
.comic-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.thumb { width: 100%; aspect-ratio: 3/4; background: #111; object-fit: cover; border-bottom: 1px solid var(--border); }
.info { padding: 10px; text-align: center; text-transform: uppercase; letter-spacing: 1px; }
/* MODAL */
#comic-modal { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.95); z-index: 9999; align-items: center; justify-content: center; }
#modal-content { position: relative; width: min(80vw, 600px); height: 85vh; border: 1px solid var(--accent); flex-shrink: 0; box-shadow: 0 0 40px rgba(0,0,0,0.8); }
iframe { width: 100%; height: 100%; border: none; display: block; }
.close-modal { position: absolute; top: 0; right: 0; z-index: 10; color: var(--accent); cursor: pointer; font-size: 24px; background: rgba(0,0,0,0.85); padding: 2px 10px; border-left: 1px solid var(--accent); border-bottom: 1px solid var(--accent); }
</style>
</head>
<body>
<div class="site-wrapper">
<h1 style="color: var(--accent); font-size: 40px;">> COMIC_ARCHIVE</h1>
<a href="index.html" style="color: #5a3a3a; text-decoration: none;">[ BACK_TO_ROOT ]</a>
<div id="comic-grid" class="grid"></div>
</div>
<div id="comic-modal" onclick="if(event.target === this) closeComic()">
<div id="modal-content">
<span class="close-modal" onclick="closeComic()">[ CLOSE_X ]</span>
<iframe id="comic-iframe" src=""></iframe>
</div>
</div>
<script src="https://www.gstatic.com/firebasejs/9.22.2/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.22.2/firebase-database-compat.js"></script>
<script>
const fbConfig = {
apiKey: "AIzaSyD1L4Mmgnbl0W7lk1rnaRu5wv61TSFhJqM",
authDomain: "gunkychat.firebaseapp.com",
databaseURL: "https://gunkychat-default-rtdb.firebaseio.com",
projectId: "gunkychat",
storageBucket: "gunkychat.firebasestorage.app",
messagingSenderId: "423489767287",
appId: "1:423489767287:web:ce847768781b0f589dc372"
};
firebase.initializeApp(fbConfig);
function loadComics() {
// First try to load from Firebase, fallback to media.json
if (typeof firebase !== 'undefined' && firebase.database) {
firebase.database().ref('media_metadata/comics').once('value').then(snap => {
const data = snap.val();
if (data) {
const comics = Object.values(data).sort((a, b) => b.uploadedAt - a.uploadedAt);
renderComics(comics);
preloadPDFs(comics);
} else {
fetchLocalComics();
}
}).catch(() => fetchLocalComics());
} else {
fetchLocalComics();
}
}
function fetchLocalComics() {
fetch('media.json').then(r => r.json()).then(data => {
renderComics(data.comics || []);
preloadPDFs(data.comics || []);
});
}
function preloadPDFs(comics) {
const pdfs = comics.filter(c => c.url && c.url.toLowerCase().endsWith('.pdf')).map(c => c.url);
if (pdfs.length === 0) return;
let i = 0;
function loadNext() {
if (i >= pdfs.length) return;
fetch(pdfs[i], { cache: 'force-cache' })
.then(res => res.blob())
.then(() => {
i++;
setTimeout(loadNext, 500);
})
.catch(e => {
console.log('Prefetch failed for', pdfs[i]);
i++;
setTimeout(loadNext, 500);
});
}
// Start preloading after a short delay
setTimeout(loadNext, 1000);
}
function renderComics(comics) {
const grid = document.getElementById('comic-grid');
grid.innerHTML = '';
comics.forEach(comic => {
grid.innerHTML += `
<div class="comic-card" onclick="openComic('${comic.url}')">
<img class="thumb" src="${comic.thumbnail || ''}" alt="THUMB">
<div class="info">${comic.title}</div>
</div>`;
});
}
function openComic(url) {
const modal = document.getElementById('comic-modal');
const iframe = document.getElementById('comic-iframe');
// We send the file to your custom viewer
iframe.src = `pdf-viewer.html?url=${encodeURIComponent(url)}`;
modal.style.display = 'flex';
}
function closeComic() {
const params = new URLSearchParams(window.location.search);
if (params.get('from') === 'index') {
window.location.href = 'index.html';
return;
}
document.getElementById('comic-modal').style.display = 'none';
document.getElementById('comic-iframe').src = '';
// Clean up the URL so refreshing doesn't reopen the comic
window.history.replaceState({}, document.title, window.location.pathname);
}
window.onload = () => {
loadComics();
// Check if a specific comic was requested via URL
const params = new URLSearchParams(window.location.search);
const requestedUrl = params.get('url');
if (requestedUrl) {
openComic(requestedUrl);
}
};
</script>
</body>
</html>