diff --git a/src/plugins/textEmoji/README.md b/src/plugins/textEmoji/README.md new file mode 100644 index 000000000..8850d0aba --- /dev/null +++ b/src/plugins/textEmoji/README.md @@ -0,0 +1,9 @@ +# TextEmoji + +Prevents Discord from replacing emoji with images, leaving it up to the browser +to render them + +![Chat with TextEmoji enabled, using the Noto Color Emoji font](https://github.com/Vendicated/Vencord/assets/33988779/464ec526-8ef7-4961-941f-a2a05642b0f7) + +Allows your browser to render emoji as regular text, using the system font, such +as Noto Color Emoji or Segoe UI Emoji. diff --git a/src/plugins/textEmoji/index.ts b/src/plugins/textEmoji/index.ts new file mode 100644 index 000000000..7ad4b9bd6 --- /dev/null +++ b/src/plugins/textEmoji/index.ts @@ -0,0 +1,46 @@ +/* + * Vencord, a modification for Discord's desktop app + * Copyright (c) 2023 Vendicated and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +import "./styles.css"; + +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; + +export default definePlugin({ + name: "TextEmoji", + description: "Prevents Discord from replacing emoji with images, leaving it up to the browser to render them", + authors: [Devs.Grzesiek11], + patches: [ + // Reactions + { + find: "getSrc(){", + replacement: { + match: /(if\(null!=\i\))return \i\.\i\.getURL\(\i\)/, + replace: "$1return null", + }, + }, + // Messages + { + find: ",findInlineEmojisFromSurrogates:", + replacement: { + match: /if\(!0!==\i&&!\i\.test\(\i\)\)/, + replace: "if(true)", + }, + }, + ], +}); diff --git a/src/plugins/textEmoji/styles.css b/src/plugins/textEmoji/styles.css new file mode 100644 index 000000000..19818b878 --- /dev/null +++ b/src/plugins/textEmoji/styles.css @@ -0,0 +1,3 @@ +[class^="reaction_"] .emoji { + white-space: nowrap; +}