Skip to content

Commit

Permalink
[open-profile-images] fix banners
Browse files Browse the repository at this point in the history
  • Loading branch information
ioj4 committed Aug 26, 2024
1 parent e52f98b commit e1c19a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/open-profile-images/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ function onClick(e) {
e.stopImmediatePropagation();
}

const bannerSelector = `[class*="userProfileInner"] [class*="banner"]`;

// this is fine 🔥
// it really is, i tested perf 🪄
const subSelectors = [
Expand All @@ -27,13 +29,15 @@ const subSelectors = [
// pfp in topbar in DMs, friends list, add to DM popover and own pfp in bottom left
`[class*="wrapper"][class*="avatar"]`,
// banner in profile modal
`[class*="bannerPremium"]:not([class*="settingsBanner"])`
bannerSelector
];

export function onLoad() {
scoped.observeDom(
`:is(${subSelectors.join(",")}):not(.${classes.ioj4Opi})`,
(el) => {
if (el.matches(bannerSelector) && !el.style.backgroundImage) return;

el.classList.add(classes.ioj4Opi);
el.addEventListener("click", onClick);
}
Expand Down

0 comments on commit e1c19a7

Please sign in to comment.