remotes.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 remotesAndIsNotes = (function(){
  18. return !(window.RevealNotes && self == top);
  19. })();
  20. if(!hasTouch && !remotesAndIsNotes){
  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){
  28. Reveal.toggleOverview();
  29. });
  30. } );
  31. head.js('https://raw.github.com/Remotes/Remotes/master/dist/remotes.ne.min.js');
  32. }
  33. })(window);