mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 05:48:36 +01:00
add jump to time v2
This commit is contained in:
parent
5f6d764965
commit
9b7c097f2e
1 changed files with 25 additions and 0 deletions
25
css/app.js
25
css/app.js
|
@ -132,6 +132,31 @@ timeLinks.forEach(link => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const videoPlayer = document.getElementById('video');
|
||||||
|
|
||||||
|
function time(seconds) {
|
||||||
|
videoPlayer.currentTime = seconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('click', function(event) {
|
||||||
|
const clickedElement = event.target;
|
||||||
|
|
||||||
|
if (clickedElement.classList.contains('comment')) {
|
||||||
|
const commentText = clickedElement.textContent.trim();
|
||||||
|
|
||||||
|
const timestampMatch = commentText.match(/(\d{1,2}:\d{2})/);
|
||||||
|
|
||||||
|
if (timestampMatch) {
|
||||||
|
const timestamp = timestampMatch[0];
|
||||||
|
let parts = timestamp.split(':');
|
||||||
|
let seconds = (+parts[0]) * 60 + (+parts[1]);
|
||||||
|
|
||||||
|
time(seconds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Save and resume video progress
|
// Save and resume video progress
|
||||||
|
|
Loading…
Reference in a new issue