-
Notifications
You must be signed in to change notification settings - Fork 22
/
index.html.template
95 lines (90 loc) · 2.84 KB
/
index.html.template
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
<!DOCTYPE html>
<!-- Copyright 2020 the V8 project authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<html lang="en" class="js dark">
<head>
<!-- ANALYTICS_PLACEHOLDER -->
<meta charset="UTF-8">
<link rel="icon" href="favicon.ico">
<title>V8 Tools Versions</title>
<link href="https://v8.dev/_css/main.css" rel="stylesheet">
</head>
<body>
<header id="header">
<h1><a class=v8 href="https://v8.dev">V8</a></h1>
<nav>
<ul>
<li><a href="https://v8.dev/tools">Tools</a></li>
<li class="current"><a href="https:/v8.dev/tools/versions">Tools Versions</a></li>
<li><a href="https://v8.dev">Main Page</a></li>
</ul>
</nav>
</header>
<main id=main>
<h2>Latest Versions </h2>
<p>
Open the most recent tools for <a href="./head">HEAD</a>.
<ul id="latestVersions">
</ul>
</p>
<h2>Other Versions</h2>
<p>
Open tools for:
<select id="versions" onchange="gotoVersion(this)">
<option></option>
</select>
</p>
</main>
<footer id="footer">
<p>
The sources of this page live on <a href="https://github.com/v8/tools">github</a>.
</p>
</footer>
</body>
<script>
// V8 8.6 is the first version with an index.html, other tools might have
// existed for longer.
const kFirstVersionMajor = 8;
const kFirstVersionMinor = 6;
fetch('versions.txt')
.then(response => response.text())
.then(data => addVersionLinks(data));
function addVersionLinks(versions) {
const select = document.getElementById("versions");
versions = versions
.trimEnd().split("\n")
.filter(version => {
// strip "v" prefix/
version = version.substring(1);
const [major, minor] = version.split(".").map(e => parseInt(e));
if (major == kFirstVersionMajor) {
return minor >= kFirstVersionMinor;
}
return major >= kFirstVersionMajor;
}).reverse();
versions.forEach(version => {
const versionNumber = version.substring(1);
const option = document.createElement("option");
option.value = version;
option.innerHTML = `v${versionNumber}`;
select.appendChild(option);
});
const latestVersionsNode = document.getElementById('latestVersions');
for (let i = 0; i < 3; i++) {
const version = versions[i];
const versionNumber = version.substring(1);
const option = document.createElement("option");
const li = document.createElement('li')
li.innerHTML = `<a href="./${version}">v${versionNumber}</a>`;
latestVersionsNode.appendChild(li);
}
}
function gotoVersion(selectNode) {
const version = selectNode.options[selectNode.selectedIndex].value;
if (version.length > 0) {
window.location.href = `./${version}`;
}
}
</script>
</html>