Update UserNotes.plugin.js

This commit is contained in:
Mirco Wittrien 2020-05-19 17:17:03 +02:00
parent 5792b2d6a9
commit 5831603a66
1 changed files with 109 additions and 110 deletions

View File

@ -1,9 +1,10 @@
//META{"name":"UserNotes","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/UserNotes","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/UserNotes/UserNotes.plugin.js"}*//
class UserNotes {
var UserNotes = (_ => {
return class UserNotes {
getName () {return "UserNotes";}
getVersion () {return "1.0.4";}
getVersion () {return "1.0.5";}
getAuthor () {return "DevilBro";}
@ -11,7 +12,7 @@ class UserNotes {
constructor () {
this.changelog = {
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
"fixed":[["Context Menu Update","Fixes for the context menu update, yaaaaaay"]]
};
}
@ -88,20 +89,17 @@ class UserNotes {
onUserContextMenu (e) {
if (e.instance.props.user) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["id", "devmode-copy-id"]]});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: BDFDB.LanguageUtils.LanguageStrings.USERS + " " + BDFDB.LanguageUtils.LanguageStrings.NOTE,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "user-note"),
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openNotesModal(e.instance.props.user);
}
})
]
});
if (index > -1) children.splice(index, 0, itemgroup);
else children.push(itemgroup);
}));
}
}
@ -133,3 +131,4 @@ class UserNotes {
});
}
}
})();