Fix some smaller bugs

This commit is contained in:
Zack Rauen 2021-04-06 21:40:19 -04:00
parent e1a510ab4c
commit 1c25997c4a
6 changed files with 14 additions and 13 deletions

View File

@ -9,7 +9,7 @@ export default new class HideGIFButton extends Builtin {
enabled() {
this.after(WebpackModules.find(m => m.type && m.type.render && m.type.render.displayName === "ChannelTextAreaContainer").type, "render", (_, __, returnValue) => {
const buttons = Utilities.getNestedProp(returnValue, "props.children.props.children.1.props.children.props.children.2.props.children");
const buttons = Utilities.getNestedProp(returnValue, "props.children.0.props.children.1.props.children.1.props.children.2.props.children");
if (Array.isArray(buttons)) {
for (const button of buttons) {
if (!button) continue;

View File

@ -9,12 +9,14 @@ export default new class HideGiftButton extends Builtin {
enabled() {
this.after(WebpackModules.find(m => m.type && m.type.render && m.type.render.displayName === "ChannelTextAreaContainer").type, "render", (_, __, returnValue) => {
const buttons = Utilities.getNestedProp(returnValue, "props.children.props.children.1.props.children.props.children.2.props.children");
const buttons = Utilities.getNestedProp(returnValue, "props.children.0.props.children.1.props.children.1.props.children.2.props.children");
if (Array.isArray(buttons)) {
for (const button of buttons) {
if (!button || !button.props) continue;
if (button.props.hasOwnProperty("shouldRenderPremiumGiftButton")) {
button.props.shouldRenderPremiumGiftButton = false;
if (!button) continue;
const renderFunc = Utilities.getNestedProp(button, "type.type");
if (!renderFunc) continue;
if (renderFunc.displayName === "ChannelPremiumGiftButton") {
button.props.disabled = true;
break;
}

View File

@ -23,8 +23,7 @@ export default new class PublicServers extends Builtin {
}
_appendButton() {
const wrapper = DiscordModules.GuildClasses.wrapper.split(" ")[0];
const guilds = DOM.query(`.${wrapper} .listItem-2P_4kh`);
const guilds = DOM.query(`.${DiscordModules.GuildClasses.wrapper} .${DiscordModules.GuildClasses.listItem}`);
DOM.after(guilds, this.button);
}

View File

@ -24,6 +24,10 @@ export default {
showToasts: {
name: "Show Toasts",
note: "Shows a small notification for important information"
},
mediaKeys: {
name: "Disable Media Keys",
note: "Prevents Discord from hijacking your media keys after playing a video."
}
},
appearance: {
@ -162,10 +166,6 @@ export default {
animateOnHover: {
name: "Animate On Hover",
note: "Only animate the emote modifiers on hover"
},
mediaKeys: {
name: "Disable Media Keys",
note: "Prevents Discord from hijacking your media keys after playing a video."
}
},
categories: {

View File

@ -67,7 +67,7 @@ export default new class PluginManager extends AddonManager {
loadPlugin(filename) {return this.loadAddon(filename);}
loadAddon(filename, shouldCTE = true) {
const error = super.loadAddon(filename);
const error = super.loadAddon(filename, shouldCTE);
if (error && shouldCTE) Modals.showAddonErrors({plugins: [error]});
return error;
}

View File

@ -48,7 +48,7 @@ export default new class ThemeManager extends AddonManager {
reloadTheme(idOrFileOrAddon) {return this.reloadAddon(idOrFileOrAddon);}
loadAddon(filename, shouldCTE = true) {
const error = super.loadAddon(filename);
const error = super.loadAddon(filename, shouldCTE);
if (error && shouldCTE) Modals.showAddonErrors({themes: [error]});
return error;
}