Skip to content

Commit c1f2f82

Browse files
Massimiliano Pippimasci
Massimiliano Pippi
authored andcommitted
fix version selector
1 parent 520630d commit c1f2f82

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/js/version-select.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
window.addEventListener("DOMContentLoaded", function() {
1+
window.addEventListener("DOMContentLoaded", function () {
22
// This is a bit hacky. Figure out the base URL from a known CSS file the
33
// template refers to...
44
var ex = new RegExp("/?assets/fonts/material-icons.css$");
@@ -12,29 +12,29 @@ window.addEventListener("DOMContentLoaded", function() {
1212
var select = document.createElement("select");
1313
select.classList.add("form-control");
1414

15-
options.forEach(function(i) {
15+
options.forEach(function (i) {
1616
var option = new Option(i.text, i.value, undefined,
17-
i.value === selected);
17+
i.value === selected);
1818
select.add(option);
1919
});
2020

2121
return select;
2222
}
2323

2424
var xhr = new XMLHttpRequest();
25-
xhr.open("GET", REL_BASE_URL + "/../versions.json");
26-
xhr.onload = function() {
25+
xhr.open("GET", ABS_BASE_URL + "/../versions.json");
26+
xhr.onload = function () {
2727
var versions = JSON.parse(this.responseText);
2828

29-
var realVersion = versions.find(function(i) {
29+
var realVersion = versions.find(function (i) {
3030
return i.version === CURRENT_VERSION ||
31-
i.aliases.includes(CURRENT_VERSION);
31+
i.aliases.includes(CURRENT_VERSION);
3232
}).version;
3333

34-
var select = makeSelect(versions.map(function(i) {
35-
return {text: i.title, value: i.version};
34+
var select = makeSelect(versions.map(function (i) {
35+
return { text: i.title, value: i.version };
3636
}), realVersion);
37-
select.addEventListener("change", function(event) {
37+
select.addEventListener("change", function (event) {
3838
window.location.href = REL_BASE_URL + "/../" + this.value;
3939
});
4040

0 commit comments

Comments
 (0)