|
@@ -7,10 +7,13 @@ var scripts = document.getElementsByTagName('script'),
|
|
|
alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch,
|
|
|
tarteaucitronForceLanguage = (tarteaucitronForceLanguage === undefined) ? '' : tarteaucitronForceLanguage,
|
|
|
tarteaucitronForceExpire = (tarteaucitronForceExpire === undefined) ? '' : tarteaucitronForceExpire,
|
|
|
+ tarteaucitronCustomText = (tarteaucitronCustomText === undefined) ? '' : tarteaucitronCustomText,
|
|
|
timeExipre = 31536000000,
|
|
|
tarteaucitronProLoadServices,
|
|
|
tarteaucitronNoAdBlocker = false;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
var tarteaucitron = {
|
|
|
"version": 323,
|
|
|
"cdn": cdn,
|
|
@@ -27,7 +30,7 @@ var tarteaucitron = {
|
|
|
"init": function (params) {
|
|
|
"use strict";
|
|
|
var origOpen;
|
|
|
-
|
|
|
+
|
|
|
tarteaucitron.parameters = params;
|
|
|
if (alreadyLaunch === 0) {
|
|
|
alreadyLaunch = 1;
|
|
@@ -47,13 +50,13 @@ var tarteaucitron = {
|
|
|
if (document.getElementById('tarteaucitronAlertBig') !== null && !tarteaucitron.highPrivacy) {
|
|
|
if (document.getElementById('tarteaucitronAlertBig').style.display === 'block') {
|
|
|
heightPosition = document.getElementById('tarteaucitronAlertBig').offsetHeight + 'px';
|
|
|
-
|
|
|
+
|
|
|
if (scrollPos > (screen.height * 2)) {
|
|
|
tarteaucitron.userInterface.respondAll(true);
|
|
|
} else if (scrollPos > (screen.height / 2)) {
|
|
|
document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<b>' + tarteaucitron.lang.alertBigScroll + '</b> ' + tarteaucitron.lang.alertBig;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (tarteaucitron.orientation === 'top') {
|
|
|
document.getElementById('tarteaucitronPercentage').style.top = heightPosition;
|
|
|
} else {
|
|
@@ -79,7 +82,7 @@ var tarteaucitron = {
|
|
|
tarteaucitron.userInterface.jsSizing('main');
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (document.getElementById('tarteaucitronCookiesListContainer') !== null) {
|
|
|
if (document.getElementById('tarteaucitronCookiesListContainer').style.display === 'block') {
|
|
|
tarteaucitron.userInterface.jsSizing('cookie');
|
|
@@ -102,7 +105,7 @@ var tarteaucitron = {
|
|
|
if (document.getElementById('tarteaucitronAlertBig') !== null && !tarteaucitron.highPrivacy) {
|
|
|
if (document.getElementById('tarteaucitronAlertBig').style.display === 'block') {
|
|
|
heightPosition = document.getElementById('tarteaucitronAlertBig').offsetHeight + 'px';
|
|
|
-
|
|
|
+
|
|
|
if (scrollPos > (screen.height * 2)) {
|
|
|
tarteaucitron.userInterface.respondAll(true);
|
|
|
} else if (scrollPos > (screen.height / 2)) {
|
|
@@ -133,7 +136,7 @@ var tarteaucitron = {
|
|
|
tarteaucitron.userInterface.jsSizing('main');
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (document.getElementById('tarteaucitronCookiesListContainer') !== null) {
|
|
|
if (document.getElementById('tarteaucitronCookiesListContainer').style.display === 'block') {
|
|
|
tarteaucitron.userInterface.jsSizing('cookie');
|
|
@@ -141,11 +144,11 @@ var tarteaucitron = {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (typeof XMLHttpRequest !== 'undefined') {
|
|
|
origOpen = XMLHttpRequest.prototype.open;
|
|
|
XMLHttpRequest.prototype.open = function () {
|
|
|
-
|
|
|
+
|
|
|
if (window.addEventListener) {
|
|
|
this.addEventListener("load", function () {
|
|
|
if (typeof tarteaucitronProLoadServices === 'function') {
|
|
@@ -163,7 +166,7 @@ var tarteaucitron = {
|
|
|
setTimeout(tarteaucitronProLoadServices, 1000);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
try {
|
|
|
origOpen.apply(this, arguments);
|
|
|
} catch (err) {}
|
|
@@ -181,6 +184,7 @@ var tarteaucitron = {
|
|
|
defaults = {
|
|
|
"adblocker": false,
|
|
|
"hashtag": '#tarteaucitron',
|
|
|
+ "cookieName": 'tarteaucitron',
|
|
|
"highPrivacy": false,
|
|
|
"orientation": "top",
|
|
|
"removeCredit": false,
|
|
@@ -190,12 +194,12 @@ var tarteaucitron = {
|
|
|
"AcceptAllCta" : false
|
|
|
},
|
|
|
params = tarteaucitron.parameters;
|
|
|
-
|
|
|
+
|
|
|
// Step 0: get params
|
|
|
if (params !== undefined) {
|
|
|
tarteaucitron.extend(defaults, params);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// global
|
|
|
tarteaucitron.orientation = defaults.orientation;
|
|
|
tarteaucitron.hashtag = defaults.hashtag;
|
|
@@ -210,6 +214,10 @@ var tarteaucitron = {
|
|
|
|
|
|
// Step 2: load language and services
|
|
|
tarteaucitron.addScript(pathToLang, '', function () {
|
|
|
+
|
|
|
+ if(tarteaucitronCustomText !== ''){
|
|
|
+ tarteaucitron.lang = tarteaucitron.AddOrUpdate(tarteaucitron.lang, tarteaucitronCustomText);
|
|
|
+ }
|
|
|
tarteaucitron.addScript(pathToServices, '', function () {
|
|
|
|
|
|
var body = document.body,
|
|
@@ -219,7 +227,7 @@ var tarteaucitron = {
|
|
|
orientation = 'Top',
|
|
|
cat = ['ads', 'analytic', 'api', 'comment', 'social', 'support', 'video', 'other'],
|
|
|
i;
|
|
|
-
|
|
|
+
|
|
|
cat = cat.sort(function (a, b) {
|
|
|
if (tarteaucitron.lang[a].title > tarteaucitron.lang[b].title) { return 1; }
|
|
|
if (tarteaucitron.lang[a].title < tarteaucitron.lang[b].title) { return -1; }
|
|
@@ -271,12 +279,13 @@ var tarteaucitron = {
|
|
|
html += ' </div>';
|
|
|
html += ' </div>';
|
|
|
html += '</div>';
|
|
|
-
|
|
|
+
|
|
|
if (defaults.orientation === 'bottom') {
|
|
|
orientation = 'Bottom';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (defaults.highPrivacy && !defaults.AcceptAllCta) {
|
|
|
+
|
|
|
html += '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '">';
|
|
|
html += ' <span id="tarteaucitronDisclaimerAlert">';
|
|
|
html += ' ' + tarteaucitron.lang.alertBigPrivacy;
|
|
@@ -299,7 +308,7 @@ var tarteaucitron = {
|
|
|
html += '</div>';
|
|
|
html += '<div id="tarteaucitronPercentage"></div>';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (defaults.showAlertSmall === true) {
|
|
|
html += '<div id="tarteaucitronAlertSmall" class="tarteaucitronAlertSmall' + orientation + '">';
|
|
|
html += ' <div id="tarteaucitronManager" onclick="tarteaucitron.userInterface.openPanel();">';
|
|
@@ -326,7 +335,7 @@ var tarteaucitron = {
|
|
|
}
|
|
|
html += '</div>';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
tarteaucitron.addScript(tarteaucitron.cdn + 'advertising.js?v=' + tarteaucitron.version, '', function () {
|
|
|
if (tarteaucitronNoAdBlocker === true || defaults.adblocker === false) {
|
|
|
div.id = 'tarteaucitronRoot';
|
|
@@ -341,7 +350,7 @@ var tarteaucitron = {
|
|
|
} else {
|
|
|
tarteaucitron.job = []
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
tarteaucitron.isAjax = true;
|
|
|
|
|
|
tarteaucitron.job.push = function (id) {
|
|
@@ -364,16 +373,16 @@ var tarteaucitron = {
|
|
|
tarteaucitron.launch[id] = false;
|
|
|
tarteaucitron.addService(id);
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
|
|
|
tarteaucitron.userInterface.openPanel();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
tarteaucitron.cookie.number();
|
|
|
setInterval(tarteaucitron.cookie.number, 60000);
|
|
|
}
|
|
|
}, defaults.adblocker);
|
|
|
-
|
|
|
+
|
|
|
if (defaults.adblocker === true) {
|
|
|
setTimeout(function () {
|
|
|
if (tarteaucitronNoAdBlocker === false) {
|
|
@@ -417,7 +426,7 @@ var tarteaucitron = {
|
|
|
|
|
|
if (tarteaucitron.added[service.key] !== true) {
|
|
|
tarteaucitron.added[service.key] = true;
|
|
|
-
|
|
|
+
|
|
|
html += '<div id="' + service.key + 'Line" class="tarteaucitronLine">';
|
|
|
html += ' <div class="tarteaucitronName">';
|
|
|
html += ' <b>' + service.name + '</b><br/>';
|
|
@@ -439,13 +448,13 @@ var tarteaucitron = {
|
|
|
html += ' </div>';
|
|
|
html += ' </div>';
|
|
|
html += '</div>';
|
|
|
-
|
|
|
+
|
|
|
tarteaucitron.userInterface.css('tarteaucitronServicesTitle_' + service.type, 'display', 'block');
|
|
|
-
|
|
|
+
|
|
|
if (document.getElementById('tarteaucitronServices_' + service.type) !== null) {
|
|
|
document.getElementById('tarteaucitronServices_' + service.type).innerHTML += html;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
tarteaucitron.userInterface.order(service.type);
|
|
|
}
|
|
|
|
|
@@ -454,7 +463,7 @@ var tarteaucitron = {
|
|
|
isAllowed = true;
|
|
|
tarteaucitron.cookie.create(service.key, true);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ((!isResponded && (isAutostart || (isNavigating && isWaiting)) && !tarteaucitron.highPrivacy) || isAllowed) {
|
|
|
if (!isAllowed) {
|
|
|
tarteaucitron.cookie.create(service.key, true);
|
|
@@ -496,7 +505,7 @@ var tarteaucitron = {
|
|
|
out = [],
|
|
|
obj = {},
|
|
|
s = tarteaucitron.services;
|
|
|
-
|
|
|
+
|
|
|
for (i = 0; i < len; i += 1) {
|
|
|
if (!obj[arr[i]]) {
|
|
|
obj[arr[i]] = {};
|
|
@@ -505,13 +514,13 @@ var tarteaucitron = {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
out = out.sort(function (a, b) {
|
|
|
if (s[a].type + s[a].key > s[b].type + s[b].key) { return 1; }
|
|
|
if (s[a].type + s[a].key < s[b].type + s[b].key) { return -1; }
|
|
|
return 0;
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
return out;
|
|
|
},
|
|
|
"userInterface": {
|
|
@@ -527,7 +536,7 @@ var tarteaucitron = {
|
|
|
service,
|
|
|
key,
|
|
|
index = 0;
|
|
|
-
|
|
|
+
|
|
|
for (index = 0; index < tarteaucitron.job.length; index += 1) {
|
|
|
service = s[tarteaucitron.job[index]];
|
|
|
key = service.key;
|
|
@@ -548,16 +557,16 @@ var tarteaucitron = {
|
|
|
"respond": function (el, status) {
|
|
|
"use strict";
|
|
|
var key = el.id.replace(new RegExp("(Eng[0-9]+|Allow|Deni)ed", "g"), '');
|
|
|
-
|
|
|
+
|
|
|
// return if same state
|
|
|
if (tarteaucitron.state[key] === status) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (status === false && tarteaucitron.launch[key] === true) {
|
|
|
tarteaucitron.reloadThePage = true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// if not already launched... launch the service
|
|
|
if (status === true) {
|
|
|
if (tarteaucitron.launch[key] !== true) {
|
|
@@ -604,11 +613,11 @@ var tarteaucitron = {
|
|
|
nbAllowed += 1;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
tarteaucitron.userInterface.css(c + 'DotGreen', 'width', ((100 / sum) * nbAllowed) + '%');
|
|
|
tarteaucitron.userInterface.css(c + 'DotYellow', 'width', ((100 / sum) * nbPending) + '%');
|
|
|
tarteaucitron.userInterface.css(c + 'DotRed', 'width', ((100 / sum) * nbDenied) + '%');
|
|
|
-
|
|
|
+
|
|
|
if (nbDenied === 0 && nbPending === 0) {
|
|
|
tarteaucitron.userInterface.css(c + 'AllAllowed', 'backgroundColor', greenDark);
|
|
|
tarteaucitron.userInterface.css(c + 'AllDenied', 'backgroundColor', gray);
|
|
@@ -619,16 +628,16 @@ var tarteaucitron = {
|
|
|
tarteaucitron.userInterface.css(c + 'AllAllowed', 'backgroundColor', gray);
|
|
|
tarteaucitron.userInterface.css(c + 'AllDenied', 'backgroundColor', gray);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// close the alert if all service have been reviewed
|
|
|
if (nbPending === 0) {
|
|
|
tarteaucitron.userInterface.closeAlert();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (tarteaucitron.services[key].cookies.length > 0 && status === false) {
|
|
|
tarteaucitron.cookie.purge(tarteaucitron.services[key].cookies);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (status === true) {
|
|
|
if (document.getElementById('tacCL' + key) !== null) {
|
|
|
document.getElementById('tacCL' + key).innerHTML = '...';
|
|
@@ -649,17 +658,17 @@ var tarteaucitron = {
|
|
|
},
|
|
|
"closePanel": function () {
|
|
|
"use strict";
|
|
|
-
|
|
|
+
|
|
|
if (document.location.hash === tarteaucitron.hashtag) {
|
|
|
document.location.hash = '';
|
|
|
}
|
|
|
tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
|
|
|
tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
|
|
|
-
|
|
|
+
|
|
|
tarteaucitron.fallback(['tarteaucitronInfoBox'], function (elem) {
|
|
|
elem.style.display = 'none';
|
|
|
}, true);
|
|
|
-
|
|
|
+
|
|
|
if (tarteaucitron.reloadThePage === true) {
|
|
|
window.location.reload();
|
|
|
} else {
|
|
@@ -684,11 +693,11 @@ var tarteaucitron = {
|
|
|
"toggleCookiesList": function () {
|
|
|
"use strict";
|
|
|
var div = document.getElementById('tarteaucitronCookiesListContainer');
|
|
|
-
|
|
|
+
|
|
|
if (div === null) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (div.style.display !== 'block') {
|
|
|
tarteaucitron.cookie.number();
|
|
|
div.style.display = 'block';
|
|
@@ -707,11 +716,11 @@ var tarteaucitron = {
|
|
|
"toggle": function (id, closeClass) {
|
|
|
"use strict";
|
|
|
var div = document.getElementById(id);
|
|
|
-
|
|
|
+
|
|
|
if (div === null) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (closeClass !== undefined) {
|
|
|
tarteaucitron.fallback([closeClass], function (elem) {
|
|
|
if (elem.id !== id) {
|
|
@@ -719,7 +728,7 @@ var tarteaucitron = {
|
|
|
}
|
|
|
}, true);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (div.style.display !== 'block') {
|
|
|
div.style.display = 'block';
|
|
|
} else {
|
|
@@ -736,9 +745,9 @@ var tarteaucitron = {
|
|
|
if (main === null) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
allDivs = main.childNodes;
|
|
|
-
|
|
|
+
|
|
|
if (typeof Array.prototype.map === 'function') {
|
|
|
Array.prototype.map.call(main.children, Object).sort(function (a, b) {
|
|
|
if (tarteaucitron.services[a.id.replace(/Line/g, '')].name > tarteaucitron.services[b.id.replace(/Line/g, '')].name) { return 1; }
|
|
@@ -768,18 +777,18 @@ var tarteaucitron = {
|
|
|
paddingBox,
|
|
|
alertSmallHeight,
|
|
|
cookiesNumberHeight;
|
|
|
-
|
|
|
+
|
|
|
if (type === 'box') {
|
|
|
if (document.getElementById('tarteaucitronAlertSmall') !== null && document.getElementById('tarteaucitronCookiesNumber') !== null) {
|
|
|
-
|
|
|
+
|
|
|
// reset
|
|
|
tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', '0px 10px');
|
|
|
-
|
|
|
+
|
|
|
// calculate
|
|
|
alertSmallHeight = document.getElementById('tarteaucitronAlertSmall').offsetHeight;
|
|
|
cookiesNumberHeight = document.getElementById('tarteaucitronCookiesNumber').offsetHeight;
|
|
|
paddingBox = (alertSmallHeight - cookiesNumberHeight) / 2;
|
|
|
-
|
|
|
+
|
|
|
// apply
|
|
|
tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', paddingBox + 'px 10px');
|
|
|
}
|
|
@@ -793,79 +802,79 @@ var tarteaucitron = {
|
|
|
|
|
|
// height of the services list container
|
|
|
if (document.getElementById('tarteaucitron') !== null && document.getElementById('tarteaucitronClosePanel') !== null && document.getElementById('tarteaucitronMainLineOffset') !== null) {
|
|
|
-
|
|
|
+
|
|
|
// reset
|
|
|
tarteaucitron.userInterface.css('tarteaucitronScrollbarParent', 'height', 'auto');
|
|
|
-
|
|
|
+
|
|
|
// calculate
|
|
|
mainHeight = document.getElementById('tarteaucitron').offsetHeight;
|
|
|
closeButtonHeight = document.getElementById('tarteaucitronClosePanel').offsetHeight;
|
|
|
headerHeight = document.getElementById('tarteaucitronMainLineOffset').offsetHeight;
|
|
|
-
|
|
|
+
|
|
|
// apply
|
|
|
servicesHeight = (mainHeight - closeButtonHeight - headerHeight + 1);
|
|
|
tarteaucitron.userInterface.css('tarteaucitronScrollbarParent', 'height', servicesHeight + 'px');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// align the main allow/deny button depending on scrollbar width
|
|
|
if (document.getElementById('tarteaucitronScrollbarParent') !== null && document.getElementById('tarteaucitronScrollbarChild') !== null) {
|
|
|
-
|
|
|
+
|
|
|
// media query
|
|
|
if (e[a + 'Width'] <= 479) {
|
|
|
tarteaucitron.userInterface.css('tarteaucitronScrollbarAdjust', 'marginLeft', '11px');
|
|
|
} else if (e[a + 'Width'] <= 767) {
|
|
|
scrollbarMarginRight = 12;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
scrollbarWidthParent = document.getElementById('tarteaucitronScrollbarParent').offsetWidth;
|
|
|
scrollbarWidthChild = document.getElementById('tarteaucitronScrollbarChild').offsetWidth;
|
|
|
tarteaucitron.userInterface.css('tarteaucitronScrollbarAdjust', 'marginRight', ((scrollbarWidthParent - scrollbarWidthChild) + scrollbarMarginRight) + 'px');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// center the main panel
|
|
|
if (document.getElementById('tarteaucitron') !== null) {
|
|
|
-
|
|
|
+
|
|
|
// media query
|
|
|
if (e[a + 'Width'] <= 767) {
|
|
|
mainTop = 0;
|
|
|
} else {
|
|
|
mainTop = ((windowInnerHeight - document.getElementById('tarteaucitron').offsetHeight) / 2) - 21;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// correct
|
|
|
if (mainTop < 0) {
|
|
|
mainTop = 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (document.getElementById('tarteaucitronMainLineOffset') !== null) {
|
|
|
if (document.getElementById('tarteaucitron').offsetHeight < (windowInnerHeight / 2)) {
|
|
|
mainTop -= document.getElementById('tarteaucitronMainLineOffset').offsetHeight;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// apply
|
|
|
tarteaucitron.userInterface.css('tarteaucitron', 'top', mainTop + 'px');
|
|
|
}
|
|
|
|
|
|
|
|
|
} else if (type === 'cookie') {
|
|
|
-
|
|
|
+
|
|
|
// put cookies list at bottom
|
|
|
if (document.getElementById('tarteaucitronAlertSmall') !== null) {
|
|
|
tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'bottom', (document.getElementById('tarteaucitronAlertSmall').offsetHeight) + 'px');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// height of cookies list
|
|
|
if (document.getElementById('tarteaucitronCookiesListContainer') !== null) {
|
|
|
-
|
|
|
+
|
|
|
// reset
|
|
|
tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', 'auto');
|
|
|
-
|
|
|
+
|
|
|
// calculate
|
|
|
cookiesListHeight = document.getElementById('tarteaucitronCookiesListContainer').offsetHeight;
|
|
|
cookiesCloseHeight = document.getElementById('tarteaucitronClosePanelCookie').offsetHeight;
|
|
|
cookiesTitleHeight = document.getElementById('tarteaucitronCookiesTitle').offsetHeight;
|
|
|
-
|
|
|
+
|
|
|
// apply
|
|
|
tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', (cookiesListHeight - cookiesCloseHeight - cookiesTitleHeight - 2) + 'px');
|
|
|
}
|
|
@@ -887,7 +896,7 @@ var tarteaucitron = {
|
|
|
expireTime = time + timeExipre, // 365 days
|
|
|
regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
|
|
|
cookie = tarteaucitron.cookie.read().replace(regex, ""),
|
|
|
- value = 'tarteaucitron=' + cookie + '!' + key + '=' + status,
|
|
|
+ value = tarteaucitron.parameters.cookieName + '=' + cookie + '!' + key + '=' + status,
|
|
|
domain = (tarteaucitron.parameters.cookieDomain !== undefined && tarteaucitron.parameters.cookieDomain !== '') ? 'domain=' + tarteaucitron.parameters.cookieDomain + ';' : '';
|
|
|
|
|
|
if (tarteaucitron.cookie.read().indexOf(key + '=' + status) === -1) {
|
|
@@ -899,7 +908,7 @@ var tarteaucitron = {
|
|
|
},
|
|
|
"read": function () {
|
|
|
"use strict";
|
|
|
- var nameEQ = "tarteaucitron=",
|
|
|
+ var nameEQ = tarteaucitron.parameters.cookieName + "=",
|
|
|
ca = document.cookie.split(';'),
|
|
|
i,
|
|
|
c;
|
|
@@ -918,7 +927,7 @@ var tarteaucitron = {
|
|
|
"purge": function (arr) {
|
|
|
"use strict";
|
|
|
var i;
|
|
|
-
|
|
|
+
|
|
|
for (i = 0; i < arr.length; i += 1) {
|
|
|
document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/;';
|
|
|
document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname + ';';
|
|
@@ -933,7 +942,7 @@ var tarteaucitron = {
|
|
|
html = '',
|
|
|
i,
|
|
|
status = document.cookie.indexOf(key + '=true');
|
|
|
-
|
|
|
+
|
|
|
if (status >= 0 && nb === 0) {
|
|
|
html += tarteaucitron.lang.useNoCookie;
|
|
|
} else if (status >= 0) {
|
|
@@ -948,7 +957,7 @@ var tarteaucitron = {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (nbCurrent > 0) {
|
|
|
html += tarteaucitron.lang.useCookieCurrent + ' ' + nbCurrent + ' cookie';
|
|
|
if (nbCurrent > 1) {
|
|
@@ -967,7 +976,7 @@ var tarteaucitron = {
|
|
|
}
|
|
|
html += '.';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (document.getElementById('tacCL' + key) !== null) {
|
|
|
document.getElementById('tacCL' + key).innerHTML = html;
|
|
|
}
|
|
@@ -998,7 +1007,7 @@ var tarteaucitron = {
|
|
|
regex = /^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i,
|
|
|
regexedDomain = (tarteaucitron.cdn.match(regex) !== null) ? tarteaucitron.cdn.match(regex)[1] : tarteaucitron.cdn,
|
|
|
host = (tarteaucitron.domain !== undefined) ? tarteaucitron.domain : regexedDomain;
|
|
|
-
|
|
|
+
|
|
|
cookies = cookies.sort(function (a, b) {
|
|
|
namea = a.split('=', 1).toString().replace(/ /g, '');
|
|
|
nameb = b.split('=', 1).toString().replace(/ /g, '');
|
|
@@ -1008,7 +1017,7 @@ var tarteaucitron = {
|
|
|
if (c + a < d + b) { return -1; }
|
|
|
return 0;
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
if (document.cookie !== '') {
|
|
|
for (i = 0; i < nb; i += 1) {
|
|
|
name = cookies[i].split('=', 1).toString().replace(/ /g, '');
|
|
@@ -1039,21 +1048,21 @@ var tarteaucitron = {
|
|
|
html += ' <div class="tarteaucitronCookiesListRight"></div>';
|
|
|
html += '</div>';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
html += '<div class="tarteaucitronHidden" style="height:20px;display:block"></div>';
|
|
|
-
|
|
|
+
|
|
|
if (document.getElementById('tarteaucitronCookiesList') !== null) {
|
|
|
document.getElementById('tarteaucitronCookiesList').innerHTML = html;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (document.getElementById('tarteaucitronCookiesNumber') !== null) {
|
|
|
document.getElementById('tarteaucitronCookiesNumber').innerHTML = nb;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (document.getElementById('tarteaucitronCookiesNumberBis') !== null) {
|
|
|
document.getElementById('tarteaucitronCookiesNumberBis').innerHTML = nb + ' cookie' + s;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
for (i = 0; i < tarteaucitron.job.length; i += 1) {
|
|
|
tarteaucitron.cookie.checkCount(tarteaucitron.job[i]);
|
|
|
}
|
|
@@ -1062,7 +1071,7 @@ var tarteaucitron = {
|
|
|
"getLanguage": function () {
|
|
|
"use strict";
|
|
|
if (!navigator) { return 'en'; }
|
|
|
-
|
|
|
+
|
|
|
var availableLanguages = 'cs,en,fr,es,it,de,nl,pt,pl,ru',
|
|
|
defaultLanguage = 'en',
|
|
|
lang = navigator.language || navigator.browserLanguage ||
|
|
@@ -1074,7 +1083,7 @@ var tarteaucitron = {
|
|
|
return tarteaucitronForceLanguage;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (availableLanguages.indexOf(userLanguage) === -1) {
|
|
|
return defaultLanguage;
|
|
|
}
|
|
@@ -1083,11 +1092,11 @@ var tarteaucitron = {
|
|
|
"getLocale": function () {
|
|
|
"use strict";
|
|
|
if (!navigator) { return 'en_US'; }
|
|
|
-
|
|
|
+
|
|
|
var lang = navigator.language || navigator.browserLanguage ||
|
|
|
navigator.systemLanguage || navigator.userLang || null,
|
|
|
userLanguage = lang.substr(0, 2);
|
|
|
-
|
|
|
+
|
|
|
if (userLanguage === 'fr') {
|
|
|
return 'fr_FR';
|
|
|
} else if (userLanguage === 'en') {
|
|
@@ -1110,7 +1119,7 @@ var tarteaucitron = {
|
|
|
"use strict";
|
|
|
var script,
|
|
|
done = false;
|
|
|
-
|
|
|
+
|
|
|
if (execute === false) {
|
|
|
if (typeof callback === 'function') {
|
|
|
callback();
|
|
@@ -1121,7 +1130,7 @@ var tarteaucitron = {
|
|
|
script.id = (id !== undefined) ? id : '';
|
|
|
script.async = true;
|
|
|
script.src = url;
|
|
|
-
|
|
|
+
|
|
|
if (attrName !== undefined && attrVal !== undefined) {
|
|
|
script.setAttribute(attrName, attrVal);
|
|
|
}
|
|
@@ -1135,7 +1144,7 @@ var tarteaucitron = {
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
document.getElementsByTagName('head')[0].appendChild(script);
|
|
|
}
|
|
|
},
|
|
@@ -1153,12 +1162,12 @@ var tarteaucitron = {
|
|
|
document.writeln = function (content) {
|
|
|
tarteaucitron.makeAsync.buffer += content.concat("\n");
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
setTimeout(function () {
|
|
|
document.write = savedWrite;
|
|
|
document.writeln = savedWriteln;
|
|
|
}, 20000);
|
|
|
-
|
|
|
+
|
|
|
tarteaucitron.makeAsync.getAndParse(url, id);
|
|
|
},
|
|
|
"getAndParse": function (url, id) {
|
|
@@ -1186,7 +1195,7 @@ var tarteaucitron = {
|
|
|
if (document.getElementById(id) === null) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
scripts = document.getElementById(id).getElementsByTagName('script');
|
|
|
for (i = 0; i < scripts.length; i += 1) {
|
|
|
type = (scripts[i].getAttribute('type') !== null) ? scripts[i].getAttribute('type') : '';
|
|
@@ -1232,7 +1241,7 @@ var tarteaucitron = {
|
|
|
"use strict";
|
|
|
var html = '',
|
|
|
r = Math.floor(Math.random() * 100000);
|
|
|
-
|
|
|
+
|
|
|
html += '<div class="tac_activate">';
|
|
|
html += ' <div class="tac_float">';
|
|
|
html += ' <b>' + tarteaucitron.services[id].name + '</b> ' + tarteaucitron.lang.fallback;
|
|
@@ -1241,7 +1250,7 @@ var tarteaucitron = {
|
|
|
html += ' </div>';
|
|
|
html += ' </div>';
|
|
|
html += '</div>';
|
|
|
-
|
|
|
+
|
|
|
return html;
|
|
|
},
|
|
|
"extend": function (a, b) {
|
|
@@ -1270,21 +1279,34 @@ var tarteaucitron = {
|
|
|
var div = document.getElementById('tarteaucitronPremium'),
|
|
|
timestamp = new Date().getTime(),
|
|
|
url = '//opt-out.ferank.eu/premium.php?';
|
|
|
-
|
|
|
+
|
|
|
if (div === null) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
url += 'domain=' + tarteaucitron.domain + '&';
|
|
|
url += 'uuid=' + tarteaucitron.uuid + '&';
|
|
|
url += 'c=' + encodeURIComponent(tarteaucitron.proTemp) + '&';
|
|
|
url += '_' + timestamp;
|
|
|
-
|
|
|
+
|
|
|
div.innerHTML = '<img src="' + url + '" style="display:none" />';
|
|
|
-
|
|
|
+
|
|
|
tarteaucitron.proTemp = '';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
tarteaucitron.cookie.number();
|
|
|
+ },
|
|
|
+ "AddOrUpdate" : function(source, custom){
|
|
|
+ /**
|
|
|
+ Utility function to Add or update the fields of obj1 with the ones in obj2
|
|
|
+ */
|
|
|
+ for(key in custom){
|
|
|
+ if(custom[key] instanceof Object){
|
|
|
+ source[key] = tarteaucitron.AddOrUpdate(source[key], custom[key]);
|
|
|
+ }else{
|
|
|
+ source[key] = custom[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return source;
|
|
|
}
|
|
|
};
|