@@ -5,6 +5,7 @@ function isPreview() {
55function initializeReveal ( ) {
66 // Full list of configuration options available at:
77 // https://github.com/hakimel/reveal.js#configuration
8+
89 Reveal . initialize ( {
910 controls : true ,
1011 progress : true ,
@@ -70,6 +71,8 @@ function initializeReveal() {
7071 }
7172 ]
7273 } ) ;
74+
75+ themesCtrl ( ) ;
7376}
7477
7578function highlightAnyCodeBlocks ( ) {
@@ -112,6 +115,47 @@ function externalLinksInNewWindow() {
112115insertMarkdownReference ( ) ;
113116initializeReveal ( ) ;
114117
118+ function themesCtrl ( ) {
119+ var defaultTheme = "black.css" ,
120+ currentTheme = localStorage . getItem ( 'theme?' ) ||
121+ defaultTheme ;
122+
123+ function setTheme ( theme ) {
124+ cssEl = $ ( "#theme" ) ;
125+ cssEl . attr ( "href" , "/static/reveal.js/css/theme/" + theme ) ;
126+ localStorage . setItem ( 'theme?' , theme ) ;
127+ }
128+ setTheme ( currentTheme ) ;
129+
130+ if ( ! isPreview ( ) ) {
131+ return
132+ }
133+ var availableThemes = [
134+ "black.css" ,
135+ "beige.css" ,
136+ "blood.css" ,
137+ "league.css" ,
138+ "moon.css" ,
139+ "night.css" ,
140+ "serif.css" ,
141+ "simple.css" ,
142+ "sky.css" ,
143+ "solarized.css" ,
144+ "white.css" ,
145+ ] ;
146+ themeEl = $ ( "#themes" ) ;
147+ availableThemes . forEach ( function ( theme ) {
148+ elem = $ ( "<option value=" + theme + ">" + theme + "</option>" ) ;
149+ themeEl . append ( elem ) ;
150+ } )
151+ themeEl . val ( currentTheme ) ;
152+ themeEl . change ( function ( ) {
153+ val = themeEl . val ( )
154+ setTheme ( val ) ;
155+ } ) ;
156+ themeEl . attr ( "hidden" , false ) ;
157+ }
158+
115159// Monkey patch Reveal so we can reload markdown through an
116160// inter window message (using the reveal rpc api)
117161// (yes, reveal has an rpc api!)
0 commit comments