MAPG-172 add cookie consent DIV and JS handler
This commit is contained in:
parent
251bf1be3d
commit
e8c246f002
@ -14,5 +14,30 @@
|
||||
<script src="<?= $jsFile ?>"></script>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?php if (!isset($_COOKIE['COOKIES_CONSENT'])): ?>
|
||||
<script>
|
||||
(function () {
|
||||
MapGuesser = {
|
||||
cookiesAgreed: false,
|
||||
|
||||
agreeCookies: function () {
|
||||
if (MapGuesser.cookiesAgreed) {
|
||||
return;
|
||||
}
|
||||
|
||||
var expirationDate = new Date(new Date().getTime() + 20 * 365 * 24 * 60 * 60 * 1000).toUTCString();
|
||||
document.cookie = 'COOKIES_CONSENT=1; expires=' + expirationDate + '; path=/';
|
||||
|
||||
MapGuesser.cookiesAgreed = true;
|
||||
document.getElementById('cookiesNotice').style.display = 'none';
|
||||
}
|
||||
};
|
||||
|
||||
window.onclick = function () {
|
||||
MapGuesser.agreeCookies();
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
@ -22,6 +22,14 @@
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="<?= $_ENV['STATIC_ROOT'] ?>/img/favicon/16x16.png?rev=<?= REVISION ?>">
|
||||
</head>
|
||||
<body>
|
||||
<?php if (!isset($_COOKIE['COOKIES_CONSENT'])): ?>
|
||||
<div id="cookiesNotice">
|
||||
<p class="small">
|
||||
<?= $_ENV['APP_NAME'] ?> uses cookies to improve user experience. By using the app or clicking I agree, you consent to our use of cookies.
|
||||
</p>
|
||||
<button id="agreeCookies" class="small marginTop">I agree</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div id="loading">
|
||||
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/loading.svg?rev=<?= REVISION ?>" width="64" height="64">
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user