From ce05138f9a9065526ee584d2f59e48952910522f Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 22 Apr 2014 14:06:58 +0200 Subject: dont toggle paused/overview modes needlessly when setting state --- js/reveal.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'js/reveal.js') diff --git a/js/reveal.js b/js/reveal.js index cba8121..e133887 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -968,8 +968,6 @@ var Reveal = (function(){ */ function dispatchEvent( type, args ) { - console.log('event', type); - var event = document.createEvent( 'HTMLEvents', 1, 2 ); event.initEvent( type, true, true ); extend( event, args ); @@ -2498,8 +2496,17 @@ var Reveal = (function(){ if( typeof state === 'object' ) { slide( deserialize( state.indexh ), deserialize( state.indexv ), deserialize( state.indexf ) ); - togglePause( deserialize( state.paused ) ); - toggleOverview( deserialize( state.overview ) ); + + var pausedFlag = deserialize( state.paused ), + overviewFlag = deserialize( state.overview ); + + if( typeof pausedFlag === 'boolean' && pausedFlag !== isPaused() ) { + togglePause( pausedFlag ); + } + + if( typeof overviewFlag === 'boolean' && overviewFlag !== isOverview() ) { + toggleOverview( overviewFlag ); + } } } -- cgit v1.2.3