Verified Commit 6a744d48 authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

linting

parent a6a80e51
...@@ -13,18 +13,20 @@ function loadMatomo() { ...@@ -13,18 +13,20 @@ function loadMatomo() {
_paq.push(['trackPageView']); _paq.push(['trackPageView']);
_paq.push(['setIgnoreClasses', ['no-tracking', 'colorbox']]); _paq.push(['setIgnoreClasses', ['no-tracking', 'colorbox']]);
_paq.push(['enableLinkTracking']); _paq.push(['enableLinkTracking']);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0]; var d = document,
g = d.createElement('script'),
s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript'; g.type = 'text/javascript';
g.defer = true; g.defer = true;
g.async = true; g.async = true;
g.src = u + 'matomo.js'; g.src = u + 'matomo.js';
s.parentNode.insertBefore(g,s); s.parentNode.insertBefore(g, s);
setResultText(true); setResultText(true);
} }
} }
/* setResultText: change the text in the footer */ /* setResultText: change the text in the footer */
function setResultText(acceptCookies){ function setResultText(acceptCookies) {
if (acceptCookies === true) { if (acceptCookies === true) {
$('#gdpr-result-text').html(settings.accept_all_text); $('#gdpr-result-text').html(settings.accept_all_text);
} else { } else {
...@@ -34,44 +36,44 @@ function setResultText(acceptCookies){ ...@@ -34,44 +36,44 @@ function setResultText(acceptCookies){
/* showBanner: show the banner */ /* showBanner: show the banner */
function showBanner() { function showBanner() {
var popup = $('#lap-cookies-banner'); var popup = $('#lap-cookies-banner');
popup.hide(); popup.hide();
popup.slideDown('slow'); popup.slideDown('slow');
} }
/* hideBanner: show the banner */ /* hideBanner: show the banner */
function hideBanner() { function hideBanner() {
var popup = $('#lap-cookies-banner'); var popup = $('#lap-cookies-banner');
popup.hide(); popup.hide();
} }
/* clearCookies: clear all cookies */ /* clearCookies: clear all cookies */
function clearCookies() { function clearCookies() {
var hostname = document.location.hostname.replace(/^www\./, ''), var hostname = document.location.hostname.replace(/^www\./, ''),
commonSuffix = '; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/'; commonSuffix = '; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/';
// remove the analytics cookies // remove the analytics cookies
var cookies = document.cookie.split('; '); var cookies = document.cookie.split('; ');
for (var i in cookies) { for (var i in cookies) {
var name = cookies[i].split('=')[0]; var name = cookies[i].split('=')[0];
if (name.startsWith('_pk_')) { if (name.startsWith('_pk_')) {
document.cookie = name + '=; domain=.' + hostname + commonSuffix; document.cookie = name + '=; domain=.' + hostname + commonSuffix;
}
} }
}
setResultText(false); setResultText(false);
} }
/* setCookie: create/update cookie */ /* setCookie: create/update cookie */
function setCookie(name, value) { function setCookie(name, value) {
var date = new Date(); var date = new Date();
date.setTime(date.getTime() + settings.cookieTimeout); date.setTime(date.getTime() + settings.cookieTimeout);
document.cookie = name + '=' + value + ';expires=' + date.toGMTString() + ';path=/'; document.cookie = name + '=' + value + ';expires=' + date.toGMTString() + ';path=/';
} }
function isCookieSetTo(val){ function isCookieSetTo(val) {
return document.cookie.indexOf(settings.cookieName + '=1' ) > -1; return document.cookie.indexOf(settings.cookieName + '=1') > -1;
} }
/* hasConsent: check if user gave consent */ /* hasConsent: check if user gave consent */
...@@ -125,15 +127,15 @@ function refuse(cookieMgmt) { ...@@ -125,15 +127,15 @@ function refuse(cookieMgmt) {
} }
/* main function */ /* main function */
$( document ).ready(function() { $(document).ready(function() {
// accept // accept
$('.lap-cookies-accept').click(function(e){ $('.lap-cookies-accept').click(function(e) {
e.preventDefault(true); e.preventDefault(true);
accept(); accept();
}); });
// refuse // refuse
$('.lap-cookies-refuse').click(function(e){ $('.lap-cookies-refuse').click(function(e) {
e.preventDefault(true); e.preventDefault(true);
refuse(); refuse();
}); });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment