2020-05-16 12:49:06 +02:00
|
|
|
{% load static %}
|
|
|
|
{% load i18n %}
|
|
|
|
|
|
|
|
|
|
|
|
<!--/
|
|
|
|
Je suis spécialisé en python, pas en js...
|
|
|
|
Don't judge me
|
|
|
|
/-->
|
|
|
|
|
2020-06-19 00:35:22 +02:00
|
|
|
{#<script src="{% static 'javascripts/uikit/uikit.min.js' %}"></script>#}
|
|
|
|
{#<script src="{% static 'javascripts/uikit/uikit-icons.min.js' %}"></script>#}
|
2020-06-19 01:36:29 +02:00
|
|
|
|
|
|
|
<!-- theme -->
|
2020-05-16 12:49:06 +02:00
|
|
|
<script>
|
2021-08-01 17:52:20 +02:00
|
|
|
window.themeCheckboxes = ["theme", "themeSidebar"];
|
2020-05-16 12:49:06 +02:00
|
|
|
|
2021-08-01 17:52:20 +02:00
|
|
|
themeCheckboxes.forEach(checkbox => {
|
|
|
|
const theme = document.querySelector(`input[name=${checkbox}]`);
|
|
|
|
|
|
|
|
theme.addEventListener('change', function () {
|
|
|
|
applyTheme(theme.checked ? 'dark' : 'light');
|
|
|
|
console.log(theme)
|
|
|
|
})
|
|
|
|
|
|
|
|
theme.checked = document.documentElement.getAttribute('data-theme') === 'dark';
|
|
|
|
})
|
2020-11-05 09:51:55 +01:00
|
|
|
window.applyTheme = function (theme) {
|
2020-05-16 13:43:12 +02:00
|
|
|
document.documentElement.setAttribute('data-theme', theme);
|
|
|
|
|
2020-05-16 12:49:06 +02:00
|
|
|
let cards = document.querySelectorAll(".uk-card.uk-card-default,.uk-card.uk-card-secondary");
|
|
|
|
cards.forEach(card => {
|
2020-05-16 13:43:12 +02:00
|
|
|
if (theme === 'dark') {
|
|
|
|
card.classList.replace("uk-card-default", `uk-card-secondary`)
|
2020-05-16 12:49:06 +02:00
|
|
|
} else {
|
2020-05-16 13:43:12 +02:00
|
|
|
card.classList.replace("uk-card-secondary", `uk-card-default`)
|
2020-05-16 12:49:06 +02:00
|
|
|
}
|
|
|
|
})
|
2020-05-16 13:43:12 +02:00
|
|
|
|
2020-05-16 14:12:46 +02:00
|
|
|
window.sessionStorage.setItem('theme', theme)
|
2020-05-16 13:43:12 +02:00
|
|
|
}
|
2020-05-16 12:49:06 +02:00
|
|
|
</script>
|
|
|
|
|
2020-06-19 01:36:29 +02:00
|
|
|
<!-- sidebar -->
|
|
|
|
<script>
|
|
|
|
offcanvas_nav = document.getElementById("offcanvas-nav");
|
|
|
|
trigger = document.querySelector("a.uk-navbar-toggle")
|
|
|
|
|
|
|
|
trigger.addEventListener("click", e => {
|
|
|
|
offcanvas_nav.classList.add("uk-offcanvas", "uk-offcanvas-overlay", "uk-open")
|
|
|
|
})
|
|
|
|
|
|
|
|
offcanvas_nav.querySelector("button.uk-close").addEventListener("click", e => {
|
|
|
|
offcanvas_nav.classList.remove("uk-offcanvas-overlay", "uk-open")
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<!-- save theme -->
|
2020-05-16 12:49:06 +02:00
|
|
|
<script>
|
2020-05-16 14:12:46 +02:00
|
|
|
theme_session = window.sessionStorage.getItem('theme')
|
|
|
|
if (theme_session !== null) {
|
|
|
|
applyTheme(theme_session);
|
2021-08-01 17:52:20 +02:00
|
|
|
|
|
|
|
themeCheckboxes.forEach(checkbox => {
|
|
|
|
document.querySelector(`input[name=${checkbox}]`).checked = theme_session === 'dark'
|
|
|
|
})
|
2020-05-16 13:43:12 +02:00
|
|
|
}
|
2021-02-03 19:41:49 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<!-- status page -->
|
|
|
|
<script src="https://qgdzfv56ntr8.statuspage.io/embed/script.js"></script>
|