diff --git a/script.js b/script.js index ba05206..78ca8dd 100644 --- a/script.js +++ b/script.js @@ -137,14 +137,13 @@ const newYouTube = { return ( typeof e !== 'undefined' && e.type === 'yt-visibility-refresh' && - (e.target.tagName === 'YT-IMG-SHADOW' || - e.target.tagName === 'YTD-VIDEO-SECONDARY-INFO-RENDERER') + e.target.tagName === 'YTD-ITEM-SECTION-RENDERER' // this mean: rendered childNode of comments'DOM(ytd-comments) ); }, _addClass() { debugLog('ADDING CLASS...'); - document.getElementById('comments').classList.add('hide-comments'); + document.querySelector('ytd-item-section-renderer.ytd-comments').classList.add('hide-comments'); }, _addButton() { @@ -166,7 +165,7 @@ const newYouTube = { _toggleComments() { const label = document.getElementById('toggle-comments').firstElementChild; - const comments = document.getElementById('comments'); + const comments = document.querySelector("ytd-item-section-renderer.ytd-comments"); if (comments.classList.toggle('hide-comments')) { label.textContent = globals.showComments; diff --git a/youtube.css b/youtube.css index a116150..99dd471 100644 --- a/youtube.css +++ b/youtube.css @@ -1,5 +1,6 @@ .hide-comments { - display: none !important; + height: 0px; + overflow: hidden; } .fake-paper-button {