remotes.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Touch-based remote controller for your presentation courtesy
  3. * of the folks at http://remotes.io
  4. */
  5. (function(window){
  6. /**
  7. * Detects if we are dealing with a touch enabled device (with some false positives)
  8. * Borrowed from modernizr: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touch.js
  9. */
  10. var hasTouch = (function(){
  11. return ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
  12. })();
  13. /**
  14. * Detects if notes are enable and the current page is opened inside an /iframe
  15. * this prevents loading Remotes.io several times
  16. */
  17. var isNotesAndIframe = (function(){
  18. return window.RevealNotes && !(self == top);
  19. })();
  20. if(!hasTouch && !isNotesAndIframe){
  21. head.ready( 'remotes.ne.min.js', function() {
  22. new Remotes("preview")
  23. .on("swipe-left", function(e){ Reveal.right(); })
  24. .on("swipe-right", function(e){ Reveal.left(); })
  25. .on("swipe-up", function(e){ Reveal.down(); })
  26. .on("swipe-down", function(e){ Reveal.up(); })
  27. .on("tap", function(e){ Reveal.next(); })
  28. .on("zoom-out", function(e){ Reveal.toggleOverview(true); })
  29. .on("zoom-in", function(e){ Reveal.toggleOverview(false); })
  30. ;
  31. } );
  32. head.js('https://hakim-static.s3.amazonaws.com/reveal-js/remotes.ne.min.js');
  33. }
  34. })(window);