Verified Commit a6a80e51 authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

minor changes

parent bd772610
<p> <p>
<a href="privacyPolicy">Privacy Policy</a> <a href="privacyPolicy">Privacy Policy</a>
(<span id="gdpr-result-text"></span> - <a href="javascript: showCookieBanner();">change</a>) (<span id="gdpr-result-text"></span> - <a href="javascript: showBanner();">change</a>)
</p> </p>
\ No newline at end of file
...@@ -32,15 +32,15 @@ function setResultText(acceptCookies){ ...@@ -32,15 +32,15 @@ function setResultText(acceptCookies){
} }
} }
/* showCookieBanner: show the banner */ /* showBanner: show the banner */
function showCookieBanner() { function showBanner() {
var popup = $('#lap-cookies-banner'); var popup = $('#lap-cookies-banner');
popup.hide(); popup.hide();
popup.slideDown('slow'); popup.slideDown('slow');
} }
/* hideCookieBanner: show the banner */ /* hideBanner: show the banner */
function hideCookieBanner() { function hideBanner() {
var popup = $('#lap-cookies-banner'); var popup = $('#lap-cookies-banner');
popup.hide(); popup.hide();
} }
...@@ -97,7 +97,7 @@ function accept(cookieMgmt) { ...@@ -97,7 +97,7 @@ function accept(cookieMgmt) {
} }
// feedback // feedback
hideCookieBanner(); hideBanner();
setResultText(true); setResultText(true);
// style // style
...@@ -116,7 +116,7 @@ function refuse(cookieMgmt) { ...@@ -116,7 +116,7 @@ function refuse(cookieMgmt) {
} }
// feedback // feedback
hideCookieBanner(); hideBanner();
setResultText(false); setResultText(false);
// style // style
...@@ -124,15 +124,15 @@ function refuse(cookieMgmt) { ...@@ -124,15 +124,15 @@ function refuse(cookieMgmt) {
$('.lap-cookies-accept').removeClass('selected'); $('.lap-cookies-accept').removeClass('selected');
} }
/* 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();
...@@ -145,22 +145,21 @@ $( document ).ready(function() { ...@@ -145,22 +145,21 @@ $( document ).ready(function() {
// Check if DoNotTrack is activated // Check if DoNotTrack is activated
var dnt = navigator.doNotTrack || navigator.msDoNotTrack || window.doNotTrack; var dnt = navigator.doNotTrack || navigator.msDoNotTrack || window.doNotTrack;
var isToTrack = (dnt !== null && dnt !== undefined) ? (dnt && dnt !== 'yes' && dnt !== 1 && dnt !== '1') : true; var isToTrack = (dnt !== null && dnt !== undefined) ? (dnt && dnt !== 'yes' && dnt !== 1 && dnt !== '1') : true;
var doNotTrack = false; var doNotTrack = false;
// Do nothing if it is a bot
// If DoNotTrack is activated, do nothing too // do nothing if it is a bot or if DoNotTrack is active
if (isBot || !isToTrack || !hasConsent()) { if (isBot || !isToTrack || !hasConsent()) {
refuse(false); refuse(false);
doNotTrack = true; doNotTrack = true;
} }
// User has already consent to use cookies to tracking if (doNotTrack === false) {
if (doNotTrack == false) {
if (hasConsent() === true) { if (hasConsent() === true) {
// user has already given consent to use cookies to tracking
accept(true); accept(true);
} else if (hasConsent() === false) { } else if (hasConsent() === false) {
// If it's not a bot, no DoNotTrack and not already accept, so show banner // all other cases considered, show banner
showCookieBanner(); showBanner();
} }
} }
}); });
\ No newline at end of file
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