-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprivate-game-4-player-bypass.user.js
More file actions
25 lines (21 loc) · 1023 Bytes
/
Copy pathprivate-game-4-player-bypass.user.js
File metadata and controls
25 lines (21 loc) · 1023 Bytes
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
// ==UserScript==
// @name TagPro Bypass Private Game 4 Player Minimum
// @version 1.0.1
// @author Zagd
// @downloadURL https://github.com/zagd/tagpro-scripts/raw/master/private-game-4-player-bypass.user.js
// @updateURL https://github.com/zagd/tagpro-scripts/raw/master/private-game-4-player-bypass.user.js
// @include *://tagpro.koalabeast.com/groups/*
// ==/UserScript==
const launchButton = document.getElementById("launch-private-btn");
if (launchButton) {
const getNeedMsgsCount = () => [...document.querySelector(".chat-log").querySelectorAll(".chat-message")]
.filter(msg => msg.innerText.match(/^Need [123] more players to launch private game\.$/))
.length;
const onLaunch = () => {
const preNeedMsgCount = getNeedMsgsCount();
setTimeout(() => {
if (getNeedMsgsCount() > preNeedMsgCount) location.href = "https://tagpro.koalabeast.com/games/find";
}, 1500);
};
launchButton.addEventListener("click", onLaunch);
}