Skip to content

Commit

Permalink
Rollup merge of rust-lang#58297 - GuillaumeGomez:cleanup-js, r=QuietM…
Browse files Browse the repository at this point in the history
…isdreavus

Cleanup JS a bit

r? @QuietMisdreavus
  • Loading branch information
GuillaumeGomez authored Feb 10, 2019
2 parents d59ca59 + b962ecc commit d5a8b24
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,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 @@ -241,7 +239,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 @@ -259,7 +257,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 @@ -290,7 +288,7 @@ if (!DOMTokenList.prototype.remove) {

case "s":
case "S":
displayHelp(false, ev);
displayHelp(false, ev, help);
hideModal();
ev.preventDefault();
focusSearchBar();
Expand All @@ -305,7 +303,7 @@ if (!DOMTokenList.prototype.remove) {
case "?":
if (ev.shiftKey) {
hideModal();
displayHelp(true, ev);
displayHelp(true, ev, help);
}
break;
}
Expand Down Expand Up @@ -655,7 +653,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 @@ -2434,7 +2432,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 d5a8b24

Please sign in to comment.