-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackold2.html
More file actions
358 lines (334 loc) · 18.1 KB
/
packold2.html
File metadata and controls
358 lines (334 loc) · 18.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Discord Chat Archive Reader</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap" rel="stylesheet">
<style>
:root{ --bg:#0f1012; --card:#16171a; --muted:#98a0b3; --accent:#5865f2; }
*{ box-sizing: border-box; }
html,body{ height:100%; margin:0; font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial; background: linear-gradient(180deg,#080808 0%, #0f1012 60%); color:#e6eef8; overflow-x: hidden; }
.app{ min-height:100vh; display:flex; align-items:flex-start; justify-content:center; padding:36px }
.container{ width:100%; max-width:1000px; display:grid; grid-template-columns: 360px 1fr; gap:20px; align-items:start }
.sidebar{ background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); border-radius:12px; padding:18px; box-shadow: 0 6px 24px rgba(3,6,12,0.6); }
.main{ background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); border-radius:12px; padding:18px; box-shadow: 0 6px 24px rgba(3,6,12,0.6); display:flex; flex-direction:column; max-height: calc(100vh - 120px); }
h1{ font-size:18px; margin:0 0 10px 0; font-weight:600 }
.controls{ display:flex; gap:8px; align-items:center; margin-bottom:12px }
.file-btn, .ghost-btn{ background:var(--accent); color:white; border:none; padding:10px 12px; border-radius:8px; cursor:pointer; font-weight:600 }
.ghost-btn{ background:transparent; border:1px solid rgba(255,255,255,0.04); color:var(--muted); font-weight:500 }
.search{ flex:1; padding:10px 12px; border-radius:8px; border:1px solid rgba(255,255,255,0.03); background:transparent; color:inherit }
#messages{ overflow:auto; border-radius:8px; padding:8px; background:linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0.01)); flex:1; max-height: calc(100vh - 200px); }
.message{ display:flex; gap:12px; padding:12px; border-radius:10px; align-items:flex-start; transition:background 120ms; max-width:100%; }
.message:hover{ background:rgba(255,255,255,0.015) }
.avatar{ width:48px; height:48px; border-radius:12px; background:#111; object-fit:cover; flex-shrink:0 }
.meta{ display:flex; gap:8px; align-items:center; margin-bottom:6px }
.author{ font-weight:600; color:#fff }
.timestamp{ color:var(--muted); font-size:12px }
.text{ color:#dbe9ff; line-height:1.35; overflow-wrap:anywhere; word-break:break-word; }
.attachments{ display:flex; gap:8px; margin-top:8px; flex-wrap:wrap }
.attachment{ width:140px; height:96px; object-fit:cover; border-radius:8px; cursor:pointer; box-shadow:0 6px 18px rgba(0,0,0,0.5) }
.empty{ color:var(--muted); padding:40px; text-align:center }
.footer{ text-align:center; color:var(--muted); font-size:13px; padding-top:8px }
/* modal */
.modal-backdrop{ position:fixed; inset:0; display:none; align-items:center; justify-content:center; background:linear-gradient(180deg, rgba(0,0,0,0.6), rgba(0,0,0,0.75)); z-index:2000 }
/* Fancy alert */
.fancy-alert-backdrop{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,0.45); z-index:3000 }
.fancy-alert{ width:420px; max-width:92%; background:linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02)); border-radius:12px; padding:18px; box-shadow:0 12px 40px rgba(0,0,0,0.6); border:1px solid rgba(255,255,255,0.04); animation: alertIn 240ms ease both }
.fancy-alert h3{ margin:0 0 8px 0; font-size:16px }
.fancy-alert p{ margin:0 0 12px 0; color:var(--muted) }
.fancy-alert .actions{ display:flex; justify-content:flex-end; gap:8px }
.fancy-alert .btn{ padding:8px 12px; border-radius:8px; cursor:pointer; border:none }
.fancy-alert .btn.primary{ background:var(--accent); color:#fff }
.fancy-alert .btn.ghost{ background:transparent; border:1px solid rgba(255,255,255,0.04); color:var(--muted) }
@keyframes alertIn{ from{ transform: translateY(12px) scale(.98); opacity:0 } to{ transform: translateY(0) scale(1); opacity:1 } }
.modal-backdrop.show{ display:flex }
.modal-card{ max-width:90%; max-height:85%; border-radius:12px; overflow:auto }
.modal-img{ max-width:100%; height:auto; display:block; border-radius:8px }
@media (max-width:820px){ .container{ grid-template-columns: 1fr; } .sidebar{ order:2 } }
/* Fancy page mode (easter egg) */
@keyframes bgMove {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
body.fancy-mode {
background: linear-gradient(120deg, #0b1020, #0e0720, #071022, #07121a);
background-size: 400% 400%;
animation: bgMove 12s ease infinite;
}
body.fancy-mode .container{
box-shadow: 0 24px 80px rgba(88,101,242,0.12), inset 0 0 60px rgba(88,101,242,0.04);
border-radius:14px;
border: 1px solid rgba(88,101,242,0.12);
animation: borderPulse 3s ease-in-out infinite;
}
body.fancy-mode .sidebar, body.fancy-mode .main{
border-radius:14px;
box-shadow: 0 12px 50px rgba(3,6,12,0.6), 0 0 30px rgba(88,101,242,0.03) inset;
transition: box-shadow 400ms;
}
body.fancy-mode .message{ transform-origin:left center; animation: floatMsg 6s ease-in-out infinite }
@keyframes floatMsg { 0%{ transform: translateY(0)} 50%{ transform: translateY(-6px)} 100%{ transform: translateY(0)} }
body.fancy-mode .avatar{ box-shadow: 0 6px 18px rgba(88,101,242,0.14); border-radius:12px }
/* subtle animated border glow */
body.fancy-mode .container::before{ content:''; position:absolute; inset:-2px; background:linear-gradient(90deg, rgba(88,101,242,0.18), rgba(60,200,180,0.12), rgba(88,101,242,0.18)); filter:blur(18px); z-index:-1; border-radius:16px; opacity:0.95; animation: bgMove 10s linear infinite }
@keyframes borderPulse {
0% {
box-shadow: 0 24px 60px rgba(88,101,242,0.06), inset 0 0 30px rgba(88,101,242,0.02);
border-color: rgba(88,101,242,0.08);
}
50% {
box-shadow: 0 30px 100px rgba(88,101,242,0.18), inset 0 0 80px rgba(88,101,242,0.06);
border-color: rgba(60,200,180,0.16);
}
100% {
box-shadow: 0 24px 60px rgba(88,101,242,0.06), inset 0 0 30px rgba(88,101,242,0.02);
border-color: rgba(88,101,242,0.08);
}
}
/* pulse inner panels too */
body.fancy-mode .sidebar, body.fancy-mode .main{ animation: innerPulse 3s ease-in-out infinite }
@keyframes innerPulse {
0% { box-shadow: 0 12px 50px rgba(3,6,12,0.6), 0 0 8px rgba(88,101,242,0.02) inset; }
50% { box-shadow: 0 18px 70px rgba(3,6,12,0.6), 0 0 30px rgba(88,101,242,0.06) inset; }
100% { box-shadow: 0 12px 50px rgba(3,6,12,0.6), 0 0 8px rgba(88,101,242,0.02) inset; }
}
</style>
</head>
<body>
<div id="root" class="app"></div>
<!-- React + Babel (lightweight dev build) -->
<script src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.min.js"></script>
<script type="text/babel">
const { useState, useRef } = React;
function formatDate(ts){
try{ return new Date(ts).toLocaleString(); }catch(e){ return ts }
}
function App(){
const [messages, setMessages] = useState([]);
const [filter, setFilter] = useState('');
const [modalSrc, setModalSrc] = useState(null);
const [showImportModal, setShowImportModal] = useState(false);
const [urlInput, setUrlInput] = useState('');
const [alert, setAlert] = useState(null); // {title, message}
const fileInputRef = useRef();
function openFile(){ setShowImportModal(true); }
function onFile(e){
const f = e.target.files && e.target.files[0];
if(!f) return;
const r = new FileReader();
r.onload = (ev) => {
try{
const data = JSON.parse(ev.target.result);
// normalize to array of messages
setMessages(Array.isArray(data) ? data : (data.messages || []));
}catch(err){ alert('Invalid JSON file') }
// if import modal was open, close it after file chosen
setShowImportModal(false);
};
r.readAsText(f);
}
async function handleUrlImport() {
if (!urlInput) return alert('Enter a URL');
try {
const res = await fetch(urlInput);
if (!res.ok) throw new Error('Network response was not ok');
const data = await res.json();
setMessages(Array.isArray(data) ? data : (data.messages || []));
setShowImportModal(false);
setUrlInput('');
} catch (err) {
console.error(err);
setAlert({ title: 'Fetch error', message: 'Failed to fetch or parse JSON from URL' });
}
}
function renderMessage(m, i){
const hasAttachments = m.attachments && m.attachments.length;
if(filter && !(m.content || '').toLowerCase().includes(filter.toLowerCase()) && !(m.author && m.author.name && m.author.name.toLowerCase().includes(filter.toLowerCase()))) return null;
return (
<div className="message" key={i}>
<img className="avatar" src={m.author && m.author.avatar ? m.author.avatar : 'https://via.placeholder.com/80x80?text=U'} alt="avatar" />
<div style={{flex:1}}>
<div className="meta">
<div>
<div className="author">{m.author ? `${m.author.name}#${m.author.discriminator}` : 'Unknown'}</div>
<div className="timestamp">{formatDate(m.timestamp)}</div>
</div>
</div>
<div className="text">{m.content || ''}</div>
{hasAttachments ? (
<div className="attachments">
{m.attachments.map((a,idx)=> (
<img key={idx} className="attachment" src={a} onClick={()=>setModalSrc(a)} alt="attachment" />
))}
</div>
) : null}
</div>
</div>
)
}
// easter egg: clear click tracker
const clearTrackerRef = React.useRef({ count:0, last:0, timer:null });
const fancyRef = React.useRef({ enabled:false, raf: null, canvas: null, particles: [] });
function startFancy() {
if (fancyRef.current.enabled) return;
fancyRef.current.enabled = true;
document.body.classList.add('fancy-mode');
// create canvas overlay for particles
const canvas = document.createElement('canvas');
canvas.id = 'fancy-canvas';
canvas.style.position = 'fixed';
canvas.style.top = '0';
canvas.style.left = '0';
canvas.style.width = '100%';
canvas.style.height = '100%';
canvas.style.pointerEvents = 'none';
canvas.style.zIndex = '2500';
document.body.appendChild(canvas);
fancyRef.current.canvas = canvas;
const ctx = canvas.getContext('2d');
function resize() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
resize();
window.addEventListener('resize', resize);
// create particles
const particles = [];
const colours = ['rgba(88,101,242,0.9)', 'rgba(60,200,180,0.9)', 'rgba(255,120,120,0.9)'];
for (let i=0;i<80;i++){
particles.push({
x: Math.random()*canvas.width,
y: Math.random()*canvas.height,
r: 1 + Math.random()*3,
vx: (Math.random()-0.5)*0.6,
vy: (Math.random()-0.5)*0.6,
c: colours[Math.floor(Math.random()*colours.length)],
alpha: 0.2 + Math.random()*0.6
});
}
fancyRef.current.particles = particles;
function tick(){
ctx.clearRect(0,0,canvas.width,canvas.height);
particles.forEach(p=>{
p.x += p.vx; p.y += p.vy;
if (p.x < -10) p.x = canvas.width+10;
if (p.x > canvas.width+10) p.x = -10;
if (p.y < -10) p.y = canvas.height+10;
if (p.y > canvas.height+10) p.y = -10;
ctx.beginPath();
ctx.fillStyle = p.c.replace('0.9', p.alpha.toFixed(2));
ctx.arc(p.x, p.y, p.r, 0, Math.PI*2);
ctx.fill();
});
fancyRef.current.raf = requestAnimationFrame(tick);
}
fancyRef.current.raf = requestAnimationFrame(tick);
// attach resize remover
fancyRef.current._onResize = resize;
}
function stopFancy() {
if (!fancyRef.current.enabled) return;
fancyRef.current.enabled = false;
document.body.classList.remove('fancy-mode');
// stop animation and remove canvas
if (fancyRef.current.raf) cancelAnimationFrame(fancyRef.current.raf);
if (fancyRef.current.canvas) {
window.removeEventListener('resize', fancyRef.current._onResize);
try { fancyRef.current.canvas.remove(); } catch(e) {}
fancyRef.current.canvas = null;
}
fancyRef.current.particles = [];
}
function handleClearClick(){
const now = Date.now();
const st = clearTrackerRef.current;
if (now - st.last > 5000) { st.count = 0; }
st.count++;
st.last = now;
if (st.timer) clearTimeout(st.timer);
st.timer = setTimeout(()=>{ st.count = 0 }, 5000);
setMessages([]);
// trigger fancy mode if 5 clicks within 5s
if (st.count >=5) {
if (fancyRef.current.enabled) {
stopFancy();
setAlert({ title: 'Fancy mode disabled', message: 'Easter egg turned off.' });
} else {
startFancy();
setAlert({ title: 'Easter Egg!', message: 'Fancy mode activated ✨' });
}
st.count = 0;
}
}
return (
<div className="container">
<div className="sidebar">
<h1>Discord Chat Archive</h1>
<div style={{display:'flex',gap:8, marginBottom:12}}>
<button className="file-btn" onClick={openFile}>Import JSON</button>
<button className="ghost-btn" onClick={handleClearClick}>Clear</button>
</div>
<input ref={fileInputRef} type="file" accept="application/json" style={{display:'none'}} onChange={onFile} />
{/* Import Modal */}
{showImportModal && (
<div style={{marginTop:8, padding:12, background:'rgba(0,0,0,0.4)', borderRadius:8}}>
<div style={{marginBottom:8}}>Choose import method:</div>
<div style={{display:'flex', gap:8}}>
<button className="file-btn" onClick={()=>{ fileInputRef.current.click(); }}>From file</button>
<div style={{flex:1}}>
<input className="search" placeholder="Enter JSON URL..." value={urlInput} onChange={e=>setUrlInput(e.target.value)} />
<div style={{display:'flex', gap:8, marginTop:8}}>
<button className="file-btn" onClick={handleUrlImport}>Import from URL</button>
<button className="ghost-btn" onClick={()=>{ setShowImportModal(false); setUrlInput(''); }}>Cancel</button>
</div>
</div>
</div>
</div>
)}
<p style={{color:'var(--muted)', marginTop:6}}>Tip: export Discord JSON or use a channel export. Click attachments to preview.</p>
<div style={{height:16}}></div>
<div style={{borderTop:'1px solid rgba(255,255,255,0.02)', paddingTop:12}}>
<div style={{fontSize:13, color:'var(--muted)', marginBottom:8}}>Messages: <strong style={{color:'#fff'}}>{messages.length}</strong></div>
<div className="footer">Built with ❤️ by MilitaryLotus</div>
</div>
</div>
<div className="main">
<div className="controls">
<input placeholder="Search messages or authors..." className="search" value={filter} onChange={e=>setFilter(e.target.value)} />
<button className="ghost-btn" onClick={()=>{ setFilter('') }}>Reset</button>
</div>
<div id="messages">
{messages.length === 0 ? (<div className="empty">No messages loaded. Click "Import JSON" to get started.</div>) : messages.map((m,i)=> renderMessage(m,i))}
</div>
</div>
<div className={"modal-backdrop " + (modalSrc ? 'show' : '')} onClick={()=>setModalSrc(null)}>
{modalSrc && (
<div className="modal-card" onClick={e=>e.stopPropagation()}>
<img className="modal-img" src={modalSrc} alt="preview" />
</div>
)}
</div>
{/* Fancy alert */}
{alert && (
<div className="fancy-alert-backdrop" onClick={()=>setAlert(null)}>
<div className="fancy-alert" onClick={e=>e.stopPropagation()}>
<h3>{alert.title}</h3>
<p>{alert.message}</p>
<div className="actions">
<button className="btn ghost" onClick={()=>setAlert(null)}>Close</button>
<button className="btn primary" onClick={()=>setAlert(null)}>OK</button>
</div>
</div>
</div>
)}
</div>
)
}
ReactDOM.render(<App />, document.getElementById('root'));
</script>
</body>
</html>