File tree 2 files changed +6
-5
lines changed
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,9 @@ function playground_text(playground, hidden = true) {
305
305
themePopup . querySelectorAll ( '.theme-selected' ) . forEach ( function ( el ) {
306
306
el . classList . remove ( 'theme-selected' ) ;
307
307
} ) ;
308
- themePopup . querySelector ( "button#" + get_theme ( ) ) . classList . add ( 'theme-selected' ) ;
308
+ try {
309
+ themePopup . querySelector ( "button#" + get_theme ( ) ) . classList . add ( 'theme-selected' ) ;
310
+ } catch ( e ) { }
309
311
}
310
312
311
313
function hideThemes ( ) {
@@ -360,13 +362,12 @@ function playground_text(playground, hidden = true) {
360
362
}
361
363
362
364
var previousTheme = get_theme ( ) ;
363
-
364
365
if ( store ) {
365
366
try { localStorage . setItem ( 'mdbook-theme' , theme ) ; } catch ( e ) { }
366
367
}
367
368
368
- html . classList . remove ( previousTheme ) ;
369
- html . classList . add ( theme ) ;
369
+ html . classList . remove ( previousTheme . replace ( / \W + / g , '_' ) . toLowerCase ( ) ) ;
370
+ html . classList . add ( theme . replace ( / \W + / g , '_' ) . toLowerCase ( ) ) ;
370
371
updateThemeSelected ( ) ;
371
372
}
372
373
Original file line number Diff line number Diff line change 85
85
var html = document .querySelector (' html' );
86
86
html .classList .remove (' no-js' )
87
87
html .classList .remove (' {{ default_theme }}' )
88
- html .classList .add (theme);
88
+ html .classList .add (theme . replace ( / \W + / g , ' _ ' ). toLowerCase () );
89
89
html .classList .add (' js' );
90
90
</script >
91
91
You can’t perform that action at this time.
0 commit comments