global: add custom context menu, fix js not working when swapping through htmx

This commit is contained in:
Agahnim 2026-03-24 16:33:32 +01:00
parent 4e69d307cf
commit d000b743a1
5 changed files with 89 additions and 20 deletions

View file

@ -83,6 +83,7 @@
</website-news>
</box>
</boxes>
<!-- Nous sommes les bestioles et nous sommes responsive -->
<chibis>
<img id="me" src="/static/assets/images/boubouille.webp" />
<img id="raplapla" src="/static/assets/images/rapla.webp" />
@ -91,7 +92,7 @@
<!-- I know I know but I need it for this pretty rainbow flagish animation -->
<script>
(function() {
(function () {
<!-- For rainbow text -->
const el = document.querySelector('woopwoop');
if (!el) return;
@ -100,28 +101,29 @@
`<span style="animation-delay: ${i * 0.08}s">${ch === ' ' ? '&nbsp;' : ch}</span>`
).join('');
const BIBOU_QUOTES = {{bibou_quotes| tojson | safe }};
const BIBOU_QUOTES = {{bibou_quotes| tojson | safe
}};
const txtEl = document.querySelector('bibou-text');
const ctrEl = document.querySelector('bibou-container');
let intervalRef = null;
const txtEl = document.querySelector('bibou-text');
const ctrEl = document.querySelector('bibou-container');
let intervalRef = null;
const ttText = (texte) => {
if (intervalRef) clearInterval(intervalRef);
const ttText = (texte) => {
if (intervalRef) clearInterval(intervalRef);
let accumulated = "";
let index = 0;
let accumulated = "";
let index = 0;
intervalRef = setInterval(() => {
if (index < texte.length) {accumulated += texte.charAt(index); txtEl.textContent = accumulated; index++;} else {
clearInterval(intervalRef); intervalRef = null;
}
}, 40);
};
intervalRef = setInterval(() => {
if (index < texte.length) {accumulated += texte.charAt(index); txtEl.textContent = accumulated; index++;} else {
clearInterval(intervalRef); intervalRef = null;
}
}, 40);
};
ctrEl.addEventListener('mouseenter', () => {
const quote = BIBOU_QUOTES[Math.floor(Math.random() * BIBOU_QUOTES.length)];
ttText(quote);
});
})();
ctrEl.addEventListener('mouseenter', () => {
const quote = BIBOU_QUOTES[Math.floor(Math.random() * BIBOU_QUOTES.length)];
ttText(quote);
});
}) ();
</script>