Fix CSS selectors

This commit is contained in:
Arne Keller 2019-07-10 11:59:04 +02:00
parent f32b631867
commit 468595da75

View File

@ -12,7 +12,7 @@ let ytacCSS = {
"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",
"other": "newness-dot, .ytp-spinner" "other": "#newness-dot, .ytp-spinner"
}; };
const INVISIBLE = " { display: none !important; }" const INVISIBLE = " { display: none !important; }"
@ -66,22 +66,18 @@ function modifyThings() {
// autoplay disabler // autoplay disabler
let autoplayButton = document.getElementById("toggle"); let autoplayButton = document.getElementById("toggle");
if (autoplayButton == null) { if (autoplayButton == null) {
console.warn("[YTAC] could not locate autoplay button, trying again in 5s"); console.warn("[YTAC] could not locate autoplay button");
setTimeout(modifyThings, 5000);
repeating = true;
} else if (autoplayButton.getAttribute("aria-pressed") === "true") { } else if (autoplayButton.getAttribute("aria-pressed") === "true") {
autoplayButton.click(); autoplayButton.click();
} }
// description expander // description expander
let showMoreButton = document.getElementById("more"); let showMoreButton = document.getElementsByClassName("more-button");
if (showMoreButton == null) { if (showMoreButton.length == 0) {
console.warn("[YTAC] could not locate description expander, trying again in 5s"); console.warn("[YTAC] could not locate description expander, trying again in 5s");
if (!repeating) { setTimeout(modifyThings, 5000);
setTimeout(modifyThings, 5000);
}
} else { } else {
showMoreButton.click(); showMoreButton[0].click();
} }
} }
modifyThings(); modifyThings();