From 33e30ef2d8904d927912468dfe4728b8b937b740 Mon Sep 17 00:00:00 2001 From: "Pannavach T." <40768385+pnvttk@users.noreply.github.com> Date: Sat, 31 Aug 2024 22:37:47 +0700 Subject: [PATCH] Fixed duplicated play all button when switch page --- js&css/web-accessible/www.youtube.com/channel.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js&css/web-accessible/www.youtube.com/channel.js b/js&css/web-accessible/www.youtube.com/channel.js index 084139b33..a2fc34a42 100644 --- a/js&css/web-accessible/www.youtube.com/channel.js +++ b/js&css/web-accessible/www.youtube.com/channel.js @@ -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',