-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path404.html
41 lines (36 loc) · 1.33 KB
/
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
39
40
41
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script>
const serverSlash = 5;
const nextRoute = location.href;
const searchStart = nextRoute.indexOf('?');
const anchorStart = nextRoute.indexOf('#');
let search = "";
let anchor = '';
if (searchStart > 0) {
const searchEnd = anchorStart > 0 ? anchorStart : nextRoute.length;
search = nextRoute.substring(searchStart + 1, searchEnd);
}
if (anchorStart > 0) {
const anchorEnd = nextRoute.length;
anchor = nextRoute.substring(anchorStart + 1, anchorEnd);
}
const route = nextRoute.split("/");
route.splice(0,serverSlash);
localStorage.setItem("PT_nextRoute", route.join("/"));
const path = nextRoute.split("/").slice(0,serverSlash).join("/");
const HREF = `${path}/${search? `?${search}` : '' }${anchor? `#${anchor}` : '' }`;
if (location.href !== HREF) {
location.href = HREF;
}
</script>
</head>
<body>
</body>
</html>