fix prevents loading remote plugin several times when notes are enabled
authorAlejandro El Informático <aeinformatico@gmail.com>
Mon, 8 Apr 2013 14:18:34 +0000 (16:18 +0200)
committerAlejandro El Informático <aeinformatico@gmail.com>
Mon, 8 Apr 2013 14:18:34 +0000 (16:18 +0200)
plugin/remotes/remotes.js

index a1f10b8bb44ee78a00f4c84d750495141507c842..febdf87ef3728568a0c9dcdd4d89c03dde693c85 100644 (file)
         return ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
     })();
 
-    if(!hasTouch){
+    /**
+     * Detects if notes are enable and the current page is opened inside an /iframe
+     * this prevents loading Remotes.io several times
+     */
+    var remotesAndIsNotes = (function(){
+      return !(window.RevealNotes && self == top);
+    })();
+
+    if(!hasTouch && !remotesAndIsNotes){
         head.ready( 'remotes.ne.min.js', function() {
             new Remotes("preview")
                 .on("swipe-left", function(e){ Reveal.right(); })