From 3aac5a1a8bfde94a2129e970958abd4d5b9a7503 Mon Sep 17 00:00:00 2001 From: zumbiepig <121742281+zumbiepig@users.noreply.github.com> Date: Mon, 19 Aug 2024 17:19:13 -0700 Subject: [PATCH] offline use --- src/resources/scripts/main.ts | 2 ++ src/resources/scripts/settings.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/resources/scripts/main.ts b/src/resources/scripts/main.ts index 16ab286..71e5902 100644 --- a/src/resources/scripts/main.ts +++ b/src/resources/scripts/main.ts @@ -311,6 +311,8 @@ if (window.location.pathname === '/') { if (storage.local.get('offlineCache') === true) { serviceworker.register(); + } else { + serviceworker.unregister(); } } else { document.addEventListener('DOMContentLoaded', () => { diff --git a/src/resources/scripts/settings.ts b/src/resources/scripts/settings.ts index 4bb28ab..5f81663 100644 --- a/src/resources/scripts/settings.ts +++ b/src/resources/scripts/settings.ts @@ -7,6 +7,7 @@ if (window.location.pathname === '/settings/') { usernameInput.placeholder = storage.local.get('username') ?? ''; themeSelect.value = storage.local.get('theme') ?? ''; + offlineCheckbox.checked = storage.local.get('offlineCache') ?? false; usernameInput.addEventListener('input', () => { let username = usernameInput.value.replace(/[^A-Za-z0-9]/g, '_').substring(0, 16);