diffusion / app.js
adamelliotfields's picture
Remove HF menu outside iframe
88a4072 verified
raw
history blame contribute delete
No virus
789 Bytes
() =>{
const menu = document.querySelector("#menu");
const menuButton = menu.querySelector("button");
const menuSpan = menuButton.querySelector("span:first-child");
const content = document.querySelector("#content");
const updateMenu = () => {
const isOpen = menuButton.classList.contains("open");
menuSpan.textContent = isOpen ? "Hide menu" : "Show menu";
content.style.display = isOpen ? "none" : "flex";
};
const observer = new MutationObserver(updateMenu);
observer.observe(menuButton, { attributes: true, attributeFilter: ["class"] });
updateMenu();
if (window.location.hostname.endsWith(".hf.space")) {
const hfHeader = document.getElementById("huggingface-space-header");
if (hfHeader) {
hfHeader.style.display = "none";
}
}
}