aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-04-27 14:46:49 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-04-27 14:47:02 +0200
commiteea437f4be92bafbe96d5276233d4fdff7b5f814 (patch)
tree95c3d337dd640b160a252c1dc044e9ab0a774078 /js
parent1623b3782efe7b57846ad7fb66fc50d1c8f041ea (diff)
downloadperl-software-in-gnu-guix-eea437f4be92bafbe96d5276233d4fdff7b5f814.tar
perl-software-in-gnu-guix-eea437f4be92bafbe96d5276233d4fdff7b5f814.tar.gz
new api method: getBackgroundSlide
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js48
1 files changed, 37 insertions, 11 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 5dc6856..55642e2 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -2286,7 +2286,7 @@ var Reveal = (function(){
element.removeAttribute( 'data-src' );
} );
- // Media elements with multiple <source>s
+ // Media elements with <source> children
toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( media ) {
var sources = 0;
@@ -2634,6 +2634,38 @@ var Reveal = (function(){
}
+ function getSlide( x, y ) {
+
+ var horizontalSlide = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR )[ x ];
+ var verticalSlides = horizontalSlide && horizontalSlide.querySelectorAll( 'section' );
+
+ if( typeof y === 'number' ) {
+ return verticalSlides ? verticalSlides[ y ] : undefined;
+ }
+
+ return horizontalSlide;
+
+ }
+
+ /**
+ * Returns the background element for the given slide.
+ * All slides, even the ones with no background properties
+ * defined, have a background element so this never returns
+ * null.
+ */
+ function getSlideBackground( x, y ) {
+
+ var horizontalBackground = document.querySelectorAll( '.backgrounds>.slide-background' )[ x ];
+ var verticalBackgrounds = horizontalBackground && horizontalBackground.querySelectorAll( '.slide-background' );
+
+ if( typeof y === 'number' ) {
+ return verticalBackgrounds ? verticalBackgrounds[ y ] : undefined;
+ }
+
+ return horizontalBackground;
+
+ }
+
/**
* Retrieves the current state of the presentation as
* an object. This state can then be restored at any
@@ -3720,17 +3752,11 @@ var Reveal = (function(){
getTotalSlides: getTotalSlides,
- // Returns the slide at the specified index, y is optional
- getSlide: function( x, y ) {
- var horizontalSlide = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR )[ x ];
- var verticalSlides = horizontalSlide && horizontalSlide.querySelectorAll( 'section' );
-
- if( typeof y !== 'undefined' ) {
- return verticalSlides ? verticalSlides[ y ] : undefined;
- }
+ // Returns the slide element at the specified index
+ getSlide: getSlide,
- return horizontalSlide;
- },
+ // Returns the slide background element at the specified index
+ getSlideBackground: getSlideBackground,
// Returns the previous slide element, may be null
getPreviousSlide: function() {