diff --git a/src/equicordplugins/_api/userArea.ts b/src/equicordplugins/_api/userArea.ts index fdc214492..b8ca1174d 100644 --- a/src/equicordplugins/_api/userArea.ts +++ b/src/equicordplugins/_api/userArea.ts @@ -19,7 +19,7 @@ export default definePlugin({ patches: [ { - find: ".DISPLAY_NAME_STYLES_COACHMARK)", + find: "#{intl::USER_PROFILE_ACCOUNT_POPOUT_BUTTON_A11Y_LABEL}", replacement: [ { match: /children:\[(?=.{0,50}accountContainerRef:\i)/, diff --git a/src/equicordplugins/declutter/index.tsx b/src/equicordplugins/declutter/index.tsx index 9446e4033..68fadc634 100644 --- a/src/equicordplugins/declutter/index.tsx +++ b/src/equicordplugins/declutter/index.tsx @@ -173,7 +173,7 @@ export default definePlugin({ }, // User Area { - find: ".DISPLAY_NAME_STYLES_COACHMARK)", + find: "#{intl::USER_PROFILE_ACCOUNT_POPOUT_BUTTON_A11Y_LABEL}", replacement: [ { match: /((\i)=\i\?\.avatarDecoration,\i=)\(0,\i\.\i\)\(\2\)/, @@ -221,7 +221,7 @@ export default definePlugin({ }, { // Always show username - find: ".DISPLAY_NAME_STYLES_COACHMARK)", + find: "#{intl::USER_PROFILE_ACCOUNT_POPOUT_BUTTON_A11Y_LABEL}", replacement: { match: /hoverText:(\i),forceHover:\i,children:/g, replace: "hoverText:$1,forceHover:!0,children:" diff --git a/src/equicordplugins/moreStickers/index.tsx b/src/equicordplugins/moreStickers/index.tsx index 4e89d8089..f3639e189 100644 --- a/src/equicordplugins/moreStickers/index.tsx +++ b/src/equicordplugins/moreStickers/index.tsx @@ -53,7 +53,7 @@ export default definePlugin({ }] }, { - find: ".GIFT_PROMOTION]).", + find: '("ChannelTextAreaButtons")', replacement: [ { match: /(?<=(,\i\.stickers\?\.button.{0,50}\i\.push\(\(.{0,100})\},"sticker"\)\))/, diff --git a/src/equicordplugins/musicControls/index.tsx b/src/equicordplugins/musicControls/index.tsx index dae172841..0a153b6d2 100644 --- a/src/equicordplugins/musicControls/index.tsx +++ b/src/equicordplugins/musicControls/index.tsx @@ -48,7 +48,7 @@ export default definePlugin({ patches: [ { - find: ".DISPLAY_NAME_STYLES_COACHMARK)", + find: "#{intl::USER_PROFILE_ACCOUNT_POPOUT_BUTTON_A11Y_LABEL}", replacement: { // react.jsx)(AccountPanel, { ..., showTaglessAccountPanel: blah }) match: /(?<=\i\.jsxs?\)\()(\i),{(?=[^}]*?userTag:\i,occluded:)/, diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index d8d9f9299..e36ba74ad 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -88,7 +88,7 @@ export default definePlugin({ }, // Current user area, at bottom of channels/dm list { - find: ".DISPLAY_NAME_STYLES_COACHMARK)", + find: "#{intl::USER_PROFILE_ACCOUNT_POPOUT_BUTTON_A11Y_LABEL}", replacement: [ // Use Decor avatar decoration hook { diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index 527439258..ff47832b8 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -738,32 +738,6 @@ export default definePlugin({ replace: "Object.assign($&,{ deleted:$1.deleted, editHistory:$1.editHistory, firstEditTimestamp:$1.firstEditTimestamp, diffViewDisabled:$1.diffViewDisabled })", }, - - { - // Construct new edited message and add editHistory & deleted (ref above) - // Pass in custom data to attachment parser to mark attachments deleted as well - match: /attachments:(\i)\((\i)\)/, - replace: - "attachments: $1((() => {" + - " if ($self.shouldIgnore($2)) return $2;" + - " let old = arguments[1]?.attachments;" + - " if (!old) return $2;" + - " let new_ = $2.attachments?.map(a => a.id) ?? [];" + - " let diff = old.filter(a => !new_.includes(a.id));" + - " old.forEach(a => a.deleted = true);" + - " $2.attachments = [...diff, ...$2.attachments];" + - " return $2;" + - "})())," + - "deleted: arguments[1]?.deleted," + - "editHistory: arguments[1]?.editHistory," + - "firstEditTimestamp: new Date(arguments[1]?.firstEditTimestamp ?? $2.editedTimestamp ?? $2.timestamp)," + - "diffViewDisabled: arguments[1]?.diffViewDisabled", - }, - { - // Preserve deleted attribute on attachments - match: /(\((\i)\){return null==\2\.attachments.+?)spoiler:/, - replace: "$1deleted: arguments[0]?.deleted," + "spoiler:", - }, ], }, @@ -771,9 +745,15 @@ export default definePlugin({ // Attachment renderer find: "#{intl::REMOVE_ATTACHMENT_TOOLTIP_TEXT}", replacement: [ + // add deleted class to deleted attachments { - match: /\.SPOILER,(?=\[\i\.\i\]:)/, - replace: '$&"messagelogger-deleted-attachment":arguments[0]?.item?.originalItem?.deleted,' + // we can't use arguments[0] because we patch a nested **non-arrow** function + match: /\.SPOILER,(?=\[\i\.\i\]:)(?<=item:(\i),.{0,200}?)/, + replace: '$&"messagelogger-deleted-attachment": $1?.originalItem?.deleted,' + }, + { + match: /(?<=function \i\(\i\)\{let\{[^}]*?item:(\i),\i:\i,)canRemoveItem:(\i)(?=,onRemoveItem:)/, + replace: "_canRemoveItem:$2 = arguments[0].canRemoveItem && !$1?.originalItem?.deleted", } ] },