-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path404.html
More file actions
150 lines (143 loc) · 4.32 KB
/
Copy path404.html
File metadata and controls
150 lines (143 loc) · 4.32 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="algolia-site-verification" content="7D377B04DA329B56" />
<title>Page Not Found</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background-color: #f8f9fa;
color: #343a40;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
text-align: center;
}
.container {
background: white;
padding: 3rem;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
max-width: 500px;
width: 90%;
}
h1 {
font-size: 4rem;
margin: 0;
color: #dc3545;
}
h2 {
font-size: 1.5rem;
margin-top: 0.5rem;
margin-bottom: 1.5rem;
font-weight: 500;
}
p {
font-size: 1.1rem;
margin-bottom: 2rem;
color: #6c757d;
}
.btn {
display: inline-block;
padding: 0.75rem 1.5rem;
font-size: 1.1rem;
color: #fff;
background-color: #007bff;
text-decoration: none;
border-radius: 4px;
transition: background-color 0.2s;
}
.btn:hover {
background-color: #0056b3;
}
#error-state {
display: none;
}
.spinner {
border: 4px solid rgba(0, 0, 0, 0.1);
width: 40px;
height: 40px;
border-radius: 50%;
border-left-color: #007bff;
animation: spin 1s linear infinite;
margin: 0 auto 1rem auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div class="container">
<div id="loading-state">
<div class="spinner"></div>
<h2>Redirecting...</h2>
<p>Looking up the requested page.</p>
</div>
<div id="error-state">
<h1>404</h1>
<h2>Page Not Found</h2>
<p>The page you are looking for does not exist or has been moved.</p>
<a href="/manual/" id="latest-link" class="btn">Go to the latest Fluxnova Documentation</a>
</div>
</div>
<script>
(async function() {
const currentPath = window.location.pathname;
const currentHash = window.location.hash;
let latestVersion = '';
// Find versions.json by traversing up the directory structure
let rootPath = currentPath;
do {
try {
const response = await fetch(`${rootPath}/manual/versions.json`, { method: 'HEAD' });
if (response.ok) {
break; // Found the versions.json, stop looking further up
}
} catch (error) {
// Ignore errors and continue looking up
}
rootPath = rootPath.substring(0, rootPath.lastIndexOf('/'));
} while (rootPath.length > 0);
try {
let response = await fetch(`${rootPath}/manual/versions.json`);
if (response.ok) {
const versions = await response.json();
if (Array.isArray(versions) && versions.length > 0) {
latestVersion = versions[0];
}
}
} catch (error) {
console.error("Failed to fetch versions.json:", error);
}
if (latestVersion) {
if (currentPath === '/') {
window.location.replace(`${rootPath}/manual/${latestVersion}/${currentHash}`);
return;
} else if (currentPath.search('/manual/latest/') >= 0) {
const targetUrl = currentPath.replace('/manual/latest/', `/manual/${latestVersion}/`) + currentHash;
window.location.replace(targetUrl);
return; // Stop execution, browser is redirecting
} else {
document.getElementById('latest-link').href = `${rootPath}/manual/${latestVersion}/`;
}
} else {
// Fallback in case versions.json cannot be loaded
if (currentPath === '/') {
window.location.replace(`/manual/latest/${currentHash}`);
return;
}
document.getElementById('latest-link').href = `${rootPath}/manual/latest/`;
}
// If we reach this point, it means no redirection happened
document.getElementById('loading-state').style.display = 'none';
document.getElementById('error-state').style.display = 'block';
})();
</script>
</body>
</html>