Back to Repository

شش

0 upvotes
By bahaa.helow90@gmail.com
Manual (context menu)

Match Pattern

<all_urls>

Script Code

function realClick(el) {
el.scrollIntoView({ block: "center" });
el.focus();

["pointerdown", "mousedown", "pointerup", "mouseup", "click"].forEach(type => {
el.dispatchEvent(new MouseEvent(type, {
bubbles: true,
cancelable: true,
view: window
}));
});
}

function clickBySelector(selector, label) {
const el = document.querySelector(selector);
if (el && !el.disabled) {
realClick(el);
console.log(label + " clicked");
return true;
}
return false;
}

function clickByText(text, label) {
const el = [...document.querySelectorAll("button")]
.find(b => b.textContent.trim() === text);

if (el && !el.disabled) {
realClick(el);
console.log(label + " clicked");
return true;
}
return false;
}

// Main sound/check/okay steps
function runSteps() {
clickBySelector('button[aria-label="Play sound"]', "Play sound");

setTimeout(() => {
clickBySelector('button[aria-label="Confirm sound check"]', "Confirm sound");
}, 1500);

setTimeout(() => {
clickByText("Okay", "Okay");
}, 2500);
}

// Keep trying main steps
setInterval(runSteps, 1000);
runSteps();

// Separate watcher: click Next whenever it appears
setInterval(() => {
clickByText("Next", "Next");
}, 500);

// Refresh every 90 seconds
setInterval(() => {
location.reload();
}, 90000);
Install requires the InjectJS Chrome extension. Scripts run only on sites matching the pattern above. Review code before installing any community script.