User:Hkmp7tommy/common.js

const head = document.getElementById("mw-head"); const pageBase = document.getElementById("mw-page-base");

function setHeader(show) { const config = show ? "block" : "none"; head.style.display = config; pageBase.style.display = config; }

var isShowing = localStorage.getItem('show') === "true";

setHeader(isShowing);

const container = document.createElement('div'); const toggleBtn = document.createElement('button'); const label = document.createTextNode('-'); container.className = "header-toggle-container"; toggleBtn.className = "header-toggle-btn"; container.appendChild(toggleBtn); toggleBtn.appendChild(label); toggleBtn.onclick = function { setHeader(isShowing = !isShowing); localStorage.setItem('show', isShowing); };

document.body.insertBefore(container, pageBase);