1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 02:39:46 +02:00
Daniel Neto 2024-02-21 10:39:19 -03:00
parent 1e61a87c3c
commit 01f835f0b1
15 changed files with 930 additions and 718 deletions

View file

@ -15,7 +15,11 @@ $(document).ready(function () {
this.controlText("Next");
}
handleClick() {
document.location = autoPlayVideoURL;
var url = getNextPlaylistUrl();
if (empty(url)) {
url = autoPlayVideoURL;
}
document.location = url;
}
}
@ -24,3 +28,22 @@ $(document).ready(function () {
player.getChild('controlBar').addChild('NextButton', {}, getPlayerButtonIndex('PlayToggle')+1);
}, 30);
});
function getNextPlaylistUrl() {
// Check if '.playlist-nav' exists
if ($('.playlist-nav').length === 0) {
// If '.playlist-nav' does not exist, return false
return false;
}
// Find the active list item
var activeLi = $('.playlist-nav .navbar-nav li.active');
// Determine the next list item; if the active item is the last, wrap to the first list item
var nextLi = activeLi.is(':last-child') ? $('.playlist-nav .navbar-nav li').first() : activeLi.next();
// Get the URL from the 'a' element inside the next list item
var nextUrl = nextLi.find('a').attr('href');
// Return the URL, or false if it's not found
return nextUrl || false;
}