From 468595da75d331f8977b5d18149ef15314f993ec Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Wed, 10 Jul 2019 11:59:04 +0200 Subject: [PATCH] Fix CSS selectors --- youtube-addiction-control-extension-firefox.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/youtube-addiction-control-extension-firefox.js b/youtube-addiction-control-extension-firefox.js index 63b19b0..f4e2df2 100644 --- a/youtube-addiction-control-extension-firefox.js +++ b/youtube-addiction-control-extension-firefox.js @@ -12,7 +12,7 @@ let ytacCSS = { "endscreen": ".videowall-endscreen", "invideo": ".ytp-ce-video", "notification": "ytd-notification-topbar-button-renderer", - "other": "newness-dot, .ytp-spinner" + "other": "#newness-dot, .ytp-spinner" }; const INVISIBLE = " { display: none !important; }" @@ -66,22 +66,18 @@ function modifyThings() { // autoplay disabler let autoplayButton = document.getElementById("toggle"); if (autoplayButton == null) { - console.warn("[YTAC] could not locate autoplay button, trying again in 5s"); - setTimeout(modifyThings, 5000); - repeating = true; + console.warn("[YTAC] could not locate autoplay button"); } else if (autoplayButton.getAttribute("aria-pressed") === "true") { autoplayButton.click(); } // description expander - let showMoreButton = document.getElementById("more"); - if (showMoreButton == null) { + let showMoreButton = document.getElementsByClassName("more-button"); + if (showMoreButton.length == 0) { console.warn("[YTAC] could not locate description expander, trying again in 5s"); - if (!repeating) { - setTimeout(modifyThings, 5000); - } + setTimeout(modifyThings, 5000); } else { - showMoreButton.click(); + showMoreButton[0].click(); } } modifyThings(); \ No newline at end of file