-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathauto-continue.js
More file actions
44 lines (38 loc) · 1.29 KB
/
Copy pathauto-continue.js
File metadata and controls
44 lines (38 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(function(){
const COOLDOWN_MS = 2500;
let lastClick = 0;
function clickIfFound() {
const now = Date.now();
if (now - lastClick < COOLDOWN_MS) return;
// Continue
const continueBtn = Array.from(
document.querySelectorAll('a.monaco-button[role="button"], button.monaco-button')
).find(el => {
const hasContinueText = /continue/i.test(el.textContent?.trim());
const isRebaseButton = /rebase/i.test(el.getAttribute('aria-label') || '');
return hasContinueText && !isRebaseButton;
});
if (continueBtn) {
continueBtn.click();
lastClick = now;
console.log('[auto] Clicked Continue');
}
// Keep
const keepBtn = Array.from(
document.querySelectorAll('a.action-label[role="button"]')
).find(el => /^keep$/i.test(el.textContent?.trim()));
if (keepBtn) {
keepBtn.click();
lastClick = now;
console.log('[auto] Clicked Keep');
}
}
const intervalId = setInterval(clickIfFound, 1000);
const observer = new MutationObserver(clickIfFound);
observer.observe(document.body, { childList: true, subtree: true });
window.stopAutoContinue = () => {
clearInterval(intervalId);
observer.disconnect();
console.log('[auto] stopped.');
};
})();