js: When making a hidden element visible, just remove "display: none"

This removes any assumption in the JavaScript code about precisely what
"display" setting the element should have.

This means that now the only places where the JavaScript manipulates
elements' styles are to set the width of the puzzle container and to
mark and unmark elements with "display: none".  These both seem like
reasonable kinds of semantic markup that just happen to be expressed as
styles.
This commit is contained in:
Ben Harris
2022-10-17 23:11:48 +01:00
parent 3c3d8aff22
commit 5c180cfa6f
2 changed files with 2 additions and 2 deletions

View File

@ -173,7 +173,7 @@ mergeInto(LibraryManager.library, {
} else { } else {
seed = UTF8ToString(seed); seed = UTF8ToString(seed);
permalink_seed.href = "#" + seed; permalink_seed.href = "#" + seed;
permalink_seed.style.display = "inline"; permalink_seed.style.display = "";
} }
}, },

View File

@ -522,6 +522,6 @@ function initPuzzle() {
// it's probably safe to hide the 'sorry, no puzzle here' div and // it's probably safe to hide the 'sorry, no puzzle here' div and
// show the div containing the actual puzzle. // show the div containing the actual puzzle.
document.getElementById("apology").style.display = "none"; document.getElementById("apology").style.display = "none";
document.getElementById("puzzle").style.display = "inline"; document.getElementById("puzzle").style.display = "";
}; };
} }