add api methods for check if overview is active or presentation is paused
This commit is contained in:
1 parent
2962325fd1
commit
24c493fb83
2 files changed
+18
-14
No files matched your search
+16
-12
@@ -822,7 +822,7 @@ var Reveal = (function(){
|
|||||||
override ? activateOverview() : deactivateOverview();
|
override ? activateOverview() : deactivateOverview();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
isOverviewActive() ? deactivateOverview() : activateOverview();
|
isOverview() ? deactivateOverview() : activateOverview();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -833,7 +833,7 @@ var Reveal = (function(){
|
|||||||
* @return {Boolean} true if the overview is active,
|
* @return {Boolean} true if the overview is active,
|
||||||
* false otherwise
|
* false otherwise
|
||||||
*/
|
*/
|
||||||
function isOverviewActive() {
|
function isOverview() {
|
||||||
|
|
||||||
return dom.wrapper.classList.contains( 'overview' );
|
return dom.wrapper.classList.contains( 'overview' );
|
||||||
|
|
||||||
@@ -973,7 +973,7 @@ var Reveal = (function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the overview is active, re-activate it to update positions
|
// If the overview is active, re-activate it to update positions
|
||||||
if( isOverviewActive() ) {
|
if( isOverview() ) {
|
||||||
activateOverview();
|
activateOverview();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1084,7 +1084,7 @@ var Reveal = (function(){
|
|||||||
|
|
||||||
// Optimization; hide all slides that are three or more steps
|
// Optimization; hide all slides that are three or more steps
|
||||||
// away from the present slide
|
// away from the present slide
|
||||||
if( isOverviewActive() === false ) {
|
if( isOverview() === false ) {
|
||||||
// The distance loops so that it measures 1 between the first
|
// The distance loops so that it measures 1 between the first
|
||||||
// and last slides
|
// and last slides
|
||||||
var distance = Math.abs( ( index - i ) % ( slidesLength - 3 ) ) || 0;
|
var distance = Math.abs( ( index - i ) % ( slidesLength - 3 ) ) || 0;
|
||||||
@@ -1431,7 +1431,7 @@ var Reveal = (function(){
|
|||||||
clearTimeout( autoSlideTimeout );
|
clearTimeout( autoSlideTimeout );
|
||||||
|
|
||||||
// Cue the next auto-slide if enabled
|
// Cue the next auto-slide if enabled
|
||||||
if( autoSlide && !isPaused() && !isOverviewActive() ) {
|
if( autoSlide && !isPaused() && !isOverview() ) {
|
||||||
autoSlideTimeout = setTimeout( navigateNext, autoSlide );
|
autoSlideTimeout = setTimeout( navigateNext, autoSlide );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1449,7 +1449,7 @@ var Reveal = (function(){
|
|||||||
function navigateLeft() {
|
function navigateLeft() {
|
||||||
|
|
||||||
// Prioritize hiding fragments
|
// Prioritize hiding fragments
|
||||||
if( availableRoutes().left && isOverviewActive() || previousFragment() === false ) {
|
if( availableRoutes().left && isOverview() || previousFragment() === false ) {
|
||||||
slide( indexh - 1 );
|
slide( indexh - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1458,7 +1458,7 @@ var Reveal = (function(){
|
|||||||
function navigateRight() {
|
function navigateRight() {
|
||||||
|
|
||||||
// Prioritize revealing fragments
|
// Prioritize revealing fragments
|
||||||
if( availableRoutes().right && isOverviewActive() || nextFragment() === false ) {
|
if( availableRoutes().right && isOverview() || nextFragment() === false ) {
|
||||||
slide( indexh + 1 );
|
slide( indexh + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1467,7 +1467,7 @@ var Reveal = (function(){
|
|||||||
function navigateUp() {
|
function navigateUp() {
|
||||||
|
|
||||||
// Prioritize hiding fragments
|
// Prioritize hiding fragments
|
||||||
if( availableRoutes().up && isOverviewActive() || previousFragment() === false ) {
|
if( availableRoutes().up && isOverview() || previousFragment() === false ) {
|
||||||
slide( indexh, indexv - 1 );
|
slide( indexh, indexv - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1476,7 +1476,7 @@ var Reveal = (function(){
|
|||||||
function navigateDown() {
|
function navigateDown() {
|
||||||
|
|
||||||
// Prioritize revealing fragments
|
// Prioritize revealing fragments
|
||||||
if( availableRoutes().down && isOverviewActive() || nextFragment() === false ) {
|
if( availableRoutes().down && isOverview() || nextFragment() === false ) {
|
||||||
slide( indexh, indexv + 1 );
|
slide( indexh, indexv + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1572,9 +1572,9 @@ var Reveal = (function(){
|
|||||||
// end
|
// end
|
||||||
case 35: slide( Number.MAX_VALUE ); break;
|
case 35: slide( Number.MAX_VALUE ); break;
|
||||||
// space
|
// space
|
||||||
case 32: isOverviewActive() ? deactivateOverview() : navigateNext(); break;
|
case 32: isOverview() ? deactivateOverview() : navigateNext(); break;
|
||||||
// return
|
// return
|
||||||
case 13: isOverviewActive() ? deactivateOverview() : triggered = false; break;
|
case 13: isOverview() ? deactivateOverview() : triggered = false; break;
|
||||||
// b, period, Logitech presenter tools "black screen" button
|
// b, period, Logitech presenter tools "black screen" button
|
||||||
case 66: case 190: case 191: togglePause(); break;
|
case 66: case 190: case 191: togglePause(); break;
|
||||||
// f
|
// f
|
||||||
@@ -1779,7 +1779,7 @@ var Reveal = (function(){
|
|||||||
|
|
||||||
// TODO There's a bug here where the event listeners are not
|
// TODO There's a bug here where the event listeners are not
|
||||||
// removed after deactivating the overview.
|
// removed after deactivating the overview.
|
||||||
if( isOverviewActive() ) {
|
if( isOverview() ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
deactivateOverview();
|
deactivateOverview();
|
||||||
@@ -1838,6 +1838,10 @@ var Reveal = (function(){
|
|||||||
// Toggles the "black screen" mode on/off
|
// Toggles the "black screen" mode on/off
|
||||||
togglePause: togglePause,
|
togglePause: togglePause,
|
||||||
|
|
||||||
|
// State checks
|
||||||
|
isOverview: isOverview,
|
||||||
|
isPaused: isPaused,
|
||||||
|
|
||||||
// Adds or removes all internal event listeners (such as keyboard)
|
// Adds or removes all internal event listeners (such as keyboard)
|
||||||
addEventListeners: addEventListeners,
|
addEventListeners: addEventListeners,
|
||||||
removeEventListeners: removeEventListeners,
|
removeEventListeners: removeEventListeners,
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
/*!
|
/*!
|
||||||
* reveal.js 2.3 (2013-02-09, 19:04)
|
* reveal.js 2.3 (2013-02-09, 19:08)
|
||||||
* http://lab.hakim.se/reveal-js
|
* http://lab.hakim.se/reveal-js
|
||||||
* MIT licensed
|
* MIT licensed
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Hakim El Hattab, http://hakim.se
|
* Copyright (C) 2013 Hakim El Hattab, http://hakim.se
|
||||||
*/
|
*/
|
||||||
var Reveal=function(){"use strict";function E(e){if(!d&&!p){document.body.setAttribute("class","no-transforms");return}window.addEventListener("load",H,!1),A(i,e),x(),T()}function S(){h.theme=document.querySelector("#theme"),h.wrapper=document.querySelector(".reveal"),h.slides=document.querySelector(".reveal .slides");if(!h.wrapper.querySelector(".progress")&&i.progress){var e=document.createElement("div");e.classList.add("progress"),e.innerHTML="<span></span>",h.wrapper.appendChild(e)}if(!h.wrapper.querySelector(".controls")&&i.controls){var t=document.createElement("aside");t.classList.add("controls"),t.innerHTML='<div class="navigate-left"></div><div class="navigate-right"></div><div class="navigate-up"></div><div class="navigate-down"></div>',h.wrapper.appendChild(t)}if(!h.wrapper.querySelector(".state-background")){var n=document.createElement("div");n.classList.add("state-background"),h.wrapper.appendChild(n)}if(!h.wrapper.querySelector(".pause-overlay")){var r=document.createElement("div");r.classList.add("pause-overlay"),h.wrapper.appendChild(r)}h.progress=document.querySelector(".reveal .progress"),h.progressbar=document.querySelector(".reveal .progress span"),i.controls&&(h.controls=document.querySelector(".reveal .controls"),h.controlsLeft=O(document.querySelectorAll(".navigate-left")),h.controlsRight=O(document.querySelectorAll(".navigate-right")),h.controlsUp=O(document.querySelectorAll(".navigate-up")),h.controlsDown=O(document.querySelectorAll(".navigate-down")),h.controlsPrev=O(document.querySelectorAll(".navigate-prev")),h.controlsNext=O(document.querySelectorAll(".navigate-next")))}function x(){/iphone|ipod|android/gi.test(navigator.userAgent)&&!/crios/gi.test(navigator.userAgent)&&(window.addEventListener("load",_,!1),window.addEventListener("orientationchange",_,!1))}function T(){function o(){t.length&&head.js.apply(null,t),N()}var e=[],t=[];for(var n=0,r=i.dependencies.length;n<r;n++){var s=i.dependencies[n];if(!s.condition||s.condition())s.async?t.push(s.src):e.push(s.src),typeof s.callback=="function"&&head.ready(s.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],s.callback)}e.length?(head.ready(o),head.js.apply(null,e)):o()}function N(){S(),k(),C(),H(),Y(),rt(),setTimeout(function(){D("ready",{indexh:o,indexv:u,currentSlide:f})},1)}function C(){p===!1&&(i.transition="linear"),i.controls&&h.controls&&(h.controls.style.display="block"),i.progress&&h.progress&&(h.progress.style.display="block"),i.transition!=="default"&&h.wrapper.classList.add(i.transition),i.rtl&&h.wrapper.classList.add("rtl"),i.center&&h.wrapper.classList.add("center"),i.mouseWheel&&(document.addEventListener("DOMMouseScroll",vt,!1),document.addEventListener("mousewheel",vt,!1)),i.rollingLinks&&P();if(i.theme&&h.theme){var e=h.theme.getAttribute("href"),t=/[^\/]*?(?=\.css)/,n=e.match(t)[0];i.theme!==n&&(e=e.replace(t,i.theme),h.theme.setAttribute("href",e))}}function k(){window.addEventListener("hashchange",xt,!1),window.addEventListener("resize",Tt,!1),i.touch&&(document.addEventListener("touchstart",ht,!1),document.addEventListener("touchmove",pt,!1),document.addEventListener("touchend",dt,!1)),i.keyboard&&document.addEventListener("keydown",ct,!1),i.progress&&h.progress&&h.progress.addEventListener("click",mt,!1);if(i.controls&&h.controls){var e="ontouchstart"in window?"touchstart":"click";h.controlsLeft.forEach(function(t){t.addEventListener(e,gt,!1)}),h.controlsRight.forEach(function(t){t.addEventListener(e,yt,!1)}),h.controlsUp.forEach(function(t){t.addEventListener(e,bt,!1)}),h.controlsDown.forEach(function(t){t.addEventListener(e,wt,!1)}),h.controlsPrev.forEach(function(t){t.addEventListener(e,Et,!1)}),h.controlsNext.forEach(function(t){t.addEventListener(e,St,!1)})}}function L(){document.removeEventListener("keydown",ct,!1),window.removeEventListener("hashchange",xt,!1),window.removeEventListener("resize",Tt,!1),i.touch&&(document.removeEventListener("touchstart",ht,!1),document.removeEventListener("touchmove",pt,!1),document.removeEventListener("touchend",dt,!1)),i.progress&&h.progress&&h.progress.removeEventListener("click",mt,!1);if(i.controls&&h.controls){var e="ontouchstart"in window?"touchstart":"click";h.controlsLeft.forEach(function(t){t.removeEventListener(e,gt,!1)}),h.controlsRight.forEach(function(t){t.removeEventListener(e,yt,!1)}),h.controlsUp.forEach(function(t){t.removeEventListener(e,bt,!1)}),h.controlsDown.forEach(function(t){t.removeEventListener(e,wt,!1)}),h.controlsPrev.forEach(function(t){t.removeEventListener(e,Et,!1)}),h.controlsNext.forEach(function(t){t.removeEventListener(e,St,!1)})}}function A(e,t){for(var n in t)e[n]=t[n]}function O(e){return Array.prototype.slice.call(e)}function M(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function _(){window.orientation===0?(document.documentElement.style.overflow="scroll",document.body.style.height="120%"):(document.documentElement.style.overflow="",document.body.style.height="100%"),setTimeout(function(){window.scrollTo(0,1)},10)}funLine truncated
|
var Reveal=function(){"use strict";function E(e){if(!d&&!p){document.body.setAttribute("class","no-transforms");return}window.addEventListener("load",H,!1),A(i,e),x(),T()}function S(){h.theme=document.querySelector("#theme"),h.wrapper=document.querySelector(".reveal"),h.slides=document.querySelector(".reveal .slides");if(!h.wrapper.querySelector(".progress")&&i.progress){var e=document.createElement("div");e.classList.add("progress"),e.innerHTML="<span></span>",h.wrapper.appendChild(e)}if(!h.wrapper.querySelector(".controls")&&i.controls){var t=document.createElement("aside");t.classList.add("controls"),t.innerHTML='<div class="navigate-left"></div><div class="navigate-right"></div><div class="navigate-up"></div><div class="navigate-down"></div>',h.wrapper.appendChild(t)}if(!h.wrapper.querySelector(".state-background")){var n=document.createElement("div");n.classList.add("state-background"),h.wrapper.appendChild(n)}if(!h.wrapper.querySelector(".pause-overlay")){var r=document.createElement("div");r.classList.add("pause-overlay"),h.wrapper.appendChild(r)}h.progress=document.querySelector(".reveal .progress"),h.progressbar=document.querySelector(".reveal .progress span"),i.controls&&(h.controls=document.querySelector(".reveal .controls"),h.controlsLeft=O(document.querySelectorAll(".navigate-left")),h.controlsRight=O(document.querySelectorAll(".navigate-right")),h.controlsUp=O(document.querySelectorAll(".navigate-up")),h.controlsDown=O(document.querySelectorAll(".navigate-down")),h.controlsPrev=O(document.querySelectorAll(".navigate-prev")),h.controlsNext=O(document.querySelectorAll(".navigate-next")))}function x(){/iphone|ipod|android/gi.test(navigator.userAgent)&&!/crios/gi.test(navigator.userAgent)&&(window.addEventListener("load",_,!1),window.addEventListener("orientationchange",_,!1))}function T(){function o(){t.length&&head.js.apply(null,t),N()}var e=[],t=[];for(var n=0,r=i.dependencies.length;n<r;n++){var s=i.dependencies[n];if(!s.condition||s.condition())s.async?t.push(s.src):e.push(s.src),typeof s.callback=="function"&&head.ready(s.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],s.callback)}e.length?(head.ready(o),head.js.apply(null,e)):o()}function N(){S(),k(),C(),H(),Y(),rt(),setTimeout(function(){D("ready",{indexh:o,indexv:u,currentSlide:f})},1)}function C(){p===!1&&(i.transition="linear"),i.controls&&h.controls&&(h.controls.style.display="block"),i.progress&&h.progress&&(h.progress.style.display="block"),i.transition!=="default"&&h.wrapper.classList.add(i.transition),i.rtl&&h.wrapper.classList.add("rtl"),i.center&&h.wrapper.classList.add("center"),i.mouseWheel&&(document.addEventListener("DOMMouseScroll",vt,!1),document.addEventListener("mousewheel",vt,!1)),i.rollingLinks&&P();if(i.theme&&h.theme){var e=h.theme.getAttribute("href"),t=/[^\/]*?(?=\.css)/,n=e.match(t)[0];i.theme!==n&&(e=e.replace(t,i.theme),h.theme.setAttribute("href",e))}}function k(){window.addEventListener("hashchange",xt,!1),window.addEventListener("resize",Tt,!1),i.touch&&(document.addEventListener("touchstart",ht,!1),document.addEventListener("touchmove",pt,!1),document.addEventListener("touchend",dt,!1)),i.keyboard&&document.addEventListener("keydown",ct,!1),i.progress&&h.progress&&h.progress.addEventListener("click",mt,!1);if(i.controls&&h.controls){var e="ontouchstart"in window?"touchstart":"click";h.controlsLeft.forEach(function(t){t.addEventListener(e,gt,!1)}),h.controlsRight.forEach(function(t){t.addEventListener(e,yt,!1)}),h.controlsUp.forEach(function(t){t.addEventListener(e,bt,!1)}),h.controlsDown.forEach(function(t){t.addEventListener(e,wt,!1)}),h.controlsPrev.forEach(function(t){t.addEventListener(e,Et,!1)}),h.controlsNext.forEach(function(t){t.addEventListener(e,St,!1)})}}function L(){document.removeEventListener("keydown",ct,!1),window.removeEventListener("hashchange",xt,!1),window.removeEventListener("resize",Tt,!1),i.touch&&(document.removeEventListener("touchstart",ht,!1),document.removeEventListener("touchmove",pt,!1),document.removeEventListener("touchend",dt,!1)),i.progress&&h.progress&&h.progress.removeEventListener("click",mt,!1);if(i.controls&&h.controls){var e="ontouchstart"in window?"touchstart":"click";h.controlsLeft.forEach(function(t){t.removeEventListener(e,gt,!1)}),h.controlsRight.forEach(function(t){t.removeEventListener(e,yt,!1)}),h.controlsUp.forEach(function(t){t.removeEventListener(e,bt,!1)}),h.controlsDown.forEach(function(t){t.removeEventListener(e,wt,!1)}),h.controlsPrev.forEach(function(t){t.removeEventListener(e,Et,!1)}),h.controlsNext.forEach(function(t){t.removeEventListener(e,St,!1)})}}function A(e,t){for(var n in t)e[n]=t[n]}function O(e){return Array.prototype.slice.call(e)}function M(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function _(){window.orientation===0?(document.documentElement.style.overflow="scroll",document.body.style.height="120%"):(document.documentElement.style.overflow="",document.body.style.height="100%"),setTimeout(function(){window.scrollTo(0,1)},10)}funLine truncated
|
||||||
Reference in new issue
Block a user