fix(cookie): fix shitty cookie banner

This commit is contained in:
Romain J 2020-06-19 00:56:31 +02:00
parent a30b4841e8
commit 12a35c3fbc
3 changed files with 23 additions and 12 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="true" />
<option name="show" value="PROJECT_FILES" />
</component>
<component name="ProjectNotificationSettings">
<option name="askShowProject" value="false" />

View file

@ -36,17 +36,15 @@ Don't judge me
<script>
cookies = document.cookie.split('; ');
banner_cookie = document.cookie.split('; ').filter(e => e.startsWith('cookie-banner='))[0];
banner_cookie_div = document.getElementById("banner_cookie_div");
if (banner_cookie === undefined || banner_cookie.split('cookie-banner=')[1] !== 'hidden') {
cookie_notification = UIkit.notification(
'<span data-uk-icon="quote-right"></span> {% trans "Bla bla bla... bannière alakon pour dire qu&amp;on utilise des cookies (pour la langue et cette bannière)" %}',
{pos: 'bottom-center'}
);
UIkit.util.on(document, 'close', function (evt) {
if (evt.detail[0] === cookie_notification) {
document.cookie = 'cookie-banner=hidden'
}
banner_cookie_div.querySelector("a.uk-close").addEventListener('click', event => {
document.cookie = 'cookie-banner=hidden';
banner_cookie_div.style.display = "none"
});
} else {
banner_cookie_div.style.display = "none"
}
</script>

View file

@ -11,7 +11,8 @@
<a class="uk-text-small uk-button-link" href="https://git.gnous.eu/Romain">Romain J.</a>
<span class="uk-text-small uk-text-muted"> | {% trans "Fait avec" %} </span>
<a href="http://getuikit.com" target="_blank" class="uk-text-small uk-button-link"><span data-uk-icon="uikit" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="uikit"><polygon points="14.4,3.1 11.3,5.1 15,7.3 15,12.9 10,15.7 5,12.9 5,8.5 2,6.8 2,14.8 9.9,19.5 18,14.8 18,5.3"></polygon><polygon points="9.8,4.2 6.7,2.4 9.8,0.4 12.9,2.3"></polygon></svg></span></a>
<a href="http://getuikit.com" target="_blank" class="uk-text-small uk-button-link"><span data-uk-icon="uikit" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="uikit"><polygon
points="14.4,3.1 11.3,5.1 15,7.3 15,12.9 10,15.7 5,12.9 5,8.5 2,6.8 2,14.8 9.9,19.5 18,14.8 18,5.3"></polygon><polygon points="9.8,4.2 6.7,2.4 9.8,0.4 12.9,2.3"></polygon></svg></span></a>
<span class="uk-text-small uk-text-muted"> | Version: </span>
<a href="https://git.gnous.eu/gnouseu/gnousdoteu/src/commit/{% version 'long' %}" target="_blank" class="uk-text-small uk-button-link">{% version 'short' %}</a>
@ -20,7 +21,7 @@
<noscript>
<style>
.need-js {
display: none!important;
display: none !important;
}
</style>
</noscript>
@ -30,4 +31,16 @@
</label>
</div>
</div>
</footer>
</footer>
<div id="banner_cookie_div" class="uk-notification uk-notification-bottom-center" style="display: block">
<div class="uk-notification-message" style="opacity: 1; margin-bottom: 0px;">
<a href="" class="uk-notification-close uk-icon uk-close">
<svg width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg" data-svg="close-icon">
<line fill="none" stroke="#000" stroke-width="1.1" x1="1" y1="1" x2="13" y2="13"></line>
<line fill="none" stroke="#000" stroke-width="1.1" x1="13" y1="1" x2="1" y2="13"></line>
</svg>
</a>
<div>{% trans "Bla bla bla... bannière alakon pour dire qu&amp;on utilise des cookies (pour la langue et cette bannière)" %}</div>
</div>
</div>