mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-16 09:57:08 -04:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
05a8d62477
4 changed files with 55 additions and 26 deletions
5
src/plugins/noUnblockToJump/README.md
Normal file
5
src/plugins/noUnblockToJump/README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# No Unblock To Jump
|
||||||
|
|
||||||
|
Removes the popup preventing you to jump to a message from a blocked/ignored user (eg: in search results)
|
||||||
|
|
||||||
|

|
|
@ -26,25 +26,46 @@ export default definePlugin({
|
||||||
authors: [Devs.dzshn],
|
authors: [Devs.dzshn],
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
|
// Clicking on search results to jump
|
||||||
find: '.id,"Search Results"',
|
find: '.id,"Search Results"',
|
||||||
replacement: {
|
replacement: [
|
||||||
|
{
|
||||||
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
||||||
replace: "if(false)$1"
|
replace: "if(false)$1"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNIGNORE_TO_JUMP_TITLE})/,
|
||||||
|
replace: "if(false)$1"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Jump buttton in top right corner of messages
|
||||||
find: "renderJumpButton()",
|
find: "renderJumpButton()",
|
||||||
replacement: {
|
replacement: [
|
||||||
|
{
|
||||||
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
||||||
replace: "if(false)$1"
|
replace: "if(false)$1"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNIGNORE_TO_JUMP_TITLE})/,
|
||||||
|
replace: "if(false)$1"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Clicking on replied messages to jump
|
||||||
find: "flash:!0,returnMessageId",
|
find: "flash:!0,returnMessageId",
|
||||||
replacement: {
|
replacement: [
|
||||||
|
{
|
||||||
match: /.\?(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
match: /.\?(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
|
||||||
replace: "false?$1"
|
replace: "false?$1"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
match: /.\?(.{1,10}\.show\({.{1,50}#{intl::UNIGNORE_TO_JUMP_TITLE})/,
|
||||||
|
replace: "false?$1"
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,7 +57,7 @@ const UrlReplacementRules: Record<string, URLReplacementRule> = {
|
||||||
description: "Open Tidal links in the Tidal app",
|
description: "Open Tidal links in the Tidal app",
|
||||||
},
|
},
|
||||||
itunes: {
|
itunes: {
|
||||||
match: /^https:\/\/music\.apple\.com\/([a-z]{2}\/)?(album|artist|playlist|song|curator)\/([^/?#]+)\/?([^/?#]+)?(?:\?.*)?(?:#.*)?$/,
|
match: /^https:\/\/(?:geo\.)?music\.apple\.com\/([a-z]{2}\/)?(album|artist|playlist|song|curator)\/([^/?#]+)\/?([^/?#]+)?(?:\?.*)?(?:#.*)?$/,
|
||||||
replace: (_, lang, type, name, id) => id ? `itunes://music.apple.com/us/${type}/${name}/${id}` : `itunes://music.apple.com/us/${type}/${name}`,
|
replace: (_, lang, type, name, id) => id ? `itunes://music.apple.com/us/${type}/${name}/${id}` : `itunes://music.apple.com/us/${type}/${name}`,
|
||||||
description: "Open Apple Music links in the iTunes app"
|
description: "Open Apple Music links in the iTunes app"
|
||||||
},
|
},
|
||||||
|
|
|
@ -20,7 +20,7 @@ import { definePluginSettings, Settings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
import { ChannelStore, FluxDispatcher as Dispatcher, MessageStore, PermissionsBits, PermissionStore, SelectedChannelStore, UserStore } from "@webpack/common";
|
import { ChannelStore, ComponentDispatch, FluxDispatcher as Dispatcher, MessageStore, PermissionsBits, PermissionStore, SelectedChannelStore, UserStore } from "@webpack/common";
|
||||||
import { Message } from "discord-types/general";
|
import { Message } from "discord-types/general";
|
||||||
|
|
||||||
const Kangaroo = findByPropsLazy("jumpToMessage");
|
const Kangaroo = findByPropsLazy("jumpToMessage");
|
||||||
|
@ -60,24 +60,24 @@ export default definePlugin({
|
||||||
settings,
|
settings,
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
Dispatcher.subscribe("DELETE_PENDING_REPLY", onDeletePendingReply);
|
|
||||||
Dispatcher.subscribe("MESSAGE_END_EDIT", onEndEdit);
|
|
||||||
Dispatcher.subscribe("MESSAGE_START_EDIT", onStartEdit);
|
|
||||||
Dispatcher.subscribe("CREATE_PENDING_REPLY", onCreatePendingReply);
|
|
||||||
document.addEventListener("keydown", onKeydown);
|
document.addEventListener("keydown", onKeydown);
|
||||||
},
|
},
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
Dispatcher.unsubscribe("DELETE_PENDING_REPLY", onDeletePendingReply);
|
|
||||||
Dispatcher.unsubscribe("MESSAGE_END_EDIT", onEndEdit);
|
|
||||||
Dispatcher.unsubscribe("MESSAGE_START_EDIT", onStartEdit);
|
|
||||||
Dispatcher.unsubscribe("CREATE_PENDING_REPLY", onCreatePendingReply);
|
|
||||||
document.removeEventListener("keydown", onKeydown);
|
document.removeEventListener("keydown", onKeydown);
|
||||||
},
|
},
|
||||||
});
|
|
||||||
|
|
||||||
const onDeletePendingReply = () => replyIdx = -1;
|
flux: {
|
||||||
const onEndEdit = () => editIdx = -1;
|
DELETE_PENDING_REPLY() {
|
||||||
|
replyIdx = -1;
|
||||||
|
},
|
||||||
|
MESSAGE_END_EDIT() {
|
||||||
|
editIdx = -1;
|
||||||
|
},
|
||||||
|
MESSAGE_START_EDIT: onStartEdit,
|
||||||
|
CREATE_PENDING_REPLY: onCreatePendingReply
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function calculateIdx(messages: Message[], id: string) {
|
function calculateIdx(messages: Message[], id: string) {
|
||||||
const idx = messages.findIndex(m => m.id === id);
|
const idx = messages.findIndex(m => m.id === id);
|
||||||
|
@ -109,6 +109,8 @@ function onKeydown(e: KeyboardEvent) {
|
||||||
if (!isUp && e.key !== "ArrowDown") return;
|
if (!isUp && e.key !== "ArrowDown") return;
|
||||||
if (!isCtrl(e) || isAltOrMeta(e)) return;
|
if (!isCtrl(e) || isAltOrMeta(e)) return;
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
if (e.shiftKey)
|
if (e.shiftKey)
|
||||||
nextEdit(isUp);
|
nextEdit(isUp);
|
||||||
else
|
else
|
||||||
|
@ -195,9 +197,10 @@ function nextReply(isUp: boolean) {
|
||||||
channel,
|
channel,
|
||||||
message,
|
message,
|
||||||
shouldMention: shouldMention(message),
|
shouldMention: shouldMention(message),
|
||||||
showMentionToggle: channel.guild_id !== null && message.author.id !== meId,
|
showMentionToggle: channel.isPrivate() && message.author.id !== meId,
|
||||||
_isQuickReply: true
|
_isQuickReply: true
|
||||||
});
|
});
|
||||||
|
ComponentDispatch.dispatchToLastSubscribed("TEXTAREA_FOCUS");
|
||||||
jumpIfOffScreen(channel.id, message.id);
|
jumpIfOffScreen(channel.id, message.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue