Skip to content

Commit

Permalink
apply disable gifs to community browse page
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon committed Jan 23, 2025
1 parent 4b0a531 commit 7c8b827
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/features/accesskit/disable_gifs.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export const styleElement = buildStyle(`
font-size: 0.6rem;
}
.${labelClass}${hovered} {
.${labelClass}${hovered},
a:hover + div .${labelClass} {
display: none;
}
Expand All @@ -46,7 +47,7 @@ img[style*="${contentModifiedVar}"]:not(${hovered}) {
.${backgroundGifClass}:not(:hover) {
background-image: none !important;
background-color: rgb(var(--secondary-accent));
background-color: rgb(var(--secondary-accent)) !important;
}
.${backgroundGifClass}:not(:hover) > div {
Expand Down Expand Up @@ -88,7 +89,7 @@ const pausedBackgroundImageValues = {};
const backgroundStyleElement = buildStyle();
const updateBackgroundStyle = () => {
backgroundStyleElement.textContent = Object.entries(pausedBackgroundImageValues)
.map(([id, value]) => `[data-disable-gifs-id="${id}"]:not(:hover) { background-image: ${value} !important; }`)
.map(([id, value]) => `[data-disable-gifs-id="${id}"]:not(:hover):not(a:hover + div > *) { background-image: ${value} !important; }`)
.join('\n');
};

Expand Down Expand Up @@ -148,7 +149,7 @@ export const main = async function () {
pageModifications.register(gifImage, processGifs);

const gifBackgroundImage = `
${keyToCss('communityHeaderImage', 'bannerImage', 'videoHubCardWrapper')}[style*=".gif"]
${keyToCss('communityHeaderImage', 'communityCategoryImage', 'bannerImage', 'videoHubCardWrapper')}[style*=".gif"]
`;
pageModifications.register(gifBackgroundImage, processBackgroundGifs);
document.documentElement.append(backgroundStyleElement);
Expand Down

0 comments on commit 7c8b827

Please sign in to comment.