mirror of
https://gitlab.com/arnekeller/yt-addiction-control.git
synced 2024-11-22 16:34:59 +00:00
Compare commits
No commits in common. "e1940c961b84828d92ef814bfe230bbb5f020795" and "772a77c7e2603405dfa45d36b419d4d34a94531f" have entirely different histories.
e1940c961b
...
772a77c7e2
@ -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.2.0",
|
"version": "0.1.3",
|
||||||
"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, #comment-teaser",
|
"comments": "#comments",
|
||||||
"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,18 +78,36 @@ 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");
|
||||||
|
|
||||||
// expand description by default
|
function modifyThings() {
|
||||||
let showMoreButton = document.querySelector("#description-inline-expander > #expand");
|
//let repeating = false;
|
||||||
if (showMoreButton) {
|
// autoplay disabler
|
||||||
showMoreButton.click();
|
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();
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
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.substring(a.innerText.indexOf(")") + 2);
|
a.innerText = a.innerText.substr(a.innerText.indexOf(")") + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setInterval(hideNotificationCount, 1000);
|
setInterval(hideNotificationCount, 1000);
|
||||||
|
Loading…
Reference in New Issue
Block a user