From 4e050b429f372bdb6df8ab48d250060887e09818 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Wed, 10 Feb 2021 11:39:30 +0100 Subject: [PATCH] Fix description expander --- ...ube-addiction-control-extension-firefox.js | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/youtube-addiction-control-extension-firefox.js b/youtube-addiction-control-extension-firefox.js index c3649b8..ca0aed1 100644 --- a/youtube-addiction-control-extension-firefox.js +++ b/youtube-addiction-control-extension-firefox.js @@ -79,26 +79,14 @@ browser.runtime.onMessage.addListener(window.ytacListener); console.log("[YTAC] added action listener"); function modifyThings() { - //let repeating = false; - // autoplay disabler - let autoplayButton = document.getElementById("toggle"); - if (autoplayButton == null) { - console.warn("[YTAC] could not locate autoplay button, trying again in 10s ..."); - setTimeout(modifyThings, 10000); - } else if (autoplayButton.getAttribute("aria-pressed") === "true") { - autoplayButton.click(); - } - // description expander - /* - let showMoreButton = document.getElementsByClassName("more-button"); - if (showMoreButton.length == 0) { - console.warn("[YTAC] could not locate description expander, trying again in 5s"); - setTimeout(modifyThings, 5000); + 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[0].click(); + showMoreButton.click(); } - */ } modifyThings();