mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
theme: avoid non-styling if user wants to use unsupported theme #178
This commit is contained in:
parent
0c261fb314
commit
8385ea78b4
1 changed files with 9 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue