From bcdab4067aedf1dab73e800f8e72f12dbdf4de5b Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Wed, 14 Sep 2022 18:39:56 +0200 Subject: [PATCH] Hide comment teaser too --- youtube-addiction-control-extension-firefox.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/youtube-addiction-control-extension-firefox.js b/youtube-addiction-control-extension-firefox.js index ca0aed1..db6f535 100644 --- a/youtube-addiction-control-extension-firefox.js +++ b/youtube-addiction-control-extension-firefox.js @@ -8,7 +8,7 @@ Array.from(document.getElementsByClassName(STYLE_CLASS)).forEach((e) => { window.ytacCSS = { "sidebar": "#related", - "comments": "#comments", + "comments": "#comments, #comment-teaser", "endscreen": ".videowall-endscreen", "invideo": ".ytp-ce-video", "notification": "ytd-notification-topbar-button-renderer", @@ -78,24 +78,18 @@ window.ytacListener = (message) => { browser.runtime.onMessage.addListener(window.ytacListener); console.log("[YTAC] added action listener"); -function modifyThings() { - // description expander - let showMoreButton = document.querySelector(".ytd-video-secondary-info-renderer > #more"); - if (!showMoreButton) { - console.warn("[YTAC] could not locate description expander"); - //setTimeout(modifyThings, 5000); - } else { - showMoreButton.click(); - } +// expand description by default +let showMoreButton = document.querySelector("#description-inline-expander > #expand"); +if (showMoreButton) { + showMoreButton.click(); } -modifyThings(); // attempt to hide the notification count in the title function hideNotificationCount() { let a = document.getElementsByTagName("title")[0]; if (a.innerText.match("^\\(\\d+\\).*")) { - a.innerText = a.innerText.substr(a.innerText.indexOf(")") + 2); + a.innerText = a.innerText.substring(a.innerText.indexOf(")") + 2); } } setInterval(hideNotificationCount, 1000);