update reload

This commit is contained in:
lelo 2025-03-23 22:30:27 +01:00
parent bc72299beb
commit 81284fcc02
2 changed files with 24 additions and 9 deletions

View File

@ -323,7 +323,11 @@ window.addEventListener('popstate', function (event) {
});
let isReloadButtonVisible = true; // Boolean to track the visibility of the reload button.
function reloadDirectory() {
if (!isReloadButtonVisible) return; // Exit if the reload button is hidden.
// Extract the current path from the URL, similar to your initial load code.
let currentSubpath = '';
if (window.location.pathname.indexOf('/path/') === 0) {
@ -331,16 +335,27 @@ function reloadDirectory() {
}
loadDirectory(currentSubpath);
// Get the SVG element (assuming it's a child of the button)
const reloadBtn = document.querySelector('#reload-button svg');
const reloadBtn = document.querySelector('#reload-button');
const reloadBtnSVG = document.querySelector('#reload-button svg');
// Force reflow to reset the animation
void reloadBtn.offsetWidth;
reloadBtn.classList.add("rotate");
void reloadBtnSVG.offsetWidth;
reloadBtnSVG.classList.add("rotate");
// call function after 500 ms to remove the class
setTimeout(() => reloadBtn.classList.remove("rotate"), 500);
// Gradually fade out the button by reducing opacity over 500ms
setTimeout(() => {
reloadBtnSVG.classList.remove("rotate");
reloadBtn.style.transition = 'opacity 0.5s ease';
reloadBtn.style.opacity = '0';
isReloadButtonVisible = false; // Update the visibility status.
}, 500);
// Gradually fade back in after 10 seconds
setTimeout(() => {
reloadBtn.style.transition = 'opacity 0.5s ease';
reloadBtn.style.opacity = '1';
isReloadButtonVisible = true; // Update the visibility status.
}, 10000);
}
if ('mediaSession' in navigator) {

View File

@ -70,13 +70,13 @@
<input type="range" class="timeline" max="100" value="0" step="0.1">
<div id="timeInfo" class="now-playing-info"></div>
</div>
<button class="sound-button">
<!--button class="sound-button">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="#34495e">
<path fill-rule="evenodd" d="M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM14.657 2.929a1 1 0 011.414 0A9.972 9.972 0 0119 10a9.972 9.972 0 01-2.929 7.071 1 1 0 01-1.414-1.414A7.971 7.971 0 0017 10c0-2.21-.894-4.208-2.343-5.657a1 1 0 010-1.414zm-2.829 2.828a1 1 0 011.415 0A5.983 5.983 0 0115 10a5.984 5.984 0 01-1.757 4.243 1 1 0 01-1.415-1.415A3.984 3.984 0 0013 10a3.983 3.983 0 00-1.172-2.828 1 1 0 010-1.415z" clip-rule="evenodd" />
</svg>
</button>
</button-->
<button class="sound-button" onclick="downloadAudio()">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 122.88 120.89" fill="#34495e" width="30" height="30">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 122.88 120.89" fill="#34495e" width="35" height="35">
<path fill-rule="evenodd" d="M84.58,47a7.71,7.71,0,1,1,10.8,11L66.09,86.88a7.72,7.72,0,0,1-10.82,0L26.4,58.37a7.71,7.71,0,1,1,10.81-11L53.1,63.12l.16-55.47a7.72,7.72,0,0,1,15.43.13l-.15,55L84.58,47ZM0,113.48.1,83.3a7.72,7.72,0,1,1,15.43.14l-.07,22q46,.09,91.91,0l.07-22.12a7.72,7.72,0,1,1,15.44.14l-.1,30h-.09a7.71,7.71,0,0,1-7.64,7.36q-53.73.1-107.38,0A7.7,7.7,0,0,1,0,113.48Z"/>
</svg>
</button>