浏览代码

Prevent looping

Amauri CHAMPEAUX 10 年之前
父节点
当前提交
10ff24c661
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      tarteaucitron.js

+ 5 - 0
tarteaucitron.js

@@ -584,6 +584,7 @@ var tarteaucitron = {
         document.getElementsByTagName('head')[0].appendChild(script);
         document.getElementsByTagName('head')[0].appendChild(script);
     },
     },
     "makeAsync": {
     "makeAsync": {
+        "antiGhost": 0,
         "buffer": '',
         "buffer": '',
         "init": function (url, id) {
         "init": function (url, id) {
             "use strict";
             "use strict";
@@ -606,6 +607,10 @@ var tarteaucitron = {
         },
         },
         "getAndParse": function (url, id) {
         "getAndParse": function (url, id) {
             "use strict";
             "use strict";
+            if (tarteaucitron.makeAsync.antiGhost > 10) {
+                return;
+            }
+            tarteaucitron.makeAsync.antiGhost += 1;
             tarteaucitron.addScript(url, '', function () {
             tarteaucitron.addScript(url, '', function () {
                 document.getElementById(id).innerHTML += tarteaucitron.makeAsync.buffer;
                 document.getElementById(id).innerHTML += tarteaucitron.makeAsync.buffer;
                 tarteaucitron.makeAsync.buffer = '';
                 tarteaucitron.makeAsync.buffer = '';