mirror of
https://gitlab.com/arnekeller/yt-addiction-control.git
synced 2024-11-22 08:25:01 +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.",
|
||||
"manifest_version": 2,
|
||||
"name": "YT addiction control",
|
||||
"version": "0.2.0",
|
||||
"version": "0.1.3",
|
||||
"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, #comment-teaser",
|
||||
"comments": "#comments",
|
||||
"endscreen": ".videowall-endscreen",
|
||||
"invideo": ".ytp-ce-video",
|
||||
"notification": "ytd-notification-topbar-button-renderer",
|
||||
@ -78,18 +78,36 @@ window.ytacListener = (message) => {
|
||||
browser.runtime.onMessage.addListener(window.ytacListener);
|
||||
console.log("[YTAC] added action listener");
|
||||
|
||||
// expand description by default
|
||||
let showMoreButton = document.querySelector("#description-inline-expander > #expand");
|
||||
if (showMoreButton) {
|
||||
showMoreButton.click();
|
||||
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();
|
||||
}
|
||||
*/
|
||||
}
|
||||
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.substring(a.innerText.indexOf(")") + 2);
|
||||
a.innerText = a.innerText.substr(a.innerText.indexOf(")") + 2);
|
||||
}
|
||||
}
|
||||
setInterval(hideNotificationCount, 1000);
|
||||
|
Loading…
Reference in New Issue
Block a user