Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(caa dims): compatibility with new beta.MBS #770

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/mb_caa_dimensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import { createCache } from './info-cache';

import css from './style.scss';

// Query for the span element containing the cover art image.
// Old class name is "cover-art-image", new (since beta.MBS of May 24 2024) is "artwork-image".
// TODO: Change this when new class name lands in production MBS.
const ARTWORK_QUERY = '.cover-art-image, .artwork-image';

function processPageChange(mutations: MutationRecord[], cache: InfoCache): void {
const addedNodes = mutations.flatMap((mutation) => [...mutation.addedNodes]);
for (const addedNode of addedNodes) {
Expand Down Expand Up @@ -50,7 +55,7 @@ function detectAndObserveImages(cache: InfoCache): void {
processPageChange(mutations, cache);
});

for (const container of qsa('.cover-art-image')) {
for (const container of qsa(ARTWORK_QUERY)) {
// Seems to cover all possible cover art images except for queued upload thumbnails
const imageElement = qsMaybe<HTMLImageElement>('img', container);

Expand Down
4 changes: 3 additions & 1 deletion src/mb_caa_dimensions/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ div.thumb-position {
}

// Styling of the info spans
span.cover-art-image {
// TODO: beta.MBS of May 24 2024 changed the classname from "cover-art-image" to "artwork-image".
// Change this when new class name lands in production MBS.
span.cover-art-image, span.artwork-image {
display: inline-block;
}
span.ROpdebee_dimensions, span.ROpdebee_fileInfo {
Expand Down