User:ArticleWriter5000/vector.js

// Add a button to the top of page that acts as a toggle to show/hide the extra text that is normally in the header bar. // https://stackoverflow.com/questions/40940506/create-buttons-with-only-javascript // https://stackoverflow.com/questions/32461696/change-position-of-buttons-javascript var newCustomButton = document.createElement("new-custom-button"); newCustomButton.innerHTML = "&bull;&bull;&bull;"; // three dots to look like a menu icon newCustomButton.style.position = "absolute"; newCustomButton.style.top = "10px"; newCustomButton.style.right = "10px"; newCustomButton.style.background = "#ffffff"; newCustomButton.style.padding = "20px";

document.body.appendChild(newCustomButton);

var headerExtra1 = document.getElementById("mw-head"); var searchbar = document.getElementById("simpleSearch");

newCustomButton.addEventListener("click", function { if (headerExtra1.style.visibility === "hidden") {    headerExtra1.style.visibility = "visible";    searchbar.style.visibility = "visible";    newCustomButton.innerHTML = "&times;"; // pressing button next time will hide it  } else {    headerExtra1.style.visibility = "hidden";    searchbar.style.visibility = "visible";    newCustomButton.innerHTML = "&bull;&bull;&bull;"; // pressing button next time will show it  } });