diff --git a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl index 1c3a5b74f28..d85341947e5 100644 --- a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl +++ b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl @@ -22,16 +22,9 @@ var COMPILER_TARGET_DEFAULT = {if !VISITOR_USE_TINY_BUILD || $__wcf->user->userID}true{else}false{/if}; {/if} - {if $__wcf->getStyleHandler()->getStyle()->hasDarkMode} + {if $__wcf->getStyleHandler()->getColorScheme() === 'system'} { - let colorScheme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; - try { - const value = localStorage.getItem("wsc_colorScheme"); - if (value === "light" || value === "dark") { - colorScheme = value; - } - } catch {} - + const colorScheme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; document.documentElement.dataset.colorScheme = colorScheme; } {/if} @@ -82,7 +75,7 @@ window.addEventListener('pageshow', function(event) { url: '{link controller="BackgroundQueuePerform"}{/link}', force: {if $forceBackgroundQueuePerform|isset}true{else}false{/if} }, - colorScheme: '{@$__wcf->getStyleHandler()->getColorScheme()|encodeJS}', + dynamicColorScheme: {if $__wcf->getStyleHandler()->getColorScheme() === 'system'}true{else}false{/if}, enableUserPopover: {if $__wcf->getSession()->getPermission('user.profile.canViewUserProfile')}true{else}false{/if}, executeCronjobs: {if $executeCronjobs}'{link controller="CronjobPerform"}{/link}'{else}undefined{/if}, {if ENABLE_SHARE_BUTTONS} diff --git a/com.woltlab.wcf/templates/pageFooter.tpl b/com.woltlab.wcf/templates/pageFooter.tpl index 00301f3642b..bdf5b1abed6 100644 --- a/com.woltlab.wcf/templates/pageFooter.tpl +++ b/com.woltlab.wcf/templates/pageFooter.tpl @@ -24,28 +24,14 @@ {assign var=__showStyleChanger value=false} {/if} - {if $__boxesFooter|count || !$boxesFooter|empty || $__showStyleChanger || $__wcf->getStyleHandler()->showColorSchemeSelector()} + {if $__boxesFooter|count || !$boxesFooter|empty || $__showStyleChanger}