sss
This commit is contained in:
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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);
|
||||
})();
|
||||
Reference in New Issue
Block a user