From 3555be9b63722e65cfb1cc202591eb56414e197a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 28 Jun 2020 17:56:47 +0200 Subject: [PATCH] MAPG-188 get rid of inline js --- public/static/js/mapguesser.js | 19 +++++++++++++++++++ views/templates/mapguesser.php | 29 +---------------------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/public/static/js/mapguesser.js b/public/static/js/mapguesser.js index 73f964c..8af9ffe 100644 --- a/public/static/js/mapguesser.js +++ b/public/static/js/mapguesser.js @@ -244,4 +244,23 @@ var MapGuesser = { document.getElementById('cover').onclick = function () { MapGuesser.hideModal(); }; + + if (COOKIES_CONSENT) { + MapGuesser.initGoogleAnalitics(); + } else { + // we don't want user to agree cookies when clicking on the notice itself + document.getElementById('cookiesNotice').onclick = function (e) { + e.stopPropagation(); + }; + + document.getElementById('agreeCookiesButton').onclick = function () { + MapGuesser.agreeCookies(); + + document.getElementById('cookiesNotice').style.display = 'none'; + }; + + window.onclick = function () { + MapGuesser.agreeCookies(); + }; + } })(); diff --git a/views/templates/mapguesser.php b/views/templates/mapguesser.php index 499f3ea..d2f3dc6 100644 --- a/views/templates/mapguesser.php +++ b/views/templates/mapguesser.php @@ -42,38 +42,11 @@ const GOOGLE_ANALITICS_ID = ''; + const COOKIES_CONSENT = ; @yields('pageScript') @yields('externalJs') @yields('inlineJs') - - - - - - -