diff options
author | Vendicated <vendicated@riseup.net> | 2022-09-08 22:25:21 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-09-08 22:25:21 +0200 |
commit | 6099179f0230e3c6eb449a2cd7f6a5c5d79201f2 (patch) | |
tree | 78d3eede2c9ca882481989523680de4c317032dd /src/plugins | |
parent | e52225304e47d92bf1b84f5a2c8e97ab57bd85a4 (diff) | |
download | Vencord-6099179f0230e3c6eb449a2cd7f6a5c5d79201f2.tar.gz Vencord-6099179f0230e3c6eb449a2cd7f6a5c5d79201f2.tar.bz2 Vencord-6099179f0230e3c6eb449a2cd7f6a5c5d79201f2.zip |
ViewIcons: Now opens icons in image viewer
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/viewIcons.tsx (renamed from src/plugins/viewIcons.ts) | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/plugins/viewIcons.ts b/src/plugins/viewIcons.tsx index a6ba4d4..39c4303 100644 --- a/src/plugins/viewIcons.ts +++ b/src/plugins/viewIcons.tsx @@ -1,12 +1,31 @@ import { REACT_GLOBAL } from "../utils/constants"; -import IpcEvents from "../utils/IpcEvents"; +import { Modal, openModal } from "../utils/modal"; import definePlugin from '../utils/types'; +import { filters, waitFor } from "../webpack"; -const OPEN_URL = `VencordNative.ipc.invoke("${IpcEvents.OPEN_EXTERNAL}",`; +let ImageModal: any; +let renderMaskedLink: any; + +waitFor(filters.byDisplayName("ImageModal"), m => ImageModal = m.default); +waitFor("renderMaskedLinkComponent", m => renderMaskedLink = m.renderMaskedLinkComponent); + +const OPEN_URL = "Vencord.Plugins.plugins.ViewIcons.openImage("; export default definePlugin({ name: "ViewIcons", author: "Vendicated", description: "Makes Avatars/Banners in user profiles clickable, and adds Guild Context Menu Entries to View Banner/Icon. Crashes if you don't have Developer Mode enabled, will fix in the future.", + + openImage(url: string) { + openModal(() => ( + <ImageModal + shouldAnimate={true} + original={url} + src={url} + renderLinkComponent={renderMaskedLink} + /> + ), { size: Modal.ModalSize.DYNAMIC }); + }, + patches: [ { find: "UserProfileModalHeader", |