pub / yt2html

Fetches Youtube content via RSS and provides a chronological timeline
git clone https://src.jayvii.de/pub/yt2html.git
Home | Log | Files | Exports | Refs | README | RSS

commit 014d7d6cdfeeb31dd82f830e0e5613082a855425
parent c038f723aec72873a5ef9f701bb0fedb06ef0916
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Tue, 10 Nov 2026 19:33:47 +0100

fix: initilise channels object correctly

Diffstat:
Massets/css/custom.css | 26++++++++++++++------------
Massets/js/yt.js | 14++++----------
Mindex.php | 4+++-
3 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/assets/css/custom.css b/assets/css/custom.css @@ -77,33 +77,35 @@ a[href^="https"]:where([href*="www.youtube.com"])::after { display: none; } -#loading { - width: 15px; - height: 15px; +#loading_dot { + width: 0.5em; + height: 0.5em; + margin-top: 0.5em; background-color: #fcd000; border-radius: 50%; position: absolute; - top: 23px; - left: 23px; - -webkit-animation: pulsate 1s ease-out; + -webkit-animation: pulsate 2s ease-out; -webkit-animation-iteration-count: infinite; opacity: 0; } +#loading_text { + margin-left: 1em; +} -#loading.finished { - background-color: ##62bd19; +#loading.finished > #loading_dot { + background-color: #62bd19 !important; opacity: 1 !important; } -#loading:not(.finished)::after { +#loading:not(.finished) > #loading_text::after { content: "Loading..."; } -#loading.finished::after { +#loading.finished > #loading_text::after { content: "Finished!"; } @-webkit-keyframes pulsate { - 0% {-webkit-transform: scale(0.1, 0.1); opacity: 0.0;} + 0% {opacity: 0.0;} 50% {opacity: 1.0;} - 100% {-webkit-transform: scale(1.2, 1.2); opacity: 0.0;} + 100% {opacity: 0.0;} } diff --git a/assets/js/yt.js b/assets/js/yt.js @@ -186,18 +186,12 @@ async function fetch_and_insert_yt(channel) { // Update loaded channels global loaded_channels.push(channel); + loading_indicator(); } -async function loading_indicator() { - while (true) { - - var await_channels = document.querySelector("#loading").getAttribute("data"); - if (await_channels == loaded_channels.sort) { +function loading_indicator() { + var await_channels = document.querySelector("#loading").getAttribute("data").split(","); + if (await_channels.length == loaded_channels.length) { document.querySelector("#loading").classList.add("finished") - break; } - - // sleep - await new Promise(r => setTimeout(r, 2000)); - } } diff --git a/index.php b/index.php @@ -146,11 +146,13 @@ </a> </nav> <h1>Videos</h1> + <script>let loaded_channels = [];</script> <stretch id="loading" - onload="let loaded_channels = []; loading_indicator();" data="<?php echo implode(",", $channels); ?>" > + <i id="loading_dot"></i> + <span id="loading_text"></span> </stretch> </header>