This commit is contained in:
Mirco Wittrien 2020-03-30 22:48:55 +02:00
parent 459939533b
commit c538692e85
3 changed files with 27 additions and 28 deletions

View File

@ -1084,7 +1084,6 @@
return InternalBDFDB.getWebModuleReq.req;
};
var isGuildFolderThere = !!BDFDB.ModuleUtils.findByName("GuildFolder"); // REMOVE
var WebModulesData = {};
WebModulesData.PatchTypes = ["before", "instead", "after"];
WebModulesData.PatchMap = {
@ -1117,7 +1116,7 @@
"UserInfo"
];
WebModulesData.MemoComponent = [
!isGuildFolderThere && "GuildFolder",
"GuildFolder",
"MessageContent",
"NowPlayingHeader"
];
@ -1134,7 +1133,7 @@
V2C_ContentColumn: ins => ins && ins.return && ins.return.stateNode && ins.return.stateNode.props && typeof ins.return.stateNode.props.title == "string" && (ins.return.stateNode.props.title.toUpperCase().indexOf("PLUGINS") == 0 || ins.return.stateNode.props.title.toUpperCase().indexOf("THEMES") == 0) && ins.return.type,
V2C_PluginCard: ins => ins && ins.return && ins.return.stateNode && ins.return.stateNode.props && ins.return.stateNode.props.addon && ins.return.stateNode.props.addon.plugin && ins.return.type,
V2C_ThemeCard: ins => ins && ins.return && ins.return.stateNode && ins.return.stateNode.props && ins.return.stateNode.props.addon && ins.return.stateNode.props.addon.css && ins.return.type,
GuildFolder: isGuildFolderThere ? null : ins => ins && ins.return && ins.return.memoizedProps && ins.return.memoizedProps.folderId && ins.return.memoizedProps.guildIds && ins.return.type
GuildFolder: ins => ins && ins.return && ins.return.memoizedProps && ins.return.memoizedProps.folderId && ins.return.memoizedProps.guildIds && ins.return.type
};
WebModulesData.PatchFinder = {
Account: "accountinfo",
@ -1150,7 +1149,7 @@
DirectMessage: "guildouter",
EmojiPicker: "emojipicker",
Guild: "guildouter",
GuildFolder: isGuildFolderThere ? null : "guildfolderwrapper",
GuildFolder: "guildfolderwrapper",
GuildIcon: "avataricon",
Guilds: "guildswrapper",
GuildSettingsBans: "guildsettingsbannedcard",
@ -5040,7 +5039,6 @@
guildfolderexpandedbackground: ["GuildFolder", "expandedFolderBackground"],
guildfolderexpandedbackgroundcollapsed: ["GuildFolder", "collapsed"],
guildfolderexpandedbackgroundhover: ["GuildFolder", "hover"],
guildfolderexpandedguilds: ["GuildFolder", "expandedGuilds"],
guildfolderguildicon: ["GuildFolder", "guildIcon"],
guildfoldericonwrapper: ["GuildFolder", "folderIconWrapper"],
guildfoldericonwrapperclosed: ["GuildFolder", "closedFolderIconWrapper"],
@ -7314,8 +7312,6 @@
InternalComponents.LibraryComponents.ListHeader = BDFDB.ModuleUtils.findByName("ListSectionItem");
InternalComponents.LibraryComponents.ListItem = BDFDB.ModuleUtils.findByName("ListItem");
InternalComponents.LibraryComponents.ListRow = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.ListRow") || reactInitialized && class BDFDB_ListRow extends LibraryModules.React.Component {
render () {
return BDFDB.ReactUtils.createElement("div", {

File diff suppressed because one or more lines are too long

View File

@ -50,10 +50,12 @@ var ServerFolders = (_ => {
guild: BDFDB.LibraryModules.GuildStore.getGuild(guildId),
state: true,
list: true,
tooltipConfig: data.copyTooltipColor && {
tooltipConfig: Object.assign({
offset: 12
}, data.copyTooltipColor && {
backgroundColor: data.color3,
fontColor: data.color4
},
fontColor: data.color4,
}),
onClick: event => {
if (BDFDB.InternalData.pressedKeys.includes(46)) {
BDFDB.ListenerUtils.stopEvent(event);
@ -62,13 +64,9 @@ var ServerFolders = (_ => {
else {
let settings = BDFDB.DataUtils.get(this.props.plugin, "settings");
if (settings.closeAllFolders) {
for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) {
if (openFolderId != folderId || !settings.forceOpenFolder) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
}
}
else if (settings.closeTheFolder && !settings.forceOpenFolder && BDFDB.LibraryModules.FolderUtils.isFolderExpanded(folderId)) {
BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folderId);
for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (openFolderId != folderId || !settings.forceOpenFolder) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
}
else if (settings.closeTheFolder && !settings.forceOpenFolder && BDFDB.LibraryModules.FolderUtils.isFolderExpanded(folderId)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folderId);
else BDFDB.ReactUtils.forceUpdate(this);
}
},
@ -276,7 +274,7 @@ var ServerFolders = (_ => {
return class ServerFolders {
getName () {return "ServerFolders";}
getVersion () {return "6.7.1";}
getVersion () {return "6.7.2";}
getAuthor () {return "DevilBro";}
@ -284,14 +282,13 @@ var ServerFolders = (_ => {
constructor () {
this.changelog = {
"fixed":[["Adding Servers to Folders","Adding Servers to FOlders via the conxtextmenu works again"]],
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
"fixed":[["Silent updated? NANI!","Fixed for discords sneaky updates"]]
};
this.patchedModules = {
after: {
AppView: "render",
GuildFolder: "render",
GuildFolder: "type",
Guild: ["componentDidMount", "render"],
GuildFolderSettingsModal: ["componentDidMount", "render"]
}
@ -336,7 +333,7 @@ var ServerFolders = (_ => {
top: -10px;
right: -10px;
}
${BDFDB.dotCN.guildfolderexpandedbackground},
${BDFDB.dotCN.guildfolderwrapper} [role="group"],
${BDFDB.dotCN.guildfolderexpandedguilds} {
display: none !important;
}
@ -458,7 +455,7 @@ var ServerFolders = (_ => {
}
}});
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!");
}
@ -467,7 +464,7 @@ var ServerFolders = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
this.forceUpdateAll();
BDFDB.DOMUtils.removeClassFromDOM(BDFDB.disCN._serverfoldersfoldercontentisopen);
@ -488,8 +485,8 @@ var ServerFolders = (_ => {
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
folderStates = {};
BDFDB.ModuleUtils.forceAllUpdates(this);
folderStates = {};
this.forceUpdateAll();
}
}
@ -582,7 +579,7 @@ var ServerFolders = (_ => {
}
processAppView (e) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "FluxContainer(Guilds)"});
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: ["FluxContainer(Guilds)", "FluxContainer(NavigableGuilds)"]});
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(folderGuildContentComponent, {
plugin: this,
themeOverride: children[index].props.themeOverride
@ -612,6 +609,7 @@ var ServerFolders = (_ => {
tooltipConfig: {
type: "right",
list: true,
offset: 12,
backgroundColor: data.color3,
fontColor: data.color4
},
@ -822,7 +820,7 @@ var ServerFolders = (_ => {
});
if (!BDFDB.equals(olddata, data)) {
BDFDB.DataUtils.save(data, this, "folders", e.instance.props.folderId);
BDFDB.ModuleUtils.forceAllUpdates(this, "GuildFolder");
BDFDB.GuildUtils.rerenderAll();
BDFDB.ReactUtils.forceUpdate(folderGuildContent);
}
e.instance.close();
@ -1039,6 +1037,11 @@ var ServerFolders = (_ => {
dragpreview.style.setProperty("left", event.clientX - 25 + "px", "important");
dragpreview.style.setProperty("top", event.clientY - 25 + "px", "important");
}
forceUpdateAll() {
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.GuildUtils.rerenderAll();
}
setLabelsByLanguage () {
switch (BDFDB.LanguageUtils.getLanguage().id) {