Sha256: fd975103c6dc4f2524f4f064a8c53a73052382ddc8504376cbe390678ff6defb
Contents?: true
Size: 1.02 KB
Versions: 8
Compression:
Stored size: 1.02 KB
Contents
function ready(callback: () => void) { if (document.readyState === "complete" || (document.readyState !== "loading" && !document.documentElement.doScroll)) { callback(); } else { document.addEventListener("DOMContentLoaded", callback); } } function applyGrid () { let showGrid = false; const gridOverlay = document.querySelector(".grid-overlay"); const setState = (newState: boolean) => { showGrid = newState; if (newState) { window.localStorage.setItem("showGrid", "true"); gridOverlay.classList.add("grid-overlay--active"); } else { window.localStorage.removeItem("showGrid"); gridOverlay.classList.remove("grid-overlay--active"); } }; if (gridOverlay) { setState(window.localStorage.getItem("showGrid") == "true"); // Keyboard toggle document.addEventListener("keyup", (evt: KeyboardEvent) => { if (evt.ctrlKey && evt.which == 71) { setState(!showGrid); } }); } } export default function gridOverlay() { ready(applyGrid); }
Version data entries
8 entries across 8 versions & 1 rubygems