Verified Commit 5cee718e authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

format comments

parent 6a744d48
......@@ -3,7 +3,9 @@ var _paq = window._paq || _paq || [];
// convert days to milliseconds
settings.cookieTimeout = settings.expires * 86400 * 1000;
/* loadMatomo: load the tracking code of the matomo instance */
/*
* loadMatomo: load the tracking code of the analytics instance
*/
function loadMatomo() {
if (settings.siteID > 0) {
var u = settings.matomoURL;
......@@ -25,7 +27,9 @@ function loadMatomo() {
}
}
/* setResultText: change the text in the footer */
/*
* setResultText: change the text in the footer
*/
function setResultText(acceptCookies) {
if (acceptCookies === true) {
$('#gdpr-result-text').html(settings.accept_all_text);
......@@ -34,20 +38,26 @@ function setResultText(acceptCookies) {
}
}
/* showBanner: show the banner */
/*
* showBanner: show the banner
*/
function showBanner() {
var popup = $('#lap-cookies-banner');
popup.hide();
popup.slideDown('slow');
}
/* hideBanner: show the banner */
/*
* hideBanner: show the banner
*/
function hideBanner() {
var popup = $('#lap-cookies-banner');
popup.hide();
}
/* clearCookies: clear all cookies */
/*
* clearCookies: clear all cookies
*/
function clearCookies() {
var hostname = document.location.hostname.replace(/^www\./, ''),
commonSuffix = '; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/';
......@@ -64,7 +74,9 @@ function clearCookies() {
setResultText(false);
}
/* setCookie: create/update cookie */
/*
* setCookie: create/update cookie
*/
function setCookie(name, value) {
var date = new Date();
date.setTime(date.getTime() + settings.cookieTimeout);
......@@ -76,7 +88,9 @@ function isCookieSetTo(val) {
return document.cookie.indexOf(settings.cookieName + '=1') > -1;
}
/* hasConsent: check if user gave consent */
/*
* hasConsent: check if user gave consent
*/
function hasConsent() {
if (isCookieSetTo(1)) {
setResultText(true);
......@@ -88,7 +102,9 @@ function hasConsent() {
return null;
}
/* accept: accept the cookies */
/*
* accept: accept the cookies
*/
function accept(cookieMgmt) {
// action
loadMatomo();
......@@ -107,7 +123,9 @@ function accept(cookieMgmt) {
$('.lap-cookies-refuse').removeClass('selected');
}
/* accept: refuse the cookies */
/*
* accept: refuse the cookies
*/
function refuse(cookieMgmt) {
// action
clearCookies();
......@@ -126,7 +144,9 @@ function refuse(cookieMgmt) {
$('.lap-cookies-accept').removeClass('selected');
}
/* main function */
/*
* main function
*/
$(document).ready(function() {
// accept
$('.lap-cookies-accept').click(function(e) {
......@@ -140,11 +160,11 @@ $(document).ready(function() {
refuse();
});
// Detect if the visitor is a bot or not
// Prevent for search engine take the cookie alert message as main content of the page
// detect if the visitor is a bot or not
// prevent search engine t otake the cookie alert message as main content
var isBot = settings.bots.test(navigator.userAgent);
// Check if DoNotTrack is activated
// check if DoNotTrack is active
var dnt = navigator.doNotTrack || navigator.msDoNotTrack || window.doNotTrack;
var isToTrack = (dnt !== null && dnt !== undefined) ? (dnt && dnt !== 'yes' && dnt !== 1 && dnt !== '1') : true;
var doNotTrack = false;
......
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