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

linting

parent a6a80e51
......@@ -13,18 +13,20 @@ function loadMatomo() {
_paq.push(['trackPageView']);
_paq.push(['setIgnoreClasses', ['no-tracking', 'colorbox']]);
_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.defer = true;
g.async = true;
g.src = u + 'matomo.js';
s.parentNode.insertBefore(g,s);
s.parentNode.insertBefore(g, s);
setResultText(true);
}
}
/* setResultText: change the text in the footer */
function setResultText(acceptCookies){
function setResultText(acceptCookies) {
if (acceptCookies === true) {
$('#gdpr-result-text').html(settings.accept_all_text);
} else {
......@@ -34,44 +36,44 @@ function setResultText(acceptCookies){
/* showBanner: show the banner */
function showBanner() {
var popup = $('#lap-cookies-banner');
popup.hide();
popup.slideDown('slow');
var popup = $('#lap-cookies-banner');
popup.hide();
popup.slideDown('slow');
}
/* hideBanner: show the banner */
function hideBanner() {
var popup = $('#lap-cookies-banner');
popup.hide();
var popup = $('#lap-cookies-banner');
popup.hide();
}
/* clearCookies: clear all cookies */
function clearCookies() {
var hostname = document.location.hostname.replace(/^www\./, ''),
commonSuffix = '; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/';
// remove the analytics cookies
var cookies = document.cookie.split('; ');
for (var i in cookies) {
var name = cookies[i].split('=')[0];
if (name.startsWith('_pk_')) {
document.cookie = name + '=; domain=.' + hostname + commonSuffix;
var hostname = document.location.hostname.replace(/^www\./, ''),
commonSuffix = '; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/';
// remove the analytics cookies
var cookies = document.cookie.split('; ');
for (var i in cookies) {
var name = cookies[i].split('=')[0];
if (name.startsWith('_pk_')) {
document.cookie = name + '=; domain=.' + hostname + commonSuffix;
}
}
}
setResultText(false);
setResultText(false);
}
/* setCookie: create/update cookie */
function setCookie(name, value) {
var date = new Date();
date.setTime(date.getTime() + settings.cookieTimeout);
var date = new Date();
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){
return document.cookie.indexOf(settings.cookieName + '=1' ) > -1;
function isCookieSetTo(val) {
return document.cookie.indexOf(settings.cookieName + '=1') > -1;
}
/* hasConsent: check if user gave consent */
......@@ -125,15 +127,15 @@ function refuse(cookieMgmt) {
}
/* main function */
$( document ).ready(function() {
$(document).ready(function() {
// accept
$('.lap-cookies-accept').click(function(e){
$('.lap-cookies-accept').click(function(e) {
e.preventDefault(true);
accept();
});
// refuse
$('.lap-cookies-refuse').click(function(e){
$('.lap-cookies-refuse').click(function(e) {
e.preventDefault(true);
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