This commit is contained in:
eric
2026-05-19 07:49:56 +00:00
parent 78e1308063
commit 585bcd9500
112 changed files with 61939 additions and 23 deletions

View File

@@ -0,0 +1,17 @@
{
"manifest_version": 3,
"name": "YouTube Studio Auto Dismiss",
"version": "1.1.0",
"description": "Auto-clicks visible Dismiss buttons on YouTube Studio livestreaming pages.",
"content_scripts": [
{
"matches": [
"https://studio.youtube.com/channel/*/livestreaming",
"https://studio.youtube.com/video/*/livestreaming",
"https://studio.youtube.com/*/livestreaming"
],
"js": ["youtube-studio-auto-dismiss.js"],
"run_at": "document_idle"
}
]
}

View File

@@ -0,0 +1,46 @@
(function () {
"use strict";
function isVisible(element) {
var style = window.getComputedStyle(element);
return style.display !== "none" && style.visibility !== "hidden" && element.offsetParent !== null;
}
function clickElement(element) {
if (!element) return;
element.dispatchEvent(
new MouseEvent("click", {
view: window,
bubbles: true,
cancelable: true,
})
);
}
function findDismiss(root) {
var buttons = (root || document).querySelectorAll("button");
for (var i = 0; i < buttons.length; i += 1) {
var button = buttons[i];
var text = button.innerText ? button.innerText.trim() : "";
if (text === "Dismiss" && isVisible(button)) {
return button;
}
if (button.shadowRoot) {
var shadowButton = findDismiss(button.shadowRoot);
if (shadowButton) return shadowButton;
}
}
return null;
}
function run() {
clickElement(findDismiss(document));
}
if (document.readyState === "complete") {
run();
} else {
window.addEventListener("load", run, { once: true });
}
window.setInterval(run, 5000);
})();