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() { enabled() {
this.after(WebpackModules.find(m => m.type && m.type.render && m.type.render.displayName === "ChannelTextAreaContainer").type, "render", (_, __, returnValue) => { 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)) { if (Array.isArray(buttons)) {
for (const button of buttons) { for (const button of buttons) {
if (!button) continue; if (!button) continue;

View File

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

View File

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

View File

@ -24,6 +24,10 @@ export default {
showToasts: { showToasts: {
name: "Show Toasts", name: "Show Toasts",
note: "Shows a small notification for important information" 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: { appearance: {
@ -162,10 +166,6 @@ export default {
animateOnHover: { animateOnHover: {
name: "Animate On Hover", name: "Animate On Hover",
note: "Only animate the emote modifiers 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: { categories: {

View File

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

View File

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