optimize use of getSlideBackground by avoiding index lookup
This commit is contained in:
parent
a0c013606e
commit
a0a9aa7821
11
js/reveal.js
11
js/reveal.js
@ -3200,8 +3200,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// Show the corresponding background element
|
// Show the corresponding background element
|
||||||
var indices = getIndices( slide );
|
var background = getSlideBackground( slide );
|
||||||
var background = getSlideBackground( indices.h, indices.v );
|
|
||||||
if( background ) {
|
if( background ) {
|
||||||
background.style.display = 'block';
|
background.style.display = 'block';
|
||||||
|
|
||||||
@ -3288,8 +3287,7 @@
|
|||||||
slide.style.display = 'none';
|
slide.style.display = 'none';
|
||||||
|
|
||||||
// Hide the corresponding background element
|
// Hide the corresponding background element
|
||||||
var indices = getIndices( slide );
|
var background = getSlideBackground( slide );
|
||||||
var background = getSlideBackground( indices.h, indices.v );
|
|
||||||
if( background ) {
|
if( background ) {
|
||||||
background.style.display = 'none';
|
background.style.display = 'none';
|
||||||
}
|
}
|
||||||
@ -3858,13 +3856,14 @@
|
|||||||
* defined, have a background element so as long as the
|
* defined, have a background element so as long as the
|
||||||
* index is valid an element will be returned.
|
* 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
|
* @param {number} y Vertical background index
|
||||||
* @return {(HTMLElement[]|*)}
|
* @return {(HTMLElement[]|*)}
|
||||||
*/
|
*/
|
||||||
function getSlideBackground( x, y ) {
|
function getSlideBackground( x, y ) {
|
||||||
|
|
||||||
var slide = getSlide( x, y );
|
var slide = typeof x === 'number' ? getSlide( x, y ) : x;
|
||||||
if( slide ) {
|
if( slide ) {
|
||||||
return slide.slideBackgroundElement;
|
return slide.slideBackgroundElement;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user