Skip to content

Commit

Permalink
Notes: Weakly enforce a minimum allocated pacing time per slide
Browse files Browse the repository at this point in the history
When using the totalTime-based pacing calculation, a presenter may
inadvertently set totalTime and per-slide data-timing attributes in
such a way that the pacing time for some slides is impossibly low or
even negative.

Add a check to ensure that the pacing on a slide never falls below a
configurable minimum, defaulting to 0. Display an alert if the
pacing for any slide(s) falls below the threshold.
  • Loading branch information
fghaas committed May 22, 2019
1 parent 078ba62 commit 23c12d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ Reveal.initialize({
// instead of using the defaultTiming value
totalTime: 0,

// Specify the minimum amount of time you want to allot to
// each slide, if using the totalTime calculation method. If
// the automated time allocation causes slide pacing to fall
// below this threshold, then you will see an alert in the
// speaker notes window
minimumTimePerSlide: 0;

// Enable slide navigation via mouse wheel
mouseWheel: false,

Expand Down
6 changes: 6 additions & 0 deletions plugin/notes/notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ <h4 class="label">Notes</h4>
callRevealApi( 'getSlidesAttributes', [], function ( slideAttributes ) {
callRevealApi( 'getConfig', [], function ( config ) {
var totalTime = config.totalTime;
var minTimePerSlide = config.minimumTimePerSlide || 0;
var defaultTiming = config.defaultTiming;
if ((defaultTiming == null) && (totalTime == null)) {
callback(null);
Expand Down Expand Up @@ -574,6 +575,11 @@ <h4 class="label">Notes</h4>
// And now we replace every zero-value timing with that average
timings = timings.map( function(x) { return (x==0 ? timePerSlide : x) } );
}
var slidesUnderMinimum = timings.filter( function(x) { return (x < minTimePerSlide) } ).length
if ( slidesUnderMinimum ) {
message = "The pacing time for " + slidesUnderMinimum + " slide(s) is under the configured minimum of " + minTimePerSlide + " seconds. Check the data-timing attribute on individual slides, or consider increasing the totalTime or minimumTimePerSlide configuration options (or removing some slides).";
alert(message);
}
callback( timings );
} );
} );
Expand Down

0 comments on commit 23c12d7

Please sign in to comment.