mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 04:18:55 +01:00
Update html/poketube.ejs
This commit is contained in:
parent
40a8e92e80
commit
c89ba51f57
1 changed files with 25 additions and 1 deletions
|
@ -719,6 +719,21 @@ background-color: #0000;
|
||||||
secs.toString().padStart(2, '0');
|
secs.toString().padStart(2, '0');
|
||||||
}
|
}
|
||||||
return timeString;
|
return timeString;
|
||||||
|
}
|
||||||
|
function cstsRemaining(totalTimeInSeconds, elapsedTimeInSeconds) {
|
||||||
|
var remainingSeconds = totalTimeInSeconds - elapsedTimeInSeconds;
|
||||||
|
var hours = Math.floor(remainingSeconds / 3600);
|
||||||
|
var minutes = Math.floor((remainingSeconds % 3600) / 60);
|
||||||
|
var secs = Math.floor(remainingSeconds % 60);
|
||||||
|
|
||||||
|
var timeString;
|
||||||
|
if (hours === 0) {
|
||||||
|
timeString = minutes.toString().padStart(2, '0') + ':' + secs.toString().padStart(2, '0');
|
||||||
|
} else {
|
||||||
|
timeString = hours.toString().padStart(2, '0') + ':' + minutes.toString().padStart(2, '0') + ':' + secs.toString().padStart(2, '0');
|
||||||
|
}
|
||||||
|
|
||||||
|
return '-' + timeString;
|
||||||
}
|
}
|
||||||
function showErrorCard(e) {
|
function showErrorCard(e) {
|
||||||
try {
|
try {
|
||||||
|
@ -755,9 +770,18 @@ background-color: #0000;
|
||||||
let setTime = false
|
let setTime = false
|
||||||
const seekbar = document.getElementById("duration-slider")
|
const seekbar = document.getElementById("duration-slider")
|
||||||
const video = document.getElementById("video");
|
const video = document.getElementById("video");
|
||||||
|
let shouldUseRemaining = false;
|
||||||
|
const timestamps = document.getElementById("timestamps");
|
||||||
video.addEventListener("timeupdate", (event) => {
|
video.addEventListener("timeupdate", (event) => {
|
||||||
seekbar.value = event.target.currentTime;
|
seekbar.value = event.target.currentTime;
|
||||||
const timestamps = document.getElementById("timestamps");
|
timestamps.innerText = shouldUseRemaining ? `${cstsRemaining(video.duration, video.currentTime)}/${csts(video.duration)}` : `${csts(video.currentTime)}/${csts(video.duration)}`;
|
||||||
|
});
|
||||||
|
timestamps.addEventListener("mouseover", () => {
|
||||||
|
shouldUseRemaining = true;
|
||||||
|
timestamps.innerText = `${cstsRemaining(video.duration, video.currentTime)}/${csts(video.duration)}`;
|
||||||
|
});
|
||||||
|
timestamps.addEventListener("mouseout", () => {
|
||||||
|
shouldUseRemaining = false;
|
||||||
timestamps.innerText = `${csts(video.currentTime)}/${csts(video.duration)}`;
|
timestamps.innerText = `${csts(video.currentTime)}/${csts(video.duration)}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue