stuff
This commit is contained in:
parent
3e9280eab8
commit
939bcddbfa
|
@ -1742,7 +1742,7 @@
|
|||
LibraryModules.CopyLinkUtils = BDFDB.ModuleUtils.findByProperties("SUPPORTS_COPY", "copy");
|
||||
LibraryModules.CurrentUserStore = BDFDB.ModuleUtils.findByProperties("getCurrentUser");
|
||||
LibraryModules.CurrentVoiceUtils = BDFDB.ModuleUtils.findByProperties("getAveragePing", "isConnected");
|
||||
LibraryModules.DirectMessageStore = BDFDB.ModuleUtils.findByProperties("getPrivateChannelIds", "getPrivateChannelTimestamps");
|
||||
LibraryModules.DirectMessageStore = BDFDB.ModuleUtils.findByProperties("getPrivateChannelIds");
|
||||
LibraryModules.DirectMessageUnreadStore = BDFDB.ModuleUtils.findByProperties("getUnreadPrivateChannelIds");
|
||||
LibraryModules.DispatchApiUtils = BDFDB.ModuleUtils.findByProperties("dirtyDispatch", "isDispatching");
|
||||
LibraryModules.DispatchUtils = BDFDB.ModuleUtils.findByProperties("ComponentDispatch");
|
||||
|
@ -10755,7 +10755,7 @@
|
|||
InternalBDFDB._processAvatarMount(e.instance.props.user, e.node.querySelector(BDFDB.dotCN.avatarwrapper));
|
||||
};
|
||||
InternalBDFDB.processDiscordTag = function (e) {
|
||||
if (e.instance && e.instance.props && e.instance.props.user && e.returnvalue) e.returnvalue.props.user = e.instance.props.user;
|
||||
if (e.instance && e.instance.props && e.returnvalue && e.instance.props.user) e.returnvalue.props.user = e.instance.props.user;
|
||||
};
|
||||
InternalBDFDB.processMessageContent = function (e) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.content)) for (let ele of e.instance.props.content) InternalBDFDB._processMessageContentEle(ele, e.instance.props.message);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -329,7 +329,7 @@ var LastMessageDate = (_ => {
|
|||
if (typeof time == "string") timeObj = new Date(time);
|
||||
if (timeObj.toString() == "Invalid Date") timeObj = new Date(parseInt(time));
|
||||
if (timeObj.toString() == "Invalid Date") return;
|
||||
let settings = BDFDB.DataUtils.get(this, "settings"), timeString = "";
|
||||
let timeString = "";
|
||||
if (languageId != "own") {
|
||||
let timestamp = [];
|
||||
if (settings.displayDate) timestamp.push(timeObj.toLocaleDateString(languageId));
|
||||
|
|
|
@ -9,13 +9,17 @@ var PinDMs = (_ => {
|
|||
return class PinDMs {
|
||||
getName () {return "PinDMs";}
|
||||
|
||||
getVersion () {return "1.7.3";}
|
||||
getVersion () {return "1.7.4";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
getDescription () {return "Allows you to pin DMs, making them appear at the top of your DMs/Guild-list.";}
|
||||
|
||||
constructor () {
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Sort by recent","Works again"]]
|
||||
};
|
||||
|
||||
this.patchedModules = {
|
||||
before: {
|
||||
PrivateChannelsList: "render",
|
||||
|
@ -567,7 +571,7 @@ var PinDMs = (_ => {
|
|||
if (e.node) {
|
||||
BDFDB.DOMUtils.addClass(e.node, BDFDB.disCN._pindmsdmchannelpinned);
|
||||
e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
|
||||
if (!BDFDB.DataUtils.get(this, "settings", "sortInRecentOrder")) {
|
||||
if (!settings.sortInRecentOrder) {
|
||||
e.node.setAttribute("draggable", false);
|
||||
e.node.PinDMsMouseDownListener = event => {
|
||||
if (!BDFDB.BDUtils.isPluginEnabled("PinDMs")) e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
|
||||
|
@ -655,7 +659,7 @@ var PinDMs = (_ => {
|
|||
if (this.isPinned(e.instance.props.channel.id, "pinnedRecents")) {
|
||||
BDFDB.DOMUtils.addClass(e.node, BDFDB.disCN._pindmsrecentpinned);
|
||||
e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
|
||||
if (!BDFDB.DataUtils.get(this, "settings", "sortInRecentOrderGuild")) {
|
||||
if (!settings.sortInRecentOrderGuild) {
|
||||
for (let child of e.node.querySelectorAll("a")) child.setAttribute("draggable", false);
|
||||
e.node.PinDMsMouseDownListener = event => {
|
||||
let mousemove = event2 => {
|
||||
|
@ -702,7 +706,7 @@ var PinDMs = (_ => {
|
|||
if (e.node && e.methodname == "componentWillUnmount") {
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this, "PrivateChannelsList");
|
||||
}
|
||||
if (e.returnvalue && this.isPinned(e.instance.props.channel.id, "pinnedRecents") && BDFDB.DataUtils.get(this, "settings", "showPinIcon")) {
|
||||
if (e.returnvalue && this.isPinned(e.instance.props.channel.id, "pinnedRecents") && settings.showPinIcon) {
|
||||
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name:"BlobMask"});
|
||||
if (index > -1) children[index].props.upperLeftBadge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.IconBadge, {
|
||||
className: BDFDB.disCN.guildiconbadge,
|
||||
|
@ -767,8 +771,8 @@ var PinDMs = (_ => {
|
|||
}
|
||||
|
||||
sortDMsByTime (dms, type) {
|
||||
if (dms.length > 1 && BDFDB.DataUtils.get(this, "settings", type == "dmCategories" ? "sortInRecentOrder" : "sortInRecentOrderGuild")) {
|
||||
let timestamps = BDFDB.LibraryModules.DirectMessageStore.getPrivateChannelTimestamps();
|
||||
if (dms.length > 1 && settings[type == "dmCategories" ? "sortInRecentOrder" : "sortInRecentOrderGuild"]) {
|
||||
let timestamps = BDFDB.LibraryModules.DirectMessageStore.getPrivateChannelIds().map(BDFDB.LibraryModules.ChannelStore.getChannel).reduce((newObj, channel) => (newObj[channel.id] = channel.lastActiveTimestamp, newObj), {});
|
||||
return [].concat(dms).sort(function (x, y) {return timestamps[x] > timestamps[y] ? -1 : timestamps[x] < timestamps[y] ? 1 : 0;});
|
||||
}
|
||||
else return dms;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
var ShowHiddenChannels = (_ => {
|
||||
var blacklist = [], hiddenCategory;
|
||||
var settings = {};
|
||||
|
||||
const settingsMap = {
|
||||
GUILD_TEXT: "showText",
|
||||
|
@ -247,7 +248,7 @@ var ShowHiddenChannels = (_ => {
|
|||
for (let channel_id in all) if (all[channel_id].guild_id == e.methodArguments[0] && !e.returnValue[channel_id] && (all[channel_id].type != BDFDB.DiscordConstants.ChannelTypes.GUILD_CATEGORY && all[channel_id].type != BDFDB.DiscordConstants.ChannelTypes.GUILD_VOICE)) e.returnValue[channel_id] = {id: channel_id, name: all[channel_id].name};
|
||||
}});
|
||||
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
this.forceUpdateAll();
|
||||
}
|
||||
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
|
||||
}
|
||||
|
@ -256,7 +257,7 @@ var ShowHiddenChannels = (_ => {
|
|||
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
this.forceUpdateAll();
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -280,7 +281,7 @@ var ShowHiddenChannels = (_ => {
|
|||
if (index > -1) children.splice(index, 1);
|
||||
}
|
||||
let isHidden = this.isChannelHidden(e.instance.props.channel.id);
|
||||
if (isHidden || BDFDB.DataUtils.get(this, "settings", "showForNormal")) {
|
||||
if (isHidden || settings.showForNormal) {
|
||||
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
|
||||
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||
|
@ -310,7 +311,7 @@ var ShowHiddenChannels = (_ => {
|
|||
e.instance.props.categories._categories = e.instance.props.categories._categories.filter(n => n.channel.id != hiddenId);
|
||||
e.instance.props.channels[BDFDB.DiscordConstants.ChannelTypes.GUILD_CATEGORY] = e.instance.props.channels[BDFDB.DiscordConstants.ChannelTypes.GUILD_CATEGORY].filter(n => n.channel.id != hiddenId);
|
||||
|
||||
let settings = BDFDB.DataUtils.get(this, "settings"), index = -1;
|
||||
let index = -1;
|
||||
for (let catId in e.instance.props.categories) {
|
||||
if (catId != "_categories") e.instance.props.categories[catId] = e.instance.props.categories[catId].filter(n => !this.isChannelHidden(n.channel.id));
|
||||
for (let channelObj of e.instance.props.categories[catId]) if (channelObj.index > index) index = parseInt(channelObj.index);
|
||||
|
@ -404,7 +405,6 @@ var ShowHiddenChannels = (_ => {
|
|||
|
||||
getHiddenChannels (guild) {
|
||||
if (!guild) return [{}, 0];
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
let all = BDFDB.LibraryModules.ChannelStore.getChannels(), hidden = {}, amount = 0;
|
||||
for (let type in BDFDB.DiscordConstants.ChannelTypes) hidden[BDFDB.DiscordConstants.ChannelTypes[type]] = [];
|
||||
for (let channel_id in all) {
|
||||
|
@ -519,6 +519,12 @@ var ShowHiddenChannels = (_ => {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
forceUpdateAll() {
|
||||
settings = BDFDB.DataUtils.get(this, "settings");
|
||||
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
}
|
||||
|
||||
setLabelsByLanguage () {
|
||||
switch (BDFDB.LanguageUtils.getLanguage().id) {
|
||||
|
|
Loading…
Reference in New Issue