Skip to content

Commit

Permalink
Find out reveal.js path based on stylesheet
Browse files Browse the repository at this point in the history
because since ES6 modules there may be no reveal.js script elements anymore
  • Loading branch information
McShelby committed May 11, 2020
1 parent ac4863a commit 0eaf186
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pdfexport.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ var PdfExport = ( function( _Reveal ){
var installAltKeyBindings = null;

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 <script> elements. Did you rename this file?' );
console.error( 'reveal.css could not be found in included <link> elements. Did you rename this file?' );
return '';
}
return script.attributes.src.value.replace( regex, '' );
return script.attributes.href.value.replace( regex, '' );
}

function setStylesheet3( pdfExport ){
Expand Down

0 comments on commit 0eaf186

Please sign in to comment.