Update zanzara.php
This commit is contained in:
parent
8bee8b82f4
commit
6593430afe
1 changed files with 40 additions and 35 deletions
75
zanzara.php
75
zanzara.php
|
|
@ -337,7 +337,7 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PLAYER AUDIO CUSTOM SEMPLICE */
|
/* PLAYER AUDIO CUSTOM SEMPLICE */
|
||||||
|
|
||||||
/* Nascondi il player nativo */
|
/* Nascondi il player nativo */
|
||||||
audio {
|
audio {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
@ -681,12 +681,8 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
|
||||||
order: 2;
|
order: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group button[type="submit"]:not(.random-button) {
|
|
||||||
order: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-group button[type="button"] {
|
.form-group button[type="button"] {
|
||||||
order: 4;
|
order: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navigation {
|
.navigation {
|
||||||
|
|
@ -864,7 +860,6 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
|
||||||
value="<?php echo htmlspecialchars($inputValue); ?>"
|
value="<?php echo htmlspecialchars($inputValue); ?>"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
inputmode="numeric">
|
inputmode="numeric">
|
||||||
<button type="submit">Procedi</button>
|
|
||||||
<button type="button" onclick="window.location.href=window.location.href">Reset</button>
|
<button type="button" onclick="window.location.href=window.location.href">Reset</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -912,10 +907,10 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
|
||||||
echo '<audio id="audio" preload="metadata">
|
echo '<audio id="audio" preload="metadata">
|
||||||
<source src="' . htmlspecialchars($paths['url']) . '" type="audio/mp3">
|
<source src="' . htmlspecialchars($paths['url']) . '" type="audio/mp3">
|
||||||
</audio>';
|
</audio>';
|
||||||
|
|
||||||
// Layout principale
|
// Layout principale
|
||||||
echo '<div class="player-layout">';
|
echo '<div class="player-layout">';
|
||||||
|
|
||||||
// Pulsante Play/Pause
|
// Pulsante Play/Pause
|
||||||
echo '<button class="play-pause-btn" id="playPauseBtn" title="Play/Pause">
|
echo '<button class="play-pause-btn" id="playPauseBtn" title="Play/Pause">
|
||||||
<svg class="play-icon" viewBox="0 0 24 24">
|
<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"/>
|
<path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>';
|
</button>';
|
||||||
|
|
||||||
// Container progresso
|
// Container progresso
|
||||||
echo '<div class="progress-container">';
|
echo '<div class="progress-container">';
|
||||||
echo '<div class="progress-bar" id="progressBar">
|
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 '<span class="time-display" id="duration">0:00</span>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '</div>'; // Chiude player-layout
|
echo '</div>'; // Chiude player-layout
|
||||||
echo '</div>'; // Chiude custom-audio-player
|
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 currentTimeDisplay = document.getElementById("currentTime");
|
||||||
const durationDisplay = document.getElementById("duration");
|
const durationDisplay = document.getElementById("duration");
|
||||||
const audioPlayer = document.getElementById("audioPlayer");
|
const audioPlayer = document.getElementById("audioPlayer");
|
||||||
|
|
||||||
let isPlaying = false;
|
let isPlaying = false;
|
||||||
let isDragging = false;
|
let isDragging = false;
|
||||||
|
|
||||||
// Formatta il tempo
|
// Formatta il tempo
|
||||||
function formatTime(seconds) {
|
function formatTime(seconds) {
|
||||||
if (isNaN(seconds)) return "0:00";
|
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);
|
const secs = Math.floor(seconds % 60);
|
||||||
return mins + ":" + (secs < 10 ? "0" : "") + secs;
|
return mins + ":" + (secs < 10 ? "0" : "") + secs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funzione per aggiornare la posizione
|
// Funzione per aggiornare la posizione
|
||||||
function updateProgress(e) {
|
function updateProgress(e) {
|
||||||
const rect = progressBar.getBoundingClientRect();
|
const rect = progressBar.getBoundingClientRect();
|
||||||
let x;
|
let x;
|
||||||
|
|
||||||
// Supporto per touch e mouse
|
// Supporto per touch e mouse
|
||||||
if (e.touches) {
|
if (e.touches) {
|
||||||
x = e.touches[0].clientX - rect.left;
|
x = e.touches[0].clientX - rect.left;
|
||||||
} else {
|
} else {
|
||||||
x = e.clientX - rect.left;
|
x = e.clientX - rect.left;
|
||||||
}
|
}
|
||||||
|
|
||||||
const clickPercent = Math.max(0, Math.min(1, x / rect.width));
|
const clickPercent = Math.max(0, Math.min(1, x / rect.width));
|
||||||
|
|
||||||
if (audio.duration) {
|
if (audio.duration) {
|
||||||
audio.currentTime = clickPercent * audio.duration;
|
audio.currentTime = clickPercent * audio.duration;
|
||||||
progressFill.style.width = (clickPercent * 100) + "%";
|
progressFill.style.width = (clickPercent * 100) + "%";
|
||||||
currentTimeDisplay.textContent = formatTime(audio.currentTime);
|
currentTimeDisplay.textContent = formatTime(audio.currentTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play/Pause
|
// Play/Pause
|
||||||
playPauseBtn.addEventListener("click", function() {
|
playPauseBtn.addEventListener("click", function() {
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
|
|
@ -991,22 +986,22 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
|
||||||
audio.play();
|
audio.play();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
audio.addEventListener("play", function() {
|
audio.addEventListener("play", function() {
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
audioPlayer.classList.add("playing");
|
audioPlayer.classList.add("playing");
|
||||||
});
|
});
|
||||||
|
|
||||||
audio.addEventListener("pause", function() {
|
audio.addEventListener("pause", function() {
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
audioPlayer.classList.remove("playing");
|
audioPlayer.classList.remove("playing");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Aggiorna durata quando disponibile
|
// Aggiorna durata quando disponibile
|
||||||
audio.addEventListener("loadedmetadata", function() {
|
audio.addEventListener("loadedmetadata", function() {
|
||||||
durationDisplay.textContent = formatTime(audio.duration);
|
durationDisplay.textContent = formatTime(audio.duration);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Aggiorna progresso durante la riproduzione
|
// Aggiorna progresso durante la riproduzione
|
||||||
audio.addEventListener("timeupdate", function() {
|
audio.addEventListener("timeupdate", function() {
|
||||||
if (!isDragging && audio.duration) {
|
if (!isDragging && audio.duration) {
|
||||||
|
|
@ -1015,7 +1010,7 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
|
||||||
currentTimeDisplay.textContent = formatTime(audio.currentTime);
|
currentTimeDisplay.textContent = formatTime(audio.currentTime);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Eventi Mouse
|
// Eventi Mouse
|
||||||
progressBar.addEventListener("mousedown", function(e) {
|
progressBar.addEventListener("mousedown", function(e) {
|
||||||
isDragging = true;
|
isDragging = true;
|
||||||
|
|
@ -1023,20 +1018,20 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
|
||||||
updateProgress(e);
|
updateProgress(e);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("mousemove", function(e) {
|
document.addEventListener("mousemove", function(e) {
|
||||||
if (isDragging) {
|
if (isDragging) {
|
||||||
updateProgress(e);
|
updateProgress(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("mouseup", function() {
|
document.addEventListener("mouseup", function() {
|
||||||
if (isDragging) {
|
if (isDragging) {
|
||||||
isDragging = false;
|
isDragging = false;
|
||||||
audioPlayer.classList.remove("dragging");
|
audioPlayer.classList.remove("dragging");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Eventi Touch
|
// Eventi Touch
|
||||||
progressBar.addEventListener("touchstart", function(e) {
|
progressBar.addEventListener("touchstart", function(e) {
|
||||||
isDragging = true;
|
isDragging = true;
|
||||||
|
|
@ -1044,42 +1039,42 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_valid_dates') {
|
||||||
updateProgress(e);
|
updateProgress(e);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("touchmove", function(e) {
|
document.addEventListener("touchmove", function(e) {
|
||||||
if (isDragging) {
|
if (isDragging) {
|
||||||
updateProgress(e);
|
updateProgress(e);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("touchend", function() {
|
document.addEventListener("touchend", function() {
|
||||||
if (isDragging) {
|
if (isDragging) {
|
||||||
isDragging = false;
|
isDragging = false;
|
||||||
audioPlayer.classList.remove("dragging");
|
audioPlayer.classList.remove("dragging");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click semplice sulla barra
|
// Click semplice sulla barra
|
||||||
progressBar.addEventListener("click", function(e) {
|
progressBar.addEventListener("click", function(e) {
|
||||||
if (!isDragging) {
|
if (!isDragging) {
|
||||||
updateProgress(e);
|
updateProgress(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Auto-play
|
// Auto-play
|
||||||
audio.play().catch(function(error) {
|
audio.play().catch(function(error) {
|
||||||
console.log("Autoplay bloccato:", error);
|
console.log("Autoplay bloccato:", error);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Gestione buffering
|
// Gestione buffering
|
||||||
audio.addEventListener("waiting", function() {
|
audio.addEventListener("waiting", function() {
|
||||||
audioPlayer.classList.add("buffering");
|
audioPlayer.classList.add("buffering");
|
||||||
});
|
});
|
||||||
|
|
||||||
audio.addEventListener("canplay", function() {
|
audio.addEventListener("canplay", function() {
|
||||||
audioPlayer.classList.remove("buffering");
|
audioPlayer.classList.remove("buffering");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fine del file
|
// Fine del file
|
||||||
audio.addEventListener("ended", function() {
|
audio.addEventListener("ended", function() {
|
||||||
isPlaying = false;
|
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
|
// Aggiungi scorciatoie da tastiera per navigazione
|
||||||
$(document).keydown(function(e) {
|
$(document).keydown(function(e) {
|
||||||
if ($('input:focus').length === 0) { // Solo se non si sta digitando in un input
|
if ($('input:focus').length === 0) { // Solo se non si sta digitando in un input
|
||||||
|
|
@ -1276,7 +1281,7 @@ $(document).ready(function() {
|
||||||
🔗 Pagina ufficiale LaZanzara
|
🔗 Pagina ufficiale LaZanzara
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</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>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue