gnousdoteu-v3/apps/gnous_eu/templates/layouts/foot.html

55 lines
No EOL
2.1 KiB
HTML

{% load static %}
{% load i18n %}
<!--/
Je suis spécialisé en python, pas en js...
Don't judge me
/-->
<script src="{% static 'javascripts/uikit/uikit.js' %}"></script>
<script src="{% static 'javascripts/uikit/uikit-icons.js' %}"></script>
<script>
window.theme = document.querySelector('input[name=theme]');
theme.checked = document.documentElement.getAttribute('data-theme') === 'dark';
theme.addEventListener('change', function () {
document.documentElement.setAttribute('data-theme', this.checked ? 'dark' : 'light')
let cards = document.querySelectorAll(".uk-card.uk-card-default,.uk-card.uk-card-secondary");
cards.forEach(card => {
if (document.documentElement.getAttribute('data-theme') === 'dark') {
card.classList.replace("uk-card-default", `uk-card-secondary`);
} else {
card.classList.replace("uk-card-secondary", `uk-card-default`);
}
})
})
</script>
<script>
let cookies = document.cookie.split('; ');
let banner_cookie = document.cookie.split('; ').filter(e => e.startsWith('cookie-banner='))[0]
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'
}
});
}
</script>
<script>
let cards = document.querySelectorAll(".uk-card.uk-card-default,.uk-card.uk-card-secondary");
cards.forEach(card => {
if (document.documentElement.getAttribute('data-theme') === 'dark') {
card.classList.replace("uk-card-default", `uk-card-secondary`);
} else {
card.classList.replace("uk-card-secondary", `uk-card-default`);
}
})
</script>