-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
482 lines (440 loc) · 21.7 KB
/
index.html
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
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Temporary Email</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
.fade-in {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.copy-animation {
animation: copyAnimation 1s ease-in-out;
}
@keyframes copyAnimation {
0% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(1.2);
opacity: 0.5;
}
100% {
transform: scale(1);
opacity: 1;
}
}
</style>
<script>
const translations = {
en: {
title: 'Temp Mail',
description: 'Forget about spam, advertising mailings, hacking and attacking robots. Keep your real mailbox clean and secure. Temp Mail provides temporary, secure, anonymous, free, disposable email address.',
copy: 'Copy',
refresh: 'Refresh',
change: 'Change',
emptyInbox: 'Your inbox is empty',
waiting: 'Waiting for incoming emails',
loading: 'Loading...',
about: 'About',
developer: 'Developer',
version: 'Version',
followGithub: 'Follow me on GitHub',
emailDetails: 'Email Details',
back: 'Back',
aboutTitle: 'About This Website',
aboutContent: 'This website provides temporary, secure, anonymous, free, disposable email addresses. Forget about spam, advertising mailings, hacking, and attacking robots. Keep your real mailbox clean and secure.',
developerTitle: 'Developer',
developerContent: 'This website was developed by mowhn.',
versionTitle: 'Version',
versionContent: 'Current version: 1.1.1',
mail: 'Mail',
yourTempEmail: 'Your Temporary Email Address',
pleaseGenerate: 'Please generate or input an email address first!'
},
zh: {
title: '临时邮箱',
description: '告别垃圾邮件、广告邮件、黑客和攻击机器人。保持您的真实邮箱清洁和安全。临时邮箱提供临时、安全、匿名、免费、一次性的电子邮件地址。',
copy: '复制',
refresh: '刷新',
change: '更换',
emptyInbox: '您的收件箱是空的',
waiting: '等待收到邮件',
loading: '加载中...',
about: '关于',
developer: '开发者',
version: '版本',
followGithub: '在GitHub上关注我',
emailDetails: '邮件详情',
back: '返回',
aboutTitle: '关于本网站',
aboutContent: '本网站提供临时、安全、匿名、免费、一次性的电子邮件地址。告别垃圾邮件、广告邮件、黑客和攻击机器人,保持您的真实邮箱清洁和安全。',
developerTitle: '开发者',
developerContent: '本网站由 mowhn 开发,由Taskschd1145增加简体中文。',
versionTitle: '版本',
versionContent: '当前版本:1.1.1',
mail: '邮件',
yourTempEmail: '您的临时邮箱地址',
pleaseGenerate: '请先生成或输入邮箱地址!'
}
};
</script>
</head>
<body class="bg-black text-green-500 h-screen flex flex-col items-center justify-center">
<div id="main-content" class="bg-gray-900 text-green-500 p-6 rounded-lg shadow-lg w-full max-w-4xl h-full flex flex-col justify-between">
<div class="flex justify-between items-center mb-4">
<h1 class="text-xl font-semibold" id="page-title">Temp Mail</h1>
<div class="flex items-center space-x-2">
<button onclick="toggleLanguage()" class="bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-language"></i>
</button>
<button id="menu-button" class="bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-bars"></i>
</button>
</div>
</div>
<div class="bg-gray-800 p-4 rounded-lg flex items-center justify-between mb-4">
<input id="addr" class="bg-transparent text-lg w-full outline-none" readonly>
</div>
<div class="text-center text-gray-400 mb-6">
<p class="text-sm sm:text-base">Forget about spam, advertising mailings, hacking and attacking robots. Keep your real mailbox clean and secure. Temp Mail provides temporary, secure, anonymous, free, disposable email address.</p>
</div>
<div class="flex flex-col sm:flex-row justify-center space-y-2 sm:space-y-0 sm:space-x-4 mb-6">
<button onclick="copyEmail()" class="bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-copy"></i>
<span>Copy</span>
</button>
<button onclick="refreshMail()" class="bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-sync-alt"></i>
<span>Refresh</span>
</button>
<button onclick="genEmail()" class="bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-exchange-alt"></i>
<span>Change</span>
</button>
</div>
<div class="bg-gray-800 rounded-lg shadow-lg p-4 flex-grow overflow-x-auto">
<table class="w-full table-auto">
<thead>
<tr class="bg-gray-700 text-green-500 p-2 rounded-t-lg">
<th class="p-2 text-xs sm:text-sm" id="mail-header">Mail</th>
</tr>
</thead>
<tbody id="emails" class="text-gray-400">
<tr>
<td class="text-center p-6">
<i class="fas fa-envelope-open-text text-4xl mb-4"></i>
<p class="text-lg">Your inbox is empty</p>
<p>Waiting for incoming emails</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="fullscreen-menu" class="fixed inset-0 bg-gray-900 bg-opacity-95 text-green-500 hidden z-50">
<div class="flex flex-col items-center justify-center h-full space-y-4">
<button onclick="closeMenu()" class="absolute top-4 right-4 bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-times"></i>
</button>
<a href="javascript:void(0)" onclick="showAbout()" class="block px-4 py-2 text-lg hover:bg-gray-700 rounded">About</a>
<a href="javascript:void(0)" onclick="showDeveloper()" class="block px-4 py-2 text-lg hover:bg-gray-700 rounded">Developer</a>
<a href="javascript:void(0)" onclick="showVersion()" class="block px-4 py-2 text-lg hover:bg-gray-700 rounded">Version</a>
<a href="https://github.com/mowhn" target="_blank" class="block px-4 py-2 text-lg hover:bg-gray-700 rounded">Follow me on GitHub</a>
</div>
</div>
<div id="fullscreen-menu-content" class="fixed inset-0 bg-gray-900 bg-opacity-95 text-green-500 hidden z-50 overflow-y-auto">
<div class="flex flex-col items-center justify-center h-full space-y-4 fade-in">
<button onclick="backToMenu()" class="absolute top-4 right-4 bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-arrow-left"></i>
</button>
<div id="menu-content" class="text-center p-4"></div>
</div>
</div>
<script>
let currentEmail = localStorage.getItem('currentEmail') || '';
let currentLang = localStorage.getItem('language') || 'en';
function getUserAndDomain() {
const addr = $("#addr").val();
if (!addr) {
const t = translations[currentLang];
alert(t.pleaseGenerate);
return null;
}
const [user, domain] = addr.split("@");
return { user, domain };
}
function genEmail() {
$.getJSON(
"https://www.1secmail.com/api/v1/?action=genRandomMailbox&count=1",
(res) => {
currentEmail = res[0];
localStorage.setItem('currentEmail', currentEmail);
$("#addr").val(currentEmail);
refreshMail();
}
);
}
function refreshMail() {
const { user, domain } = getUserAndDomain();
if (!user || !domain) return;
const t = translations[currentLang];
const emailsElement = $("#emails");
emailsElement.empty();
emailsElement.append(`
<tr>
<td class="text-center p-6">
<i class="fas fa-spinner fa-spin text-4xl mb-4"></i>
<p class="text-lg">${t.loading}</p>
</td>
</tr>
`);
$.getJSON(
`https://www.1secmail.com/api/v1/?action=getMessages&login=${user}&domain=${domain}`,
(emails) => {
emailsElement.empty();
if (emails.length === 0) {
emailsElement.append(`
<tr>
<td class="text-center p-6 w-full">
<div class="flex flex-col items-center justify-center">
<i class="fas fa-envelope-open-text text-4xl mb-4"></i>
<p class="text-lg">${t.emptyInbox}</p>
<p>${t.waiting}</p>
</div>
</td>
</tr>
`);
} else {
for (const email of emails) {
emailsElement.append(`
<tr>
<td class="p-2 text-xs sm:text-sm break-words">
<a href="javascript:void(0)" onclick="viewEmail('${email.id}', '${email.from}', '${email.subject}', '${email.date}')">
${email.subject} - ${email.from}
</a>
</td>
</tr>
`);
}
}
}
);
}
function viewEmail(id, from, subject, date) {
const { user, domain } = getUserAndDomain();
if (!user || !domain) return;
$.getJSON(
`https://www.1secmail.com/api/v1/?action=readMessage&login=${user}&domain=${domain}&id=${id}`,
(email) => {
const emailContent = `
<div class="bg-gray-900 text-green-500 p-6 rounded-lg shadow-lg w-full max-w-4xl h-full flex flex-col justify-between fade-in overflow-y-auto">
<div class="text-center mb-4">
<h1 class="text-xl font-semibold">Email Details</h1>
</div>
<div class="bg-gray-800 p-4 rounded-lg mb-4">
<p><strong>ID:</strong> ${id}</p>
<p><strong>From:</strong> ${from}</p>
<p><strong>Subject:</strong> ${subject}</p>
<p><strong>Date:</strong> ${date}</p>
<p><strong>Content:</strong> ${email.htmlBody || email.body}</p>
</div>
<button onclick="goBack()" class="bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-arrow-left"></i>
<span>Back</span>
</button>
</div>
`;
$('#main-content').html(emailContent);
}
);
}
function goBack() {
const t = translations[currentLang];
$('#main-content').html(`
<div class="flex justify-between items-center mb-4">
<h1 class="text-xl font-semibold" id="page-title">${t.title}</h1>
<div class="flex items-center space-x-2">
<button onclick="toggleLanguage()" class="bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-language"></i>
</button>
<button id="menu-button" class="bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-bars"></i>
</button>
</div>
</div>
<div class="bg-gray-800 p-4 rounded-lg flex items-center justify-between mb-4">
<input id="addr" class="bg-transparent text-lg w-full outline-none" readonly value="${currentEmail}">
</div>
<div class="text-center text-gray-400 mb-6">
<p class="text-sm sm:text-base">${t.description}</p>
</div>
<div class="flex flex-col sm:flex-row justify-center space-y-2 sm:space-y-0 sm:space-x-4 mb-6">
<button onclick="copyEmail()" class="bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-copy"></i>
<span>${t.copy}</span>
</button>
<button onclick="refreshMail()" class="bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-sync-alt"></i>
<span>${t.refresh}</span>
</button>
<button onclick="genEmail()" class="bg-gray-800 text-green-500 px-4 py-2 rounded-lg shadow-md flex items-center justify-center space-x-2 hover:bg-gray-700">
<i class="fas fa-exchange-alt"></i>
<span>${t.change}</span>
</button>
</div>
<div class="bg-gray-800 rounded-lg shadow-lg p-4 flex-grow overflow-x-auto">
<table class="w-full table-auto">
<thead>
<tr class="bg-gray-700 text-green-500 p-2 rounded-t-lg">
<th class="p-2 text-xs sm:text-sm" id="mail-header">${t.mail}</th>
</tr>
</thead>
<tbody id="emails" class="text-gray-400">
<tr>
<td class="text-center p-6 w-full">
<div class="flex flex-col items-center justify-center">
<i class="fas fa-envelope-open-text text-4xl mb-4"></i>
<p class="text-lg">${t.emptyInbox}</p>
<p>${t.waiting}</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
`);
refreshMail();
setupMenu();
}
function copyEmail() {
const addr = $("#addr").val();
navigator.clipboard.writeText(addr).then(() => {
const copyButton = $("button:contains('Copy')");
copyButton.addClass("copy-animation");
setTimeout(() => {
copyButton.removeClass("copy-animation");
}, 1000);
});
}
function setupMenu() {
$('#menu-button').on('click', function() {
$('#fullscreen-menu').toggleClass('hidden');
});
$('#fullscreen-menu a').on('click', function() {
$('#fullscreen-menu').addClass('hidden');
});
}
function closeMenu() {
$('#fullscreen-menu').addClass('hidden');
}
function backToMenu() {
$('#fullscreen-menu-content').addClass('hidden');
$('#fullscreen-menu').removeClass('hidden');
}
function showAbout() {
const t = translations[currentLang];
const aboutContent = `
<div class="text-center fade-in">
<h1 class="text-xl font-semibold mb-4">${t.aboutTitle}</h1>
<p>${t.aboutContent}</p>
</div>
`;
$('#menu-content').html(aboutContent);
$('#fullscreen-menu').addClass('hidden');
$('#fullscreen-menu-content').removeClass('hidden');
}
function showDeveloper() {
const t = translations[currentLang];
const developerContent = `
<div class="text-center fade-in">
<h1 class="text-xl font-semibold mb-4">${t.developerTitle}</h1>
<p>${t.developerContent}</p>
</div>
`;
$('#menu-content').html(developerContent);
$('#fullscreen-menu').addClass('hidden');
$('#fullscreen-menu-content').removeClass('hidden');
}
function showVersion() {
const t = translations[currentLang];
const versionContent = `
<div class="text-center fade-in">
<h1 class="text-xl font-semibold mb-4">${t.versionTitle}</h1>
<p>${t.versionContent}</p>
</div>
`;
$('#menu-content').html(versionContent);
$('#fullscreen-menu').addClass('hidden');
$('#fullscreen-menu-content').removeClass('hidden');
}
function toggleLanguage() {
currentLang = currentLang === 'en' ? 'zh' : 'en';
localStorage.setItem('language', currentLang);
updateUIText();
refreshMail();
}
function updateUIText() {
const t = translations[currentLang];
// 更新页面文本
$('#page-title').text(t.title);
$('.text-center.text-gray-400.mb-6 p').text(t.description);
$('button:contains("Copy"), button:contains("复制")').find('span').text(t.copy);
$('button:contains("Refresh"), button:contains("刷新")').find('span').text(t.refresh);
$('button:contains("Change"), button:contains("更换")').find('span').text(t.change);
// 更新表头
$('#mail-header').text(t.mail);
// 更新菜单项
$('a:contains("About"), a:contains("关于")').text(t.about);
$('a:contains("Developer"), a:contains("开发者")').text(t.developer);
$('a:contains("Version"), a:contains("版本")').text(t.version);
$('a:contains("Follow me on GitHub"), a:contains("在GitHub上关注我")').text(t.followGithub);
// 更新空收件箱提示
if ($('#emails').find('td').length === 1) {
const emptyInbox = `
<td class="text-center p-6 w-full">
<div class="flex flex-col items-center justify-center">
<i class="fas fa-envelope-open-text text-4xl mb-4"></i>
<p class="text-lg">${t.emptyInbox}</p>
<p>${t.waiting}</p>
</div>
</td>
`;
$('#emails tr td').html(emptyInbox);
}
// 更新弹窗内容
if ($('#menu-content').is(':visible')) {
const currentContent = $('#menu-content').text();
if (currentContent.includes('About') || currentContent.includes('关于')) {
showAbout();
} else if (currentContent.includes('Developer') || currentContent.includes('开发者')) {
showDeveloper();
} else if (currentContent.includes('Version') || currentContent.includes('版本')) {
showVersion();
}
}
}
$(document).ready(function() {
if (currentEmail) {
$("#addr").val(currentEmail);
refreshMail();
} else {
genEmail();
}
setupMenu();
updateUIText(); // 初始化页面文本
});
</script>
</body>
</html>