-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path404.html
More file actions
330 lines (283 loc) · 12 KB
/
Copy path404.html
File metadata and controls
330 lines (283 loc) · 12 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
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Primary Meta Tags -->
<title>404 - Page Not Found</title>
<meta name="title" content="404 - Page Not Found">
<meta name="description" content="The requested page or tool link could not be found.">
<style>
/* ==========================================================================
DESIGN SYSTEM VARIABLES (DARK THEME - DEFAULT)
========================================================================== */
:root, [data-theme="dark"] {
--bg-main: #090d16;
--bg-card: rgba(19, 27, 46, 0.6);
--bg-card-hover: rgba(25, 36, 61, 0.8);
--border-color: rgba(255, 255, 255, 0.08);
--border-hover: rgba(99, 102, 241, 0.5);
--text-primary: #f8fafc;
--text-secondary: #94a3b8;
--text-muted: #64748b;
--accent-primary: #6366f1; /* Indigo */
--accent-hover: #4f46e5;
--accent-glow: rgba(99, 102, 241, 0.25);
--input-bg: rgba(15, 23, 42, 0.8);
--icon-bg: rgba(255, 255, 255, 0.03);
--btn-bg: rgba(255, 255, 255, 0.04);
--btn-hover: rgba(255, 255, 255, 0.09);
--bg-gradient:
radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
radial-gradient(circle at 80% 80%, rgba(14, 165, 233, 0.05) 0%, transparent 40%);
--heading-gradient: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
--card-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
}
/* ==========================================================================
LIGHT THEME OVERRIDES
========================================================================== */
[data-theme="light"] {
--bg-main: #f8fafc;
--bg-card: rgba(255, 255, 255, 0.75);
--bg-card-hover: rgba(255, 255, 255, 0.95);
--border-color: rgba(0, 0, 0, 0.08);
--border-hover: rgba(79, 70, 229, 0.4);
--text-primary: #0f172a;
--text-secondary: #475569;
--text-muted: #94a3b8;
--accent-primary: #4f46e5;
--accent-hover: #4338ca;
--accent-glow: rgba(79, 70, 229, 0.15);
--input-bg: rgba(255, 255, 255, 0.9);
--icon-bg: rgba(0, 0, 0, 0.04);
--btn-bg: rgba(0, 0, 0, 0.03);
--btn-hover: rgba(0, 0, 0, 0.07);
--bg-gradient:
radial-gradient(circle at 50% 0%, rgba(79, 70, 229, 0.08) 0%, transparent 50%),
radial-gradient(circle at 80% 80%, rgba(14, 165, 233, 0.05) 0%, transparent 40%);
--heading-gradient: linear-gradient(135deg, #0f172a 0%, #334155 100%);
--card-shadow: 0 12px 25px -5px rgba(0, 0, 0, 0.08);
}
/* Shared Dimensions & Fonts */
:root {
--radius-lg: 16px;
--radius-md: 10px;
--radius-sm: 6px;
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
--font-mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
background-color: var(--bg-main);
color: var(--text-primary);
font-family: var(--font-sans);
min-height: 100vh;
line-height: 1.5;
padding: 2rem 1.5rem 4rem;
background-image: var(--bg-gradient);
background-attachment: fixed;
transition: background-color 0.3s ease, color 0.3s ease;
display: flex;
flex-direction: column;
}
.container { max-width: 680px; margin: 0 auto; width: 100%; flex: 1; display: flex; flex-direction: column; }
/* Top Navigation Bar */
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3rem; }
.back-link {
display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; font-weight: 500; padding: 6px 12px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border-color); transition: all 0.2s ease;
}
.back-link:hover { color: var(--text-primary); border-color: var(--accent-primary); }
.theme-toggle {
background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-primary); padding: 8px 14px; border-radius: 20px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 500; backdrop-filter: blur(8px); transition: all 0.2s ease;
}
.theme-toggle:hover { border-color: var(--accent-primary); box-shadow: 0 0 12px var(--accent-glow); }
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="dark"] .sun-icon { display: block; } [data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; } [data-theme="light"] .moon-icon { display: block; }
/* Redirect Loader */
.redirect-loader {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: auto 0;
gap: 1.25rem;
text-align: center;
}
.spinner {
width: 44px;
height: 44px;
border: 3.5px solid var(--border-color);
border-top-color: var(--accent-primary);
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
.loader-text {
color: var(--text-secondary);
font-size: 0.95rem;
font-weight: 500;
}
/* Card Container */
.notFoundCard {
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 3rem 2rem;
backdrop-filter: blur(12px);
box-shadow: var(--card-shadow);
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
margin: auto 0;
animation: fadeIn 0.4s ease;
}
.code-badge {
font-size: 3.5rem;
font-weight: 800;
line-height: 1;
background: var(--heading-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 0.5rem;
letter-spacing: -0.02em;
}
h1 {
font-size: 1.5rem;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 0.75rem;
}
.description {
color: var(--text-secondary);
font-size: 0.95rem;
max-width: 440px;
margin-bottom: 2rem;
line-height: 1.6;
}
.requested-path {
display: inline-block;
background: var(--input-bg);
border: 1px solid var(--border-color);
color: var(--accent-primary);
font-family: var(--font-mono);
padding: 2px 8px;
border-radius: var(--radius-sm);
font-size: 0.85rem;
word-break: break-all;
}
.action-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 12px 24px;
border-radius: var(--radius-md);
background: var(--accent-primary);
color: #fff;
font-size: 0.95rem;
font-weight: 600;
text-decoration: none;
transition: all 0.2s ease;
border: none;
}
.action-btn:hover {
background: var(--accent-hover);
box-shadow: 0 4px 12px var(--accent-glow);
transform: translateY(-1px);
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
</style>
</head>
<body>
<div class="container">
<!-- Top Nav Bar -->
<div class="top-bar">
<a href="/" class="back-link">
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"/></svg>
Return to Hub
</a>
<button class="theme-toggle" id="themeToggleBtn">
<svg class="sun-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"/></svg>
<svg class="moon-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"/></svg>
<span id="themeToggleText">Light Mode</span>
</button>
</div>
<!-- Redirect Checking State -->
<div id="redirectLoader" class="redirect-loader">
<div class="spinner"></div>
<p class="loader-text">Checking redirect mapping...</p>
</div>
<!-- 404 Fallback Display Card (Initially Hidden) -->
<main id="notFoundCard" class="notFoundCard" style="display: none;">
<div class="code-badge">404</div>
<h1>Page Not Found</h1>
<p class="description">
We couldn't find any tool or page associated with <code id="requestedPath" class="requested-path"></code>.
</p>
<a href="/" class="action-btn">
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"/></svg>
Return to Tool Hub
</a>
</main>
</div>
<script>
// --------------------------------------------------------------------------
// Theme Switcher
// --------------------------------------------------------------------------
const themeToggleBtn = document.getElementById('themeToggleBtn');
const themeToggleText = document.getElementById('themeToggleText');
const htmlElement = document.documentElement;
function applyTheme(theme) {
htmlElement.setAttribute('data-theme', theme);
localStorage.setItem('theme', theme);
themeToggleText.textContent = theme === 'dark' ? 'Light Mode' : 'Dark Mode';
}
const savedTheme = localStorage.getItem('theme') || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
applyTheme(savedTheme);
themeToggleBtn.addEventListener('click', () => {
const currentTheme = htmlElement.getAttribute('data-theme');
applyTheme(currentTheme === 'dark' ? 'light' : 'dark');
});
// --------------------------------------------------------------------------
// Shortlink Redirection & Fallback
// --------------------------------------------------------------------------
async function handle404Redirection() {
const loader = document.getElementById('redirectLoader');
const card = document.getElementById('notFoundCard');
const pathDisplay = document.getElementById('requestedPath');
// Extract path segments (e.g., "/104" -> ["104"])
const path = window.location.pathname;
const pathSegments = path.split('/').filter(Boolean);
pathDisplay.textContent = path;
if (pathSegments.length > 0) {
const querySegment = pathSegments[0].toLowerCase();
const possibleId = parseInt(querySegment, 10);
try {
const configRes = await fetch('/tools-config.json');
if (configRes.ok) {
const config = await configRes.json();
// Match by tool_id (e.g. 104) OR by tool name (e.g. uuid-generator)
const matchedTool = config.tools.find(t =>
(t.tool_id && t.tool_id === possibleId) ||
(t.name && t.name.toLowerCase() === querySegment)
);
if (matchedTool && matchedTool.card && matchedTool.card.url) {
// Redirect to destination URL
window.location.replace(`${matchedTool.card.url}`);
return;
}
}
} catch (err) {
console.error('Error verifying tools-config.json:', err);
}
}
// If no match found or error occurs, show 404 UI
loader.style.display = 'none';
card.style.display = 'flex';
}
handle404Redirection();
</script>
</body>
</html>