Skip to content

Commit

Permalink
🚀 Update package version to 1.3.11
Browse files Browse the repository at this point in the history
Bump up the package version from 1.3.10 to 1.3.11 in the package.json file, improving Autodarts Tools on autodarts.io gaming platform.
  • Loading branch information
creazy231 committed May 16, 2024
1 parent a24236a commit bd243b0
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 20 deletions.
16 changes: 8 additions & 8 deletions AD Tools/AD Tools.xcodeproj/project.pbxproj
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 = 22;
CURRENT_PROJECT_VERSION = 23;
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.3.8;
MARKETING_VERSION = 1.3.11;
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 = 22;
CURRENT_PROJECT_VERSION = 23;
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.3.8;
MARKETING_VERSION = 1.3.11;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand Down Expand Up @@ -836,7 +836,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "macOS (App)/AD Tools.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 22;
CURRENT_PROJECT_VERSION = 23;
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.3.8;
MARKETING_VERSION = 1.3.11;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand All @@ -873,7 +873,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "macOS (App)/AD Tools.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 22;
CURRENT_PROJECT_VERSION = 23;
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.3.8;
MARKETING_VERSION = 1.3.11;
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>AD Tools (iOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
<key>AD Tools (macOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
Expand Down
69 changes: 60 additions & 9 deletions entrypoints/match.content/nextPlayerOnTakeOutStuck.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,68 @@
import type { TBoardStatus } from "@/utils/storage";
import { AutodartsToolsBoardStatus, AutodartsToolsConfig } from "@/utils/storage";
import { BoardStatus } from "@/utils/types";
import { getNextBtn } from "@/utils/getElements";
import { waitForElementWithTextContent } from "@/utils";

// Create a map to store event listeners
const eventListenersMap = new Map();

// Create a wrapper around addEventListener
// @ts-expect-error
Document.prototype.realAddEventListener = Document.prototype.addEventListener;
Document.prototype.addEventListener = function (eventName, callback) {
// @ts-expect-error
this.realAddEventListener(eventName, callback);

if (!eventListenersMap.has(eventName)) {
eventListenersMap.set(eventName, []);
}

eventListenersMap.get(eventName).push(callback);
};

// Create a function to check if an event listener has been defined
function hasEventListener(eventName, callback) {
const listeners = eventListenersMap.get(eventName);
return listeners && listeners.includes(callback);
}

export async function nextPlayerOnTakeOutStuck() {
try {
const { nextPlayerOnTakeOutStuck } = await AutodartsToolsConfig.getValue();
if (!nextPlayerOnTakeOutStuck.enabled) return;
const configValue = await AutodartsToolsConfig.getValue();
if (!configValue || !configValue.nextPlayerOnTakeOutStuck || !configValue.nextPlayerOnTakeOutStuck.enabled) return;

// check if element with id "ad-ext_next-leg-active" is already added to body. if yes, return
if (document.getElementById("ad-ext_next-leg-active")) return;

// add element with id "ad-ext_next-leg-active" to body
const nextLegActiveEl = document.createElement("div");
nextLegActiveEl.id = "ad-ext_next-leg-active";
nextLegActiveEl.style.display = "none";
document.body.appendChild(nextLegActiveEl);

let takeOutTimout: NodeJS.Timeout;

function remove() {
const element = document.getElementById("ad-ext_next-leg-text");
element?.remove();
if (takeOutTimout) clearInterval(takeOutTimout);
}

if (!hasEventListener("click", remove)) {
document.addEventListener("click", remove);
}

AutodartsToolsBoardStatus.watch(async (boardStatus: TBoardStatus) => {
takeOutTimout && clearInterval(takeOutTimout);
const nextBtnTextEl = document.getElementById("ad-ext_next-leg-text");
nextBtnTextEl?.remove();

if (takeOutTimout) clearInterval(takeOutTimout);

if (boardStatus === BoardStatus.TAKEOUT) {
const nextBtn = getNextBtn();
const nextBtn = await waitForElementWithTextContent("button", "Next", 1000);
if (!nextBtn) return;

let startSec = nextPlayerOnTakeOutStuck.sec;
let startSec = configValue.nextPlayerOnTakeOutStuck.sec;

const nextBtnTextEl = document.createElement("span");
nextBtnTextEl.id = "ad-ext_next-leg-text";
Expand All @@ -30,9 +75,15 @@ export async function nextPlayerOnTakeOutStuck() {
nextBtnTextEl.textContent = ` (${startSec})`;

if (startSec <= 0) {
clearInterval(takeOutTimout);
(nextBtn as HTMLElement).click();
document.getElementById("ad-ext_next-leg-text")?.remove();
if (takeOutTimout) {
nextBtnTextEl.textContent = ""; // Reset the button text
clearInterval(takeOutTimout);
}
if (nextBtn instanceof HTMLElement) {
nextBtn.click();
}
const element = document.getElementById("ad-ext_next-leg-text");
element?.remove();
}
}, 1000);
}
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.10",
"version": "1.3.11",
"type": "module",
"author": {
"name": "Tobias Thiele",
Expand Down

0 comments on commit bd243b0

Please sign in to comment.