Fix ImageZoom

Also fixes the image modal being off centre when having the plugin enabled

Co-Authored-By: sadan <117494111+sadan4@users.noreply.github.com>
This commit is contained in:
Vendicated 2024-10-23 04:22:11 +02:00
parent a11ccde40f
commit 0af820c874
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
6 changed files with 28 additions and 28 deletions

View file

@ -156,14 +156,10 @@ export default definePlugin({
patches: [ patches: [
{ {
find: "Messages.OPEN_IN_BROWSER", find: ".contain,SCALE_DOWN:",
replacement: { replacement: {
// there are 2 image thingies. one for carosuel and one for the single image. match: /\.slide,\i\),/g,
// so thats why i added global flag. replace: `$&id:"${ELEMENT_ID}",`
// also idk if this patch is good, should it be more specific?
// https://regex101.com/r/xfvNvV/1
match: /return.{1,200}\.wrapper.{1,200}src:\i,/g,
replace: `$&id: '${ELEMENT_ID}',`
} }
}, },
@ -185,13 +181,6 @@ export default definePlugin({
replace: "$&$self.unMountMagnifier();" replace: "$&$self.unMountMagnifier();"
} }
] ]
},
{
find: ".carouselModal",
replacement: {
match: /(?<=\.carouselModal.{0,100}onClick:)\i,/,
replace: "()=>{},"
}
} }
], ],

View file

@ -23,12 +23,3 @@
/* https://googlechrome.github.io/samples/image-rendering-pixelated/index.html */ /* https://googlechrome.github.io/samples/image-rendering-pixelated/index.html */
} }
/* make the carousel take up less space so we can click the backdrop and exit out of it */
[class*="modalCarouselWrapper_"] {
top: 0 !important;
}
[class*="carouselModal_"] {
height: 0 !important;
}

View file

@ -30,7 +30,9 @@ export default definePlugin({
name: "ServerInfo", name: "ServerInfo",
description: "Allows you to view info about a server", description: "Allows you to view info about a server",
authors: [Devs.Ven, Devs.Nuckyz], authors: [Devs.Ven, Devs.Nuckyz],
dependencies: ["DynamicImageModalAPI"],
tags: ["guild", "info", "ServerProfile"], tags: ["guild", "info", "ServerProfile"],
contextMenus: { contextMenus: {
"guild-context": Patch, "guild-context": Patch,
"guild-header-popout": Patch "guild-header-popout": Patch

View file

@ -229,11 +229,7 @@ function AlbumContextMenu({ track }: { track: Track; }) {
id="view-cover" id="view-cover"
label="View Album Cover" label="View Album Cover"
// trolley // trolley
action={() => openImageModal({ action={() => openImageModal(track.album.image)}
url: track.album.image.url,
height: 512,
width: 512
})}
icon={ImageIcon} icon={ImageIcon}
/> />
<Menu.MenuControlItem <Menu.MenuControlItem

View file

@ -1,3 +1,24 @@
.vc-position-inherit { .vc-position-inherit {
position: inherit; position: inherit;
} }
/**
* copy pasted from discord css. not really webpack-findable since it's the only class in the module
**/
.vc-image-modal {
background: transparent!important;
box-shadow: none!important;
display: flex;
justify-content: center;
align-items: center;
border-radius: 0
}
@media(width <= 485px) {
.vc-image-modal {
display:relative;
overflow: visible;
overflow: initial
}
}

View file

@ -117,6 +117,7 @@ export function openImageModal(props: Omit<ImageModalItem, "type">): string {
return openModal(modalProps => ( return openModal(modalProps => (
<ImageModal <ImageModal
{...modalProps} {...modalProps}
className="vc-image-modal"
fit="vc-position-inherit" fit="vc-position-inherit"
items={[{ items={[{
type: "IMAGE", type: "IMAGE",