File tree Expand file tree Collapse file tree 1 file changed +38
-4
lines changed Expand file tree Collapse file tree 1 file changed +38
-4
lines changed Original file line number Diff line number Diff line change 727
727
numberElement . innerHTML = formatSlideNumber ( slideNumberH , '.' , slideNumberV ) ;
728
728
page . appendChild ( numberElement ) ;
729
729
}
730
+
731
+ // Copy page and show fragments one after another
732
+ if ( isPrintingPDFFragments ( ) ) {
733
+
734
+ var numberOfFragments = toArray ( page . querySelectorAll ( '.fragment' ) ) . length ;
735
+
736
+ for ( var currentFragment = 0 ; currentFragment < numberOfFragments ; currentFragment ++ ) {
737
+ var clonedPage = page . cloneNode ( true ) ;
738
+ page . parentNode . insertBefore ( clonedPage , page . nextSibling ) ;
739
+
740
+ toArray ( sortFragments ( clonedPage . querySelectorAll ( '.fragment' ) ) ) . forEach ( function ( fragment , fragmentIndex ) {
741
+ if ( fragmentIndex <= currentFragment ) {
742
+ fragment . classList . add ( 'visible' ) ;
743
+ } else {
744
+ fragment . classList . remove ( 'visible' ) ;
745
+ }
746
+ } ) ;
747
+
748
+ page = clonedPage ;
749
+ }
750
+
751
+ }
752
+ // Show all fragments
753
+ else {
754
+ toArray ( page . querySelectorAll ( '.fragment' ) ) . forEach ( function ( fragment ) {
755
+ fragment . classList . add ( 'visible' ) ;
756
+ } ) ;
757
+ }
758
+
730
759
}
731
760
732
761
} ) ;
733
762
734
- // Show all fragments
735
- toArray ( dom . wrapper . querySelectorAll ( SLIDES_SELECTOR + ' .fragment' ) ) . forEach ( function ( fragment ) {
736
- fragment . classList . add ( 'visible' ) ;
737
- } ) ;
738
763
739
764
// Notify subscribers that the PDF layout is good to go
740
765
dispatchEvent ( 'pdf-ready' ) ;
1497
1522
1498
1523
}
1499
1524
1525
+ /**
1526
+ * Check if this instance is being used to print a PDF with fragments.
1527
+ */
1528
+ function isPrintingPDFFragments ( ) {
1529
+
1530
+ return ( / p r i n t - p d f - f r a g m e n t s / gi ) . test ( window . location . search ) ;
1531
+
1532
+ }
1533
+
1500
1534
/**
1501
1535
* Hides the address bar if we're on a mobile device.
1502
1536
*/
You can’t perform that action at this time.
0 commit comments