Skip to content
Permalink
Browse files

Cleanup JS a bit

  • Loading branch information...
GuillaumeGomez committed Feb 8, 2019
1 parent 43e04fb commit b962ecc6f97cbd6258d1a77041a865aecd6fa3fb
Showing with 6 additions and 8 deletions.
  1. +6 −8 src/librustdoc/html/static/main.js
@@ -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() {
@@ -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();
@@ -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");
@@ -289,7 +287,7 @@ if (!DOMTokenList.prototype.remove) {

case "s":
case "S":
displayHelp(false, ev);
displayHelp(false, ev, help);
hideModal();
ev.preventDefault();
focusSearchBar();
@@ -304,7 +302,7 @@ if (!DOMTokenList.prototype.remove) {
case "?":
if (ev.shiftKey) {
hideModal();
displayHelp(true, ev);
displayHelp(true, ev, help);
}
break;
}
@@ -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;
@@ -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 {

0 comments on commit b962ecc

Please sign in to comment.
You can’t perform that action at this time.