|
Balises : Contenu remplacé Révocation Révoqué |
Ligne 17 : |
Ligne 17 : |
| window.location = url; | | window.location = url; |
| } ); | | } ); |
| })
| |
|
| |
| /** Déplace le sélecteur de langue **/
| |
| jQuery( document ).ready( function( $ ) {
| |
| $("#pt-uls").detach().appendTo("#langue_interface");
| |
| });
| |
|
| |
| /** MATOMO OPT-OUT **/
| |
| jQuery( document ).ready( function( $ ) {
| |
|
| |
| var settings = {
| |
| showIntro: true,
| |
| divId: 'matomo-opt-out',
| |
| useSecureCookies: true,
| |
| cookiePath: null,
| |
| cookieDomain: "",
| |
| cookieSameSite: 'Lax',
| |
| OptOutComplete: "Cookie d'exclusion install\u00e9. Vos visites sur ce site web ne seront PAS enregistr\u00e9es par notre outil d'analyse web.",
| |
| OptOutCompleteBis: "Note\u00a0: si vous nettoyez vos cookies et supprimez le cookie d'exclusion, ou bien si vous changez d'ordinateur et\/ou de navigateur, il vous faudra de nouveau effectuer la proc\u00e9dure d'exclusion.",
| |
| YouMayOptOut2: 'Vous pouvez vous opposer au suivi de votre navigation sur ce site web.',
| |
| YouMayOptOut3: "Cela prot\u00e9gera votre vie priv\u00e9e, mais emp\u00eachera \u00e9galement le propri\u00e9taire d'apprendre de vos actions et de cr\u00e9er une meilleure exp\u00e9rience pour vous et les autres utilisateurs.",
| |
| OptOutErrorNoCookies: 'La fonctionnalit\u00e9 de d\u00e9sactivation du suivi n\u00e9cessite que les cookies soient autoris\u00e9s.',
| |
| OptOutErrorNotHttps: "La fonctionnalit\u00e9 de d\u00e9sactivation du suivi pourrait ne pas fonctionner car ce site n'a pas \u00e9t\u00e9 charg\u00e9 en HTTPS. Veuillez recharger la page pour v\u00e9rifier que le statut de ce suivi a bien \u00e9t\u00e9 chang\u00e9.",
| |
| YouAreNotOptedOut: "<span class='pl-3'>Vous n'\u00eates pas exclu(e).</span>",
| |
| UncheckToOptOut: 'D\u00e9cochez cette case pour vous exclure.',
| |
| YouAreOptedOut: "<span class='pl-3'>Vous n'\u00eates actuellement pas suivi(e).</span>",
| |
| CheckToOptIn: 'Cochez cette case pour ne plus \u00eatre exclu(e).',
| |
| };
| |
|
| |
| function showContent(consent,errorMessage, useTracker) {
| |
|
| |
| var errorBlock = '<p style="color: red; font-weight: bold;">';
| |
|
| |
| var div = document.getElementById(settings.divId);
| |
|
| |
| if (!div) {
| |
| // var warningDiv = document.createElement('div');
| |
| var msg = "Unable to find opt-out content div : " + settings.divId ;
| |
| // warningDiv.id = settings.divId + '-warning';
| |
| // warningDiv.innerHTML = errorBlock + msg ;
| |
| // document.body.insertBefore(warningDiv, document.body.firstChild);
| |
| // console.log(msg);
| |
| return;
| |
| }
| |
|
| |
| if (!navigator || !navigator.cookieEnabled) {
| |
| div.innerHTML = errorBlock + settings.OptOutErrorNoCookies ;
| |
| return;
| |
| }
| |
| if (location.protocol !== 'https:') {
| |
| div.innerHTML = errorBlock + settings.OptOutErrorNotHttps;
| |
| return;
| |
| }
| |
| if (errorMessage !== null) {
| |
| div.innerHTML = errorBlock + errorMessage;
| |
| return;
| |
| }
| |
| content = '';
| |
|
| |
| if (consent) {
| |
| if (settings.showIntro) {
| |
| content += "<p>" + settings.YouMayOptOut2 + settings.YouMayOptOut3 + "</p>";
| |
| }
| |
| if (useTracker) {
| |
| content += '<input id="trackVisits" type="checkbox" checked="checked" />';
| |
| } else {
| |
| content += '<input id="trackVisits2" type="checkbox" checked="checked" />';
| |
| }
| |
| content += '<label for="trackVisits"><strong><span>' + settings.YouAreNotOptedOut + settings.UncheckToOptOut + "</span></strong></label>";
| |
| } else {
| |
| if (settings.showIntro) {
| |
| content += '<p>' + settings.OptOutComplete + settings.OptOutCompleteBis + "</p>";
| |
| }
| |
| if (useTracker) {
| |
| content += '<input onclick="_paq.push([\'forgetUserOptOut\']);showContent(true, null, true);" id="trackVisits" type="checkbox" />';
| |
| } else {
| |
| content += '<input onclick="window.MatomoConsent.consentGiven();showContent(true);" id="trackVisits2" type="checkbox" />';
| |
| }
| |
| content += '<label for="trackVisits"><strong><span>' + settings.YouAreOptedOut + settings.CheckToOptIn + "</span></strong></label>";
| |
| }
| |
| div.innerHTML = content;
| |
| }
| |
| window.MatomoConsent = {
| |
| cookiesDisabled: (!navigator || !navigator.cookieEnabled),
| |
| CONSENT_COOKIE_NAME: 'mtm_consent',
| |
| CONSENT_REMOVED_COOKIE_NAME: 'mtm_consent_removed',
| |
| cookieIsSecure: false,
| |
| useSecureCookies: true,
| |
| cookiePath: '',
| |
| cookieDomain: '',
| |
| cookieSameSite: 'Lax',
| |
| init : function(useSecureCookies, cookiePath, cookieDomain, cookieSameSite) {
| |
| this.useSecureCookies = useSecureCookies; this.cookiePath = cookiePath;
| |
| this.cookieDomain = cookieDomain; this.cookieSameSite = cookieSameSite;
| |
| if (useSecureCookies && location.protocol !== 'https:') {
| |
| console.log('Error with setting useSecureCookies: You cannot use this option on http.');
| |
| } else {
| |
| this.cookieIsSecure = useSecureCookies;
| |
| }
| |
| },
| |
| hasConsent : function() {
| |
| consentCookie = this.getCookie(this.CONSENT_COOKIE_NAME);
| |
| removedCookie = this.getCookie(this.CONSENT_REMOVED_COOKIE_NAME);
| |
|
| |
| if (!consentCookie && !removedCookie) {
| |
| return true; // No cookies set, so opted in
| |
| }
| |
| if (removedCookie && consentCookie) {
| |
| this.setCookie(this.CONSENT_COOKIE_NAME, '', -8888888);
| |
| return false;
| |
| }
| |
| console.log("OK");
| |
| return (consentCookie || consentCookie !== 0);
| |
| },
| |
| consentGiven : function() {
| |
| this.setCookie(this.CONSENT_REMOVED_COOKIE_NAME, '', -129600000);
| |
| this.setCookie(this.CONSENT_COOKIE_NAME, new Date().getTime(), 946080000000);
| |
| },
| |
| consentRevoked : function() {
| |
| this.setCookie(this.CONSENT_COOKIE_NAME, '', -129600000);
| |
| this.setCookie(this.CONSENT_REMOVED_COOKIE_NAME, new Date().getTime(), 946080000000);
| |
| },
| |
| getCookie : function(cookieName) {
| |
| var cookiePattern = new RegExp('(^|;)[ ]*'+cookieName+'=([^;]*)');
| |
| var cookieMatch = cookiePattern.exec(document.cookie);
| |
| return cookieMatch ? window.decodeURIComponent(cookieMatch[2]) : 0;
| |
| },
| |
| setCookie : function(cookieName, value, msToExpire) {
| |
| var expiryDate = new Date();
| |
| expiryDate.setTime((new Date().getTime()) + msToExpire);
| |
| document.cookie = "cookieName=" + window.encodeURIComponent(value) + ";expires=" + expiryDate.toGMTString() + ";path="+ this.cookiePath + ";domain=" + this.cookieDomain + ";secure="+ ";SameSite=" + this.cookieSameSite ;
| |
| if ((!msToExpire || msToExpire >= 0) && this.getCookie(cookieName) !== String(value)) {
| |
| console.log('There was an error setting cookie ' + cookieName + '. Please check domain and path.');
| |
| }
| |
| },
| |
| };
| |
|
| |
| window.MatomoConsent.init(settings.useSecureCookies, settings.cookiePath, settings.cookieDomain, settings.cookieSameSite);
| |
|
| |
| showContent(window.MatomoConsent.hasConsent(),null,false);
| |
|
| |
| $( "#trackVisits" ).on( "click", function() {
| |
| _paq.push(['optUserOut']);
| |
| showContent(false, null, true);
| |
| })
| |
|
| |
| $( "#trackVisits2" ).on( "click", function() {
| |
| window.MatomoConsent.consentRevoked();
| |
| showContent(false);
| |
| })
| |
|
| |
| }) | | }) |