master.js 901 B

1234567891011121314151617181920212223242526272829303132
  1. (function() {
  2. // don't emit events from inside the previews themselves
  3. if ( window.location.search.match( /receiver/gi ) ) { return; }
  4. var multiplex = window.globals.multiplex;
  5. var socket = io.connect(multiplex.url);
  6. Reveal.addEventListener( 'slidechanged', function( event ) {
  7. var nextindexh;
  8. var nextindexv;
  9. var slideElement = event.currentSlide;
  10. if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') {
  11. nextindexh = event.indexh;
  12. nextindexv = event.indexv + 1;
  13. } else {
  14. nextindexh = event.indexh + 1;
  15. nextindexv = 0;
  16. }
  17. var slideData = {
  18. indexh : event.indexh,
  19. indexv : event.indexv,
  20. nextindexh : nextindexh,
  21. nextindexv : nextindexv,
  22. secret: multiplex.secret,
  23. socketId : multiplex.id
  24. };
  25. if( typeof event.origin === 'undefined' && event.origin !== 'remote' ) socket.emit('slidechanged', slideData);
  26. } );
  27. }());