diff --git a/src/equicordplugins/moreStickers/index.tsx b/src/equicordplugins/moreStickers/index.tsx index 2388329f..08796396 100644 --- a/src/equicordplugins/moreStickers/index.tsx +++ b/src/equicordplugins/moreStickers/index.tsx @@ -35,54 +35,34 @@ export default definePlugin({ find: "ChannelStickerPickerButton", replacement: [{ match: /(children:\(0,\i\.jsx\)\()(.{0,10})({innerClassName.{10,30}\.stickerButton)/, - replace: (_, head, button, tail) => { - const isMoreStickers = "arguments[0]?.stickersType"; - return `${head}${isMoreStickers}?$self.stickerButton:${button}${tail}`; - } + replace: "$1arguments[0]?.stickersType?$self.stickerButton:$2$3" }, { - match: /(\i=)(\i\.useCallback.{0,25}\.STICKER,.{0,10});/, - replace: (_, decl, cb) => { - const newCb = cb.replace(/(?<=\(\)=>\{\(.*?\)\().+?\.STICKER/, "\"stickers+\""); - return `${decl}arguments[0]?.stickersType?${newCb}:${cb};`; - } + match: /(\i=)((\i\.useCallback\(\(\)=>\{\(.*?\)\().*?\.STICKER,(\i.{0,10}));/, + replace: '$1arguments[0]?.stickersType?$3"stickers+",$4:$2;' }, { match: /(\i)=((\i)===\i\.\i\.STICKER)/, - replace: (_, isActive, isStickerTab, currentTab) => { - const c = "arguments[0].stickersType"; - return `${isActive}=${c}?(${currentTab}===${c}):(${isStickerTab})`; - } + replace: "$1=arguments[0].stickersType?($3===arguments[0].stickersType):($2)" }] }, { find: ".gifts)", replacement: { - match: /,.{0,5}\(null==\(\i=\i\.stickers\)\?void 0.*?(\i)\.push\((\(0,\w\.jsx\))\((.+?),{disabled:\i,type:(\i)},"sticker"\)\)\)/, - replace: (m, _, jsx, compo, type) => { - const c = "arguments[0].type"; - return `${m},${c}?.submit?.button&&${_}.push(${jsx}(${compo},{disabled:!${c}?.submit?.button,type:${type},stickersType:"stickers+"},"stickers+"))`; - } + match: /(?<=,.{0,5}\(null==\(\i=\i\.stickers\)\?void 0.*?(\i)\.push\((\(0,\i\.jsx\))\((.+?),{disabled:\i,type:(\i)},"sticker"\)\)\))/, + replace: ",arguments[0].type?.submit?.button&&$1.push($2($3,{disabled:!arguments[0].type?.submit?.button,type:$4,stickersType:\"stickers+\"},\"stickers+\"))" } }, { find: "#{intl::EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL}", - replacement: { - match: /role:"tablist",.*?,?"aria-label":.+?\),children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s, - replace: m => { - const stickerTabRegex = /(\w+?)\?(\([^()]+?\))\((.{1,2}),{.{0,128},isActive:(.{1,2})===.{1,6}\.STICKER.{1,140},children:(.{1,5}\.string\(.+?\)).*?:null/s; - const res = m.replace(stickerTabRegex, (_m, canUseStickers, jsx, tabHeaderComp, currentTab, stickerText) => { - const isActive = `${currentTab}==="stickers+"`; - return ( - `${_m},${canUseStickers}?` + - `${jsx}(${tabHeaderComp},{id:"stickers+-picker-tab","aria-controls":"more-stickers-picker-tab-panel","aria-selected":${isActive},isActive:${isActive},autoFocus:true,viewType:"stickers+",children:${jsx}("div",{children:${stickerText}+"+"})})` + - ":null" - ); - }); - - return res.replace(/:null,((.{1,200})===.{1,30}\.STICKER&&\w+\?(\([^()]{1,10}\)).{1,15}?(\{.*?,onSelectSticker:.*?\})\):null)/s, (_, _m, currentTab, jsx, props) => { - return `:null,${currentTab}==="stickers+"?${jsx}($self.moreStickersComponent,${props}):null,${_m}`; - }); + replacement: [ + { + match: /(?<=null,(\i)\?(\(.*?\))\((\i),{.{0,128},isActive:(\i)===.{0,200},children:(\i\.intl\.string\(.*?\))\}\)\}\):null,)/s, + replace: '$1?$2($3,{id:"stickers+-picker-tab","aria-controls":"more-stickers-picker-tab-panel","aria-selected":$4==="stickers+",isActive:$4==="stickers+",autoFocus:true,viewType:"stickers+",children:$5+"+"}):null,' + }, + { + match: /:null,((.{1,200})===.{1,30}\.STICKER&&\w+\?(\([^()]{1,10}\)).{1,15}?(\{.*?,onSelectSticker:.*?\})\):null)/, + replace: ':null,$2==="stickers+"?$3($self.moreStickersComponent,$4):null,$1' } - } + ] }, { find: '==="remove_text"', @@ -114,8 +94,8 @@ export default definePlugin({ > - - + + ); }, moreStickersComponent({ diff --git a/src/equicordplugins/moreStickers/style.css b/src/equicordplugins/moreStickers/style.css index 6392044a..16101bf4 100644 --- a/src/equicordplugins/moreStickers/style.css +++ b/src/equicordplugins/moreStickers/style.css @@ -116,7 +116,7 @@ .vc-more-stickers-category-scroller, .vc-more-stickers-picker-content-scroller { - scrollbar-width: thin; + scrollbar-width: none; scrollbar-color: var(--scrollbar-thin-thumb) var(--scrollbar-thin-track); }