Merge branch 'master' into display-cta-accept-all-with-highPrivacy
This commit is contained in:
commit
b43cbce36b
|
|
@ -63,6 +63,7 @@ Bonus:
|
|||
* Marketing Automation & CRM
|
||||
* Mautic
|
||||
* Webmecanik Automation
|
||||
* Koban
|
||||
|
||||
* Social network
|
||||
* AddThis
|
||||
|
|
@ -117,6 +118,7 @@ In PHP for example, you can bypass all the script by setting this var `tarteauci
|
|||
<script type="text/javascript">
|
||||
tarteaucitron.init({
|
||||
"hashtag": "#tarteaucitron", /* Ouverture automatique du panel avec le hashtag */
|
||||
"cookieName": "tartaucitron", /* Nom du cookie */
|
||||
"highPrivacy": false, /* désactiver le consentement implicite (en naviguant) ? */
|
||||
"AcceptAllCta" : false, /* Afficher le CTA "Tout accepter" si "hightPrivacy : true" */
|
||||
"orientation": "top", /* le bandeau doit être en haut (top) ou en bas (bottom) ? */
|
||||
|
|
|
|||
216
tarteaucitron.js
216
tarteaucitron.js
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -711,7 +711,7 @@ tarteaucitron.services.facebook = {
|
|||
"cookies": [],
|
||||
"js": function () {
|
||||
"use strict";
|
||||
tarteaucitron.fallback(['fb-post', 'fb-follow', 'fb-activity', 'fb-send', 'fb-share-button', 'fb-like'], '');
|
||||
tarteaucitron.fallback(['fb-post', 'fb-follow', 'fb-activity', 'fb-send', 'fb-share-button', 'fb-like', 'fb-video'], '');
|
||||
tarteaucitron.addScript('//connect.facebook.net/' + tarteaucitron.getLocale() + '/sdk.js#xfbml=1&version=v2.0', 'facebook-jssdk');
|
||||
if (tarteaucitron.isAjax === true) {
|
||||
if (typeof FB !== "undefined") {
|
||||
|
|
@ -722,7 +722,7 @@ tarteaucitron.services.facebook = {
|
|||
"fallback": function () {
|
||||
"use strict";
|
||||
var id = 'facebook';
|
||||
tarteaucitron.fallback(['fb-post', 'fb-follow', 'fb-activity', 'fb-send', 'fb-share-button', 'fb-like'], tarteaucitron.engage(id));
|
||||
tarteaucitron.fallback(['fb-post', 'fb-follow', 'fb-activity', 'fb-send', 'fb-share-button', 'fb-like', 'fb-video'], tarteaucitron.engage(id));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1073,7 +1073,7 @@ tarteaucitron.services.gtag = {
|
|||
"use strict";
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
tarteaucitron.addScript('https://www.googletagmanager.com/gtag/js?id=' + tarteaucitron.user.gtagUa, '', function () {
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
window.gtag = function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', tarteaucitron.user.gtagUa);
|
||||
|
||||
|
|
@ -1103,7 +1103,13 @@ tarteaucitron.services.googlemaps = {
|
|||
tarteaucitron.user.mapscallback = 'tac_googlemaps_callback';
|
||||
}
|
||||
|
||||
tarteaucitron.addScript('//maps.googleapis.com/maps/api/js?v=3.exp&key=' + tarteaucitron.user.googlemapsKey + '&callback='+tarteaucitron.user.mapscallback);
|
||||
// Add Google Maps libraries if any (https://developers.google.com/maps/documentation/javascript/libraries)
|
||||
var googleMapsLibraries = '';
|
||||
if (tarteaucitron.user.googlemapsLibraries) {
|
||||
googleMapsLibraries = '&libraries=' + tarteaucitron.user.googlemapsLibraries;
|
||||
}
|
||||
|
||||
tarteaucitron.addScript('//maps.googleapis.com/maps/api/js?v=3.exp&key=' + tarteaucitron.user.googlemapsKey + '&callback='+tarteaucitron.user.mapscallback + googleMapsLibraries);
|
||||
|
||||
window.tac_googlemaps_callback = function () {
|
||||
tarteaucitron.fallback(['googlemaps-canvas'], function (x) {
|
||||
|
|
@ -2192,7 +2198,7 @@ tarteaucitron.services.multiplegtag = {
|
|||
tarteaucitron.user.multiplegtagUa.forEach(function(ua) {
|
||||
|
||||
tarteaucitron.addScript('https://www.googletagmanager.com/gtag/js?id=' + ua, '', function () {
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
window.gtag = function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', ua);
|
||||
});
|
||||
|
|
@ -2200,3 +2206,70 @@ tarteaucitron.services.multiplegtag = {
|
|||
}
|
||||
};
|
||||
|
||||
// Koban
|
||||
tarteaucitron.services.koban = {
|
||||
"key": "koban",
|
||||
"type": "analytic",
|
||||
"name": "Koban",
|
||||
"uri": "https://koban.cloud/tos",
|
||||
"needConsent": true,
|
||||
"cookies": ['kbntrk'],
|
||||
"js": function () {
|
||||
"use strict";
|
||||
if (tarteaucitron.user.kobanurl === undefined) {
|
||||
return;
|
||||
}
|
||||
if (tarteaucitron.user.kobanapi === undefined) {
|
||||
return;
|
||||
}
|
||||
window.KobanObject = 'kb';
|
||||
window.kb = window.kb || function() {
|
||||
window.kb.q = window.kb.q || [];
|
||||
window.kb.q.push(arguments);
|
||||
};
|
||||
window.kb.l = new Date();
|
||||
kb('reg', tarteaucitron.user.kobanapi);
|
||||
tarteaucitron.addScript(tarteaucitron.user.kobanurl, '', function() {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// matomo
|
||||
|
||||
/*
|
||||
1. Set the following variable before the initialization :
|
||||
|
||||
tarteaucitron.user.matomoId = YOUR_SITE_ID_FROM_MATOMO;
|
||||
tarteaucitron.user.matomoHost = "YOUR_MATOMO_URL"; //eg: https://stat.mydomain.com/
|
||||
|
||||
2. Push the service :
|
||||
|
||||
(tarteaucitron.job = tarteaucitron.job || []).push('matomo');
|
||||
|
||||
3. HTML
|
||||
You don't need to add any html code, if the service is autorized, the javascript is added. otherwise no.
|
||||
*/
|
||||
tarteaucitron.services.matomo = {
|
||||
"key": "matomo",
|
||||
"type": "analytic",
|
||||
"name": "Matomo (formerly known as Piwik)",
|
||||
"uri": "https://matomo.org/faq/general/faq_146/",
|
||||
"needConsent": true,
|
||||
"cookies": ['_pk_ref', '_pk_cvar', '_pk_id', '_pk_ses', '_pk_hsr', 'piwik_ignore', '_pk_uid'],
|
||||
"js": function () {
|
||||
"use strict";
|
||||
if (tarteaucitron.user.matomoId === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
window._paq = window._paq || [];
|
||||
window._paq.push(["setSiteId", tarteaucitron.user.matomoId]);
|
||||
window._paq.push(["setTrackerUrl", tarteaucitron.user.matomoHost + "piwik.php"]);
|
||||
window._paq.push(["setDoNotTrack", 1]);
|
||||
window._paq.push(["trackPageView"]);
|
||||
window._paq.push(["setIgnoreClasses", ["no-tracking", "colorbox"]]);
|
||||
window._paq.push(["enableLinkTracking"]);
|
||||
|
||||
tarteaucitron.addScript(tarteaucitron.user.matomoHost + 'piwik.js', '', '', true, 'defer', true);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue