Skip to content

Commit

Permalink
Merge pull request #22 from creazy231/fix/bugfixes
Browse files Browse the repository at this point in the history
Fix: getting p of stats
  • Loading branch information
creazy231 authored Apr 10, 2024
2 parents a117d3f + 17d6233 commit f5a1a56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion entrypoints/match.content/setPlayerInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function setPlayerInfo() {
...(matchhasLegs && { legs: playerStatsEl?.children[0]?.children[matchhasSets ? 1 : 0]?.textContent?.trim() }),
...(matchhasSets && { sets: playerStatsEl?.children[0]?.children[0]?.textContent?.trim() }),
darts: getDartsThrown(playerCardEl as HTMLElement),
stats: playerStatsEl?.querySelectorAll("p")[1]?.textContent?.split("|")[1].trim(),
stats: playerStatsEl?.querySelector(":scope > div > p")?.textContent?.split("|")[1].trim(),
};
});

Expand Down
2 changes: 1 addition & 1 deletion utils/getElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getMenu = () => document.querySelector("#root > div > div") as HTML

export const getWinnerPlayerCard = () => document.querySelector(".ad-ext-player-winner");

export const getDartsThrown = (playerCard: HTMLElement) => playerCard?.nextElementSibling?.querySelectorAll("p")[1]?.textContent?.split("|")[0].trim().split("#")[1].trim();
export const getDartsThrown = (playerCard: HTMLElement) => playerCard?.nextElementSibling?.querySelector(":scope > div > p")?.textContent?.split("|")[0].trim().split("#")[1];

export const getUndoBtn = () => [ ...document.getElementById("ad-ext-turn")?.nextElementSibling?.querySelectorAll("button") as NodeListOf<HTMLButtonElement> ].find(el => el.textContent === "Undo");
export const getNextBtn = () => [ ...document.getElementById("ad-ext-turn")?.nextElementSibling?.querySelectorAll("button") as NodeListOf<HTMLButtonElement> ].find(el => el.textContent === "Next");

0 comments on commit f5a1a56

Please sign in to comment.