File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,9 @@ function playground_text(playground, hidden = true) {
305305 themePopup . querySelectorAll ( '.theme-selected' ) . forEach ( function ( el ) {
306306 el . classList . remove ( 'theme-selected' ) ;
307307 } ) ;
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 ) { }
309311 }
310312
311313 function hideThemes ( ) {
@@ -360,13 +362,12 @@ function playground_text(playground, hidden = true) {
360362 }
361363
362364 var previousTheme = get_theme ( ) ;
363- var themeId = theme . replace ( / \W + / g, '_' ) . toLowerCase ( ) ;
364365 if ( store ) {
365- try { localStorage . setItem ( 'mdbook-theme' , themeId ) ; } catch ( e ) { }
366+ try { localStorage . setItem ( 'mdbook-theme' , theme ) ; } catch ( e ) { }
366367 }
367368
368- html . classList . remove ( previousTheme ) ;
369- html . classList . add ( themeId ) ;
369+ html . classList . remove ( previousTheme . replace ( / \W + / g , '_' ) . toLowerCase ( ) ) ;
370+ html . classList . add ( theme . replace ( / \W + / g , '_' ) . toLowerCase ( ) ) ;
370371 updateThemeSelected ( ) ;
371372 }
372373
Original file line number Diff line number Diff line change 8585 var html = document .querySelector (' html' );
8686 html .classList .remove (' no-js' )
8787 html .classList .remove (' {{ default_theme }}' )
88- html .classList .add (theme);
88+ html .classList .add (theme . replace ( / \W + / g , ' _ ' ). toLowerCase () );
8989 html .classList .add (' js' );
9090 </script >
9191
You can’t perform that action at this time.
0 commit comments