Skip to content

Commit 833a5f2

Browse files
authored
Merge pull request #649 from kgryte/fix-version-menu-bug
2 parents 8c5ba34 + 244796d commit 833a5f2

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

spec/_static/javascripts/version_dropdown.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ function add_version_dropdown(json_loc, target_loc, text) {
2121
dropdown.appendChild(content);
2222
$.getJSON(json_loc, function(versions) {
2323
var currentURL = window.location.href;
24-
var path = currentURL.split("_site")[1];
25-
path = path.split("/");
26-
path = path.slice(2, path.length);
27-
path = path.join("/");
28-
for (var key in versions) {
29-
if (versions.hasOwnProperty(key)) {
30-
var a = document.createElement("a");
31-
a.innerHTML = key;
32-
a.title = key;
33-
assign_href(a, target_loc + versions[key], path);
34-
content.appendChild(a);
24+
var path = currentURL.split(/_site|array_api/)[1];
25+
if (path) {
26+
path = path.split("/");
27+
path = path.slice(2, path.length);
28+
path = path.join("/");
29+
for (var key in versions) {
30+
if (versions.hasOwnProperty(key)) {
31+
var a = document.createElement("a");
32+
a.innerHTML = key;
33+
a.title = key;
34+
assign_href(a, target_loc + versions[key], path);
35+
content.appendChild(a);
36+
}
3537
}
3638
}
3739
}).done(function() {

0 commit comments

Comments
 (0)