Prevent loading advertising.js if the adblock feature is disabled

This commit is contained in:
Amauri CHAMPEAUX 2015-03-07 03:04:23 +01:00
parent 9e16b59381
commit 8ba9ba7633
1 changed files with 11 additions and 4 deletions

View File

@ -95,7 +95,7 @@ var tarteaucitron = {
pathToServices = cdn + 'tarteaucitron.services.js?v=' + tarteaucitron.version, pathToServices = cdn + 'tarteaucitron.services.js?v=' + tarteaucitron.version,
linkElement = document.createElement('link'), linkElement = document.createElement('link'),
defaults = { defaults = {
"adblocker": true, "adblocker": false,
"hashtag": '#tarteaucitron', "hashtag": '#tarteaucitron',
"highPrivacy": false, "highPrivacy": false,
"orientation": "top", "orientation": "top",
@ -275,7 +275,7 @@ var tarteaucitron = {
tarteaucitron.cookie.number(); tarteaucitron.cookie.number();
setInterval(tarteaucitron.cookie.number, 60000); setInterval(tarteaucitron.cookie.number, 60000);
} }
}); }, defaults.adblocker);
if (defaults.adblocker === true) { if (defaults.adblocker === true) {
setTimeout(function () { setTimeout(function () {
@ -790,7 +790,7 @@ var tarteaucitron = {
return 'en_US'; return 'en_US';
} }
}, },
"addScript": function (url, id, callback) { "addScript": function (url, id, callback, execute) {
"use strict"; "use strict";
var script = document.createElement('script'), var script = document.createElement('script'),
done = false; done = false;
@ -809,7 +809,14 @@ var tarteaucitron = {
} }
}; };
} }
if (execute === false) {
if (typeof callback === 'function') {
callback();
}
} else {
document.getElementsByTagName('head')[0].appendChild(script); document.getElementsByTagName('head')[0].appendChild(script);
}
}, },
"makeAsync": { "makeAsync": {
"antiGhost": 0, "antiGhost": 0,