From 3989cdc4e337db53682699a1f3df9db0d355fc17 Mon Sep 17 00:00:00 2001 From: Nyan404 Date: Tue, 25 Aug 2026 04:22:40 +0300 Subject: [PATCH] docs: explain lightweight CatWar helpers --- web/CatWarModLite.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/CatWarModLite.js b/web/CatWarModLite.js index 193214e..fabdddd 100644 --- a/web/CatWarModLite.js +++ b/web/CatWarModLite.js @@ -69,6 +69,7 @@ } }; + // Applies shared stylesheet and DOM tweaks used on every supported page. function applyCommon() { const footer = document.getElementById('footer'); if (footer) { @@ -79,6 +80,7 @@ } } + // Rebuilds the compact menu when the page menu appears or changes. function enhanceMenu(forceRefresh) { const menu = document.querySelector('#app > span.small, .small'); if (!menu) return; @@ -111,6 +113,7 @@ } } + // Adds the small-screen layout classes and hides nonessential controls. function applyCompactLayout() { toggleStyle('compact', state.compactLayout, ` body { @@ -142,6 +145,7 @@ `); } + // Inserts the user-facing toggle that enables or disables compact mode. function injectToggle() { const menu = document.querySelector('#app > span.small, .small'); if (!menu || menu.querySelector('[data-cwmod-lite="toggle"]')) return; @@ -169,6 +173,7 @@ menu.appendChild(toggle); } + // Persists one style preference and injects/removes its matching CSS rule. function toggleStyle(key, shouldEnable, cssText) { if (!shouldEnable) { if (styles[key] && styles[key].parentNode) { @@ -185,6 +190,7 @@ styles[key] = style; } + // Reads the saved lite-mode settings, using defaults for malformed values. function loadSettings() { try { const raw = window.localStorage.getItem(STORAGE_KEY); @@ -197,6 +203,7 @@ } } + // Serializes the current lite-mode settings to browser storage. function saveSettings(settings) { try { window.localStorage.setItem(STORAGE_KEY, JSON.stringify(settings)); @@ -205,4 +212,3 @@ } } })(window, document); -