mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-13 10:54:28 +08:00
Remove getElementIndex
This commit is contained in:
parent
5c5d6af536
commit
db0e29cdf4
2 changed files with 5 additions and 16 deletions
|
|
@ -314,14 +314,14 @@ qs("#replayWords")?.onChild("click", "letter", (event) => {
|
|||
pauseReplay();
|
||||
const replayWords = qs("#replayWords");
|
||||
|
||||
const words = replayWords?.getChildren();
|
||||
const words = [...(replayWords?.native?.children ?? [])];
|
||||
targetWordPos =
|
||||
words?.getElementIndex(
|
||||
words?.indexOf(
|
||||
(event.childTarget as HTMLElement).parentNode as HTMLElement,
|
||||
) ?? 0;
|
||||
const letters = words?.[targetWordPos]?.getChildren();
|
||||
targetCurPos =
|
||||
letters?.getElementIndex(event.childTarget as HTMLElement) ?? 0;
|
||||
|
||||
const letters = [...(words[targetWordPos] as HTMLElement).children];
|
||||
targetCurPos = letters?.indexOf(event.childTarget as HTMLElement) ?? 0;
|
||||
|
||||
initializeReplayPrompt();
|
||||
loadOldReplay();
|
||||
|
|
|
|||
|
|
@ -862,17 +862,6 @@ export class ElementsWithUtils<
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the index of element in the array
|
||||
*/
|
||||
getElementIndex(element: HTMLElement): number {
|
||||
console.warn(this.length);
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
if (this[i]?.native === element) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set multiple style properties on all elements in the array.
|
||||
* An empty object clears all styles.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue