Apparently, the first time this condition is executed, the
host_tools.style.display attribute is not "none" but is instead some
sort of empty value. With the old code, this made a first click on the
gear do nothing, (setting it to "none" but not toggling visibility)
and then a second click would make the host tools appear.
With this change to reverse the logic to look for an explicit value of
"block" (which is set only after the first click) the gear button
works reliably on every click including the first.
function toggle_host_tools() {
const host_tools = document.getElementById("host-tools");
- if (host_tools.style.display === "none")
- host_tools.style.display = "block";
- else
+ console.log("Toggling, host_tools.style.display is '" + host_tools.style.display + "'");
+
+ if (host_tools.style.display === "block")
host_tools.style.display = "none";
+ else
+ host_tools.style.display = "block";
}
function post_reveal() {