Skip to content

Commit

Permalink
🔧 Fix auto-start and shuffle players buttons
Browse files Browse the repository at this point in the history
- Updated code to use `querySelector` instead of accessing children directly
- Cloned the first button element in the buttons container
  • Loading branch information
creazy231 committed May 8, 2024
1 parent 1df90df commit bf722ef
Show file tree
Hide file tree
Showing 6 changed files with 488 additions and 379 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<key>AD Tools (iOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
<key>AD Tools (macOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion entrypoints/lobby.content/auto-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function autoStart() {
if (hasAutoStartButton) return;

const buttonsContainer = await waitForElement("#root > div > div:nth-of-type(2) > div > div > div:nth-of-type(3) > div") as HTMLDivElement;
const button = buttonsContainer.children[0].cloneNode(true) as HTMLButtonElement;
const button = buttonsContainer.querySelector("button")?.cloneNode(true) as HTMLButtonElement;

if (button.innerText !== "Start") return;

Expand Down
2 changes: 1 addition & 1 deletion entrypoints/lobby.content/shuffle-players.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let shuffledPlayerNames: string[] = [];
export async function shufflePlayers() {
try {
const buttonsContainer = await waitForElement("#root > div > div:nth-of-type(2) > div > div > div:nth-of-type(3) > div") as HTMLDivElement;
const button = buttonsContainer.children[0].cloneNode(true) as HTMLButtonElement;
const button = buttonsContainer.querySelector("button")?.cloneNode(true) as HTMLButtonElement;

if (button.innerText !== "Start") return;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "autodarts-tools",
"description": "Autodarts Tools enhances the gaming experience on autodarts.io",
"version": "1.3.9",
"version": "1.3.10",
"type": "module",
"author": {
"name": "Tobias Thiele",
Expand Down
Loading

0 comments on commit bf722ef

Please sign in to comment.