add previews, MAR v2.0.6

This commit is contained in:
_Lighty_ 2020-02-08 13:35:04 +01:00
parent 5800444b08
commit a65b9cd64c
8 changed files with 96 additions and 63 deletions

View File

@ -6,3 +6,5 @@ This plugin simply fixes that, so the server stays in the sidebar and you can mo
BetterDiscord and BetterDiscord2 servers are precached for convenience sake.
### Settings
N/A
### Preview
![preview](https://i.imgur.com/C2z5Bj5.png)

View File

@ -8,3 +8,10 @@ If your Discord crashes out of random (maybe you clicked something?) it'll attem
In the event that recovery fails, you still have some info on what plugin may have been responsible for the initial crash, and have a button alongside the reload button, to try to recover again, maybe after removing a plugin from your plugins folder.
### Settings
N/A
### Preview
Plugin start crash
![crash](https://i.imgur.com/Sb5BSX9.png)
Unknown crash that may happen at random
![crash2](https://i.imgur.com/oICzvKB.png)
Startup crash + reenable auto disabled plugins due to crash
![startcrash](https://i.imgur.com/ZtkJG5N.png)

View File

@ -1,4 +1,8 @@
# [MentionAliasesRedux](https://1lighty.github.io/BetterDiscordStuff/?plugin=MentionAliasesRedux "MentionAliasesRedux") Changelog
### 2.0.6
- Fixed menu button not showing
- Fixed misc error spam
### 2.0.5
- Fixed crash if XenoLib or ZeresPluginLib were missing

View File

@ -41,16 +41,16 @@ var MentionAliasesRedux = (() => {
twitter_username: ''
}
],
version: '2.0.5',
version: '2.0.6',
description: 'Set custom @mention aliases, that can also appear next to their name (nearly) anywhere, as well as have mention groups to mention multiple people at once.',
github: 'https://github.com/1Lighty',
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/MentionAliasesRedux/MentionAliasesRedux.plugin.js'
},
changelog: [
{
title: 'sad',
title: "bug b' gone",
type: 'fixed',
items: ['Fixed crash if XenoLib or ZeresPluginLib were missing']
items: ['Fixed menu button not showing', 'Fixed misc error spam']
}
],
defaultConfig: [
@ -184,7 +184,7 @@ var MentionAliasesRedux = (() => {
const PopoutTagClassname = XenoLib.joinClassNames('mentionAlias', XenoLib.getClass('botTagRegular'), XenoLib.getClass('nameTag bot'));
const roughlyMatches = WebpackModules.getByRegex(/{var \w=\w\.length,\w=\w\.length;if\(\w>\w\)return!1;if\(\w===\w\)return \w===\w;\w:/);
const AnimatedAvatar = WebpackModules.getByProps('AnimatedAvatar').AnimatedAvatar;
const AnimatedAvatar = (WebpackModules.getByProps('AnimatedAvatar') || {}).AnimatedAvatar;
const renderAvatar = user => React.createElement(AnimatedAvatar, { size: 'SIZE_32', src: user.getAvatarURL(), status: UserStatusStore.getStatus(user.id), isMobile: UserStatusStore.isMobileOnline(user.id), isTyping: false, statusTooltip: true });
const renderAlias = (name, description, color, noAt) => React.createElement(FlexChild, { align: FlexChild.Align.CENTER, className: AutocompleteContentClassname }, React.createElement(FlexChild.Child, { grow: 1 }, React.createElement(TextElement.default, { style: { color } }, noAt ? undefined : '@', name)), React.createElement(TextElement.default, { className: AutocompleteDescriptionClassname }, description));
@ -262,7 +262,7 @@ var MentionAliasesRedux = (() => {
}
}
class SetAliasModal extends WebpackModules.getByDisplayName('ChangeNickname') {
class SetAliasModal extends (WebpackModules.getByDisplayName('ChangeNickname') || class fuck {}) {
constructor(props) {
super(props);
this.handleSubmit = this.handleSubmitPatch.bind(this);
@ -290,7 +290,7 @@ var MentionAliasesRedux = (() => {
}
render() {
const m = {};
m[WebpackModules.getByProps('autocomplete', 'selector').selectorSelected] = this.state.hovered;
m[XenoLib.getClass('autocomplete selector')] = this.state.hovered;
m[XenoLib.getClass('avatar layout')] = this.props.isUser;
return React.createElement('div', { className: XenoLib.joinClassNames(WebpackModules.getByProps('autocomplete', 'selector').selector, WebpackModules.getByProps('autocomplete', 'selector').selectable, m), onMouseEnter: () => this.setState({ hovered: true }), onMouseLeave: () => this.setState({ hovered: false }), onContextMenu: this.props.onContextMenu, onClick: this.props.onClick }, this.props.children);
}
@ -396,10 +396,11 @@ var MentionAliasesRedux = (() => {
return class MentionAliasesRedux extends Plugin {
constructor() {
super();
XenoLib.DiscordUtils.bindAll(this, ['openAliasesPopout', 'queryAliases', 'setAlias', 'setGroup', 'handleSetAliasDispatch', 'handleSetGroupDispatch', 'getUserAlias', 'forceUpdateAll', 'handleContextMenu']);
XenoLib._.bindAll(this, ['openAliasesPopout', 'queryAliases', 'setAlias', 'setGroup', 'handleSetAliasDispatch', 'handleSetGroupDispatch', 'getUserAlias', 'forceUpdateAll', 'handleContextMenu']);
XenoLib.changeName(__filename, 'MentionAliasesRedux');
}
onStart() {
this.__menuBroken = false;
this.patchedModules = [];
/* migrate settings */
if (typeof this.settings.aliases !== 'undefined') {
@ -710,7 +711,7 @@ var MentionAliasesRedux = (() => {
};
});
/* reason for div:not is so it doesn't match anything that is not an actual message, like pins */
const Message = new ReactComponents.ReactComponent('Message', MessageModule.Message, `.${XenoLib.getSingleClass('messageEditorCompact container')} > div:not(.${XenoLib.getSingleClass('marginCompactIndent content')})`);
const Message = new ReactComponents.ReactComponent('Message', MessageModule.Message, `.${XenoLib.getSingleClass('messageEditorCompact container', true)} > div:not(.${XenoLib.getSingleClass('marginCompactIndent content', true)})`);
this.patchedModules.push(Message);
Message.forceUpdateAll();
} else {
@ -759,7 +760,7 @@ var MentionAliasesRedux = (() => {
}
async patchMemberListItem(promiseState) {
const MemberListItem = await ReactComponents.getComponentByName('MemberListItem', `.${XenoLib.getSingleClass('offline member')}`);
const MemberListItem = await ReactComponents.getComponentByName('MemberListItem', `.${XenoLib.getSingleClass('offline member', true)}`);
if (promiseState.cancelled) return;
Patcher.after(MemberListItem.component.prototype, 'render', (_this, _, ret) => {
if (!_this.props.user || !this.settings.display.displayMemberTags) return;
@ -772,7 +773,7 @@ var MentionAliasesRedux = (() => {
}
async patchPrivateChannel(promiseState) {
const PrivateChannel = await ReactComponents.getComponentByName('PrivateChannel', `.${XenoLib.getSingleClass('closeButton channel')}`);
const PrivateChannel = await ReactComponents.getComponentByName('PrivateChannel', `.${XenoLib.getSingleClass('closeButton channel', true)}`);
if (promiseState.cancelled) return;
const TypePatch = function(e) {
const ret = e.__oldTypeMA(e);
@ -794,7 +795,7 @@ var MentionAliasesRedux = (() => {
}
/* friends list */
async patchPeopleListItem(promiseState) {
const PeopleListItem = await ReactComponents.getComponentByName('PeopleListItem', `.${XenoLib.getSingleClass('noBorder peopleListItem')}`);
const PeopleListItem = await ReactComponents.getComponentByName('PeopleListItem', `.${XenoLib.getSingleClass('peopleListItem', true)}`);
if (promiseState.cancelled) return;
const TypePatch3 = function(e) {
try {
@ -865,7 +866,7 @@ var MentionAliasesRedux = (() => {
}
/* mutual friends */
async patchMutualFriends(promiseState) {
const MutualFriends = await ReactComponents.getComponentByName('MutualFriends', `.${XenoLib.getSingleClass('scroller themeGhostHairline')}`);
const MutualFriends = await ReactComponents.getComponentByName('MutualFriends', `.${XenoLib.getSingleClass('scroller themeGhostHairline', true)}`);
if (promiseState.cancelled) return;
const TypePatch3 = function(e) {
try {
@ -937,11 +938,9 @@ var MentionAliasesRedux = (() => {
}
/* add mentions popout button */
async patchChannelTextArea(promiseState) {
const ChannelTextArea = await ReactComponents.getComponentByName('ChannelTextAreaForm', `.${XenoLib.getSingleClass('channelTextArea')}`);
if (promiseState.cancelled) return;
const ChannelTextAreaContainer = WebpackModules.find(m => m.render && m.render.displayName === 'ChannelTextAreaContainer');
const original = ChannelTextAreaContainer.render;
Patcher.after(ChannelTextAreaContainer, 'render', (_this, _, ret) => {
const ChannelTextAreaContainer = WebpackModules.find(m => m.type && m.type.render && m.type.render.displayName === 'ChannelTextAreaContainer');
Patcher.after(ChannelTextAreaContainer.type, 'render', (_this, _, ret) => {
if (this.__menuBroken) return;
const ChannelEditorContainer = Utilities.getNestedProp(ret, 'props.children.0.props.children.props.children.1');
if (!ChannelEditorContainer || ChannelEditorContainer.props.disabled || !this.settings.display.displayButton) return;
const buttons = Utilities.getNestedProp(ret, 'props.children.0.props.children.props.children.2.props.children');
@ -952,14 +951,10 @@ var MentionAliasesRedux = (() => {
iconName: 'Nova_At',
label: 'Open Aliases',
className: ChannelTextAreaButtonClassname,
onClick: e => this.openAliasesPopout(e, { _editorRef })
onClick: e => !this.__menuBroken && this.openAliasesPopout(e, { _editorRef })
})
);
});
/* transfer displayName and such, to be friendly to other plugins */
Object.keys(original).forEach(name => (ChannelTextAreaContainer.render[name] = original[name]));
this.patchedModules.push(ChannelTextArea);
ChannelTextArea.forceUpdateAll();
}
openAliasesPopout({ target }, ref) {
@ -969,11 +964,18 @@ var MentionAliasesRedux = (() => {
showArrow: true,
position: 'top',
zIndexBoost: 1,
render: () => {
render: _ => {
try {
return React.createElement(
XenoLib.ReactComponents.ErrorBoundary,
{
label: 'Popout',
onError: () => _.onClose()
},
React.createElement(
'div',
{
className: ZLibrary.WebpackModules.getByProps('header', 'messagesPopoutWrap').messagesPopoutWrap + ' ' + ZLibrary.WebpackModules.getByProps('themedPopout').themedPopout,
className: WebpackModules.getByProps('header', 'messagesPopoutWrap').messagesPopoutWrap,
style: { maxHeight: Structs.Screen.height - 43 - 25 - 40 }
},
WebpackModules.getByProps('Header', 'EmptyStateBottom').Header({
@ -995,7 +997,16 @@ var MentionAliasesRedux = (() => {
})
),
false
)
);
} catch (e) {
Logger.stacktrace('There has been an issue loading the menu', e);
XenoLib.Notifications.error('There has been an issue loading the menu. Open up the console using CTRL + SHIFT + I, click console, and show any errors to Lighty in the support server. Menu button has been disabled.', { timeout: 0 });
this.__menuBroken = true;
this.forceUpdateAll();
_.onClose();
return null;
}
}
},
'MentionAliasesRedux'

View File

@ -21,3 +21,5 @@ tag in friends list
Custom text color if your theme doesn't do it, or don't want to use custom CSS
##### Tag Background Color
Set the background color of the tag next to their name
### Preview
![preview](https://i.imgur.com/fCEhgQN.png)

View File

@ -22,3 +22,6 @@ Append random
#### Misc
##### Context menu option at the bottom instead of top
Force the Save * To option to stay at the bottom at all times
### Preview
Right click on nearly any image, video or file
![preview](https://i.imgur.com/htOuqtw.png)

View File

@ -107,8 +107,8 @@ var SaveToRedux = (() => {
const ContextMenuSubMenuItem = WebpackModules.getByDisplayName('FluxContainer(SubMenuItem)');
const TextComponent = WebpackModules.getByDisplayName('Text');
const getEmojiURL = WebpackModules.getByProps('getEmojiURL').getEmojiURL;
const showAlertModal = WebpackModules.find(m => m.show && m.show.toString().search(/\w\.minorText,\w=\w\.onConfirmSecondary/)).show;
const getEmojiURL = (WebpackModules.getByProps('getEmojiURL') || {}).getEmojiURL;
const showAlertModal = (WebpackModules.find(m => m.show && m.show.toString().search(/\w\.minorText,\w=\w\.onConfirmSecondary/)) || {}).show;
const dialog = require('electron').remote.dialog;
const openSaveDialog = dialog.showSaveDialogSync || dialog.showSaveDialog;
@ -119,7 +119,7 @@ var SaveToRedux = (() => {
const PathModule = require('path');
const MimeTypesModule = require('mime-types');
const FormItem = WebpackModules.getByDisplayName('FormItem');
const Messages = WebpackModules.getByProps('Messages').Messages;
const Messages = (WebpackModules.getByProps('Messages') || {}).Messages;
const TextInput = WebpackModules.getByDisplayName('TextInput');
const AvatarModule = WebpackModules.getByProps('getChannelIconURL');

View File

@ -18,3 +18,7 @@ Note: If you use BetterNsfwTags, it will always display to the right of it sadly
##### Background color
##### Text color
##### Muted channel badge darkness
### Preview
![folders](https://i.imgur.com/v4kHabL.png)
![servers](https://i.imgur.com/MJHKjuT.png)
![channels](https://i.imgur.com/dhFgSrL.png)