merge conflicts w preview & backgrounds
This commit is contained in:
commit
7094f44eb9
14 files changed
+509
-75
No files matched your search
+151
-8
@@ -82,6 +82,9 @@ var Reveal = (function(){
|
||||
// Transition speed
|
||||
transitionSpeed: 'default', // default/fast/slow
|
||||
|
||||
// Transition style for full page slide backgrounds
|
||||
backgroundTransition: 'default', // default/linear
|
||||
|
||||
// Script dependencies to load
|
||||
dependencies: []
|
||||
},
|
||||
@@ -189,6 +192,13 @@ var Reveal = (function(){
|
||||
dom.wrapper = document.querySelector( '.reveal' );
|
||||
dom.slides = document.querySelector( '.reveal .slides' );
|
||||
|
||||
// Background element
|
||||
if( !document.querySelector( '.reveal .backgrounds' ) ) {
|
||||
dom.background = document.createElement( 'div' );
|
||||
dom.background.classList.add( 'backgrounds' );
|
||||
dom.wrapper.appendChild( dom.background );
|
||||
}
|
||||
|
||||
// Progress bar
|
||||
if( !dom.wrapper.querySelector( '.progress' ) ) {
|
||||
var progressElement = document.createElement( 'div' );
|
||||
@@ -208,11 +218,11 @@ var Reveal = (function(){
|
||||
dom.wrapper.appendChild( controlsElement );
|
||||
}
|
||||
|
||||
// Presentation background element
|
||||
// State background element [DEPRECATED]
|
||||
if( !dom.wrapper.querySelector( '.state-background' ) ) {
|
||||
var backgroundElement = document.createElement( 'div' );
|
||||
backgroundElement.classList.add( 'state-background' );
|
||||
dom.wrapper.appendChild( backgroundElement );
|
||||
var stateBackgroundElement = document.createElement( 'div' );
|
||||
stateBackgroundElement.classList.add( 'state-background' );
|
||||
dom.wrapper.appendChild( stateBackgroundElement );
|
||||
}
|
||||
|
||||
// Overlay graphic which is displayed during the paused mode
|
||||
@@ -240,6 +250,86 @@ var Reveal = (function(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the slide background elements and appends them
|
||||
* to the background container. One element is created per
|
||||
* slide no matter if the given slide has visible background.
|
||||
*/
|
||||
function createBackgrounds() {
|
||||
|
||||
if( isPrintingPDF() ) {
|
||||
document.body.classList.add( 'print-pdf' );
|
||||
}
|
||||
|
||||
// Clear prior backgrounds
|
||||
dom.background.innerHTML = '';
|
||||
dom.background.classList.add( 'no-transition' );
|
||||
|
||||
// Helper method for creating a background element for the
|
||||
// given slide
|
||||
function _createBackground( slide, container ) {
|
||||
|
||||
var data = {
|
||||
background: slide.getAttribute( 'data-background' ),
|
||||
backgroundSize: slide.getAttribute( 'data-background-size' ),
|
||||
backgroundColor: slide.getAttribute( 'data-background-color' ),
|
||||
backgroundRepeat: slide.getAttribute( 'data-background-repeat' ),
|
||||
backgroundPosition: slide.getAttribute( 'data-background-position' )
|
||||
};
|
||||
|
||||
var element = document.createElement( 'div' );
|
||||
element.className = 'slide-background';
|
||||
|
||||
if( data.background ) {
|
||||
// Auto-wrap image urls in url(...)
|
||||
if( /\.(png|jpg|jpeg|gif|bmp)$/gi.test( data.background ) ) {
|
||||
element.style.backgroundImage = 'url('+ data.background +')';
|
||||
}
|
||||
else {
|
||||
element.style.background = data.background;
|
||||
}
|
||||
}
|
||||
|
||||
// Additional and optional background properties
|
||||
if( data.backgroundSize ) element.style.backgroundSize = data.backgroundSize;
|
||||
if( data.backgroundColor ) element.style.backgroundColor = data.backgroundColor;
|
||||
if( data.backgroundRepeat ) element.style.backgroundRepeat = data.backgroundRepeat;
|
||||
if( data.backgroundPosition ) element.style.backgroundPosition = data.backgroundPosition;
|
||||
|
||||
container.appendChild( element );
|
||||
|
||||
return element;
|
||||
|
||||
}
|
||||
|
||||
// Iterate over all horizontal slides
|
||||
toArray( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( slideh ) {
|
||||
|
||||
var backgroundStack;
|
||||
|
||||
if( isPrintingPDF() ) {
|
||||
backgroundStack = _createBackground( slideh, slideh );
|
||||
}
|
||||
else {
|
||||
backgroundStack = _createBackground( slideh, dom.background );
|
||||
}
|
||||
|
||||
// Iterate over all vertical slides
|
||||
toArray( slideh.querySelectorAll( 'section' ) ).forEach( function( slidev ) {
|
||||
|
||||
if( isPrintingPDF() ) {
|
||||
_createBackground( slidev, slidev );
|
||||
}
|
||||
else {
|
||||
_createBackground( slidev, backgroundStack );
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the address bar if we're on a mobile device.
|
||||
*/
|
||||
@@ -351,6 +441,7 @@ var Reveal = (function(){
|
||||
dom.wrapper.classList.add( config.transition );
|
||||
|
||||
dom.wrapper.setAttribute( 'data-transition-speed', config.transitionSpeed );
|
||||
dom.wrapper.setAttribute( 'data-background-transition', config.backgroundTransition );
|
||||
|
||||
if( dom.controls ) {
|
||||
dom.controls.style.display = ( config.controls && dom.controls ) ? 'block' : 'none';
|
||||
@@ -570,6 +661,15 @@ var Reveal = (function(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this instance is being used to print a PDF.
|
||||
*/
|
||||
function isPrintingPDF() {
|
||||
|
||||
return ( /print-pdf/gi ).test( window.location.search );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Causes the address bar to hide on mobile devices,
|
||||
* more vertical space ftw.
|
||||
@@ -770,7 +870,7 @@ var Reveal = (function(){
|
||||
*/
|
||||
function layout() {
|
||||
|
||||
if( dom.wrapper ) {
|
||||
if( dom.wrapper && !isPrintingPDF() ) {
|
||||
|
||||
// Available space to scale within
|
||||
var availableWidth = dom.wrapper.offsetWidth,
|
||||
@@ -1262,7 +1362,8 @@ var Reveal = (function(){
|
||||
}
|
||||
|
||||
// Dispatch an event if the slide changed
|
||||
if( indexh !== indexhBefore || indexv !== indexvBefore ) {
|
||||
var slideChanged = ( indexh !== indexhBefore || indexv !== indexvBefore );
|
||||
if( slideChanged ) {
|
||||
dispatchEvent( 'slidechanged', {
|
||||
'indexh': indexh,
|
||||
'indexv': indexv,
|
||||
@@ -1299,11 +1400,14 @@ var Reveal = (function(){
|
||||
}
|
||||
|
||||
// Handle embedded content
|
||||
stopEmbeddedContent( previousSlide );
|
||||
startEmbeddedContent( currentSlide );
|
||||
if( slideChanged ) {
|
||||
stopEmbeddedContent( previousSlide );
|
||||
startEmbeddedContent( currentSlide );
|
||||
}
|
||||
|
||||
updateControls();
|
||||
updateProgress();
|
||||
updateBackground();
|
||||
|
||||
}
|
||||
|
||||
@@ -1327,8 +1431,12 @@ var Reveal = (function(){
|
||||
// Start auto-sliding if it's enabled
|
||||
cueAutoSlide();
|
||||
|
||||
// Re-create the slide backgrounds
|
||||
createBackgrounds();
|
||||
|
||||
updateControls();
|
||||
updateProgress();
|
||||
updateBackground();
|
||||
|
||||
}
|
||||
|
||||
@@ -1385,6 +1493,9 @@ var Reveal = (function(){
|
||||
element.classList.remove( 'present' );
|
||||
element.classList.remove( 'future' );
|
||||
|
||||
// http://www.w3.org/html/wg/drafts/html/master/editing.html#the-hidden-attribute
|
||||
element.setAttribute( 'hidden', '' );
|
||||
|
||||
if( i < index ) {
|
||||
// Any element previous to index is given the 'past' class
|
||||
element.classList.add( reverse ? 'future' : 'past' );
|
||||
@@ -1402,6 +1513,7 @@ var Reveal = (function(){
|
||||
|
||||
// Mark the current slide as present
|
||||
slides[index].classList.add( 'present' );
|
||||
slides[index].removeAttribute( 'hidden' );
|
||||
|
||||
// If this slide has a state associated with it, add it
|
||||
// onto the current state of the deck
|
||||
@@ -1533,6 +1645,37 @@ var Reveal = (function(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the background elements to reflect the current
|
||||
* slide.
|
||||
*/
|
||||
function updateBackground() {
|
||||
|
||||
// Update the classes of all backgrounds to match the
|
||||
// states of their slides (past/present/future)
|
||||
toArray( dom.background.childNodes ).forEach( function( backgroundh, h ) {
|
||||
|
||||
// Reverse past/future classes when in RTL mode
|
||||
var horizontalPast = config.rtl ? 'future' : 'past',
|
||||
horizontalFuture = config.rtl ? 'past' : 'future';
|
||||
|
||||
backgroundh.className = 'slide-background ' + ( h < indexh ? horizontalPast : h > indexh ? horizontalFuture : 'present' );
|
||||
|
||||
toArray( backgroundh.childNodes ).forEach( function( backgroundv, v ) {
|
||||
|
||||
backgroundv.className = 'slide-background ' + ( v < indexv ? 'past' : v > indexv ? 'future' : 'present' );
|
||||
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
// Allow the first background to apply without transition
|
||||
setTimeout( function() {
|
||||
dom.background.classList.remove( 'no-transition' );
|
||||
}, 1 );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine what available routes there are for navigation.
|
||||
*
|
||||
|
||||
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* reveal.js 2.5.0 (2013-05-20, 00:27)
|
||||
* reveal.js 2.5.0 (2013-06-10, 16:46)
|
||||
* http://lab.hakim.se/reveal-js
|
||||
* MIT licensed
|
||||
*
|
||||
* Copyright (C) 2013 Hakim El Hattab, http://hakim.se
|
||||
*/
|
||||
var Reveal=function(){"use strict";function e(e){return Yt||Ot?(window.addEventListener("load",b,!1),c(kt,e),n(),r(),void 0):(document.body.setAttribute("class","no-transforms"),void 0)}function t(){if(Ct.theme=document.querySelector("#theme"),Ct.wrapper=document.querySelector(".reveal"),Ct.slides=document.querySelector(".reveal .slides"),!Ct.wrapper.querySelector(".progress")){var e=document.createElement("div");e.classList.add("progress"),e.innerHTML="<span></span>",Ct.wrapper.appendChild(e)}if(!Ct.wrapper.querySelector(".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>',Ct.wrapper.appendChild(t)}if(!Ct.wrapper.querySelector(".state-background")){var n=document.createElement("div");n.classList.add("state-background"),Ct.wrapper.appendChild(n)}if(!Ct.wrapper.querySelector(".pause-overlay")){var r=document.createElement("div");r.classList.add("pause-overlay"),Ct.wrapper.appendChild(r)}Ct.progress=document.querySelector(".reveal .progress"),Ct.progressbar=document.querySelector(".reveal .progress span"),kt.controls&&(Ct.controls=document.querySelector(".reveal .controls"),Ct.controlsLeft=l(document.querySelectorAll(".navigate-left")),Ct.controlsRight=l(document.querySelectorAll(".navigate-right")),Ct.controlsUp=l(document.querySelectorAll(".navigate-up")),Ct.controlsDown=l(document.querySelectorAll(".navigate-down")),Ct.controlsPrev=l(document.querySelectorAll(".navigate-prev")),Ct.controlsNext=l(document.querySelectorAll(".navigate-next")))}function n(){/iphone|ipod|android/gi.test(navigator.userAgent)&&!/crios/gi.test(navigator.userAgent)&&(window.addEventListener("load",f,!1),window.addEventListener("orientationchange",f,!1))}function r(){function e(){n.length&&head.js.apply(null,n),o()}for(var t=[],n=[],r=0,a=kt.dependencies.length;a>r;r++){var i=kt.dependencies[r];(!i.condition||i.condition())&&(i.async?n.push(i.src):t.push(i.src),"function"==typeof i.callback&&head.ready(i.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],i.callback))}t.length?(head.ready(e),head.js.apply(null,t)):e()}function o(){t(),a(),F(),setTimeout(function(){v("ready",{indexh:Mt,indexv:Pt,currentSlide:Et})},1)}function a(e){if(Ct.wrapper.classList.remove(kt.transition),"object"==typeof e&&c(kt,e),Ot===!1&&(kt.transition="linear"),Ct.wrapper.classList.add(kt.transition),Ct.wrapper.setAttribute("data-transition-speed",kt.transitionSpeed),Ct.controls&&(Ct.controls.style.display=kt.controls&&Ct.controls?"block":"none"),Ct.progress&&(Ct.progress.style.display=kt.progress&&Ct.progress?"block":"none"),kt.rtl?Ct.wrapper.classList.add("rtl"):Ct.wrapper.classList.remove("rtl"),kt.center?Ct.wrapper.classList.add("center"):Ct.wrapper.classList.remove("center"),kt.mouseWheel?(document.addEventListener("DOMMouseScroll",lt,!1),document.addEventListener("mousewheel",lt,!1)):(document.removeEventListener("DOMMouseScroll",lt,!1),document.removeEventListener("mousewheel",lt,!1)),kt.rollingLinks?p():m(),kt.previewLinks?h():(g(),h("[data-preview-link]")),kt.theme&&Ct.theme){var t=Ct.theme.getAttribute("href"),n=/[^\/]*?(?=\.css)/,r=t.match(n)[0];kt.theme!==r&&(t=t.replace(n,kt.theme),Ct.theme.setAttribute("href",t))}Y()}function i(){Ut=!0,window.addEventListener("hashchange",gt,!1),window.addEventListener("resize",yt,!1),kt.touch&&(Ct.wrapper.addEventListener("touchstart",rt,!1),Ct.wrapper.addEventListener("touchmove",ot,!1),Ct.wrapper.addEventListener("touchend",at,!1),window.navigator.msPointerEnabled&&(Ct.wrapper.addEventListener("MSPointerDown",it,!1),Ct.wrapper.addEventListener("MSPointerMove",st,!1),Ct.wrapper.addEventListener("MSPointerUp",ct,!1))),kt.keyboard&&document.addEventListener("keydown",nt,!1),kt.progress&&Ct.progress&&Ct.progress.addEventListener("click",dt,!1),kt.controls&&Ct.controls&&["touchstart","click"].forEach(function(e){Ct.controlsLeft.forEach(function(t){t.addEventListener(e,ut,!1)}),Ct.controlsRight.forEach(function(t){t.addEventListener(e,ft,!1)}),Ct.controlsUp.forEach(function(t){t.addEventListener(e,vt,!1)}),Ct.controlsDown.forEach(function(t){t.addEventListener(e,pt,!1)}),Ct.controlsPrev.forEach(function(t){t.addEventListener(e,mt,!1)}),Ct.controlsNext.forEach(function(t){t.addEventListener(e,ht,!1)})})}function s(){Ut=!1,document.removeEventListener("keydown",nt,!1),window.removeEventListener("hashchange",gt,!1),window.removeEventListener("resize",yt,!1),Ct.wrapper.removeEventListener("touchstart",rt,!1),Ct.wrapper.removeEventListener("touchmove",ot,!1),Ct.wrapper.removeEventListener("touchend",at,!1),window.navigator.msPointerEnabled&&(Ct.wrapper.removeEventListener("MSPointerDown",it,!1),Ct.wrapper.removeEventListener("MSPointerMove",st,!1),Ct.wrapper.removeEventListener("MSPointerUp",ct,!1)),kt.progress&&Ct.progress&&Ct.progress.removeEventListener("click",dt,!1),kt.controls&&Ct.controls&&["touchstart","click"].forEach(function(e){Ct.controlsLeftLine truncated
|
||||
var Reveal=function(){"use strict";function e(e){return Ht||zt?(window.addEventListener("load",S,!1),l(Pt,e),r(),o(),void 0):(document.body.setAttribute("class","no-transforms"),void 0)}function t(){if(Yt.theme=document.querySelector("#theme"),Yt.wrapper=document.querySelector(".reveal"),Yt.slides=document.querySelector(".reveal .slides"),document.querySelector(".reveal .backgrounds")||(Yt.background=document.createElement("div"),Yt.background.classList.add("backgrounds"),Yt.wrapper.appendChild(Yt.background)),!Yt.wrapper.querySelector(".progress")){var e=document.createElement("div");e.classList.add("progress"),e.innerHTML="<span></span>",Yt.wrapper.appendChild(e)}if(!Yt.wrapper.querySelector(".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>',Yt.wrapper.appendChild(t)}if(!Yt.wrapper.querySelector(".state-background")){var n=document.createElement("div");n.classList.add("state-background"),Yt.wrapper.appendChild(n)}if(!Yt.wrapper.querySelector(".pause-overlay")){var r=document.createElement("div");r.classList.add("pause-overlay"),Yt.wrapper.appendChild(r)}Yt.progress=document.querySelector(".reveal .progress"),Yt.progressbar=document.querySelector(".reveal .progress span"),Pt.controls&&(Yt.controls=document.querySelector(".reveal .controls"),Yt.controlsLeft=d(document.querySelectorAll(".navigate-left")),Yt.controlsRight=d(document.querySelectorAll(".navigate-right")),Yt.controlsUp=d(document.querySelectorAll(".navigate-up")),Yt.controlsDown=d(document.querySelectorAll(".navigate-down")),Yt.controlsPrev=d(document.querySelectorAll(".navigate-prev")),Yt.controlsNext=d(document.querySelectorAll(".navigate-next")))}function n(){function e(e,t){var n={background:e.getAttribute("data-background"),backgroundSize:e.getAttribute("data-background-size"),backgroundColor:e.getAttribute("data-background-color"),backgroundRepeat:e.getAttribute("data-background-repeat"),backgroundPosition:e.getAttribute("data-background-position")},r=document.createElement("div");return r.className="slide-background",n.background&&(/\.(png|jpg|jpeg|gif|bmp)$/gi.test(n.background)?r.style.backgroundImage="url("+n.background+")":r.style.background=n.background),n.backgroundSize&&(r.style.backgroundSize=n.backgroundSize),n.backgroundColor&&(r.style.backgroundColor=n.backgroundColor),n.backgroundRepeat&&(r.style.backgroundRepeat=n.backgroundRepeat),n.backgroundPosition&&(r.style.backgroundPosition=n.backgroundPosition),t.appendChild(r),r}v()&&document.body.classList.add("print-pdf"),Yt.background.innerHTML="",Yt.background.classList.add("no-transition"),d(document.querySelectorAll(xt)).forEach(function(t){var n;n=v()?e(t,t):e(t,Yt.background),d(t.querySelectorAll("section")).forEach(function(t){v()?e(t,t):e(t,n)})})}function r(){/iphone|ipod|android/gi.test(navigator.userAgent)&&!/crios/gi.test(navigator.userAgent)&&(window.addEventListener("load",p,!1),window.addEventListener("orientationchange",p,!1))}function o(){function e(){n.length&&head.js.apply(null,n),a()}for(var t=[],n=[],r=0,o=Pt.dependencies.length;o>r;r++){var i=Pt.dependencies[r];(!i.condition||i.condition())&&(i.async?n.push(i.src):t.push(i.src),"function"==typeof i.callback&&head.ready(i.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],i.callback))}t.length?(head.ready(e),head.js.apply(null,t)):e()}function a(){t(),i(),K(),setTimeout(function(){m("ready",{indexh:Ct,indexv:Dt,currentSlide:At})},1)}function i(e){if(Yt.wrapper.classList.remove(Pt.transition),"object"==typeof e&&l(Pt,e),zt===!1&&(Pt.transition="linear"),Yt.wrapper.classList.add(Pt.transition),Yt.wrapper.setAttribute("data-transition-speed",Pt.transitionSpeed),Yt.wrapper.setAttribute("data-background-transition",Pt.backgroundTransition),Yt.controls&&(Yt.controls.style.display=Pt.controls&&Yt.controls?"block":"none"),Yt.progress&&(Yt.progress.style.display=Pt.progress&&Yt.progress?"block":"none"),Pt.rtl?Yt.wrapper.classList.add("rtl"):Yt.wrapper.classList.remove("rtl"),Pt.center?Yt.wrapper.classList.add("center"):Yt.wrapper.classList.remove("center"),Pt.mouseWheel?(document.addEventListener("DOMMouseScroll",ft,!1),document.addEventListener("mousewheel",ft,!1)):(document.removeEventListener("DOMMouseScroll",ft,!1),document.removeEventListener("mousewheel",ft,!1)),Pt.rollingLinks?h():g(),Pt.previewLinks?y():(b(),y("[data-preview-link]")),Pt.theme&&Yt.theme){var t=Yt.theme.getAttribute("href"),n=/[^\/]*?(?=\.css)/,r=t.match(n)[0];Pt.theme!==r&&(t=t.replace(n,Pt.theme),Yt.theme.setAttribute("href",t))}z()}function s(){Ft=!0,window.addEventListener("hashchange",wt,!1),window.addEventListener("resize",Lt,!1),Pt.touch&&(Yt.wrapper.addEventListener("touchstart",it,!1),Yt.wrapper.addEventListener("touchmove",st,!1),Yt.wrapper.addEventListener("touchend",ct,!1),window.navigator.msPointerEnabled&&(Yt.wrapper.addEventListener("MSPointerDown",lt,!1),Yt.wrappeLine truncated
|
||||
Reference in new issue
Block a user