Skip to content

Commit

Permalink
Merge pull request #2551 from pnvttk/fix-play-all-button
Browse files Browse the repository at this point in the history
Fixed duplicated play all button when switch page
  • Loading branch information
ImprovedTube authored Sep 1, 2024
2 parents 1889ea9 + 33e30ef commit d6a0919
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js&css/web-accessible/www.youtube.com/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ ImprovedTube.channelPlayAllButton = function () {
if (ImprovedTube.regex.channel.test(location.pathname)) {
if (this.storage.channel_play_all_button) {
const container = document.querySelector('ytd-channel-sub-menu-renderer #primary-items')
|| document.querySelector('ytd-two-column-browse-results-renderer #chips-content'),
playlistUrl = document.querySelector('ytd-app')?.__data?.data?.response?.metadata?.channelMetadataRenderer?.externalId?.substring(2);
|| document.querySelector('ytd-two-column-browse-results-renderer #chips-content');
const playlistUrl = document.querySelector('ytd-app')?.__data?.data?.response?.metadata?.channelMetadataRenderer?.externalId?.substring(2);
const existingPlayAllButton = document.querySelector('.it-play-all-button')

if (!container) return; // we only add button on /videos page
if (!playlistUrl) {
console.error('channelPlayAllButton: Cant fint Channel playlist');
return;
}
if (existingPlayAllButton) return // prevent add duplicate button
const button = this.createIconButton({
type: 'playAll',
className: 'it-play-all-button',
Expand Down

0 comments on commit d6a0919

Please # to comment.