diff --git a/src/plugins/viewIcons/index.tsx b/src/plugins/viewIcons/index.tsx index 06a7c0a7..fd6b7b6b 100644 --- a/src/plugins/viewIcons/index.tsx +++ b/src/plugins/viewIcons/index.tsx @@ -173,7 +173,7 @@ export default definePlugin({ patches: [ // Make pfps clickable { - find: "onAddFriend:", + find: "onAddFriend:function", replacement: { match: /\{src:(\i)(?=,avatarDecoration)/, replace: "{src:$1,onClick:()=>$self.openImage($1)" @@ -191,9 +191,9 @@ export default definePlugin({ } }, { - find: "().avatarWrapperNonUserBot", + find: ".avatarPositionPanel", replacement: { - match: /(?<=avatarPositionPanel.+?)onClick:(\i\|\|\i)\?void 0(?<=,(\i)=\i\.avatarSrc.+?)/, + match: /(?<=avatarWrapperNonUserBot.{0,50})onClick:(\i\|\|\i)\?void 0(?<=,avatarSrc:(\i).+?)/, replace: "style:($1)?{cursor:\"pointer\"}:{},onClick:$1?()=>{$self.openImage($2)}" } } diff --git a/src/utils/modal.tsx b/src/utils/modal.tsx index d7a054a5..1efb9cdd 100644 --- a/src/utils/modal.tsx +++ b/src/utils/modal.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { filters, findByCode, findByPropsLazy, mapMangledModuleLazy } from "@webpack"; +import { filters, findByProps, findByPropsLazy, mapMangledModuleLazy } from "@webpack"; import type { ComponentType, PropsWithChildren, ReactNode, Ref } from "react"; import { LazyComponent } from "./react"; @@ -124,7 +124,7 @@ export type ImageModal = ComponentType<{ shouldHideMediaOptions?: boolean; }>; -export const ImageModal = LazyComponent(() => findByCode(".renderLinkComponent", ".responsive") as ImageModal); +export const ImageModal = LazyComponent(() => findByProps("ImageModal").ImageModal as ImageModal); export const ModalRoot = LazyComponent(() => Modals.ModalRoot); export const ModalHeader = LazyComponent(() => Modals.ModalHeader); diff --git a/src/webpack/common/classes.ts b/src/webpack/common/classes.ts index 8bc76409..ca3d75f5 100644 --- a/src/webpack/common/classes.ts +++ b/src/webpack/common/classes.ts @@ -16,9 +16,9 @@ * along with this program. If not, see . */ -import { findByPropsLazy } from "@webpack"; +import { findByPropsLazy, findLazy } from "@webpack"; import * as t from "./types/classes"; -export const ModalImageClasses: t.ImageModalClasses = findByPropsLazy("image", "modal", "responsiveWidthMobile"); +export const ModalImageClasses: t.ImageModalClasses = findLazy(m => m.image && m.modal && !m.applicationIcon); export const ButtonWrapperClasses: t.ButtonWrapperClasses = findByPropsLazy("buttonWrapper", "buttonContent"); diff --git a/src/webpack/common/types/classes.d.ts b/src/webpack/common/types/classes.d.ts index 0d2946fe..b6066177 100644 --- a/src/webpack/common/types/classes.d.ts +++ b/src/webpack/common/types/classes.d.ts @@ -19,7 +19,6 @@ export interface ImageModalClasses { image: string, modal: string, - responsiveWidthMobile: string; } export interface ButtonWrapperClasses {