-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpack1.html
More file actions
365 lines (316 loc) · 8.22 KB
/
pack1.html
File metadata and controls
365 lines (316 loc) · 8.22 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
<!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</title>
<!-- Link to the DiscordChatExporter CSS file -->
<link rel="stylesheet" href="discord-.css">
<style>
body {
font-family: 'Whitney', 'Helvetica Neue', Arial, sans-serif;
background-color: #36393f;
margin: 0;
padding: 20px;
color: #dcddde;
}
#messages {
background-color: #2f3136;
border-radius: 8px;
padding: 20px;
max-width: 800px;
margin: 0 auto;
overflow-y: auto;
scrollbar-width: thin; /* New: Custom scrollbar width */
scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); /* New: Custom scrollbar color */
}
/* New: Define custom scrollbar colors */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #2f3136;
}
::-webkit-scrollbar-thumb {
background-color: #7289da;
border-radius: 10px;
}
.message {
display: flex;
padding: 10px 0;
border-bottom: 1px solid #202225;
}
.message:last-child {
border-bottom: none;
}
.avatar {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 10px;
}
.message-content {
display: flex;
flex-direction: column;
}
.author {
font-weight: 600;
color: #7289da;
margin-bottom: 2px;
}
.timestamp {
color: #72767d;
font-size: 0.75em;
margin-left: 10px;
}
.text {
color: #dcddde;
line-height: 1.4;
font-size: 0.9em;
}
.attachment-container {
display: flex;
flex-wrap: wrap;
}
.attachment {
max-width: 200px;
max-height: 200px;
margin: 5px;
border-radius: 5px;
object-fit: cover;
cursor: pointer;
transition: transform 0.2s ease-in-out;
}
.attachment:hover {
transform: scale(1.05);
}
/* Styling for file input */
.file-upload-container {
position: relative;
overflow: hidden;
display: inline-block;
margin-top: 10px;
}
.file-upload {
background-color: #7289da;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.file-upload:hover {
background-color: #5469a4;
}
.file-upload:focus {
outline: none;
}
.file-upload-container input[type=file] {
position: absolute;
top: 0;
right: 0;
opacity: 0;
font-size: 20px;
cursor: pointer;
}
.selected-file {
margin-top: 10px;
font-size: 0.9em;
color: #7289da;
}
/* Modal Styles */
.modal {
display: none;
position: fixed;
z-index: 9999;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.9);
}
.modal-content {
margin: auto;
display: block;
max-width: 80%;
max-height: 80%;
}
.modal img {
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
margin: auto;
display: block;
border-radius: 5px;
cursor: pointer;
transition: transform 0.2s ease-in-out;
}
.close {
position: absolute;
top: 15px;
right: 35px;
color: #f1f1f1;
font-size: 40px;
font-weight: bold;
transition: 0.3s;
cursor: pointer;
}
.close:hover,
.close:focus {
color: #bbb;
text-decoration: none;
cursor: pointer;
}
/* Credits Popup */
.credits-popup {
display: none;
position: fixed;
z-index: 9999;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background-color: #36393f;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
max-width: 80%;
max-height: 80%;
overflow-y: auto;
color: #dcddde;
}
.credits-popup-content {
margin-bottom: 20px;
}
.credits-popup h2 {
color: #7289da;
margin-top: 0;
}
.credits-popup p {
margin-top: 0;
line-height: 1.6;
}
.credits-popup-close {
position: absolute;
top: 10px;
right: 10px;
color: #dcddde;
cursor: pointer;
}
/* Modern Button Style */
.modern-button {
background-color: #2A50D8;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 1em;
transition: background-color 0.3s ease;
margin-top: 10px;
}
.modern-button:hover {
background-color: #5469a4;
}
.modern-button:focus {
outline: none;
}
</style>
</head>
<body>
<h1>Discord Chat Archive</h1>
<div class="file-upload-container">
<label for="fileInput" class="file-upload">Choose File</label>
<input type="file" id="fileInput">
<span class="selected-file" id="selectedFile"></span>
</div>
<div id="messages"></div>
<!-- The Modal -->
<div id="myModal" class="modal">
<span class="close">×</span>
<img class="modal-content" id="modalImg">
</div>
<!-- Credits Popup -->
<div id="creditsPopup" class="credits-popup">
<div class="credits-popup-content">
<span class="credits-popup-close" onclick="closeCreditsPopup()">×</span>
<h2>Credits</h2>
<p>This Discord Chat Archive tool was created by Your Name.</p>
<h2>How to Use</h2>
<p>1. Choose a JSON file exported from Discord.</p>
<p>2. Click on messages to view attachments in a modal.</p>
<h2>About</h2>
<p>This tool is designed to help users archive and view Discord chat history conveniently.</p>
</div>
</div>
<!-- Credits Popup Button -->
<button class="modern-button" onclick="openCreditsPopup()">Credits & Info</button>
<script>
document.getElementById('fileInput').addEventListener('change', function(event) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
const messages = JSON.parse(e.target.result);
const messagesContainer = document.getElementById('messages');
messagesContainer.innerHTML = ''; // Clear any existing messages
messages.forEach((message, index) => {
const messageElement = document.createElement('div');
messageElement.classList.add('message');
messageElement.innerHTML = `
<img class="avatar" src="${message.author.avatar}" alt="Avatar">
<div class="message-content">
<div>
<span class="author">${message.author.name}#${message.author.discriminator}</span>
<span class="timestamp">${new Date(message.timestamp).toLocaleString()}</span>
</div>
<div class="text">${message.content}</div>
</div>`;
messagesContainer.appendChild(messageElement);
// If there are attachments, add them as images
if (message.attachments.length) {
const attachmentContainer = document.createElement('div');
attachmentContainer.classList.add('attachment-container');
messageElement.appendChild(attachmentContainer);
message.attachments.forEach((url, attachmentIndex) => {
const img = document.createElement('img');
img.src = url;
img.classList.add('attachment');
img.dataset.messageIndex = index;
img.dataset.attachmentIndex = attachmentIndex;
attachmentContainer.appendChild(img);
img.addEventListener('click', function() {
const modal = document.getElementById('myModal');
const modalImg = document.getElementById('modalImg');
modal.style.display = "block";
modalImg.src = this.src;
});
});
}
});
};
reader.readAsText(file);
}
});
document.querySelector('.close').addEventListener('click', function() {
document.getElementById('myModal').style.display = "none";
});
window.onclick = function(event) {
const modal = document.getElementById('myModal');
if (event.target === modal) {
modal.style.display = "none";
}
};
// Function to open the credits popup
function openCreditsPopup() {
document.getElementById('creditsPopup').style.display = "block";
}
// Function to close the credits popup
function closeCreditsPopup() {
document.getElementById('creditsPopup').style.display = "none";
}
</script>
</body>
</html>