-
Notifications
You must be signed in to change notification settings - Fork 9
/
404.html
99 lines (96 loc) · 2.48 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
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
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body
style="
margin: 0;
font-family: sans-serif;
"
>
<div
style="
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
"
>
<div
style="
text-align: center;
"
>
<img
src="img/logo-cylc-colour.svg"
/>
<h1
id="redirect-notice"
>
404 - Page Not Found
</h1>
<a
id="redirect"
href="http://www.cylc.org"
style="
font-size: 30px;
text-decoration: none;
border-radius: 10px;
background-color: rgb(78,179,247);
padding: 10px;
color: white;
"
>
Home
</a>
</div>
</div>
<script type="text/javascript">
// the new path to the default version & format of the docs
const newDocRoot = ['cylc-doc', 'stable', 'html']
function compareArrays(a1, a2) {
if (a1.length != a2.length) {
return false;
}
return a1.every(function(val, ind) {
return val === a2[ind];
});
}
function getRedirect() {
const parts = window.location.pathname.split('/');
if (compareArrays(parts, ['', 'documentation', ''])) {
// the old documentation landing page
return newDocRoot;
}
if (
compareArrays(parts.slice(0, 3), ['', 'cylc.github.io', 'doc'])
|| compareArrays(parts.slice(0, 3), ['', 'doc', 'built-sphinx'])
) {
// the old documentation root dir
return newDocRoot.concat(parts.slice(4));
}
if (compareArrays(parts.slice(0, 2), ['', 'doc'])) {
// the old documentation landing page
return newDocRoot.concat(parts.slice(3));
}
return false;
}
const redirect = getRedirect();
if (redirect) {
// get the redirect url
var url = '/' + redirect.join('/');
// add the url fragment if present
if (window.location.hash) {
url = url + window.location.hash;
}
// change the redirect notice
document.getElementById('redirect-notice')
.innerText = 'Page Moved';
document.getElementById('redirect')
.href = url;
document.getElementById('redirect')
.innerText = url;
}
</script>
</body>
</html>