Skip to content

Commit

Permalink
Simplifying code
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed May 10, 2020
1 parent 466fbeb commit 68644ec
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions pdfexport.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var PdfExport = ( function( Reveal ){
return script.attributes.src.value.replace( regex, '' );
}

function setStylesheet( pdf ){
function setStylesheet( pdfExport ){
var link = document.querySelector( '#print' );
if( !link ){
link = document.createElement( 'link' );
Expand All @@ -23,15 +23,13 @@ var PdfExport = ( function( Reveal ){
document.querySelector( 'head' ).appendChild( link );
}
var style = 'paper';
if( pdf ){
if( pdfExport ){
style = 'pdf';
}
link.href = getRevealJsPath() + 'css/print/' + style + '.css';
}

function setPdfExport( pdfExport ){
var config = Reveal.getConfig();
pdfExport = pdfExport !== null ? pdfExport : config.pdfExport !== undefined ? !!config.pdfExport : defMode;
setStylesheet( pdfExport );
}

Expand All @@ -51,10 +49,6 @@ var PdfExport = ( function( Reveal ){
window.location.href = url_doc.toString();
}

function applyPdfExportParameter(){
setPdfExport( isPrintingPDF() );
}

function installKeyBindings(){
var config = Reveal.getConfig();
var shortcut = config.pdfExportShortcut || 'E';
Expand All @@ -72,7 +66,7 @@ var PdfExport = ( function( Reveal ){

function install(){
installKeyBindings();
applyPdfExportParameter();
setPdfExport( isPrintingPDF() );
}

install();
Expand Down

0 comments on commit 68644ec

Please sign in to comment.