aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2017-11-23 15:45:15 +0100
committerHakim El Hattab <hakim.elhattab@gmail.com>2017-11-23 15:45:15 +0100
commita0a9aa78219ad54c1a8be2c478b91bc4ccfa36c1 (patch)
tree7314594be7700ec140cc6f6fc545a4e0093378f7 /js
parenta0c013606e130baad976195730dcd7e7cd9e2855 (diff)
downloadperl-software-in-gnu-guix-a0a9aa78219ad54c1a8be2c478b91bc4ccfa36c1.tar
perl-software-in-gnu-guix-a0a9aa78219ad54c1a8be2c478b91bc4ccfa36c1.tar.gz
optimize use of getSlideBackground by avoiding index lookup
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/js/reveal.js b/js/reveal.js
index f125c55..9a43903 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -3200,8 +3200,7 @@
// Show the corresponding background element
- var indices = getIndices( slide );
- var background = getSlideBackground( indices.h, indices.v );
+ var background = getSlideBackground( slide );
if( background ) {
background.style.display = 'block';
@@ -3288,8 +3287,7 @@
slide.style.display = 'none';
// Hide the corresponding background element
- var indices = getIndices( slide );
- var background = getSlideBackground( indices.h, indices.v );
+ var background = getSlideBackground( slide );
if( background ) {
background.style.display = 'none';
}
@@ -3858,13 +3856,14 @@
* defined, have a background element so as long as the
* index is valid an element will be returned.
*
- * @param {number} x Horizontal background index
+ * @param {mixed} x Horizontal background index OR a slide
+ * HTML element
* @param {number} y Vertical background index
* @return {(HTMLElement[]|*)}
*/
function getSlideBackground( x, y ) {
- var slide = getSlide( x, y );
+ var slide = typeof x === 'number' ? getSlide( x, y ) : x;
if( slide ) {
return slide.slideBackgroundElement;
}