Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Cleanup JS a bit
  • Loading branch information
GuillaumeGomez committed Feb 8, 2019
1 parent 43e04fb commit b962ecc
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/librustdoc/html/static/main.js
Expand Up @@ -79,8 +79,6 @@ if (!DOMTokenList.prototype.remove) {
// 2 for "In Return Types"
var currentTab = 0;

var themesWidth = null;

var titleBeforeSearch = document.title;

function getPageId() {
Expand Down Expand Up @@ -240,7 +238,7 @@ if (!DOMTokenList.prototype.remove) {
return String.fromCharCode(c);
}

function displayHelp(display, ev) {
function displayHelp(display, ev, help) {
if (display === true) {
if (hasClass(help, "hidden")) {
ev.preventDefault();
Expand All @@ -258,7 +256,7 @@ if (!DOMTokenList.prototype.remove) {
hideModal();
var search = document.getElementById("search");
if (hasClass(help, "hidden") === false) {
displayHelp(false, ev);
displayHelp(false, ev, help);
} else if (hasClass(search, "hidden") === false) {
ev.preventDefault();
addClass(search, "hidden");
Expand Down Expand Up @@ -289,7 +287,7 @@ if (!DOMTokenList.prototype.remove) {

case "s":
case "S":
displayHelp(false, ev);
displayHelp(false, ev, help);
hideModal();
ev.preventDefault();
focusSearchBar();
Expand All @@ -304,7 +302,7 @@ if (!DOMTokenList.prototype.remove) {
case "?":
if (ev.shiftKey) {
hideModal();
displayHelp(true, ev);
displayHelp(true, ev, help);
}
break;
}
Expand Down Expand Up @@ -654,7 +652,7 @@ if (!DOMTokenList.prototype.remove) {
return MAX_LEV_DISTANCE + 1;
}
}
return lev_distance;//Math.ceil(total / done);
return Math.ceil(total / done);
}
}
return MAX_LEV_DISTANCE + 1;
Expand Down Expand Up @@ -2432,7 +2430,7 @@ if (!DOMTokenList.prototype.remove) {
// for vertical layout (column-oriented flex layout for divs caused
// errors in mobile browsers).
if (e.tagName === "H2" || e.tagName === "H3") {
let nextTagName = e.nextElementSibling.tagName;
var nextTagName = e.nextElementSibling.tagName;
if (nextTagName == "H2" || nextTagName == "H3") {
e.nextElementSibling.style.display = "flex";
} else {
Expand Down

0 comments on commit b962ecc

Please sign in to comment.