Compare commits

...

3 Commits

Author SHA1 Message Date
Arne Keller
e1940c961b Version 0.2.0 2022-09-14 18:40:13 +02:00
Arne Keller
bcdab4067a Hide comment teaser too 2022-09-14 18:39:56 +02:00
Arne Keller
4e050b429f Fix description expander 2021-02-10 11:39:30 +01:00
2 changed files with 7 additions and 25 deletions

View File

@ -2,7 +2,7 @@
"description": "Enables you to fight your youtube addiction by hiding video suggestions and related 'features' of YouTube's website. If you really want to, you can temporarily unhide those elements.", "description": "Enables you to fight your youtube addiction by hiding video suggestions and related 'features' of YouTube's website. If you really want to, you can temporarily unhide those elements.",
"manifest_version": 2, "manifest_version": 2,
"name": "YT addiction control", "name": "YT addiction control",
"version": "0.1.3", "version": "0.2.0",
"homepage_url": "https://gitlab.com/arnekeller/yt-addiction-control", "homepage_url": "https://gitlab.com/arnekeller/yt-addiction-control",
"icons": { "icons": {

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,36 +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
//let repeating = false; let showMoreButton = document.querySelector("#description-inline-expander > #expand");
// autoplay disabler if (showMoreButton) {
let autoplayButton = document.getElementById("toggle"); showMoreButton.click();
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);
} else {
showMoreButton[0].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);