Skip to content

Commit

Permalink
Remove dead code in main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Apr 26, 2022
1 parent 509b145 commit 4e0be6d
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,29 +504,6 @@ function hideThemeButtonState() {
document.addEventListener("keypress", handleShortcut);
document.addEventListener("keydown", handleShortcut);

(function() {
const x = document.getElementsByClassName("version-selector");
if (x.length > 0) {
x[0].onchange = function() {
let url = document.location.href, stripped = "";
const len = window.rootPath.match(/\.\.\//g).length + 1;

for (let i = 0; i < len; ++i) {
const match = url.match(/\/[^/]*$/);
if (i < len - 1) {
stripped = match[0] + stripped;
}
url = url.substring(0, url.length - match[0].length);
}

const selectedVersion = document.getElementsByClassName("version-selector")[0].value;
url += "/" + selectedVersion + stripped;

document.location.href = url;
};
}
}());

// delayed sidebar rendering.
window.initSidebarItems = function(items) {
const sidebar = document.getElementsByClassName("sidebar-elems")[0];
Expand Down

0 comments on commit 4e0be6d

Please sign in to comment.