Update zanzara.php

This commit is contained in:
gmarco 2025-09-14 12:01:53 +02:00
parent 8bee8b82f4
commit 6593430afe

View file

@ -337,7 +337,7 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
}
/* PLAYER AUDIO CUSTOM SEMPLICE */
/* Nascondi il player nativo */
audio {
display: none;
@ -681,12 +681,8 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
order: 2;
}
.form-group button[type="submit"]:not(.random-button) {
order: 3;
}
.form-group button[type="button"] {
order: 4;
order: 3;
}
.navigation {
@ -864,7 +860,6 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
value="<?php echo htmlspecialchars($inputValue); ?>"
autocomplete="off"
inputmode="numeric">
<button type="submit">Procedi</button>
<button type="button" onclick="window.location.href=window.location.href">Reset</button>
</div>
</form>
@ -912,10 +907,10 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
echo '<audio id="audio" preload="metadata">
<source src="' . htmlspecialchars($paths['url']) . '" type="audio/mp3">
</audio>';
// Layout principale
echo '<div class="player-layout">';
// Pulsante Play/Pause
echo '<button class="play-pause-btn" id="playPauseBtn" title="Play/Pause">
<svg class="play-icon" viewBox="0 0 24 24">
@ -925,7 +920,7 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
<path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/>
</svg>
</button>';
// Container progresso
echo '<div class="progress-container">';
echo '<div class="progress-bar" id="progressBar">
@ -936,7 +931,7 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
echo '<span class="time-display" id="duration">0:00</span>';
echo '</div>';
echo '</div>';
echo '</div>'; // Chiude player-layout
echo '</div>'; // Chiude custom-audio-player
@ -950,10 +945,10 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
const currentTimeDisplay = document.getElementById("currentTime");
const durationDisplay = document.getElementById("duration");
const audioPlayer = document.getElementById("audioPlayer");
let isPlaying = false;
let isDragging = false;
// Formatta il tempo
function formatTime(seconds) {
if (isNaN(seconds)) return "0:00";
@ -961,28 +956,28 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
const secs = Math.floor(seconds % 60);
return mins + ":" + (secs < 10 ? "0" : "") + secs;
}
// Funzione per aggiornare la posizione
function updateProgress(e) {
const rect = progressBar.getBoundingClientRect();
let x;
// Supporto per touch e mouse
if (e.touches) {
x = e.touches[0].clientX - rect.left;
} else {
x = e.clientX - rect.left;
}
const clickPercent = Math.max(0, Math.min(1, x / rect.width));
if (audio.duration) {
audio.currentTime = clickPercent * audio.duration;
progressFill.style.width = (clickPercent * 100) + "%";
currentTimeDisplay.textContent = formatTime(audio.currentTime);
}
}
// Play/Pause
playPauseBtn.addEventListener("click", function() {
if (isPlaying) {
@ -991,22 +986,22 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
audio.play();
}
});
audio.addEventListener("play", function() {
isPlaying = true;
audioPlayer.classList.add("playing");
});
audio.addEventListener("pause", function() {
isPlaying = false;
audioPlayer.classList.remove("playing");
});
// Aggiorna durata quando disponibile
audio.addEventListener("loadedmetadata", function() {
durationDisplay.textContent = formatTime(audio.duration);
});
// Aggiorna progresso durante la riproduzione
audio.addEventListener("timeupdate", function() {
if (!isDragging && audio.duration) {
@ -1015,7 +1010,7 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
currentTimeDisplay.textContent = formatTime(audio.currentTime);
}
});
// Eventi Mouse
progressBar.addEventListener("mousedown", function(e) {
isDragging = true;
@ -1023,20 +1018,20 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
updateProgress(e);
e.preventDefault();
});
document.addEventListener("mousemove", function(e) {
if (isDragging) {
updateProgress(e);
}
});
document.addEventListener("mouseup", function() {
if (isDragging) {
isDragging = false;
audioPlayer.classList.remove("dragging");
}
});
// Eventi Touch
progressBar.addEventListener("touchstart", function(e) {
isDragging = true;
@ -1044,42 +1039,42 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
updateProgress(e);
e.preventDefault();
});
document.addEventListener("touchmove", function(e) {
if (isDragging) {
updateProgress(e);
e.preventDefault();
}
});
document.addEventListener("touchend", function() {
if (isDragging) {
isDragging = false;
audioPlayer.classList.remove("dragging");
}
});
// Click semplice sulla barra
progressBar.addEventListener("click", function(e) {
if (!isDragging) {
updateProgress(e);
}
});
// Auto-play
audio.play().catch(function(error) {
console.log("Autoplay bloccato:", error);
});
// Gestione buffering
audio.addEventListener("waiting", function() {
audioPlayer.classList.add("buffering");
});
audio.addEventListener("canplay", function() {
audioPlayer.classList.remove("buffering");
});
// Fine del file
audio.addEventListener("ended", function() {
isPlaying = false;
@ -1235,6 +1230,16 @@ $(document).ready(function() {
}
});
// Gestione invio con Enter nell'input
$('#datepicker').on('keypress', function(e) {
if (e.which === 13) { // Enter key
e.preventDefault();
if ($(this).val().length === 8) { // Controlla che sia nel formato YYYYMMDD
$('#dateForm').submit();
}
}
});
// Aggiungi scorciatoie da tastiera per navigazione
$(document).keydown(function(e) {
if ($('input:focus').length === 0) { // Solo se non si sta digitando in un input
@ -1276,7 +1281,7 @@ $(document).ready(function() {
🔗 Pagina ufficiale LaZanzara
</a>
</p>
<p>- - - powered by Gabry, Claude and me - v1.0.0 (01/08/2025) - - -</p>
<p>- - - powered by Gabry, Claude and me - v1.1.0 (14/09/2025) - - -</p>
</footer>
</body>
</html>
</html>