Skip to content

Commit

Permalink
🔧 Refactor auto-start and shuffle buttons
Browse files Browse the repository at this point in the history
- Updated the selector for the buttons container in `autoStart` and `shufflePlayers` functions.
- Modified the styling of the buttons to have a white background, white border color, and limited maximum width.

🎨 Adjust RecentLocalPlayers layout

- Added top margin to the container div in `RecentLocalPlayers.vue` component.
  • Loading branch information
creazy231 committed Aug 29, 2024
1 parent 8716a62 commit 2a507da
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 29;
CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = BXYGXAJ99T;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "iOS (App)/Info.plist";
Expand All @@ -708,7 +708,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.4.3;
MARKETING_VERSION = 1.5.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand All @@ -731,7 +731,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 29;
CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = BXYGXAJ99T;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "iOS (App)/Info.plist";
Expand All @@ -747,7 +747,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.4.3;
MARKETING_VERSION = 1.5.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand Down Expand Up @@ -836,7 +836,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "macOS (App)/Tools for Autodarts.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 29;
CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = BXYGXAJ99T;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -850,7 +850,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.4.3;
MARKETING_VERSION = 1.5.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand All @@ -873,7 +873,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "macOS (App)/Tools for Autodarts.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 29;
CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = BXYGXAJ99T;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -887,7 +887,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.4.3;
MARKETING_VERSION = 1.5.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<key>Tools for Autodarts (iOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
<key>Tools for Autodarts (macOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion entrypoints/lobby.content/RecentLocalPlayers.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div v-if="config?.recentLocalPlayers?.players?.length">
<div class="flex flex-wrap gap-2">
<div class="mt-4 flex flex-wrap gap-2">
<div
@click="addUserToLobby(player)"
v-for="player in config.recentLocalPlayers.players"
Expand Down
9 changes: 5 additions & 4 deletions entrypoints/lobby.content/auto-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ export async function autoStart() {
const hasAutoStartButton = document.getElementById("adt-autostart-button");
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 buttonsContainer = await waitForElement("#root > div > div:nth-of-type(2) > div > div:nth-of-type(2) > div:nth-of-type(2) > div:nth-of-type(2) > div:last-of-type") as HTMLDivElement;
const button = buttonsContainer.querySelector("button")?.cloneNode(true) as HTMLButtonElement;

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

button.id = "adt-autostart-button";
button.innerText = "Autostart OFF";
button.style.color = "var(--chakra-colors-green-500)";
button.style.color = "var(--chakra-colors-red-500)";
button.style.background = "var(--chakra-colors-whiteAlpha-200)";
button.style.borderColor = "var(--chakra-colors-whiteAlpha-200)";
button.style.maxWidth = "10rem";

button.addEventListener("click", () => {
button.textContent = button.textContent === "Autostart ON" ? "Autostart OFF" : "Autostart ON";
Expand All @@ -42,7 +43,7 @@ export async function onRemove() {
}

async function checkAutoStart() {
const rows = document.querySelectorAll("#root > div > div:nth-of-type(2) > div > div > div:nth-of-type(2) > div > table > tbody > tr");
const rows = document.querySelectorAll("#root > div > div:nth-of-type(2) > div > div:nth-of-type(2) > div:nth-of-type(2) > div:nth-of-type(2) table > tbody > tr");
if (rows.length > 1) {
await new Promise(resolve => setTimeout(resolve, 3000));

Expand Down
11 changes: 6 additions & 5 deletions entrypoints/lobby.content/shuffle-players.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ 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 buttonsContainer = await waitForElement("#root > div > div:nth-of-type(2) > div > div:nth-of-type(2) > div:nth-of-type(2) > div:nth-of-type(2) > div:last-of-type") as HTMLDivElement;
const button = buttonsContainer.querySelector("button")?.cloneNode(true) as HTMLButtonElement;

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

button.setAttribute("id", "autodarts-tools-shuffle-button");
button.id = "autodarts-tools-shuffle-button";
button.innerText = "Shuffle";
button.style.color = "var(--chakra-colors-white)";
button.style.background = "var(--chakra-colors-whiteAlpha-200)";
button.style.borderColor = "var(--chakra-colors-whiteAlpha-200)";
button.style.maxWidth = "7rem";

button.addEventListener("click", handleShuffle);

Expand All @@ -26,7 +27,7 @@ export async function shufflePlayers() {
}

async function checkPlayers() {
const rows = document.querySelectorAll("#root > div > div:nth-of-type(2) > div > div > div:nth-of-type(2) > div > table > tbody > tr");
const rows = document.querySelectorAll("#root > div > div:nth-of-type(2) > div > div:nth-of-type(2) > div:nth-of-type(2) > div:nth-of-type(2) table > tbody > tr");
playerRows = rows as unknown as HTMLTableRowElement[];
}

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.4.4",
"version": "1.5.0",
"type": "module",
"author": {
"name": "Tobias Thiele",
Expand Down
65 changes: 36 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,14 @@
js-tokens "^4.0.0"
picocolors "^1.0.0"

"@babel/parser@^7.24.7", "@babel/parser@^7.25.4":
"@babel/parser@^7.24.7":
version "7.25.6"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.6.tgz#85660c5ef388cbbf6e3d2a694ee97a38f18afe2f"
integrity sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==
dependencies:
"@babel/types" "^7.25.6"

"@babel/parser@^7.25.4":
version "7.25.4"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.4.tgz#af4f2df7d02440286b7de57b1c21acfb2a6f257a"
integrity sha512-nq+eWrOgdtu3jG5Os4TQP3x3cLA8hR8TvJNjD8vnPa20WGycimcparWnLK4jJhElTK6SDyuJo1weMKO/5LpmLA==
Expand All @@ -124,10 +131,10 @@
dependencies:
regenerator-runtime "^0.14.0"

"@babel/types@^7.25.4":
version "7.25.4"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.4.tgz#6bcb46c72fdf1012a209d016c07f769e10adcb5f"
integrity sha512-zQ1ijeeCXVEh+aNL0RlmkPkG8HUiDcU2pzQQFjtbntgAczRASFzj4H+6+bV+dy1ntKR14I/DypeuRG1uma98iQ==
"@babel/types@^7.25.4", "@babel/types@^7.25.6":
version "7.25.6"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.6.tgz#893942ddb858f32ae7a004ec9d3a76b3463ef8e6"
integrity sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==
dependencies:
"@babel/helper-string-parser" "^7.24.8"
"@babel/helper-validator-identifier" "^7.24.7"
Expand Down Expand Up @@ -1342,24 +1349,24 @@
resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-4.6.2.tgz#057d2ded94c4e71b94e9814f92dcd9306317aa46"
integrity sha512-kqf7SGFoG+80aZG6Pf+gsZIVvGSCKE98JbiWqcCV9cThtg91Jav0yvYFC9Zb+jKetNGF6ZKeoaxgZfND21fWKw==

"@volar/language-core@2.4.0", "@volar/language-core@~2.4.0-alpha.18":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@volar/language-core/-/language-core-2.4.0.tgz#962efc66ff9198ee2412786e99528bf77cdad100"
integrity sha512-FTla+khE+sYK0qJP+6hwPAAUwiNHVMph4RUXpxf/FIPKUP61NFrVZorml4mjFShnueR2y9/j8/vnh09YwVdH7A==
"@volar/language-core@2.4.1", "@volar/language-core@~2.4.1":
version "2.4.1"
resolved "https://registry.yarnpkg.com/@volar/language-core/-/language-core-2.4.1.tgz#267984b2b06908b78f1c016392fc75b75516595b"
integrity sha512-9AKhC7Qn2mQYxj7Dz3bVxeOk7gGJladhWixUYKef/o0o7Bm4an+A3XvmcTHVqZ8stE6lBVH++g050tBtJ4TZPQ==
dependencies:
"@volar/source-map" "2.4.0"
"@volar/source-map" "2.4.1"

"@volar/source-map@2.4.0":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-2.4.0.tgz#b6690f06c600eaf587bbc81b0153203e4f6db72a"
integrity sha512-2ceY8/NEZvN6F44TXw2qRP6AQsvCYhV2bxaBPWxV9HqIfkbRydSksTFObCF1DBDNBfKiZTS8G/4vqV6cvjdOIQ==
"@volar/source-map@2.4.1":
version "2.4.1"
resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-2.4.1.tgz#6a6d02b9dac66a5dd99378dcdae63107a0b45fce"
integrity sha512-Xq6ep3OZg9xUqN90jEgB9ztX5SsTz1yiV8wiQbcYNjWkek+Ie3dc8l7AVt3EhDm9mSIR58oWczHkzM2H6HIsmQ==

"@volar/typescript@~2.4.0-alpha.18":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@volar/typescript/-/typescript-2.4.0.tgz#f909d20dfe43dd846d30695f6e5467276ff4418e"
integrity sha512-9zx3lQWgHmVd+JRRAHUSRiEhe4TlzL7U7e6ulWXOxHH/WNYxzKwCvZD7WYWEZFdw4dHfTD9vUR0yPQO6GilCaQ==
"@volar/typescript@~2.4.1":
version "2.4.1"
resolved "https://registry.yarnpkg.com/@volar/typescript/-/typescript-2.4.1.tgz#6285f29b36c58769ccc14153f329d11e89ee13bc"
integrity sha512-UoRzC0PXcwajFQTu8XxKSYNsWNBtVja6Y9gC8eLv7kYm+UEKJCcZ8g7dialsOYA0HKs3Vpg57MeCsawFLC6m9Q==
dependencies:
"@volar/language-core" "2.4.0"
"@volar/language-core" "2.4.1"
path-browserify "^1.0.1"
vscode-uri "^3.0.8"

Expand Down Expand Up @@ -1460,12 +1467,12 @@
resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.6.3.tgz#b23a588154cba8986bba82b6e1d0248bde3fd1a0"
integrity sha512-0MiMsFma/HqA6g3KLKn+AGpL1kgKhFWszC9U29NfpWK5LE7bjeXxySWJrOJ77hBz+TBrBQ7o4QJqbPbqbs8rJw==

"@vue/language-core@2.0.29":
version "2.0.29"
resolved "https://registry.yarnpkg.com/@vue/language-core/-/language-core-2.0.29.tgz#19462d786cd7a1c21dbe575b46970a57094e0357"
integrity sha512-o2qz9JPjhdoVj8D2+9bDXbaI4q2uZTHQA/dbyZT4Bj1FR9viZxDJnLcKVHfxdn6wsOzRgpqIzJEEmSSvgMvDTQ==
"@vue/language-core@2.1.2":
version "2.1.2"
resolved "https://registry.yarnpkg.com/@vue/language-core/-/language-core-2.1.2.tgz#98e7864ab4a928293a88ebf7b427d773e1a40e2e"
integrity sha512-tt2J7C+l0J/T5PaLhJ0jvCCi0JNwu3e8azWTYxW3jmAW5B/dac0g5UxmI7l59CQgCGFotqUqI3tXjfZgoWNtog==
dependencies:
"@volar/language-core" "~2.4.0-alpha.18"
"@volar/language-core" "~2.4.1"
"@vue/compiler-dom" "^3.4.0"
"@vue/compiler-vue2" "^2.7.16"
"@vue/shared" "^3.4.0"
Expand Down Expand Up @@ -6648,12 +6655,12 @@ vue-i18n@^9.13.1:
"@vue/devtools-api" "^6.5.0"

vue-tsc@^2.0.24:
version "2.0.29"
resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-2.0.29.tgz#bf7e9605af9fadec7fd6037d242217f5c6ad2c3b"
integrity sha512-MHhsfyxO3mYShZCGYNziSbc63x7cQ5g9kvijV7dRe1TTXBRLxXyL0FnXWpUF1xII2mJ86mwYpYsUmMwkmerq7Q==
version "2.1.2"
resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-2.1.2.tgz#93e3bc5133766fcd4bc3e5cb8b998ea9b159038b"
integrity sha512-PH1BDxWT3eaPhl73elyZj6DV0nR3K4IFoUM1sGzMXXQneovVUwHQytdSyAHiED5MtEINGSHpL/Hs9ch+c/tDTw==
dependencies:
"@volar/typescript" "~2.4.0-alpha.18"
"@vue/language-core" "2.0.29"
"@volar/typescript" "~2.4.1"
"@vue/language-core" "2.1.2"
semver "^7.5.4"

vue@^3.4.31:
Expand Down

0 comments on commit 2a507da

Please sign in to comment.