Merge branch 'master' of https://github.com/koehlma/reveal.js into dev
This commit is contained in:
commit
a86146180f
1 changed files with 38 additions and 4 deletions
42
js/reveal.js
42
js/reveal.js
|
@ -787,14 +787,39 @@
|
|||
numberElement.innerHTML = formatSlideNumber( slideNumberH, '.', slideNumberV );
|
||||
page.appendChild( numberElement );
|
||||
}
|
||||
|
||||
// Copy page and show fragments one after another
|
||||
if ( isPrintingPDFFragments() ) {
|
||||
|
||||
var numberOfFragments = toArray( page.querySelectorAll( '.fragment' ) ).length;
|
||||
|
||||
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 ) {
|
||||
fragment.classList.add( 'visible' );
|
||||
} else {
|
||||
fragment.classList.remove( 'visible' );
|
||||
}
|
||||
} );
|
||||
|
||||
page = clonedPage;
|
||||
}
|
||||
|
||||
}
|
||||
// Show all fragments
|
||||
else {
|
||||
toArray( page.querySelectorAll( '.fragment' ) ).forEach( function( fragment ) {
|
||||
fragment.classList.add( 'visible' );
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
// Show all fragments
|
||||
toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ' .fragment' ) ).forEach( function( fragment ) {
|
||||
fragment.classList.add( 'visible' );
|
||||
} );
|
||||
|
||||
// Notify subscribers that the PDF layout is good to go
|
||||
dispatchEvent( 'pdf-ready' );
|
||||
|
@ -1637,6 +1662,15 @@
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this instance is being used to print a PDF with fragments.
|
||||
*/
|
||||
function isPrintingPDFFragments() {
|
||||
|
||||
return ( /print-pdf-fragments/gi ).test( window.location.search );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the address bar if we're on a mobile device.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue