home: fix js not being able to load after routing through htmx
This commit is contained in:
parent
9e47d0ce83
commit
d5e6c8a82c
2 changed files with 27 additions and 26 deletions
|
|
@ -216,7 +216,6 @@ table {
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
|
||||||
background-image: url(assets/images/tiledbgpink.webp);
|
background-image: url(assets/images/tiledbgpink.webp);
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
|
|
|
||||||
|
|
@ -91,35 +91,37 @@
|
||||||
|
|
||||||
<!-- I know I know but I need it for this pretty rainbow flagish animation -->
|
<!-- I know I know but I need it for this pretty rainbow flagish animation -->
|
||||||
<script>
|
<script>
|
||||||
<!-- For rainbow text -->
|
(function() {
|
||||||
const el = document.querySelector('woopwoop');
|
<!-- For rainbow text -->
|
||||||
const text = el.textContent;
|
const el = document.querySelector('woopwoop');
|
||||||
el.innerHTML = text.split('').map((ch, i) =>
|
if (!el) return;
|
||||||
`<span style="animation-delay: ${i * 0.08}s">${ch === ' ' ? ' ' : ch}</span>`
|
const text = el.textContent;
|
||||||
).join('');
|
el.innerHTML = text.split('').map((ch, i) =>
|
||||||
|
`<span style="animation-delay: ${i * 0.08}s">${ch === ' ' ? ' ' : ch}</span>`
|
||||||
|
).join('');
|
||||||
|
|
||||||
|
const BIBOU_QUOTES = {{bibou_quotes| tojson | safe }};
|
||||||
|
|
||||||
|
const txtEl = document.querySelector('bibou-text');
|
||||||
|
const ctrEl = document.querySelector('bibou-container');
|
||||||
|
let intervalRef = null;
|
||||||
|
|
||||||
const BIBOU_QUOTES = {{bibou_quotes| tojson | safe }};
|
const ttText = (texte) => {
|
||||||
|
if (intervalRef) clearInterval(intervalRef);
|
||||||
|
|
||||||
const txtEl = document.querySelector('bibou-text');
|
let accumulated = "";
|
||||||
const ctrEl = document.querySelector('bibou-container');
|
let index = 0;
|
||||||
let intervalRef = null;
|
|
||||||
|
|
||||||
const ttText = (texte) => {
|
intervalRef = setInterval(() => {
|
||||||
if (intervalRef) clearInterval(intervalRef);
|
if (index < texte.length) {accumulated += texte.charAt(index); txtEl.textContent = accumulated; index++;} else {
|
||||||
|
clearInterval(intervalRef); intervalRef = null;
|
||||||
let accumulated = "";
|
}
|
||||||
let index = 0;
|
}, 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>
|
</script>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue