Skip to content

Commit

Permalink
fix: handle scores without previews
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterNjeim committed Nov 8, 2023
1 parent cad92bb commit 0dfb311
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ const main = (): void => {
let isOfficial = false;
new Promise(() => {
const observer = new MutationObserver(() => {
const sub = Array.from(
let noSub = Array.from(
document.querySelectorAll("#jmuse-scroller-component div")
).some((img: HTMLDivElement) =>
img.innerText.startsWith("End of preview")
);
if (!noSub) {
noSub = document.querySelector("#jmuse-scroller-component")
? false
: true;
}
const scoreinfo = new ScoreInfoInPage(document);
const btnList = new BtnList();
let indvPartBtn: HTMLButtonElement | null = null;
Expand All @@ -57,7 +62,7 @@ const main = (): void => {
};

if (
sub &&
noSub &&
(document.querySelector(
"meta[property='musescore:author'][content='Official Scores']"
) ||
Expand Down

0 comments on commit 0dfb311

Please sign in to comment.