45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
function shouldShowPopup() {
|
|
dismissed = localStorage.getItem('popupDismissed');
|
|
|
|
banner = document.getElementsByClassName("cookie-banner")[0];
|
|
if (dismissed == null || dismissed === "no") {
|
|
banner.style.display = 'block';
|
|
}
|
|
}
|
|
|
|
function dismissPopup() {
|
|
localStorage.setItem('popupDismissed', 'yes');
|
|
banner = document.getElementsByClassName("cookie-banner")[0];
|
|
banner.style.display = 'none';
|
|
}
|
|
|
|
function updateCookieConsent() {
|
|
t=Matomo.getAsyncTracker();
|
|
|
|
button = document.getElementById("cookiesaction");
|
|
text = button.parentNode.getElementsByTagName('span')[0]
|
|
if (!t.areCookiesEnabled()) {
|
|
text.innerHTML = "You haven't allowed cookies to be used"
|
|
button.innerHTML = "Allow"
|
|
button.style.visibility = ""
|
|
button.onclick = function() { startCookieConsent(); }
|
|
} else {
|
|
text.innerHTML = "Using cookies to track your usage of the site"
|
|
button.innerHTML = "Stop"
|
|
button.style.visibility = ""
|
|
button.onclick = function() { stopCookieConsent(); }
|
|
}
|
|
}
|
|
|
|
function stopCookieConsent() {
|
|
t=Matomo.getAsyncTracker();
|
|
t.forgetCookieConsentGiven();
|
|
updateCookieConsent();
|
|
}
|
|
|
|
function startCookieConsent() {
|
|
t=Matomo.getAsyncTracker();
|
|
t.rememberCookieConsentGiven();
|
|
updateCookieConsent();
|
|
}
|