mirror of
https://gitlab.com/arnekeller/yt-addiction-control.git
synced 2024-11-22 00:15:00 +00:00
Compare commits
3 Commits
772a77c7e2
...
e1940c961b
Author | SHA1 | Date | |
---|---|---|---|
|
e1940c961b | ||
|
bcdab4067a | ||
|
4e050b429f |
@ -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.",
|
||||
"manifest_version": 2,
|
||||
"name": "YT addiction control",
|
||||
"version": "0.1.3",
|
||||
"version": "0.2.0",
|
||||
"homepage_url": "https://gitlab.com/arnekeller/yt-addiction-control",
|
||||
|
||||
"icons": {
|
||||
|
@ -8,7 +8,7 @@ Array.from(document.getElementsByClassName(STYLE_CLASS)).forEach((e) => {
|
||||
|
||||
window.ytacCSS = {
|
||||
"sidebar": "#related",
|
||||
"comments": "#comments",
|
||||
"comments": "#comments, #comment-teaser",
|
||||
"endscreen": ".videowall-endscreen",
|
||||
"invideo": ".ytp-ce-video",
|
||||
"notification": "ytd-notification-topbar-button-renderer",
|
||||
@ -78,36 +78,18 @@ window.ytacListener = (message) => {
|
||||
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);
|
||||
} else {
|
||||
showMoreButton[0].click();
|
||||
}
|
||||
*/
|
||||
// expand description by default
|
||||
let showMoreButton = document.querySelector("#description-inline-expander > #expand");
|
||||
if (showMoreButton) {
|
||||
showMoreButton.click();
|
||||
}
|
||||
modifyThings();
|
||||
|
||||
// attempt to hide the notification count in the title
|
||||
|
||||
function hideNotificationCount() {
|
||||
let a = document.getElementsByTagName("title")[0];
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user