-
Notifications
You must be signed in to change notification settings - Fork 0
/
404.html
38 lines (32 loc) · 969 Bytes
/
404.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Page not found</title>
<script type="text/javascript">
const ROUTE_MAP = [
{ from: /^\/devtools\/(\w+)\/.*/, to: '/devtools/$1' },
];
function matchRedirect() {
for (const { from, to } of ROUTE_MAP) {
if (!location.pathname.match(from)) continue;
const finalUrl = new URL(window.location.href);
finalUrl.pathname = finalUrl.pathname.replace(from, to);
const finalPathname = finalUrl.pathname;
finalUrl.search = finalUrl.hash = '';
const restUrl = location.href.replace(finalUrl.href, '');
return { final: finalPathname, rest: restUrl }
}
return null;
}
const redirect = matchRedirect();
if (redirect) {
sessionStorage.setItem('github-page-route-redirect', JSON.stringify(redirect));
window.location.pathname = redirect.final;
}
</script>
</head>
<body>
404
</body>
</html>