mirror of
https://github.com/goodtube4u/goodtube.git
synced 2025-11-22 10:16:11 +00:00
Timestamp fix'
This commit is contained in:
12
goodtube.js
12
goodtube.js
@@ -413,16 +413,22 @@
|
||||
// For each link
|
||||
timestampLinks.forEach((element) => {
|
||||
// Make sure we've not touched it yet, this stops doubling up on event listeners
|
||||
if (!element.classList.contains('goodTube_timestampLink') && element.getAttribute('href') && element.getAttribute('href').indexOf(goodTube_getParams['v']) !== -1 && element.getAttribute('href').indexOf('t=') !== -1) {
|
||||
if (!element.classList.contains('goodTube_timestampLink') && element.getAttribute('href') && element.getAttribute('href').indexOf(goodTube_getParams['v']) !== -1) {
|
||||
element.classList.add('goodTube_timestampLink');
|
||||
|
||||
// Add the event listener to send our player to the correct time
|
||||
element.addEventListener('click', function () {
|
||||
// Define the time to skip to
|
||||
let time = 0;
|
||||
|
||||
// Get the time from the link (if it exstis)
|
||||
let bits = element.getAttribute('href').split('t=');
|
||||
if (typeof bits[1] !== 'undefined') {
|
||||
let time = bits[1].replace('s', '');
|
||||
goodTube_player_skipTo(time);
|
||||
time = parseFloat(bits[1].replace('s', ''));
|
||||
}
|
||||
|
||||
// Skip to the time
|
||||
goodTube_player_skipTo(time);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user