Skip to content

Commit

Permalink
Update playlist.js booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
raszpl authored Aug 5, 2024
1 parent 707fb42 commit 4e27531
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions js&css/web-accessible/www.youtube.com/playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ImprovedTube.playlistUpNextAutoplay = function () {
}
};
/*--- REVERSE ----------------------------------------------------------------*/
// FIXME
ImprovedTube.playlistReverse = function (node) {
if (this.storage.playlist_reverse) {
// playlist_reverse button already applied or nowhere to attach it
Expand Down Expand Up @@ -73,25 +74,24 @@ rename extension/www.youtube.com/styles.css
});
node.appendChild(button);

if (this.playlistReversed === true) {
button.click();
}
if (this.playlistReversed) button.click();
} else {
document.querySelector('#it-reverse-playlist-button')?.remove();
}
};
/*--- REPEAT -----------------------------------------------------------------*/
// FIXME
ImprovedTube.playlistRepeat = function () {
if ( ImprovedTube.storage.playlist_repeat === true ) {
if (ImprovedTube.storage.playlist_repeat) {
setTimeout(function () {
const option = ImprovedTube.storage.playlist_repeat,
button = document.querySelector("#button.ytd-playlist-loop-button-renderer") || document.querySelector("ytd-playlist-loop-button-renderer button") || document.querySelector("ytd-playlist-loop-button-renderer");
if (button && (option === true && button.querySelector("path").attributes.d.textContent.split(" ")[0].startsWith('M21')
) && button.querySelector("#tooltip")?.textContent !== 'Loop video'
&& button.firstElementChild?.firstElementChild?.attributes[2]?.textContent !== 'Loop video'
&& button.querySelector("#tooltip")?.textContent !== 'Turn off loop'
&& button.firstElementChild?.firstElementChild?.attributes[2]?.textContent !== 'Turn off loop'
) button.click();
if (button
&& (option && button.querySelector("path").attributes.d.textContent.split(" ")[0].startsWith('M21'))
&& button.querySelector("#tooltip")?.textContent !== 'Loop video'
&& button.firstElementChild?.firstElementChild?.attributes[2]?.textContent !== 'Loop video'
&& button.querySelector("#tooltip")?.textContent !== 'Turn off loop'
&& button.firstElementChild?.firstElementChild?.attributes[2]?.textContent !== 'Turn off loop') button.click();
}, 10000);
}
};
Expand Down

0 comments on commit 4e27531

Please sign in to comment.