diff --git a/themeoverride.js b/themeoverride.js index d6264c2..689f920 100644 --- a/themeoverride.js +++ b/themeoverride.js @@ -1,10 +1,12 @@ -var ThemeOverride = ( function( Reveal ){ +var ThemeOverride = ( function( _Reveal ){ + var Reveal = _Reveal; + var isHighlightJsUsed = null; var constants = [{ id: 'theme', // id attribute of link element parameter: 'theme', // URL parameter name option: 'theme', // reveal configuration option name - path: 'css/theme/', // standard path to css file + path: null, // standard path to css file - dependend on reveal version },{ // deprecatved settings for compat, don't move this setting // so our new settings will overwrite deprecated ones @@ -40,7 +42,7 @@ var ThemeOverride = ( function( Reveal ){ return o; } - function isHighlightJsUsed(){ + function isHighlightJsUsed3(){ var regex = /\bhighlight.js$/i; var script = Array.from( document.querySelectorAll( 'script' ) ).find( function( e ){ return e.attributes.src && e.attributes.src.value.search( regex ) >= 0; @@ -48,16 +50,20 @@ var ThemeOverride = ( function( Reveal ){ return !!script; } + function isHighlightJsUsed4(){ + return Reveal.hasPlugin( 'highlight' ); + } + function getRevealJsPath(){ - var regex = /\bjs\/reveal.js$/i; - var script = Array.from( document.querySelectorAll( 'script' ) ).find( function( e ){ - return e.attributes.src && e.attributes.src.value.search( regex ) >= 0; + var regex = /\b[^/]+\/reveal.css$/i; + var script = Array.from( document.querySelectorAll( 'link' ) ).find( function( e ){ + return e.attributes.href && e.attributes.href.value.search( regex ) >= 0; }); if( !script ){ - console.error( 'reveal.js script could not be found in included