From f5a37fc6b58f7b1d3a70fd3a7586113e1f8de8b6 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Wed, 16 Oct 2024 00:16:45 -0600 Subject: [PATCH] mediaTweaks: canary fixes --- .../webpackModules/enlargeVideoButton.tsx | 51 ++++++++----------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/src/mediaTweaks/webpackModules/enlargeVideoButton.tsx b/src/mediaTweaks/webpackModules/enlargeVideoButton.tsx index c2c4066..a6b8692 100644 --- a/src/mediaTweaks/webpackModules/enlargeVideoButton.tsx +++ b/src/mediaTweaks/webpackModules/enlargeVideoButton.tsx @@ -26,14 +26,8 @@ type MimeType = { compressible?: boolean; }; -const createMediaModal = spacepack.findFunctionByStrings( - spacepack.findByCode(".zoomedCarouselModalRoot,items:")[0].exports, - '.searchParams.append("format","webp")' -); - -const MediaModalClasses = spacepack.findByExports("modal", "image")[0].exports; - -const noop = () => null; +const MediaModal = spacepack.findByCode(".Messages.MEDIA_VIEWER_MODAL_ALT_TEXT,")[0]?.exports?.default; +const MediaModalClasses = spacepack.findByCode(/\.exports={modal:"modal_[a-z0-9]+"}/)[0].exports; const MimeTypes = Object.entries( spacepack.findByCode(`JSON.parse('{"application/1d-interleaved-parityfec":`)[0].exports @@ -49,28 +43,25 @@ export default function EnlargeVideoButton({ mimeType, item }: HoverButtonsProps focusProps={{ offset: 2 }} aria-label="Enlarge Video" onClick={() => { - if (createMediaModal != null) { - console.log(mimeType, item); - const modal = createMediaModal( - { - contentType: item.contentType, - proxyUrl: item.originalItem.proxy_url, - url: item.originalItem.proxy_url, - width: item.originalItem.width, - height: item.originalItem.height - }, - noop, - true, - false - ); - if (modal != null) - openModal((modalProps: any) => { - return ( - - {modal.component} - - ); - }); + if (MediaModal != null) { + openModal((modalProps: any) => { + return ( + + ); + }); } }} >