-
Notifications
You must be signed in to change notification settings - Fork 1
/
404.html
150 lines (130 loc) · 6.01 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
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">
<title>jMonkeyEngine Javadoc - 404</title>
<link rel="stylesheet" href="/style.css">
<!-- Polyfills, since this page must work also for ancient browsers -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.13/es5-shim.min.js" integrity="sha256-ZRWwGWedbHHvnM8DDaoLhDR5Zfjd+/1TCnC9mwh9lEg=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.5/es6-shim.min.js" integrity="sha256-v4QwgOaE1ZEBhPc7nMtFztuz+yWcxwiYM0OwG0Wtj3Q=" crossorigin="anonymous"></script>
<script>
window.onload=function(){
var pathname = window.location.pathname;
var redirect=function(cnt,redir){
document.getElementById("spinner").style.display="block";
console.log("Redirect to",redir);
var t=cnt.querySelector("#time").innerHTML*1000;
console.log("Redirect in",t);
// Redirect in 5 seconds
setTimeout(function(){
document.location.href = redir;
},t);
// Setup a clickable link, in case the automatic redirect fails for some reason
var redirel= cnt.querySelector("#redir");
redirel.style.display="block";
redirel.querySelector("a").href=redir;
// Decrease the value in #time every second (just a visual feedback for the timer)
setInterval(function(){
var timer=cnt.querySelector("#time");
var time=timer.innerHTML;
time-=1;
if(time<0)time=0;
timer.innerHTML=Math.floor(time);
},1000);
}
var redir=null;
if(!pathname.startsWith("/v3.x")){
if(pathname.startsWith("/latest")){ // redirect to latest version
pathname=pathname.substring("/latest".length);
var cnt=document.querySelector("#txLatest");
cnt.style.display="block";
document.querySelector("#tx").style.display="none";
const latestReleaseUrl="https://api.github.com/repos/jMonkeyEngine/jmonkeyengine/releases/latest";
const req = new XMLHttpRequest();
req.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
const json=JSON.parse(this.responseText);
console.log("Detect latest version",json["tag_name"]);
redir="/"+json["tag_name"]+pathname;
redirect(cnt,redir);
}
};
req.open("GET", latestReleaseUrl, true);
req.send();
}else{ // If the missing page is not inside /v3.x (the old javadoc) then we setup a redirect
// Migration: Redirect v3.2.4-stable to old javadoc
if(pathname.startsWith("/v3.2.4-stable"))pathname=pathname.substring("/v3.2.4-stable".length);
//
redir="/v3.x"+pathname;
var cnt=document.querySelector("#tx");
cnt.style.display="block";
redirect(cnt,redir);
}
}
};
</script>
<style>
#spinner,#redir {
display:none;
}
p{
margin:0.2em;
padding:0;
}
#tx,#txLatest{
font-size:1.5em;
width:100%;
text-align:center;
}
#tx h1,#txLatest h1{
font-size:2em;
}
#txLatest{
display:none;
}
.lds-dual-ring {
display:inline-block;
width: 8em;
height: 8em;
display:block;
margin:auto;
margin-top:2em;
margin-bottom:6em;
}
.lds-dual-ring:after {
content: " ";
display: block;
width: 5.8em;
height: 5.8em;
margin: 0.8em;
border-radius: 50%;
border: 0.5em solid #ffd700;
border-color: #ffd700 transparent #ffd700 transparent;
animation: lds-dual-ring 1.2s linear infinite;
}
@keyframes lds-dual-ring {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div id="spinner">
<div class="lds-dual-ring"></div>
</div>
<div id="tx">
<h1>This page doesn't exist anymore.</h1>
<p>You can visit the new javadoc <a href="/">here</a>.</p>
<p id="redir">You will be automatically redirected to the <a href="/v3.x/">old javadoc archive</a> in <span id="time">5</span> seconds.
</div>
<div id="txLatest">
<h1>You are being redirected to the latest javadoc.</h1>
<p>You can select a different version from <a href="/">here</a>.</p>
<p id="redir">You will be automatically redirected to the <a href="/">latest javadoc</a> in <span id="time">1</span> seconds.
</div>
</body>
</html>