This commit is contained in:
Amauri CHAMPEAUX 2020-04-26 20:59:27 +02:00
commit ca76bca789
1 changed files with 9 additions and 6 deletions

View File

@ -252,12 +252,12 @@ var tarteaucitron = {
document.getElementsByTagName('head')[0].appendChild(linkElement); document.getElementsByTagName('head')[0].appendChild(linkElement);
} }
// Step 2: load language and services // Step 2: load language and services
tarteaucitron.addScript(pathToLang, '', function () { tarteaucitron.addInternalScript(pathToLang, '', function () {
if(tarteaucitronCustomText !== ''){ if(tarteaucitronCustomText !== ''){
tarteaucitron.lang = tarteaucitron.AddOrUpdate(tarteaucitron.lang, tarteaucitronCustomText); tarteaucitron.lang = tarteaucitron.AddOrUpdate(tarteaucitron.lang, tarteaucitronCustomText);
} }
tarteaucitron.addScript(pathToServices, '', function () { tarteaucitron.addInternalScript(pathToServices, '', function () {
// css for new middle bar // css for new middle bar
@ -433,7 +433,7 @@ var tarteaucitron = {
html += '</div>'; html += '</div>';
} }
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) { 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 // create a wrapper container at the same level than tarteaucitron so we can add an aria-hidden when tarteaucitron is opened
@ -1422,7 +1422,7 @@ var tarteaucitron = {
return 'en_US'; return 'en_US';
} }
}, },
"addScript": function (url, id, callback, execute, attrName, attrVal) { "addScript": function (url, id, callback, execute, attrName, attrVal, internal) {
"use strict"; "use strict";
var script, var script,
done = false; done = false;
@ -1456,11 +1456,14 @@ var tarteaucitron = {
} }
} }
if ( !tarteaucitron.parameters.useExternalJs ) { if ( !tarteaucitron.parameters.useExternalJs || !internal ) {
document.getElementsByTagName('head')[0].appendChild(script); document.getElementsByTagName('head')[0].appendChild(script);
} }
} }
}, },
"addInternalScript": function (url, id, callback, execute, attrName, attrVal) {
tarteaucitron.addScript(url, id, callback, execute, attrName, attrVal, true);
},
"makeAsync": { "makeAsync": {
"antiGhost": 0, "antiGhost": 0,
"buffer": '', "buffer": '',
@ -1490,7 +1493,7 @@ var tarteaucitron = {
return; return;
} }
tarteaucitron.makeAsync.antiGhost += 1; tarteaucitron.makeAsync.antiGhost += 1;
tarteaucitron.addScript(url, '', function () { tarteaucitron.addInternalScript(url, '', function () {
if (document.getElementById(id) !== null) { if (document.getElementById(id) !== null) {
document.getElementById(id).innerHTML += "<span style='display:none'>&nbsp;</span>" + tarteaucitron.makeAsync.buffer; document.getElementById(id).innerHTML += "<span style='display:none'>&nbsp;</span>" + tarteaucitron.makeAsync.buffer;
tarteaucitron.makeAsync.buffer = ''; tarteaucitron.makeAsync.buffer = '';