function addControlPanel() { setTimeout(() => { const icon = ``; const menu = document.querySelector(".gc-account-leftbar"); const controlPanel = document.createElement("div"); controlPanel.classList.add("leftbar-controls"); controlPanel.innerHTML = `
${icon}
A+
A-
`; const plusButton = controlPanel.querySelector(".size-plus"); const minusButton = controlPanel.querySelector(".size-minus"); plusButton.addEventListener("click", () => changeFontSize(2)); minusButton.addEventListener("click", () => changeFontSize(-2)); function changeFontSize(count) { const body = document.querySelector("body"); const currentFontSize = parseInt(window.getComputedStyle(body).fontSize); const newSize = currentFontSize + count; if (newSize >= 12 && newSize <= 24) { body.style.fontSize = newSize + "px"; localStorage.setItem("fontSize", newSize); } } const savedFontSize = localStorage.getItem("fontSize"); if (savedFontSize) { document.querySelector("body").style.fontSize = savedFontSize + "px"; } if (window.innerWidth <= 768) { const mobileWrapper = document.querySelector(".mobile-wrapper"); mobileWrapper.appendChild(controlPanel); } else { menu.appendChild(controlPanel); } }, 200); } document.addEventListener("DOMContentLoaded", addControlPanel);