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,33 +964,49 @@ var MentionAliasesRedux = (() => {
showArrow: true,
position: 'top',
zIndexBoost: 1,
render: () => {
return React.createElement(
'div',
{
className: ZLibrary.WebpackModules.getByProps('header', 'messagesPopoutWrap').messagesPopoutWrap + ' ' + ZLibrary.WebpackModules.getByProps('themedPopout').themedPopout,
style: { maxHeight: Structs.Screen.height - 43 - 25 - 40 }
},
WebpackModules.getByProps('Header', 'EmptyStateBottom').Header({
title: 'Defined User Aliases'
}),
React.createElement(
WebpackModules.getByDisplayName('VerticalScroller'),
render: _ => {
try {
return React.createElement(
XenoLib.ReactComponents.ErrorBoundary,
{
className: XenoLib.getClass('messagesPopoutWrap messagesPopout')
label: 'Popout',
onError: () => _.onClose()
},
React.createElement(AliasesPopout, {
getUserAlias: this.getUserAlias,
getGroup: id => this.groups.find(m => m.id === id),
getMentions: this.queryAliases,
getGroupUsers: this.getGroupUsers,
setAlias: this.setAlias,
setGroup: this.setGroup,
channelTextAreaRef: ref
})
),
false
);
React.createElement(
'div',
{
className: WebpackModules.getByProps('header', 'messagesPopoutWrap').messagesPopoutWrap,
style: { maxHeight: Structs.Screen.height - 43 - 25 - 40 }
},
WebpackModules.getByProps('Header', 'EmptyStateBottom').Header({
title: 'Defined User Aliases'
}),
React.createElement(
WebpackModules.getByDisplayName('VerticalScroller'),
{
className: XenoLib.getClass('messagesPopoutWrap messagesPopout')
},
React.createElement(AliasesPopout, {
getUserAlias: this.getUserAlias,
getGroup: id => this.groups.find(m => m.id === id),
getMentions: this.queryAliases,
getGroupUsers: this.getGroupUsers,
setAlias: this.setAlias,
setGroup: this.setGroup,
channelTextAreaRef: ref
})
),
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

@ -1,23 +1,25 @@
# MentionAliasesRedux [![download](https://i.imgur.com/OAHgjZu.png)](https://1lighty.github.io/BetterDiscordStuff/?plugin=MentionAliasesRedux&dl=1 "MentionAliasesRedux")
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.
### Features
Right click on a user or DM to set an alias, or create a group or add them to a group.
This alias will show next to their name, like a BOT tag, but only you see it.
Right click on a user or DM to set an alias, or create a group or add them to a group.
This alias will show next to their name, like a BOT tag, but only you see it.
You can tag them with this alias, just as if they had that very alias as their name.
### Settings
#### Display Settings
##### Display *
tags menu button - Show an @ button to open a menu, showing all the aliases and groups you can tag in current channel
owner tags - The Owner tag will show. Note: owner always shows in menu
tag in user popups - Show tag next to their name when you click on a user
tags in members list - Show tag in members list in servers
tags in messages
tag on the right side of the name in compact mode - If you use compact mode, you can set where the tag appears
alias in AKA in DMs
tag in DMs list
tag in Mutual Friends tab in user modals
tag in friends list
tags menu button - Show an @ button to open a menu, showing all the aliases and groups you can tag in current channel
owner tags - The Owner tag will show. Note: owner always shows in menu
tag in user popups - Show tag next to their name when you click on a user
tags in members list - Show tag in members list in servers
tags in messages
tag on the right side of the name in compact mode - If you use compact mode, you can set where the tag appears
alias in AKA in DMs
tag in DMs list
tag in Mutual Friends tab in user modals
tag in friends list
##### Tag Text Color
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

@ -17,4 +17,8 @@ Shows an unread badge on folders, server icons and channels, all toggleable with
Note: If you use BetterNsfwTags, it will always display to the right of it sadly. This option only changes if you want the badge to the left or the right of the settings and invite buttons (if you have them even)
##### Background color
##### Text color
##### Muted channel badge darkness
##### 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)