diff --git a/app/static/bootstrap/theme.js b/app/static/bootstrap/theme.js index 365bde5..ff5976d 100644 --- a/app/static/bootstrap/theme.js +++ b/app/static/bootstrap/theme.js @@ -1,4 +1,4 @@ -// BS Theme Switcher JS +// JS Bootstrap Theme Switcher ;(() => { const getStoredTheme = () => localStorage.getItem('theme') @@ -39,7 +39,8 @@ // console.debug(`showActiveTheme: ${theme}`) const themeIcon = document.querySelector('#theme-icon') if (!themeIcon) { - return console.debug('No Theme Icon to Set.') + // console.debug('No Theme Icon to Set.') + return } document.querySelectorAll('[data-bs-theme-value]').forEach((el) => { if (el.dataset.bsThemeValue === theme) { @@ -54,6 +55,14 @@ }) } + window.addEventListener('storage', (event) => { + // console.log('storage:', event) + if (event.key === 'theme') { + setTheme(event.newValue) + showActiveTheme(event.newValue) + } + }) + window .matchMedia('(prefers-color-scheme: dark)') .addEventListener('change', () => { diff --git a/app/static/js/sw.js b/app/static/js/sw.js index ee4009f..cb0f293 100644 --- a/app/static/js/sw.js +++ b/app/static/js/sw.js @@ -22,7 +22,7 @@ const resources = [ '/static/dist/bootstrap/bootstrap.bundle.min.js', '/static/dist/clipboard/clipboard.min.js', '/static/dist/fontawesome/css/all.min.css', - '/static/dist/fontawesome/js/all.min.js', + // '/static/dist/fontawesome/js/all.min.js', '/static/dist/fontawesome/webfonts/fa-brands-400.woff2', '/static/dist/fontawesome/webfonts/fa-regular-400.woff2', '/static/dist/fontawesome/webfonts/fa-solid-900.woff2',