-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutoJoiner.js
32 lines (24 loc) · 973 Bytes
/
AutoJoiner.js
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
(function checkForButton() {
function findButton() {
const buttonSpan = document.querySelector('.general-button.button-primary.join-button .general-box.box-primary .box-inner span');
if (buttonSpan && buttonSpan.textContent === 'JOIN') {
const button = buttonSpan.closest('.general-button.button-primary.join-button');
const buttonVisible = button && button.offsetParent !== null;
return buttonVisible ? button : null;
}
return null;
}
const button = findButton();
if (button) {
console.log('Button found and visible! Clicking the button...');
const event = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});
button.dispatchEvent(event);
} else {
console.log('Button not found or not visible, retrying...');
}
setTimeout(checkForButton, 10000);
})();