Ver Fonte

Revert #412 Fix #421

Amauri CHAMPEAUX há 5 anos atrás
pai
commit
88af745341
1 ficheiros alterados com 1 adições e 16 exclusões
  1. 1 16
      tarteaucitron.js

+ 1 - 16
tarteaucitron.js

@@ -1,22 +1,7 @@
 /*jslint browser: true, evil: true */
 
 var scripts = document.getElementsByTagName('script'),
-    thisScript = null;
-for (var i = 0, il = scripts.length; i < il; ++i) {
-    if ( scripts[i].getAttribute('src').indexOf('tarteaucitron') >= 0) {
-        // should always find this script
-        thisScript = scripts[i];
-        break;
-    }
-}
-
-if (thisScript === null) {
-    // should never happen
-    throw new Error("Error: tarteaucitron.js script not found");
-}
-
-// define correct path for files inclusion
-var path = thisScript.src.split('?')[0],
+    path = scripts[scripts.length - 1].src.split('?')[0],
     tarteaucitronForceCDN = (tarteaucitronForceCDN === undefined) ? '' : tarteaucitronForceCDN,
     cdn = (tarteaucitronForceCDN === '') ? path.split('/').slice(0, -1).join('/') + '/' : tarteaucitronForceCDN,
     alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch,