Refactor to make addScript() calls easier to read
This commit is contained in:
parent
ab8bb3de65
commit
4eb716c351
|
|
@ -255,12 +255,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
|
||||||
|
|
@ -427,7 +427,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
|
||||||
|
|
@ -497,7 +497,7 @@ var tarteaucitron = {
|
||||||
tarteaucitron.cookie.number();
|
tarteaucitron.cookie.number();
|
||||||
setInterval(tarteaucitron.cookie.number, 60000);
|
setInterval(tarteaucitron.cookie.number, 60000);
|
||||||
}
|
}
|
||||||
}, tarteaucitron.parameters.adblocker, null, null, true);
|
}, tarteaucitron.parameters.adblocker);
|
||||||
|
|
||||||
if (tarteaucitron.parameters.adblocker === true) {
|
if (tarteaucitron.parameters.adblocker === true) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
|
@ -519,8 +519,8 @@ var tarteaucitron = {
|
||||||
}
|
}
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
}, null, null, null, true);
|
});
|
||||||
}, null, null, null, true);
|
});
|
||||||
|
|
||||||
if(tarteaucitron.events.load) {
|
if(tarteaucitron.events.load) {
|
||||||
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": {
|
"makeAsync": {
|
||||||
"antiGhost": 0,
|
"antiGhost": 0,
|
||||||
"buffer": '',
|
"buffer": '',
|
||||||
|
|
@ -1464,13 +1467,13 @@ 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'> </span>" + tarteaucitron.makeAsync.buffer;
|
document.getElementById(id).innerHTML += "<span style='display:none'> </span>" + tarteaucitron.makeAsync.buffer;
|
||||||
tarteaucitron.makeAsync.buffer = '';
|
tarteaucitron.makeAsync.buffer = '';
|
||||||
tarteaucitron.makeAsync.execJS(id);
|
tarteaucitron.makeAsync.execJS(id);
|
||||||
}
|
}
|
||||||
}, null, null, null, true);
|
});
|
||||||
},
|
},
|
||||||
"execJS": function (id) {
|
"execJS": function (id) {
|
||||||
/* not strict because third party scripts may have errors */
|
/* not strict because third party scripts may have errors */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue