diff options
| author | Eltrac <hi@guhub.cn> | 2025-10-21 20:26:13 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-10-21 20:26:13 +0800 |
| commit | 48b82af70feb7a20dc80490353da39540c83acec (patch) | |
| tree | 94ed6721b74c9efc04530cd4bd16819bbd4b14fe /assets | |
| parent | 7e0fc22f87a26df392368bb78c7397451655af23 (diff) | |
remove: settings page
Former-commit-id: 4e40e1ed71a3ff5889c2a12848667eda03319f29
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/js/settings.js | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/assets/js/settings.js b/assets/js/settings.js deleted file mode 100644 index 6dcbdfa9..00000000 --- a/assets/js/settings.js +++ /dev/null @@ -1,79 +0,0 @@ -(() => { - /** - * =========================== - * Initialize Settings Page - * =========================== - */ - - // return if this is not the settings page - if (!document.getElementById('settings')) return; - - const initializeSettingsPage = () => { - // initialize text altering buttons - function initTextAlterButtons() { - const textAlterButtons = document.querySelectorAll('#text-alter-buttons button'); - textAlterButtons.forEach(button => { - // highlight selected button - if (button.dataset.textSize === localStorage.getItem('geedeapro.ui.fontSize')) { - button.classList.add('bg-neutral-200/50', 'dark:bg-neutral-700/50'); - } - - // switch font size when clicked - button.addEventListener('click', () => { - setFontSize(button.dataset.textSize); - // highlight selected button - textAlterButtons.forEach(btn => btn.classList.remove('bg-neutral-200/50', 'dark:bg-neutral-700/50')); - button.classList.add('bg-neutral-200/50', 'dark:bg-neutral-700/50'); - }); - }); - } - initTextAlterButtons() - - // initialize checkbox options - function initCheckboxes() { - const checkboxOptions = [ - { - id: 'hideBatrick', - label: '隐藏 Batrick(返回顶部按钮)', - storage: 'geedeapro.ui.hideBatrick', - default: 'false' - } - ] - - checkboxOptions.forEach(checkboxOption => { - // create checkbox - const element = document.createElement('input'); - element.type = 'checkbox'; - element.id = checkboxOption.id; - element.checked = localStorage.getItem(checkboxOption.storage) || - checkboxOption.default === 'true'; - - // add event listener to checkbox - element.addEventListener('change', () => { - if (element.checked) - localStorage.setItem(checkboxOption.storage, 1); - else - localStorage.removeItem(checkboxOption.storage); - }); - - // create label - const label = document.createElement('label'); - label.htmlFor = element.id; - label.textContent = checkboxOption.label; - - // wrap checkbox and label in a div - const wrapper = document.createElement('div'); - wrapper.classList.add('flex', 'items-center', 'mb-2', 'gap-2'); - wrapper.appendChild(element); - wrapper.appendChild(label); - - // append checkbox and label to container - const container = document.getElementById('checkbox-options'); - container.appendChild(wrapper); - }); - } - initCheckboxes(); - }; - - initializeSettingsPage(); -})(); |
