From b03e7374a5038bf73790da4ba869d01677c53afe Mon Sep 17 00:00:00 2001 From: Silver Kuusik Date: Sun, 8 Jul 2018 20:50:42 +0200 Subject: [PATCH] add opt-in and status change listener --- assets/js/cookie.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/assets/js/cookie.js b/assets/js/cookie.js index 1086894..63cb145 100644 --- a/assets/js/cookie.js +++ b/assets/js/cookie.js @@ -1,5 +1,12 @@ +var cookiesEnabled = false; + window.addEventListener("load", function() { window.cookieconsent.initialise({ + "type": "opt-in", + "position": "bottom-right", + content: { + message: 'Please allow cookies to enable all features of this website.' + }, "palette": { "popup": { "background": "#242943ff" @@ -7,6 +14,15 @@ window.addEventListener("load", function() { "button": { "background": "#ffd500ff" } + }, + onStatusChange: function(status, chosenBefore) { + // Allow cookies + if (status == 'allow') { + cookiesEnabled = true; + // Disable cookies + } else { + cookiesEnabled = false + } } }) });