Merge branch 'dev' into patch-1

This commit is contained in:
Hakim El Hattab 2020-01-27 13:51:24 +01:00 committed by GitHub
commit 9693816480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 687 additions and 378 deletions

View File

@ -1,4 +1,4 @@
Copyright (C) 2019 Hakim El Hattab, http://hakim.se, and reveal.js contributors Copyright (C) 2020 Hakim El Hattab, http://hakim.se, and reveal.js contributors
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
* http://revealjs.com * http://revealjs.com
* MIT licensed * MIT licensed
* *
* Copyright (C) 2019 Hakim El Hattab, http://hakim.se * Copyright (C) 2020 Hakim El Hattab, http://hakim.se
*/ */
/********************************************* /*********************************************
* GLOBAL STYLES * GLOBAL STYLES
@ -77,29 +77,29 @@ body {
text-decoration: line-through; } text-decoration: line-through; }
.reveal .slides section .fragment.fade-up { .reveal .slides section .fragment.fade-up {
-webkit-transform: translate(0, 20%); -webkit-transform: translate(0, 40px);
transform: translate(0, 20%); } transform: translate(0, 40px); }
.reveal .slides section .fragment.fade-up.visible { .reveal .slides section .fragment.fade-up.visible {
-webkit-transform: translate(0, 0); -webkit-transform: translate(0, 0);
transform: translate(0, 0); } transform: translate(0, 0); }
.reveal .slides section .fragment.fade-down { .reveal .slides section .fragment.fade-down {
-webkit-transform: translate(0, -20%); -webkit-transform: translate(0, -40px);
transform: translate(0, -20%); } transform: translate(0, -40px); }
.reveal .slides section .fragment.fade-down.visible { .reveal .slides section .fragment.fade-down.visible {
-webkit-transform: translate(0, 0); -webkit-transform: translate(0, 0);
transform: translate(0, 0); } transform: translate(0, 0); }
.reveal .slides section .fragment.fade-right { .reveal .slides section .fragment.fade-right {
-webkit-transform: translate(-20%, 0); -webkit-transform: translate(-40px, 0);
transform: translate(-20%, 0); } transform: translate(-40px, 0); }
.reveal .slides section .fragment.fade-right.visible { .reveal .slides section .fragment.fade-right.visible {
-webkit-transform: translate(0, 0); -webkit-transform: translate(0, 0);
transform: translate(0, 0); } transform: translate(0, 0); }
.reveal .slides section .fragment.fade-left { .reveal .slides section .fragment.fade-left {
-webkit-transform: translate(20%, 0); -webkit-transform: translate(40px, 0);
transform: translate(20%, 0); } transform: translate(40px, 0); }
.reveal .slides section .fragment.fade-left.visible { .reveal .slides section .fragment.fade-left.visible {
-webkit-transform: translate(0, 0); -webkit-transform: translate(0, 0);
transform: translate(0, 0); } transform: translate(0, 0); }
@ -227,7 +227,7 @@ body {
bottom: 12px; bottom: 12px;
right: 12px; right: 12px;
left: auto; left: auto;
z-index: 1; z-index: 11;
color: #000; color: #000;
pointer-events: none; pointer-events: none;
font-size: 10px; } font-size: 10px; }
@ -312,7 +312,8 @@ body {
transform: rotate(90deg); } transform: rotate(90deg); }
.reveal .controls .navigate-down { .reveal .controls .navigate-down {
right: 3.2em; right: 3.2em;
bottom: 0; bottom: -1.4em;
padding-bottom: 1.4em;
-webkit-transform: translateY(10px); -webkit-transform: translateY(10px);
transform: translateY(10px); } transform: translateY(10px); }
.reveal .controls .navigate-down .controls-arrow { .reveal .controls .navigate-down .controls-arrow {
@ -395,18 +396,18 @@ body {
right: auto; } right: auto; }
.reveal .controls[data-controls-layout="edges"] .navigate-left { .reveal .controls[data-controls-layout="edges"] .navigate-left {
top: 50%; top: 50%;
left: 8px; left: 0.8em;
margin-top: -1.8em; } margin-top: -1.8em; }
.reveal .controls[data-controls-layout="edges"] .navigate-right { .reveal .controls[data-controls-layout="edges"] .navigate-right {
top: 50%; top: 50%;
right: 8px; right: 0.8em;
margin-top: -1.8em; } margin-top: -1.8em; }
.reveal .controls[data-controls-layout="edges"] .navigate-up { .reveal .controls[data-controls-layout="edges"] .navigate-up {
top: 8px; top: 0.8em;
left: 50%; left: 50%;
margin-left: -1.8em; } margin-left: -1.8em; }
.reveal .controls[data-controls-layout="edges"] .navigate-down { .reveal .controls[data-controls-layout="edges"] .navigate-down {
bottom: 8px; bottom: -0.3em;
left: 50%; left: 50%;
margin-left: -1.8em; } } margin-left: -1.8em; } }
@ -1453,9 +1454,16 @@ body {
text-align: right; text-align: right;
vertical-align: top; } vertical-align: top; }
.reveal .hljs[data-line-numbers]:not([data-line-numbers=""]) tr:not(.highlight-line) { .reveal .hljs.has-highlights tr:not(.highlight-line) {
opacity: 0.4; } opacity: 0.4; }
.reveal .hljs:not(:first-child).fragment {
position: absolute;
top: 0;
left: 0;
width: 100%;
box-sizing: border-box; }
/********************************************* /*********************************************
* ROLLING LINKS * ROLLING LINKS
*********************************************/ *********************************************/

View File

@ -3,7 +3,7 @@
* http://revealjs.com * http://revealjs.com
* MIT licensed * MIT licensed
* *
* Copyright (C) 2019 Hakim El Hattab, http://hakim.se * Copyright (C) 2020 Hakim El Hattab, http://hakim.se
*/ */
@ -102,7 +102,7 @@ body {
} }
.reveal .slides section .fragment.fade-up { .reveal .slides section .fragment.fade-up {
transform: translate(0, 20%); transform: translate(0, 40px);
&.visible { &.visible {
transform: translate(0, 0); transform: translate(0, 0);
@ -110,7 +110,7 @@ body {
} }
.reveal .slides section .fragment.fade-down { .reveal .slides section .fragment.fade-down {
transform: translate(0, -20%); transform: translate(0, -40px);
&.visible { &.visible {
transform: translate(0, 0); transform: translate(0, 0);
@ -118,7 +118,7 @@ body {
} }
.reveal .slides section .fragment.fade-right { .reveal .slides section .fragment.fade-right {
transform: translate(-20%, 0); transform: translate(-40px, 0);
&.visible { &.visible {
transform: translate(0, 0); transform: translate(0, 0);
@ -126,7 +126,7 @@ body {
} }
.reveal .slides section .fragment.fade-left { .reveal .slides section .fragment.fade-left {
transform: translate(20%, 0); transform: translate(40px, 0);
&.visible { &.visible {
transform: translate(0, 0); transform: translate(0, 0);
@ -263,7 +263,7 @@ $controlsArrowAngleActive: 36deg;
bottom: $spacing; bottom: $spacing;
right: $spacing; right: $spacing;
left: auto; left: auto;
z-index: 1; z-index: 11;
color: #000; color: #000;
pointer-events: none; pointer-events: none;
font-size: 10px; font-size: 10px;
@ -355,7 +355,8 @@ $controlsArrowAngleActive: 36deg;
.navigate-down { .navigate-down {
right: $controlArrowSpacing + $controlArrowSize/2; right: $controlArrowSpacing + $controlArrowSize/2;
bottom: 0; bottom: -$controlArrowSpacing;
padding-bottom: $controlArrowSpacing;
transform: translateY( 10px ); transform: translateY( 10px );
.controls-arrow { .controls-arrow {
@ -452,7 +453,7 @@ $controlsArrowAngleActive: 36deg;
// Edge aligned controls layout // Edge aligned controls layout
@media screen and (min-width: 500px) { @media screen and (min-width: 500px) {
$spacing: 8px; $spacing: 0.8em;
.reveal .controls[data-controls-layout="edges"] { .reveal .controls[data-controls-layout="edges"] {
& { & {
@ -489,7 +490,7 @@ $controlsArrowAngleActive: 36deg;
} }
.navigate-down { .navigate-down {
bottom: $spacing; bottom: $spacing - $controlArrowSpacing + 0.3em;
left: 50%; left: 50%;
margin-left: -$controlArrowSize/2; margin-left: -$controlArrowSize/2;
} }
@ -1590,10 +1591,18 @@ $controlsArrowAngleActive: 36deg;
vertical-align: top; vertical-align: top;
} }
.reveal .hljs[data-line-numbers]:not([data-line-numbers=""]) tr:not(.highlight-line) { .reveal .hljs.has-highlights tr:not(.highlight-line) {
opacity: 0.4; opacity: 0.4;
} }
.reveal .hljs:not(:first-child).fragment {
position: absolute;
top: 0;
left: 0;
width: 100%;
box-sizing: border-box;
}
/********************************************* /*********************************************
* ROLLING LINKS * ROLLING LINKS

View File

@ -4,7 +4,7 @@ Themes are written using Sass to keep things modular and reduce the need for rep
## Creating a Theme ## Creating a Theme
To create your own theme, start by duplicating a ```.scss``` file in [/css/theme/source](https://github.com/hakimel/reveal.js/blob/master/css/theme/source). It will be automatically compiled by Grunt from Sass to CSS (see the [Gruntfile](https://github.com/hakimel/reveal.js/blob/master/Gruntfile.js)) when you run `npm run build -- css-themes`. To create your own theme, start by duplicating a ```.scss``` file in [/css/theme/source](https://github.com/hakimel/reveal.js/blob/master/css/theme/source). It will be automatically compiled by Grunt from Sass to CSS (see the [Gruntfile](https://github.com/hakimel/reveal.js/blob/master/gruntfile.js)) when you run `npm run build -- css-themes`.
Each theme file does four things in the following order: Each theme file does four things in the following order:

View File

@ -241,7 +241,7 @@
<section> <section>
<h2>Pretty Code</h2> <h2>Pretty Code</h2>
<pre><code class="hljs" data-trim data-line-numbers="4,8-11"> <pre><code class="hljs" data-trim data-line-numbers="4|9|4,8-11">
import React, { useState } from 'react'; import React, { useState } from 'react';
function Example() { function Example() {
@ -412,7 +412,7 @@ Reveal.addEventListener( 'customevent', function() {
dependencies: [ dependencies: [
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, { src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true }, { src: 'plugin/highlight/highlight.js' },
{ src: 'plugin/search/search.js', async: true }, { src: 'plugin/search/search.js', async: true },
{ src: 'plugin/zoom-js/zoom.js', async: true }, { src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true } { src: 'plugin/notes/notes.js', async: true }

View File

@ -19,7 +19,7 @@ module.exports = grunt => {
' * http://revealjs.com\n' + ' * http://revealjs.com\n' +
' * MIT licensed\n' + ' * MIT licensed\n' +
' *\n' + ' *\n' +
' * Copyright (C) 2019 Hakim El Hattab, http://hakim.se\n' + ' * Copyright (C) 2020 Hakim El Hattab, http://hakim.se\n' +
' */' ' */'
}, },

View File

@ -37,11 +37,12 @@
// - https://github.com/hakimel/reveal.js#configuration // - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies // - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({ Reveal.initialize({
hash: true,
dependencies: [ dependencies: [
{ src: 'plugin/markdown/marked.js' }, { src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' }, { src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true }, { src: 'plugin/highlight/highlight.js' },
{ src: 'plugin/highlight/highlight.js', async: true } { src: 'plugin/notes/notes.js', async: true }
] ]
}); });
</script> </script>

View File

@ -3,7 +3,7 @@
* http://revealjs.com * http://revealjs.com
* MIT licensed * MIT licensed
* *
* Copyright (C) 2019 Hakim El Hattab, http://hakim.se * Copyright (C) 2020 Hakim El Hattab, http://hakim.se
*/ */
(function( root, factory ) { (function( root, factory ) {
if( typeof define === 'function' && define.amd ) { if( typeof define === 'function' && define.amd ) {
@ -270,6 +270,11 @@
// Number of slides away from the current that are visible // Number of slides away from the current that are visible
viewDistance: 3, viewDistance: 3,
// Number of slides away from the current that are visible on mobile
// devices. It is advisable to set this to a lower number than
// viewDistance in order to save resources.
mobileViewDistance: 2,
// The display mode that will be used to show slides // The display mode that will be used to show slides
display: 'block', display: 'block',
@ -447,7 +452,8 @@
*/ */
function checkCapabilities() { function checkCapabilities() {
isMobileDevice = /(iphone|ipod|ipad|android)/gi.test( UA ); isMobileDevice = /(iphone|ipod|ipad|android)/gi.test( UA ) ||
( navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 ); // iPadOS
isChrome = /chrome/i.test( UA ) && !/edge/i.test( UA ); isChrome = /chrome/i.test( UA ) && !/edge/i.test( UA );
var testElement = document.createElement( 'div' ); var testElement = document.createElement( 'div' );
@ -1217,6 +1223,8 @@
if( data.backgroundColor ) element.style.backgroundColor = data.backgroundColor; if( data.backgroundColor ) element.style.backgroundColor = data.backgroundColor;
if( data.backgroundTransition ) element.setAttribute( 'data-background-transition', data.backgroundTransition ); if( data.backgroundTransition ) element.setAttribute( 'data-background-transition', data.backgroundTransition );
if( slide.hasAttribute( 'data-preload' ) ) element.setAttribute( 'data-preload', '' );
// Background image options are set on the content wrapper // Background image options are set on the content wrapper
if( data.backgroundSize ) contentElement.style.backgroundSize = data.backgroundSize; if( data.backgroundSize ) contentElement.style.backgroundSize = data.backgroundSize;
if( data.backgroundRepeat ) contentElement.style.backgroundRepeat = data.backgroundRepeat; if( data.backgroundRepeat ) contentElement.style.backgroundRepeat = data.backgroundRepeat;
@ -1276,7 +1284,11 @@
// Check if the requested method can be found // Check if the requested method can be found
if( data.method && typeof Reveal[data.method] === 'function' ) { if( data.method && typeof Reveal[data.method] === 'function' ) {
Reveal[data.method].apply( Reveal, data.args ); var result = Reveal[data.method].apply( Reveal, data.args );
// Dispatch a postMessage event with the returned value from
// our method invocation for getter functions
dispatchPostMessage( 'callback', { method: data.method, result: result } );
} }
} }
}, false ); }, false );
@ -1447,8 +1459,8 @@
keyboardShortcuts['&#8595; , J'] = 'Navigate down'; keyboardShortcuts['&#8595; , J'] = 'Navigate down';
} }
keyboardShortcuts['Home , &#8984;/CTRL &#8592;'] = 'First slide'; keyboardShortcuts['Home , Shift &#8592;'] = 'First slide';
keyboardShortcuts['End , &#8984;/CTRL &#8594;'] = 'Last slide'; keyboardShortcuts['End , Shift &#8594;'] = 'Last slide';
keyboardShortcuts['B , .'] = 'Pause'; keyboardShortcuts['B , .'] = 'Pause';
keyboardShortcuts['F'] = 'Fullscreen'; keyboardShortcuts['F'] = 'Fullscreen';
keyboardShortcuts['ESC, O'] = 'Slide overview'; keyboardShortcuts['ESC, O'] = 'Slide overview';
@ -1981,8 +1993,25 @@
// If we're in an iframe, post each reveal.js event to the // If we're in an iframe, post each reveal.js event to the
// parent window. Used by the notes plugin // parent window. Used by the notes plugin
dispatchPostMessage( type );
}
/**
* Dispatched a postMessage of the given type from our window.
*/
function dispatchPostMessage( type, data ) {
if( config.postMessageEvents && window.parent !== window.self ) { if( config.postMessageEvents && window.parent !== window.self ) {
window.parent.postMessage( JSON.stringify({ namespace: 'reveal', eventName: type, state: getState() }), '*' ); var message = {
namespace: 'reveal',
eventName: type,
state: getState()
};
extend( message, data );
window.parent.postMessage( JSON.stringify( message ), '*' );
} }
} }
@ -2243,10 +2272,12 @@
transformSlides( { layout: '' } ); transformSlides( { layout: '' } );
} }
else { else {
// Prefer zoom for scaling up so that content remains crisp. // Zoom Scaling
// Don't use zoom to scale down since that can lead to shifts // Content remains crisp no matter how much we scale. Side
// in text layout/line breaks. // effects are minor differences in text layout and iframe
if( scale > 1 && features.zoom ) { // viewports changing size. A 200x200 iframe viewport in a
// 2x zoomed presentation ends up having a 400x400 viewport.
if( scale > 1 && features.zoom && window.devicePixelRatio < 2 ) {
dom.slides.style.zoom = scale; dom.slides.style.zoom = scale;
dom.slides.style.left = ''; dom.slides.style.left = '';
dom.slides.style.top = ''; dom.slides.style.top = '';
@ -2254,7 +2285,10 @@
dom.slides.style.right = ''; dom.slides.style.right = '';
transformSlides( { layout: '' } ); transformSlides( { layout: '' } );
} }
// Apply scale transform as a fallback // Transform Scaling
// Content layout remains the exact same when scaled up.
// Side effect is content becoming blurred, especially with
// high scale values on ldpi screens.
else { else {
dom.slides.style.zoom = ''; dom.slides.style.zoom = '';
dom.slides.style.left = '50%'; dom.slides.style.left = '50%';
@ -3039,11 +3073,11 @@
syncBackground( slide ); syncBackground( slide );
syncFragments( slide ); syncFragments( slide );
loadSlide( slide );
updateBackground(); updateBackground();
updateNotes(); updateNotes();
loadSlide( slide );
} }
/** /**
@ -3255,9 +3289,10 @@
// be visible // be visible
var viewDistance = isOverview() ? 10 : config.viewDistance; var viewDistance = isOverview() ? 10 : config.viewDistance;
// Limit view distance on weaker devices // Shorten the view distance on devices that typically have
// less resources
if( isMobileDevice ) { if( isMobileDevice ) {
viewDistance = isOverview() ? 6 : 2; viewDistance = isOverview() ? 6 : config.mobileViewDistance;
} }
// All slides need to be visible when exporting to PDF // All slides need to be visible when exporting to PDF
@ -3309,7 +3344,7 @@
} }
// Flag if there are ANY vertical slides, anywhere in the deck // Flag if there are ANY vertical slides, anywhere in the deck
if( dom.wrapper.querySelectorAll( '.slides>section>section' ).length ) { if( hasVerticalSlides() ) {
dom.wrapper.classList.add( 'has-vertical-slides' ); dom.wrapper.classList.add( 'has-vertical-slides' );
} }
else { else {
@ -3317,7 +3352,7 @@
} }
// Flag if there are ANY horizontal slides, anywhere in the deck // Flag if there are ANY horizontal slides, anywhere in the deck
if( dom.wrapper.querySelectorAll( '.slides>section' ).length > 1 ) { if( hasHorizontalSlides() ) {
dom.wrapper.classList.add( 'has-horizontal-slides' ); dom.wrapper.classList.add( 'has-horizontal-slides' );
} }
else { else {
@ -3599,7 +3634,7 @@
// Stop content inside of previous backgrounds // Stop content inside of previous backgrounds
if( previousBackground ) { if( previousBackground ) {
stopEmbeddedContent( previousBackground ); stopEmbeddedContent( previousBackground, { unloadIframes: !shouldPreload( previousBackground ) } );
} }
@ -3778,6 +3813,7 @@
background.style.display = 'block'; background.style.display = 'block';
var backgroundContent = slide.slideBackgroundContentElement; var backgroundContent = slide.slideBackgroundContentElement;
var backgroundIframe = slide.getAttribute( 'data-background-iframe' );
// If the background contains media, load it // If the background contains media, load it
if( background.hasAttribute( 'data-loaded' ) === false ) { if( background.hasAttribute( 'data-loaded' ) === false ) {
@ -3786,8 +3822,7 @@
var backgroundImage = slide.getAttribute( 'data-background-image' ), var backgroundImage = slide.getAttribute( 'data-background-image' ),
backgroundVideo = slide.getAttribute( 'data-background-video' ), backgroundVideo = slide.getAttribute( 'data-background-video' ),
backgroundVideoLoop = slide.hasAttribute( 'data-background-video-loop' ), backgroundVideoLoop = slide.hasAttribute( 'data-background-video-loop' ),
backgroundVideoMuted = slide.hasAttribute( 'data-background-video-muted' ), backgroundVideoMuted = slide.hasAttribute( 'data-background-video-muted' );
backgroundIframe = slide.getAttribute( 'data-background-iframe' );
// Images // Images
if( backgroundImage ) { if( backgroundImage ) {
@ -3827,15 +3862,9 @@
iframe.setAttribute( 'allowfullscreen', '' ); iframe.setAttribute( 'allowfullscreen', '' );
iframe.setAttribute( 'mozallowfullscreen', '' ); iframe.setAttribute( 'mozallowfullscreen', '' );
iframe.setAttribute( 'webkitallowfullscreen', '' ); iframe.setAttribute( 'webkitallowfullscreen', '' );
iframe.setAttribute( 'allow', 'autoplay' );
// Only load autoplaying content when the slide is shown to
// avoid having it play in the background
if( /autoplay=(1|true|yes)/gi.test( backgroundIframe ) ) {
iframe.setAttribute( 'data-src', backgroundIframe ); iframe.setAttribute( 'data-src', backgroundIframe );
}
else {
iframe.setAttribute( 'src', backgroundIframe );
}
iframe.style.width = '100%'; iframe.style.width = '100%';
iframe.style.height = '100%'; iframe.style.height = '100%';
@ -3846,6 +3875,19 @@
} }
} }
// Start loading preloadable iframes
var backgroundIframeElement = backgroundContent.querySelector( 'iframe[data-src]' );
if( backgroundIframeElement ) {
// Check if this iframe is eligible to be preloaded
if( shouldPreload( background ) && !/autoplay=(1|true|yes)/gi.test( backgroundIframe ) ) {
if( backgroundIframeElement.getAttribute( 'src' ) !== backgroundIframe ) {
backgroundIframeElement.setAttribute( 'src', backgroundIframe );
}
}
}
} }
} }
@ -3865,6 +3907,11 @@
var background = getSlideBackground( slide ); var background = getSlideBackground( slide );
if( background ) { if( background ) {
background.style.display = 'none'; background.style.display = 'none';
// Unload any background iframes
toArray( background.querySelectorAll( 'iframe[src]' ) ).forEach( function( element ) {
element.removeAttribute( 'src' );
} );
} }
// Reset lazy-loaded media elements with src attributes // Reset lazy-loaded media elements with src attributes
@ -4429,7 +4476,44 @@
*/ */
function getSlides() { function getSlides() {
return toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ':not(.stack)' )); return toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ':not(.stack)' ) );
}
/**
* Returns a list of all horizontal slides in the deck. Each
* vertical stack is included as one horizontal slide in the
* resulting array.
*/
function getHorizontalSlides() {
return toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );
}
/**
* Returns all vertical slides that exist within this deck.
*/
function getVerticalSlides() {
return toArray( dom.wrapper.querySelectorAll( '.slides>section>section' ) );
}
/**
* Returns true if there are at least two horizontal slides.
*/
function hasHorizontalSlides() {
return getHorizontalSlides().length > 1;
}
/**
* Returns true if there are at least two vertical slides.
*/
function hasVerticalSlides() {
return getVerticalSlides().length > 1;
} }
@ -4667,6 +4751,8 @@
if( fragments.length ) { if( fragments.length ) {
var maxIndex = 0;
if( typeof index !== 'number' ) { if( typeof index !== 'number' ) {
var currentFragment = sortFragments( currentSlide.querySelectorAll( '.fragment.visible' ) ).pop(); var currentFragment = sortFragments( currentSlide.querySelectorAll( '.fragment.visible' ) ).pop();
if( currentFragment ) { if( currentFragment ) {
@ -4680,6 +4766,8 @@
i = parseInt( el.getAttribute( 'data-fragment-index' ), 10 ); i = parseInt( el.getAttribute( 'data-fragment-index' ), 10 );
} }
maxIndex = Math.max( maxIndex, i );
// Visible fragments // Visible fragments
if( i <= index ) { if( i <= index ) {
if( !el.classList.contains( 'visible' ) ) changedFragments.shown.push( el ); if( !el.classList.contains( 'visible' ) ) changedFragments.shown.push( el );
@ -4703,6 +4791,13 @@
} ); } );
// Write the current fragment index to the slide <section>.
// This can be used by end users to apply styles based on
// the current fragment index.
index = typeof index === 'number' ? index : -1;
index = Math.max( Math.min( index, maxIndex ), -1 );
currentSlide.setAttribute( 'data-fragment', index );
} }
} }
@ -5116,8 +5211,8 @@
// Whitelist specific modified + keycode combinations // Whitelist specific modified + keycode combinations
var prevSlideShortcut = event.shiftKey && event.keyCode === 32; var prevSlideShortcut = event.shiftKey && event.keyCode === 32;
var firstSlideShortcut = ( event.metaKey || event.ctrlKey ) && keyCode === 37; var firstSlideShortcut = event.shiftKey && keyCode === 37;
var lastSlideShortcut = ( event.metaKey || event.ctrlKey ) && keyCode === 39; var lastSlideShortcut = event.shiftKey && keyCode === 39;
// Prevent all other events when a modifier is pressed // Prevent all other events when a modifier is pressed
var unusedModifier = !prevSlideShortcut && !firstSlideShortcut && !lastSlideShortcut && var unusedModifier = !prevSlideShortcut && !firstSlideShortcut && !lastSlideShortcut &&
@ -5144,6 +5239,10 @@
return false; return false;
} }
// Use linear navigation if we're configured to OR if
// the presentation is one-dimensional
var useLinearMode = config.navigationMode === 'linear' || !hasHorizontalSlides() || !hasVerticalSlides();
var triggered = false; var triggered = false;
// 1. User defined key bindings // 1. User defined key bindings
@ -5216,7 +5315,7 @@
if( firstSlideShortcut ) { if( firstSlideShortcut ) {
slide( 0 ); slide( 0 );
} }
else if( !isOverview() && config.navigationMode === 'linear' ) { else if( !isOverview() && useLinearMode ) {
navigatePrev(); navigatePrev();
} }
else { else {
@ -5228,7 +5327,7 @@
if( lastSlideShortcut ) { if( lastSlideShortcut ) {
slide( Number.MAX_VALUE ); slide( Number.MAX_VALUE );
} }
else if( !isOverview() && config.navigationMode === 'linear' ) { else if( !isOverview() && useLinearMode ) {
navigateNext(); navigateNext();
} }
else { else {
@ -5237,7 +5336,7 @@
} }
// K, UP // K, UP
else if( keyCode === 75 || keyCode === 38 ) { else if( keyCode === 75 || keyCode === 38 ) {
if( !isOverview() && config.navigationMode === 'linear' ) { if( !isOverview() && useLinearMode ) {
navigatePrev(); navigatePrev();
} }
else { else {
@ -5246,7 +5345,7 @@
} }
// J, DOWN // J, DOWN
else if( keyCode === 74 || keyCode === 40 ) { else if( keyCode === 74 || keyCode === 40 ) {
if( !isOverview() && config.navigationMode === 'linear' ) { if( !isOverview() && useLinearMode ) {
navigateNext(); navigateNext();
} }
else { else {
@ -5356,20 +5455,50 @@
if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) {
touch.captured = true; touch.captured = true;
if( config.navigationMode === 'linear' ) {
if( config.rtl ) {
navigateNext();
}
else {
navigatePrev();
}
}
else {
navigateLeft(); navigateLeft();
} }
}
else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) {
touch.captured = true; touch.captured = true;
if( config.navigationMode === 'linear' ) {
if( config.rtl ) {
navigatePrev();
}
else {
navigateNext();
}
}
else {
navigateRight(); navigateRight();
} }
}
else if( deltaY > touch.threshold ) { else if( deltaY > touch.threshold ) {
touch.captured = true; touch.captured = true;
if( config.navigationMode === 'linear' ) {
navigatePrev();
}
else {
navigateUp(); navigateUp();
} }
}
else if( deltaY < -touch.threshold ) { else if( deltaY < -touch.threshold ) {
touch.captured = true; touch.captured = true;
if( config.navigationMode === 'linear' ) {
navigateNext();
}
else {
navigateDown(); navigateDown();
} }
}
// If we're embedded, only block touch events if they have // If we're embedded, only block touch events if they have
// triggered an action // triggered an action
@ -5905,6 +6034,15 @@
// Returns the speaker notes string for a slide, or null // Returns the speaker notes string for a slide, or null
getSlideNotes: getSlideNotes, getSlideNotes: getSlideNotes,
// Returns an array with all horizontal/vertical slides in the deck
getHorizontalSlides: getHorizontalSlides,
getVerticalSlides: getVerticalSlides,
// Checks if the presentation contains two or more
// horizontal/vertical slides
hasHorizontalSlides: hasHorizontalSlides,
hasVerticalSlides: hasVerticalSlides,
// Returns the previous slide element, may be null // Returns the previous slide element, may be null
getPreviousSlide: function() { getPreviousSlide: function() {
return previousSlide; return previousSlide;

360
package-lock.json generated
View File

@ -44,18 +44,18 @@
"dev": true "dev": true
}, },
"agent-base": { "agent-base": {
"version": "4.2.1", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz",
"integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==",
"dev": true, "dev": true,
"requires": { "requires": {
"es6-promisify": "^5.0.0" "es6-promisify": "^5.0.0"
} }
}, },
"ajv": { "ajv": {
"version": "6.9.2", "version": "6.10.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.2.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
"integrity": "sha512-4UFy0/LgDo7Oa/+wOAlj44tp9K78u38E5/359eSrqEp1Z5PdVfimCcs7SluXMP755RUQu6d2b4AvF0R1C9RZjg==", "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
"dev": true, "dev": true,
"requires": { "requires": {
"fast-deep-equal": "^2.0.1", "fast-deep-equal": "^2.0.1",
@ -275,9 +275,9 @@
"dev": true "dev": true
}, },
"aws4": { "aws4": {
"version": "1.8.0", "version": "1.9.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.0.tgz",
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "integrity": "sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==",
"dev": true "dev": true
}, },
"backo2": { "backo2": {
@ -712,9 +712,9 @@
"dev": true "dev": true
}, },
"combined-stream": { "combined-stream": {
"version": "1.0.7", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dev": true, "dev": true,
"requires": { "requires": {
"delayed-stream": "~1.0.0" "delayed-stream": "~1.0.0"
@ -1263,9 +1263,9 @@
} }
}, },
"es6-promise": { "es6-promise": {
"version": "4.2.6", "version": "4.2.8",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
"integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==", "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
"dev": true "dev": true
}, },
"es6-promisify": { "es6-promisify": {
@ -1615,9 +1615,9 @@
} }
}, },
"extend": { "extend": {
"version": "3.0.0", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
"integrity": "sha1-WkdDU7nzNT3dgXbf03uRyDpG8dQ=", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
"dev": true "dev": true
}, },
"extend-shallow": { "extend-shallow": {
@ -1737,15 +1737,15 @@
"dev": true "dev": true
}, },
"process-nextick-args": { "process-nextick-args": {
"version": "2.0.0", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
"dev": true "dev": true
}, },
"readable-stream": { "readable-stream": {
"version": "2.3.6", "version": "2.3.7",
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"dev": true, "dev": true,
"requires": { "requires": {
"core-util-is": "~1.0.0", "core-util-is": "~1.0.0",
@ -1781,9 +1781,9 @@
"dev": true "dev": true
}, },
"fast-json-stable-stringify": { "fast-json-stable-stringify": {
"version": "2.0.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
"dev": true "dev": true
}, },
"faye-websocket": { "faye-websocket": {
@ -1988,9 +1988,9 @@
"dev": true "dev": true
}, },
"fstream": { "fstream": {
"version": "1.0.11", "version": "1.0.12",
"resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz",
"integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==",
"dev": true, "dev": true,
"requires": { "requires": {
"graceful-fs": "^4.1.2", "graceful-fs": "^4.1.2",
@ -2305,9 +2305,9 @@
} }
}, },
"lodash": { "lodash": {
"version": "4.17.11", "version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
"dev": true "dev": true
} }
} }
@ -2790,12 +2790,12 @@
"dev": true "dev": true
}, },
"https-proxy-agent": { "https-proxy-agent": {
"version": "2.2.1", "version": "2.2.4",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz",
"integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==",
"dev": true, "dev": true,
"requires": { "requires": {
"agent-base": "^4.1.0", "agent-base": "^4.3.0",
"debug": "^3.1.0" "debug": "^3.1.0"
}, },
"dependencies": { "dependencies": {
@ -3120,9 +3120,9 @@
"dev": true "dev": true
}, },
"js-yaml": { "js-yaml": {
"version": "3.13.0", "version": "3.13.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.0.tgz", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
"integrity": "sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ==", "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
"dev": true, "dev": true,
"requires": { "requires": {
"argparse": "^1.0.7", "argparse": "^1.0.7",
@ -3276,21 +3276,9 @@
} }
}, },
"lodash": { "lodash": {
"version": "4.17.11", "version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
"dev": true
},
"lodash.assign": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz",
"integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=",
"dev": true
},
"lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=",
"dev": true "dev": true
}, },
"lodash.isfinite": { "lodash.isfinite": {
@ -3299,12 +3287,6 @@
"integrity": "sha1-+4m2WpqAKBgz8LdHizpRBPiY67M=", "integrity": "sha1-+4m2WpqAKBgz8LdHizpRBPiY67M=",
"dev": true "dev": true
}, },
"lodash.mergewith": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz",
"integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==",
"dev": true
},
"loud-rejection": { "loud-rejection": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz",
@ -3431,18 +3413,18 @@
"dev": true "dev": true
}, },
"mime-db": { "mime-db": {
"version": "1.38.0", "version": "1.43.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.38.0.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz",
"integrity": "sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg==", "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==",
"dev": true "dev": true
}, },
"mime-types": { "mime-types": {
"version": "2.1.22", "version": "2.1.26",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.22.tgz", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz",
"integrity": "sha512-aGl6TZGnhm/li6F7yx82bJiBZwgiEa4Hf6CNr8YO+r5UHr53tSTYZb102zyU50DOWWKeOv0uQLRL0/9EiKWCog==", "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"mime-db": "~1.38.0" "mime-db": "1.43.0"
} }
}, },
"minimatch": { "minimatch": {
@ -3461,9 +3443,9 @@
"dev": true "dev": true
}, },
"mixin-deep": { "mixin-deep": {
"version": "1.3.1", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
"integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
"dev": true, "dev": true,
"requires": { "requires": {
"for-in": "^1.0.2", "for-in": "^1.0.2",
@ -3559,9 +3541,9 @@
"dev": true "dev": true
}, },
"nan": { "nan": {
"version": "2.12.1", "version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==", "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
"dev": true "dev": true
}, },
"nanomatch": { "nanomatch": {
@ -3609,45 +3591,6 @@
"which": "1" "which": "1"
}, },
"dependencies": { "dependencies": {
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"semver": { "semver": {
"version": "5.3.0", "version": "5.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
@ -3673,9 +3616,9 @@
} }
}, },
"node-sass": { "node-sass": {
"version": "4.11.0", "version": "4.13.0",
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.11.0.tgz", "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.13.0.tgz",
"integrity": "sha512-bHUdHTphgQJZaF1LASx0kAviPH7sGlcyNhWade4eVIpFp6tsn7SV8xNMTbsQFpEV9VXpnwTTnNYlfsZXgGgmkA==", "integrity": "sha512-W1XBrvoJ1dy7VsvTAS5q1V45lREbTlZQqFbiHb3R3OTTCma0XBtuG6xZ6Z4506nR4lmHPTqVRwxT6KgtWC97CA==",
"dev": true, "dev": true,
"requires": { "requires": {
"async-foreach": "^0.1.3", "async-foreach": "^0.1.3",
@ -3685,12 +3628,10 @@
"get-stdin": "^4.0.1", "get-stdin": "^4.0.1",
"glob": "^7.0.3", "glob": "^7.0.3",
"in-publish": "^2.0.0", "in-publish": "^2.0.0",
"lodash.assign": "^4.2.0", "lodash": "^4.17.15",
"lodash.clonedeep": "^4.3.2",
"lodash.mergewith": "^4.6.0",
"meow": "^3.7.0", "meow": "^3.7.0",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"nan": "^2.10.0", "nan": "^2.13.2",
"node-gyp": "^3.8.0", "node-gyp": "^3.8.0",
"npmlog": "^4.0.0", "npmlog": "^4.0.0",
"request": "^2.88.0", "request": "^2.88.0",
@ -3699,44 +3640,11 @@
"true-case-path": "^1.0.2" "true-case-path": "^1.0.2"
}, },
"dependencies": { "dependencies": {
"balanced-match": { "lodash": {
"version": "1.0.0", "version": "4.17.15",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
"dev": true "dev": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
} }
} }
}, },
@ -4153,9 +4061,9 @@
} }
}, },
"lodash": { "lodash": {
"version": "4.17.11", "version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
"dev": true "dev": true
} }
} }
@ -4229,9 +4137,9 @@
"dev": true "dev": true
}, },
"psl": { "psl": {
"version": "1.1.31", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz",
"integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==", "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==",
"dev": true "dev": true
}, },
"punycode": { "punycode": {
@ -4241,9 +4149,9 @@
"dev": true "dev": true
}, },
"puppeteer": { "puppeteer": {
"version": "1.12.2", "version": "1.20.0",
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2.tgz", "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.20.0.tgz",
"integrity": "sha512-xWSyCeD6EazGlfnQweMpM+Hs6X6PhUYhNTHKFj/axNZDq4OmrVERf70isBf7HsnFgB3zOC1+23/8+wCAZYg+Pg==", "integrity": "sha512-bt48RDBy2eIwZPrkgbcwHtb51mj2nKvHOPMaSH2IsWiv7lOG9k9zhaRzpDZafrk05ajMc3cu+lSQYYOfH2DkVQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"debug": "^4.1.0", "debug": "^4.1.0",
@ -4266,9 +4174,9 @@
} }
}, },
"mime": { "mime": {
"version": "2.4.0", "version": "2.4.4",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.0.tgz", "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz",
"integrity": "sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w==", "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==",
"dev": true "dev": true
} }
} }
@ -4572,47 +4480,6 @@
"lodash": "^4.0.0", "lodash": "^4.0.0",
"scss-tokenizer": "^0.2.3", "scss-tokenizer": "^0.2.3",
"yargs": "^7.0.0" "yargs": "^7.0.0"
},
"dependencies": {
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
}
} }
}, },
"scss-tokenizer": { "scss-tokenizer": {
@ -4773,9 +4640,9 @@
"dev": true "dev": true
}, },
"set-value": { "set-value": {
"version": "2.0.0", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
"integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==",
"dev": true, "dev": true,
"requires": { "requires": {
"extend-shallow": "^2.0.1", "extend-shallow": "^2.0.1",
@ -5248,13 +5115,13 @@
"dev": true "dev": true
}, },
"tar": { "tar": {
"version": "2.2.1", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz",
"integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==",
"dev": true, "dev": true,
"requires": { "requires": {
"block-stream": "*", "block-stream": "*",
"fstream": "^1.0.2", "fstream": "^1.0.12",
"inherits": "2" "inherits": "2"
} }
}, },
@ -5379,26 +5246,10 @@
"glob": "^7.1.2" "glob": "^7.1.2"
}, },
"dependencies": { "dependencies": {
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"glob": { "glob": {
"version": "7.1.3", "version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dev": true, "dev": true,
"requires": { "requires": {
"fs.realpath": "^1.0.0", "fs.realpath": "^1.0.0",
@ -5488,38 +5339,15 @@
} }
}, },
"union-value": { "union-value": {
"version": "1.0.0", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
"integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==",
"dev": true, "dev": true,
"requires": { "requires": {
"arr-union": "^3.1.0", "arr-union": "^3.1.0",
"get-value": "^2.0.6", "get-value": "^2.0.6",
"is-extendable": "^0.1.1", "is-extendable": "^0.1.1",
"set-value": "^0.4.3" "set-value": "^2.0.1"
},
"dependencies": {
"extend-shallow": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true,
"requires": {
"is-extendable": "^0.1.0"
}
},
"set-value": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz",
"integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=",
"dev": true,
"requires": {
"extend-shallow": "^2.0.1",
"is-extendable": "^0.1.1",
"is-plain-object": "^2.0.1",
"to-object-path": "^0.3.0"
}
}
} }
}, },
"unpipe": { "unpipe": {
@ -5649,9 +5477,9 @@
"dev": true "dev": true
}, },
"uuid": { "uuid": {
"version": "3.3.2", "version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==",
"dev": true "dev": true
}, },
"v8flags": { "v8flags": {

View File

@ -36,7 +36,7 @@
"grunt-sass": "^3.0.2", "grunt-sass": "^3.0.2",
"grunt-zip": "~0.17.1", "grunt-zip": "~0.17.1",
"load-grunt-tasks": "^4.0.0", "load-grunt-tasks": "^4.0.0",
"node-sass": "^4.11.0", "node-sass": "^4.13.0",
"mustache": "^2.3.0", "mustache": "^2.3.0",
"socket.io": "^2.2.0" "socket.io": "^2.2.0"
}, },

File diff suppressed because one or more lines are too long

View File

@ -539,12 +539,17 @@
callRevealApi( 'getSlidesAttributes', [], function ( slideAttributes ) { callRevealApi( 'getSlidesAttributes', [], function ( slideAttributes ) {
callRevealApi( 'getConfig', [], function ( config ) { callRevealApi( 'getConfig', [], function ( config ) {
var totalTime = config.totalTime;
var minTimePerSlide = config.minimumTimePerSlide || 0;
var defaultTiming = config.defaultTiming; var defaultTiming = config.defaultTiming;
if (defaultTiming == null) { if ((defaultTiming == null) && (totalTime == null)) {
callback(null); callback(null);
return; return;
} }
// Setting totalTime overrides defaultTiming
if (totalTime) {
defaultTiming = 0;
}
var timings = []; var timings = [];
for ( var i in slideAttributes ) { for ( var i in slideAttributes ) {
var slide = slideAttributes[ i ]; var slide = slideAttributes[ i ];
@ -559,7 +564,22 @@
} }
timings.push(timing); timings.push(timing);
} }
if ( totalTime ) {
// After we've allocated time to individual slides, we summarize it and
// subtract it from the total time
var remainingTime = totalTime - timings.reduce( function(a, b) { return a + b; }, 0 );
// The remaining time is divided by the number of slides that have 0 seconds
// allocated at the moment, giving the average time-per-slide on the remaining slides
var remainingSlides = (timings.filter( function(x) { return x == 0 }) ).length
var timePerSlide = Math.round( remainingTime / remainingSlides, 0 )
// 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 ); callback( timings );
} ); } );
} ); } );

View File

@ -0,0 +1,104 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Iframe Backgrounds</title>
<link rel="stylesheet" href="../css/reveal.css">
<link rel="stylesheet" href="qunit-2.5.0.css">
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<div class="slides">
<section data-background-iframe="#1">1</section>
<section data-background-iframe="#2">2</section>
<section data-background-iframe="#3" data-preload>3</section>
<section data-background-iframe="#4">4</section>
<section data-background-iframe="#5">5</section>
<section data-background-iframe="#6">6</section>
</div>
</div>
<script src="../js/reveal.js"></script>
<script src="qunit-2.5.0.js"></script>
<script>
Reveal.addEventListener( 'ready', function() {
function getIframe( index ) {
return document.querySelectorAll( '.slide-background' )[index].querySelector( 'iframe' );
}
QUnit.module( 'Iframe' );
QUnit.test( 'Using default settings', function( assert ) {
Reveal.slide(0);
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), false, 'not preloaded when within viewDistance' );
Reveal.slide(1);
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), true, 'loaded when slide becomes visible' );
Reveal.slide(0);
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), false, 'unloaded when slide becomes invisible' );
});
QUnit.test( 'Using data-preload', function( assert ) {
Reveal.slide(1);
assert.strictEqual( getIframe(2).hasAttribute( 'src' ), true, 'preloaded within viewDistance' );
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), true, 'loaded when slide becomes visible' );
Reveal.slide(0);
assert.strictEqual( getIframe(3).hasAttribute( 'src' ), false, 'unloads outside of viewDistance' );
});
QUnit.test( 'Using preloadIframes: true', function( assert ) {
Reveal.configure({ preloadIframes: true });
Reveal.slide(1);
assert.strictEqual( getIframe(0).hasAttribute( 'src' ), true, 'preloaded within viewDistance' );
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), true, 'preloaded within viewDistance' );
assert.strictEqual( getIframe(2).hasAttribute( 'src' ), true, 'preloaded within viewDistance' );
});
QUnit.test( 'Using preloadIframes: false', function( assert ) {
Reveal.configure({ preloadIframes: false });
Reveal.slide(0);
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), false, 'not preloaded within viewDistance' );
assert.strictEqual( getIframe(2).hasAttribute( 'src' ), false, 'not preloaded within viewDistance' );
Reveal.slide(1);
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), true, 'loaded when slide becomes visible' );
});
} );
Reveal.initialize({
viewDistance: 3
});
</script>
</body>
</html>

View File

@ -250,6 +250,22 @@ Reveal.addEventListener( 'ready', function() {
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'Reveal.slide( 2, 0, 1 )' ); assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'Reveal.slide( 2, 0, 1 )' );
}); });
QUnit.test( 'data-fragment is set on slide <section>', function( assert ) {
Reveal.slide( 2, 0, -1 );
assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '-1' );
Reveal.slide( 2, 0, 2 );
assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '2' );
Reveal.slide( 2, 0, 0 );
assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '0' );
var fragmentSlide = Reveal.getCurrentSlide();
Reveal.slide( 3, 0 );
assert.deepEqual( fragmentSlide.getAttribute( 'data-fragment' ), '0', 'data-fragment persists when jumping to another slide' );
});
QUnit.test( 'Hiding all fragments', function( assert ) { QUnit.test( 'Hiding all fragments', function( assert ) {
var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' ); var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );