Rollup merge of #58297 - GuillaumeGomez:cleanup-js, r=QuietMisdreavus

Cleanup JS a bit

r? @QuietMisdreavus
This commit is contained in:
Guillaume Gomez 2019-02-10 21:45:18 +01:00 committed by GitHub
commit d5a8b247be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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