From 87894e5503a03c600cf9054e228b1d142d48e821 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20El=20Inform=C3=A1tico?=
 <aeinformatico@gmail.com>
Date: Mon, 8 Apr 2013 16:18:34 +0200
Subject: [PATCH] fix prevents loading remote plugin several times when notes
 are enabled

---
 plugin/remotes/remotes.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/plugin/remotes/remotes.js b/plugin/remotes/remotes.js
index a1f10b8..febdf87 100644
--- a/plugin/remotes/remotes.js
+++ b/plugin/remotes/remotes.js
@@ -13,7 +13,15 @@
         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(); })
-- 
GitLab