From 8385ea78b48e82e28d6b0100b7e70bdabd5ec6df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 13 Feb 2022 12:48:38 +0100 Subject: [PATCH] theme: avoid non-styling if user wants to use unsupported theme #178 --- layouts/partials/stylesheet.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/layouts/partials/stylesheet.html b/layouts/partials/stylesheet.html index 28125cc4b8..18bb16d4f9 100644 --- a/layouts/partials/stylesheet.html +++ b/layouts/partials/stylesheet.html @@ -35,7 +35,15 @@ } select.value = theme; } - function changeTheme( theme, noanimation ){ + function changeTheme( theme ){ + {{- $quotedthemevariants := slice }} + {{- range $themevariants }} + {{- $quotedthemevariants = $quotedthemevariants | append (printf "\"%s\"" .) }} + {{- end }} + var themes = [ {{ delimit $quotedthemevariants ", " | safeJS }} ]; + if( !themes.find( function(e){ return e==theme; } ) ){ + theme = themes.length ? themes[ 0 ] : null; + } if( !theme ){ return; }