From b8e87a9f6de687aa1c410c862e204a4c6badcdd6 Mon Sep 17 00:00:00 2001 From: Xmader Date: Mon, 26 Oct 2020 15:22:54 -0400 Subject: [PATCH] fix: scoreinfo store --- src/scoreinfo.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scoreinfo.ts b/src/scoreinfo.ts index c980864..5df249f 100644 --- a/src/scoreinfo.ts +++ b/src/scoreinfo.ts @@ -3,8 +3,9 @@ // run at document-start export const ugappJsStore: Record | null = (() => { try { - const el = document.querySelector('.js-store') as HTMLDivElement - const json = el.dataset.content as string + const l = document.body.children as HTMLCollectionOf + const el = [...l].find(e => Object.keys(e.dataset).length > 0) as HTMLDivElement + const json = Object.values(el.dataset)[0] as string return JSON.parse(json) } catch (err) { console.error(err)