浏览代码

fix prevents loading remote plugin several times when notes are enabled

Alejandro El Informático 12 年之前
父节点
当前提交
87894e5503
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      plugin/remotes/remotes.js

+ 9 - 1
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(); })