1
Fork 0

Revert "Remove "important traits" feature"

This reverts commit 1244ced958.
This commit is contained in:
Manish Goregaokar 2020-07-06 12:53:44 -07:00
parent 6ee1b62c81
commit 98450757e5
15 changed files with 393 additions and 9 deletions

View file

@ -365,6 +365,7 @@ function defocusSearchBar() {
function handleEscape(ev) {
var help = getHelpElement();
var search = getSearchElement();
hideModal();
if (hasClass(help, "hidden") === false) {
displayHelp(false, ev, help);
} else if (hasClass(search, "hidden") === false) {
@ -397,6 +398,7 @@ function defocusSearchBar() {
case "s":
case "S":
displayHelp(false, ev);
hideModal();
ev.preventDefault();
focusSearchBar();
break;
@ -409,6 +411,7 @@ function defocusSearchBar() {
case "?":
if (ev.shiftKey) {
hideModal();
displayHelp(true, ev);
}
break;
@ -2636,6 +2639,31 @@ function defocusSearchBar() {
});
}());
function showModal(content) {
var modal = document.createElement("div");
modal.id = "important";
addClass(modal, "modal");
modal.innerHTML = "<div class=\"modal-content\"><div class=\"close\" id=\"modal-close\">✕" +
"</div><div class=\"whiter\"></div><span class=\"docblock\">" + content +
"</span></div>";
document.getElementsByTagName("body")[0].appendChild(modal);
document.getElementById("modal-close").onclick = hideModal;
modal.onclick = hideModal;
}
function hideModal() {
var modal = document.getElementById("important");
if (modal) {
modal.parentNode.removeChild(modal);
}
}
onEachLazy(document.getElementsByClassName("important-traits"), function(e) {
e.onclick = function() {
showModal(e.lastElementChild.innerHTML);
};
});
// In the search display, allows to switch between tabs.
function printTab(nb) {
if (nb === 0 || nb === 1 || nb === 2) {