stuff
This commit is contained in:
parent
19e337ac66
commit
ad2a55c086
|
@ -2,7 +2,7 @@
|
||||||
* @name BDFDB
|
* @name BDFDB
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 2.8.3
|
* @version 2.8.5
|
||||||
* @description Required Library for DevilBro's Plugins
|
* @description Required Library for DevilBro's Plugins
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -4724,6 +4724,7 @@ module.exports = (_ => {
|
||||||
handleMouseEnter(e) {if (typeof this.props.onMouseEnter == "function") this.props.onMouseEnter(e, this);}
|
handleMouseEnter(e) {if (typeof this.props.onMouseEnter == "function") this.props.onMouseEnter(e, this);}
|
||||||
handleMouseLeave(e) {if (typeof this.props.onMouseLeave == "function") this.props.onMouseLeave(e, this);}
|
handleMouseLeave(e) {if (typeof this.props.onMouseLeave == "function") this.props.onMouseLeave(e, this);}
|
||||||
getBadgeWidthForValue(e) {return e < 10 ? 16 : e < 100 ? 22 : 30}
|
getBadgeWidthForValue(e) {return e < 10 ? 16 : e < 100 ? 22 : 30}
|
||||||
|
getBadgeCountString(e) {return e < 1e3 ? "" + e : Math.min(Math.floor(e/1e3), 9) + "k+"}
|
||||||
render() {
|
render() {
|
||||||
return BDFDB.ReactUtils.createElement("div", {
|
return BDFDB.ReactUtils.createElement("div", {
|
||||||
className: BDFDB.DOMUtils.formatClassName(this.props.className, BDFDB.disCN.badgenumberbadge, this.props.shape && Internal.LibraryComponents.Badges.BadgeShapes[this.props.shape] || Internal.LibraryComponents.Badges.BadgeShapes.ROUND),
|
className: BDFDB.DOMUtils.formatClassName(this.props.className, BDFDB.disCN.badgenumberbadge, this.props.shape && Internal.LibraryComponents.Badges.BadgeShapes[this.props.shape] || Internal.LibraryComponents.Badges.BadgeShapes.ROUND),
|
||||||
|
@ -4735,7 +4736,7 @@ module.exports = (_ => {
|
||||||
onContextMenu: this.handleContextMenu.bind(this),
|
onContextMenu: this.handleContextMenu.bind(this),
|
||||||
onMouseEnter: this.handleMouseEnter.bind(this),
|
onMouseEnter: this.handleMouseEnter.bind(this),
|
||||||
onMouseLeave: this.handleMouseLeave.bind(this),
|
onMouseLeave: this.handleMouseLeave.bind(this),
|
||||||
children: Internal.LibraryComponents.Badges.getBadgeCountString(this.props.count)
|
children: this.getBadgeCountString(this.props.count)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @name PinDMs
|
* @name PinDMs
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 1.9.4
|
* @version 1.9.5
|
||||||
* @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList
|
* @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -81,15 +81,22 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.patchedModules = {
|
this.modulePatches = {
|
||||||
before: {
|
before: [
|
||||||
PrivateChannelsList: "render"
|
"PrivateChannelsList"
|
||||||
},
|
],
|
||||||
after: {
|
after: [
|
||||||
PrivateChannelsList: "render",
|
"DirectMessage",
|
||||||
PrivateChannel: ["render", "componentDidMount"],
|
"PrivateChannel",
|
||||||
DirectMessage: ["render", "componentDidMount", "componentWillUnmount"]
|
"PrivateChannelsList"
|
||||||
}
|
],
|
||||||
|
componentDidMount: [
|
||||||
|
"DirectMessage",
|
||||||
|
"PrivateChannel"
|
||||||
|
],
|
||||||
|
componentWillUnmount: [
|
||||||
|
"DirectMessage"
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.css = `
|
this.css = `
|
||||||
|
@ -157,7 +164,7 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onStart () {
|
onStart () {
|
||||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.PrivateChannelReadStateStore, "getUnreadPrivateChannelIds", {after: e => {
|
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.DirectMessageUnreadStore, "getUnreadPrivateChannelIds", {after: e => {
|
||||||
let sortedRecents = this.sortAndUpdate("guildList");
|
let sortedRecents = this.sortAndUpdate("guildList");
|
||||||
if (sortedRecents.length) {
|
if (sortedRecents.length) {
|
||||||
const dms = [];
|
const dms = [];
|
||||||
|
@ -252,13 +259,18 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onUserContextMenu (e) {
|
onUserContextMenu (e) {
|
||||||
if (e.instance.props.channel && !e.instance.props.channel.guild_id && e.subType == "useCloseDMItem") e.returnvalue.unshift(this.createItem(e.instance.props.channel.id));
|
if (e.instance.props.channel && !e.instance.props.channel.guild_id) {
|
||||||
|
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "close-dm"});
|
||||||
|
children.splice(index > -1 ? index : children.length, 0, this.createItem(e.instance.props.channel.id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onChannelContextMenu (e) {
|
onGroupDMContextMenu (e) {
|
||||||
if (e.instance.props.channel && !e.instance.props.channel.guild_id && e.instance.props.channel.isGroupDM() && e.subType == "useChannelMarkAsReadItem") {
|
if (e.instance.props.channel) {
|
||||||
if (e.returnvalue.length > 0) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
|
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon", group: true});
|
||||||
e.returnvalue.push(this.createItem(e.instance.props.channel.id));
|
children.splice(index > -1 ? index + 1 : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||||
|
children: this.createItem(e.instance.props.channel.id)
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue