mirror of
https://gitlab.com/arnekeller/yt-addiction-control.git
synced 2024-11-22 16:34:59 +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.",
|
"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": {
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user