Delete functionality to control presentation from notes window
authorMichael Kühnel <mail@michael-kuehnel.de>
Wed, 24 Oct 2012 13:06:32 +0000 (15:06 +0200)
committerMichael Kühnel <mail@michael-kuehnel.de>
Wed, 24 Oct 2012 13:06:32 +0000 (15:06 +0200)
Its was impossible (at least for me) to keep the windows in sync without bloating the code too much.

plugin/notes/notes.html
plugin/notes/notes.js

index 775ccb4b4cf201e2d80d51f86761436f1afc54e0..90083cf4c0678374b93e116dbe69a28580ce4dd3 100644 (file)
                                                        }
                                                }
 
-                                               // Kill the slide listeners while responding to the event
-                                               removeSlideListeners();
-
                                                // Update the note slides
                                                currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv );
                                                nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
                                                        currentSlide.contentWindow.Reveal.prevFragment();
                                                }
 
-                                               // Resume listening on the next cycle
-                                               setTimeout( addSlideListeners, 1 );
-
                                        }, false );
 
-                                       function addSlideListeners() {
-                                               currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', onNotesSlideChange, false );
-                                               nextSlide.contentWindow.Reveal.addEventListener( 'slidechanged', onNotesSlideChange, false );
-                                       }
-
-                                       function removeSlideListeners() {
-                                               currentSlide.contentWindow.Reveal.removeEventListener( 'slidechanged', onNotesSlideChange, false );
-                                               nextSlide.contentWindow.Reveal.removeEventListener( 'slidechanged', onNotesSlideChange, false );
-                                       }
-
-                                       function onNotesSlideChange( event ) {
-                                               window.opener.postMessage( JSON.stringify({
-                                                       indexh : event.indexh,
-                                                       indexv : event.indexv
-                                               }), '*' );
-                                       }
-
-                                       addSlideListeners();
-
                                })( window );
 
                        }, false );
index 057344023f2a49861fe40bfc80a62bfdefaf6438..00d386d9df74d8803850bf487e677bfde9d475cc 100644 (file)
@@ -69,16 +69,6 @@ var RevealNotes = (function() {
                        notesPopup.postMessage( JSON.stringify( slideData ), '*' );
                }
 
-               // The main presentation is kept in sync when navigating the
-               // note slides so that the popup may be used as a remote
-               window.addEventListener( 'message', function( event ) {
-                       var data = JSON.parse( event.data );
-
-                       if( data && typeof data.indexh === 'number' && typeof data.indexv === 'number' ) {
-                               Reveal.slide( data.indexh, data.indexv );
-                       }
-               } );
-
                // Navigate to the current slide when the notes are loaded
                notesPopup.addEventListener( 'load', function( event ) {
                        post('slidechanged');