style: auto-fix linting issues
This commit is contained in:
parent
993698b666
commit
9fc20c973b
1 changed files with 8 additions and 7 deletions
15
js/events.js
15
js/events.js
|
|
@ -317,10 +317,10 @@ function initializeSmoothSliders(audioPlayer, player) {
|
||||||
|
|
||||||
const updateSeekUI = (position) => {
|
const updateSeekUI = (position) => {
|
||||||
if (!isNaN(audioPlayer.duration)) {
|
if (!isNaN(audioPlayer.duration)) {
|
||||||
progressFill.style.width = `${position * 100}%`;
|
progressFill.style.width = `${position * 100}%`;
|
||||||
if (currentTimeEl) {
|
if (currentTimeEl) {
|
||||||
currentTimeEl.textContent = formatTime(position * audioPlayer.duration);
|
currentTimeEl.textContent = formatTime(position * audioPlayer.duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -346,7 +346,7 @@ function initializeSmoothSliders(audioPlayer, player) {
|
||||||
const touch = e.touches[0];
|
const touch = e.touches[0];
|
||||||
const rect = progressBar.getBoundingClientRect();
|
const rect = progressBar.getBoundingClientRect();
|
||||||
const position = Math.max(0, Math.min(1, (touch.clientX - rect.left) / rect.width));
|
const position = Math.max(0, Math.min(1, (touch.clientX - rect.left) / rect.width));
|
||||||
|
|
||||||
lastSeekPosition = position;
|
lastSeekPosition = position;
|
||||||
updateSeekUI(position);
|
updateSeekUI(position);
|
||||||
});
|
});
|
||||||
|
|
@ -377,7 +377,7 @@ function initializeSmoothSliders(audioPlayer, player) {
|
||||||
const touch = e.touches[0];
|
const touch = e.touches[0];
|
||||||
const rect = progressBar.getBoundingClientRect();
|
const rect = progressBar.getBoundingClientRect();
|
||||||
const position = Math.max(0, Math.min(1, (touch.clientX - rect.left) / rect.width));
|
const position = Math.max(0, Math.min(1, (touch.clientX - rect.left) / rect.width));
|
||||||
|
|
||||||
lastSeekPosition = position;
|
lastSeekPosition = position;
|
||||||
updateSeekUI(position);
|
updateSeekUI(position);
|
||||||
}
|
}
|
||||||
|
|
@ -428,7 +428,8 @@ function initializeSmoothSliders(audioPlayer, player) {
|
||||||
});
|
});
|
||||||
|
|
||||||
progressBar.addEventListener('click', (e) => {
|
progressBar.addEventListener('click', (e) => {
|
||||||
if (!isSeeking) { // Only handle click if not result of a drag release
|
if (!isSeeking) {
|
||||||
|
// Only handle click if not result of a drag release
|
||||||
seek(progressBar, e, (position) => {
|
seek(progressBar, e, (position) => {
|
||||||
if (!isNaN(audioPlayer.duration) && audioPlayer.duration > 0 && audioPlayer.duration !== Infinity) {
|
if (!isNaN(audioPlayer.duration) && audioPlayer.duration > 0 && audioPlayer.duration !== Infinity) {
|
||||||
audioPlayer.currentTime = position * audioPlayer.duration;
|
audioPlayer.currentTime = position * audioPlayer.duration;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue