mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-09 14:43:03 -04:00
PR Fixes
This commit is contained in:
parent
480f8154b3
commit
0067e54819
4 changed files with 8 additions and 121 deletions
|
@ -100,7 +100,6 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
|
||||||
- NewPluginsManager by Sqaaakoi
|
- NewPluginsManager by Sqaaakoi
|
||||||
- NoAppsAllowed by kvba
|
- NoAppsAllowed by kvba
|
||||||
- NoBulletPoints by Samwich
|
- NoBulletPoints by Samwich
|
||||||
- NoDefaultEmojis by Samwich
|
|
||||||
- NoDeleteSafety by Samwich
|
- NoDeleteSafety by Samwich
|
||||||
- NoMirroredCamera by Nyx
|
- NoMirroredCamera by Nyx
|
||||||
- NoModalAnimation by AutumnVN
|
- NoModalAnimation by AutumnVN
|
||||||
|
@ -148,6 +147,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
|
||||||
- VoiceChannelLog by Sqaaakoi & maintained by thororen
|
- VoiceChannelLog by Sqaaakoi & maintained by thororen
|
||||||
- VoiceChatUtilities by D3SOX
|
- VoiceChatUtilities by D3SOX
|
||||||
- WebpackTarball by Kyuuhachi
|
- WebpackTarball by Kyuuhachi
|
||||||
|
- WhitelistedEmojis by Creations
|
||||||
- WhosWatching by fres
|
- WhosWatching by fres
|
||||||
- WigglyText by nexpid
|
- WigglyText by nexpid
|
||||||
- Woof by Samwich
|
- Woof by Samwich
|
||||||
|
|
|
@ -1,109 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a Discord client mod
|
|
||||||
* Copyright (c) 2024 Vendicated and contributors
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
|
||||||
import { definePluginSettings } from "@api/Settings";
|
|
||||||
import { disableStyle, enableStyle } from "@api/Styles";
|
|
||||||
import { Devs } from "@utils/constants";
|
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
|
||||||
import { Menu } from "@webpack/common";
|
|
||||||
|
|
||||||
import style from "./style.css?managed";
|
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
|
||||||
except: {
|
|
||||||
type: OptionType.STRING,
|
|
||||||
description: "",
|
|
||||||
default: ""
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const expressionPickerPatch: NavContextMenuPatchCallback = (children, props: { target: HTMLElement; }) => () => {
|
|
||||||
// eslint-disable-next-line no-unsafe-optional-chaining
|
|
||||||
const { id, type, name } = props?.target?.dataset;
|
|
||||||
if (id) return;
|
|
||||||
|
|
||||||
if (type === "emoji") {
|
|
||||||
children.push(buttonThingy(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => () => {
|
|
||||||
|
|
||||||
const { favoriteableName } = props ?? {};
|
|
||||||
if (!favoriteableName) { return; }
|
|
||||||
// WHY DID I DO IT THIS WAY
|
|
||||||
const name = favoriteableName.split(":").join("");
|
|
||||||
if (name == null) { return; }
|
|
||||||
const group = findGroupChildrenByChildId("favorite", children) || findGroupChildrenByChildId("unfavorite", children);
|
|
||||||
if (!group) return;
|
|
||||||
|
|
||||||
group.splice(group.findIndex(c => c?.props?.id === "favorite" || c?.props?.id === "unfavorite") + 1, 0, buttonThingy(name));
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function buttonThingy(name) {
|
|
||||||
return (
|
|
||||||
<Menu.MenuItem
|
|
||||||
id="add-emoji-autofill"
|
|
||||||
key="add-emoji-autofill"
|
|
||||||
label={`${(isEmojiExcepted(name)) ? "Remove From " : "Add To "} Autofill`}
|
|
||||||
action={() => addEmojiToAutofill(name)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addEmojiToAutofill(name) {
|
|
||||||
const excepted = isEmojiExcepted(name);
|
|
||||||
if (excepted) {
|
|
||||||
// remove the emoji if its already in there
|
|
||||||
// split up the exceptions by the seperator, filter out the emoji, then re join it.
|
|
||||||
settings.store.except = settings.store.except.split(", ").filter(item => item !== name).join(", ");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// add the emoji to the exceptions
|
|
||||||
settings.store.except = settings.store.except += (", " + name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function isEmojiExcepted(name) {
|
|
||||||
return settings.store.except.split(", ").includes(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "NoDefaultEmojis",
|
|
||||||
description: "Stops default emojis showing in the autocomplete. (You can add exceptions)",
|
|
||||||
authors: [Devs.Samwich],
|
|
||||||
settings,
|
|
||||||
patches: [
|
|
||||||
{
|
|
||||||
find: ".Messages.EMOJI_MATCHING",
|
|
||||||
replacement: {
|
|
||||||
match: /renderResults\((\i)\){/,
|
|
||||||
replace: "renderResults($1){ $1.results.emojis = $1.results.emojis.filter(emoji => !emoji.uniqueName || Vencord.Settings.plugins.NoDefaultEmojis.except.split(',\\ ').includes(emoji.uniqueName));"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
contextMenus:
|
|
||||||
{
|
|
||||||
"expression-picker": expressionPickerPatch,
|
|
||||||
"message": messageContextMenuPatch
|
|
||||||
},
|
|
||||||
start() {
|
|
||||||
enableStyle(style);
|
|
||||||
},
|
|
||||||
stop() {
|
|
||||||
disableStyle(style);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
/* stylelint-disable selector-class-pattern */
|
|
||||||
.scroller_cc9b9a.thin_b1c063.scrollerBase_dc3aa9:not(:has(.base__76a71)) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
|
@ -8,7 +8,7 @@ import "./style.css";
|
||||||
|
|
||||||
import { addContextMenuPatch, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu";
|
import { addContextMenuPatch, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu";
|
||||||
import { DataStore } from "@api/index";
|
import { DataStore } from "@api/index";
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
|
||||||
import { EquicordDevs } from "@utils/constants";
|
import { EquicordDevs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { Alerts, Button, EmojiStore, GuildStore, Menu, Toasts, useEffect, useState } from "@webpack/common";
|
import { Alerts, Button, EmojiStore, GuildStore, Menu, Toasts, useEffect, useState } from "@webpack/common";
|
||||||
|
@ -594,19 +594,20 @@ const settings = definePluginSettings({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migratePluginSettings("WhitelistedEmojis", "NoDefaultEmojis");
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "WhitelistedEmojis",
|
name: "WhitelistedEmojis",
|
||||||
description: "Adds the ability to disable all message emojis except for a whitelisted set.",
|
description: "Adds the ability to disable all message emojis except for a whitelisted set.",
|
||||||
|
authors: [EquicordDevs.creations],
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: ".Messages.EMOJI_MATCHING",
|
find: ".Messages.EMOJI_MATCHING",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /renderResults\(e\){/,
|
match: /renderResults\((\i)\){/,
|
||||||
replace: "renderResults(e){ e.results.emojis = $self.filterEmojis(e);"
|
replace: "renderResults($1){ $1.results.emojis = $self.filterEmojis($1);"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
authors: [EquicordDevs.creations],
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
async start() {
|
async start() {
|
||||||
cache_allowedList = await getAllowedList();
|
cache_allowedList = await getAllowedList();
|
||||||
|
@ -617,9 +618,8 @@ export default definePlugin({
|
||||||
removeContextMenuPatch("expression-picker", expressionPickerPatch);
|
removeContextMenuPatch("expression-picker", expressionPickerPatch);
|
||||||
removeContextMenuPatch("guild-context", guildContextPatch);
|
removeContextMenuPatch("guild-context", guildContextPatch);
|
||||||
},
|
},
|
||||||
|
filterEmojis: (data: { results: { emojis: (CustomEmoji | UnicodeEmoji)[]; }; }) => {
|
||||||
filterEmojis: (e: { results: { emojis: (CustomEmoji | UnicodeEmoji)[]; }; }) => {
|
const { emojis } = data.results;
|
||||||
const { emojis } = e.results;
|
|
||||||
let modifiedEmojis = emojis;
|
let modifiedEmojis = emojis;
|
||||||
|
|
||||||
if (settings.store.defaultEmojis) {
|
if (settings.store.defaultEmojis) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue