Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup JS a bit #58297

Merged
merged 1 commit into from
Feb 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
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