Hide comment teaser too

This commit is contained in:
Arne Keller 2022-09-14 18:39:56 +02:00
parent 4e050b429f
commit bcdab4067a

View File

@ -8,7 +8,7 @@ Array.from(document.getElementsByClassName(STYLE_CLASS)).forEach((e) => {
window.ytacCSS = { window.ytacCSS = {
"sidebar": "#related", "sidebar": "#related",
"comments": "#comments", "comments": "#comments, #comment-teaser",
"endscreen": ".videowall-endscreen", "endscreen": ".videowall-endscreen",
"invideo": ".ytp-ce-video", "invideo": ".ytp-ce-video",
"notification": "ytd-notification-topbar-button-renderer", "notification": "ytd-notification-topbar-button-renderer",
@ -78,24 +78,18 @@ window.ytacListener = (message) => {
browser.runtime.onMessage.addListener(window.ytacListener); browser.runtime.onMessage.addListener(window.ytacListener);
console.log("[YTAC] added action listener"); console.log("[YTAC] added action listener");
function modifyThings() { // expand description by default
// description expander let showMoreButton = document.querySelector("#description-inline-expander > #expand");
let showMoreButton = document.querySelector(".ytd-video-secondary-info-renderer > #more"); if (showMoreButton) {
if (!showMoreButton) {
console.warn("[YTAC] could not locate description expander");
//setTimeout(modifyThings, 5000);
} else {
showMoreButton.click(); showMoreButton.click();
} }
}
modifyThings();
// attempt to hide the notification count in the title // attempt to hide the notification count in the title
function hideNotificationCount() { function hideNotificationCount() {
let a = document.getElementsByTagName("title")[0]; let a = document.getElementsByTagName("title")[0];
if (a.innerText.match("^\\(\\d+\\).*")) { 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); setInterval(hideNotificationCount, 1000);