diff --git a/tarteaucitron.js b/tarteaucitron.js index 77c4caf..9e9b8bc 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -255,12 +255,12 @@ var tarteaucitron = { document.getElementsByTagName('head')[0].appendChild(linkElement); } // Step 2: load language and services - tarteaucitron.addScript(pathToLang, '', function () { + tarteaucitron.addInternalScript(pathToLang, '', function () { if(tarteaucitronCustomText !== ''){ tarteaucitron.lang = tarteaucitron.AddOrUpdate(tarteaucitron.lang, tarteaucitronCustomText); } - tarteaucitron.addScript(pathToServices, '', function () { + tarteaucitron.addInternalScript(pathToServices, '', function () { // css for new middle bar @@ -427,7 +427,7 @@ var tarteaucitron = { html += ''; } - tarteaucitron.addScript(tarteaucitron.cdn + 'advertising.js?v=' + tarteaucitron.version, '', function () { + tarteaucitron.addInternalScript(tarteaucitron.cdn + 'advertising.js?v=' + tarteaucitron.version, '', function () { if (tarteaucitronNoAdBlocker === true || tarteaucitron.parameters.adblocker === false) { // create a wrapper container at the same level than tarteaucitron so we can add an aria-hidden when tarteaucitron is opened @@ -497,7 +497,7 @@ var tarteaucitron = { tarteaucitron.cookie.number(); setInterval(tarteaucitron.cookie.number, 60000); } - }, tarteaucitron.parameters.adblocker, null, null, true); + }, tarteaucitron.parameters.adblocker); if (tarteaucitron.parameters.adblocker === true) { setTimeout(function () { @@ -519,8 +519,8 @@ var tarteaucitron = { } }, 1500); } - }, null, null, null, true); - }, null, null, null, true); + }); + }); if(tarteaucitron.events.load) { tarteaucitron.events.load(); @@ -1435,6 +1435,9 @@ var tarteaucitron = { } } }, + "addInternalScript": function (url, id, callback, execute, attrName, attrVal) { + tarteaucitron.addScript(url, id, callback, execute, attrName, attrVal, true); + }, "makeAsync": { "antiGhost": 0, "buffer": '', @@ -1464,13 +1467,13 @@ var tarteaucitron = { return; } tarteaucitron.makeAsync.antiGhost += 1; - tarteaucitron.addScript(url, '', function () { + tarteaucitron.addInternalScript(url, '', function () { if (document.getElementById(id) !== null) { document.getElementById(id).innerHTML += " " + tarteaucitron.makeAsync.buffer; tarteaucitron.makeAsync.buffer = ''; tarteaucitron.makeAsync.execJS(id); } - }, null, null, null, true); + }); }, "execJS": function (id) { /* not strict because third party scripts may have errors */