aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2018-06-11 12:35:11 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2018-06-11 12:35:11 +0200
commit3680f1ad10d1cbb4a48eb98673fa7018d1ab36e5 (patch)
treed7f3a3c09410f93b610416700119d6b7bf354a12 /js
parenta86146180f62f38ccbdc9da68fd38ebee5da074a (diff)
downloadperl-software-in-gnu-guix-3680f1ad10d1cbb4a48eb98673fa7018d1ab36e5.tar
perl-software-in-gnu-guix-3680f1ad10d1cbb4a48eb98673fa7018d1ab36e5.tar.gz
merge #1955 with minor changes
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 926b1d9..921b633 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -204,6 +204,9 @@
// to PDF, unlimited by default
pdfMaxPagesPerSlide: Number.POSITIVE_INFINITY,
+ // Prints each fragment on a separate slide
+ pdfSeparateFragments: true,
+
// Offset used to reduce the height of content within exported PDF pages.
// This exists to account for environment differences based on how you
// print to PDF. CLI printing options, like phantomjs and wkpdf, can end
@@ -789,29 +792,38 @@
}
// Copy page and show fragments one after another
- if ( isPrintingPDFFragments() ) {
+ if( config.pdfSeparateFragments ) {
var numberOfFragments = toArray( page.querySelectorAll( '.fragment' ) ).length;
- for ( var currentFragment = 0; currentFragment < numberOfFragments; currentFragment++ ) {
+ for( var currentFragment = 0; currentFragment < numberOfFragments; currentFragment++ ) {
+
var clonedPage = page.cloneNode( true );
page.parentNode.insertBefore( clonedPage, page.nextSibling );
- toArray( sortFragments( clonedPage.querySelectorAll( '.fragment' ))).forEach( function ( fragment, fragmentIndex ) {
- if ( fragmentIndex <= currentFragment ) {
+ toArray( sortFragments( clonedPage.querySelectorAll( '.fragment' ) ) ).forEach( function( fragment, fragmentIndex ) {
+
+ if( fragmentIndex < currentFragment ) {
fragment.classList.add( 'visible' );
- } else {
- fragment.classList.remove( 'visible' );
+ fragment.classList.remove( 'current-fragment' );
+ }
+ else if( fragmentIndex === currentFragment ) {
+ fragment.classList.add( 'visible', 'current-fragment' );
}
+ else {
+ fragment.classList.remove( 'visible', 'current-fragment' );
+ }
+
} );
page = clonedPage;
+
}
}
// Show all fragments
else {
- toArray( page.querySelectorAll( '.fragment' ) ).forEach( function( fragment ) {
+ toArray( page.querySelectorAll( '.fragment:not(.fade-out)' ) ).forEach( function( fragment ) {
fragment.classList.add( 'visible' );
} );
}
@@ -820,7 +832,6 @@
} );
-
// Notify subscribers that the PDF layout is good to go
dispatchEvent( 'pdf-ready' );