stuff
This commit is contained in:
parent
34ffada6d0
commit
fbd63a9184
|
@ -2,7 +2,7 @@
|
||||||
* @name BetterFriendList
|
* @name BetterFriendList
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 1.4.7
|
* @version 1.4.8
|
||||||
* @description Adds extra Controls to the Friends Page, for example sort by Name/Status, Search and All/Request/Blocked Amount
|
* @description Adds extra Controls to the Friends Page, for example sort by Name/Status, Search and All/Request/Blocked Amount
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -96,9 +96,6 @@ module.exports = (_ => {
|
||||||
after: [
|
after: [
|
||||||
"PeopleList",
|
"PeopleList",
|
||||||
"PeopleListItem",
|
"PeopleListItem",
|
||||||
"PeopleListItemBlocked",
|
|
||||||
"PeopleListItemFriend",
|
|
||||||
"PeopleListItemPending",
|
|
||||||
"PeopleListSectionedLazy",
|
"PeopleListSectionedLazy",
|
||||||
"PeopleListSectionedNonLazy",
|
"PeopleListSectionedNonLazy",
|
||||||
"TabBar"
|
"TabBar"
|
||||||
|
@ -373,18 +370,6 @@ module.exports = (_ => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
processPeopleListItemFriend (e) {
|
|
||||||
e.returnvalue.props.mutualGuilds = e.instance.props.mutualGuilds;
|
|
||||||
}
|
|
||||||
|
|
||||||
processPeopleListItemPending (e) {
|
|
||||||
this.processPeopleListItemFriend(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
processPeopleListItemBlocked (e) {
|
|
||||||
this.processPeopleListItemFriend(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
processPeopleListItem (e) {
|
processPeopleListItem (e) {
|
||||||
if (e.node) {
|
if (e.node) {
|
||||||
BDFDB.TimeUtils.clear(rerenderTimeout);
|
BDFDB.TimeUtils.clear(rerenderTimeout);
|
||||||
|
@ -392,30 +377,27 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (e.instance.props.user.id == placeHolderId) return null;
|
if (e.instance.props.user.id == placeHolderId) return null;
|
||||||
else if (this.settings.general.addMutualGuild && e.instance.props.mutualGuilds && e.instance.props.mutualGuilds.length) {
|
else if (this.settings.general.addMutualGuild) {
|
||||||
if (typeof e.returnvalue.props.children == "function") {
|
let mutualGuilds = BDFDB.ArrayUtils.removeCopies([].concat(BDFDB.LibraryStores.GuildMemberStore.memberOf(e.instance.props.user.id), (BDFDB.LibraryStores.UserProfileStore.getMutualGuilds(e.instance.props.user.id) || []).map(n => n && n.guild && n.guild.id)).flat()).filter(n => n);
|
||||||
|
if (mutualGuilds && mutualGuilds.length) {
|
||||||
|
let guildsIds = BDFDB.LibraryModules.SortedGuildUtils.getFlattenedGuildIds();
|
||||||
let childrenRender = e.returnvalue.props.children;
|
let childrenRender = e.returnvalue.props.children;
|
||||||
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
|
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
|
||||||
let children = childrenRender(...args);
|
let returnValue = childrenRender(...args);
|
||||||
this.injectMutualGuilds(children, e.instance.props.mutualGuilds);
|
let [children, index] = BDFDB.ReactUtils.findParent(returnValue, {filter: n => n && n.props && n.props.subText && n.props.user});
|
||||||
return children;
|
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildSummaryItem, {
|
||||||
|
className: BDFDB.disCN._betterfriendlistmutualguilds,
|
||||||
|
guilds: mutualGuilds.sort((x, y) => guildsIds.indexOf(x) < guildsIds.indexOf(y) ? -1 : 1).map(BDFDB.LibraryStores.GuildStore.getGuild),
|
||||||
|
showTooltip: true,
|
||||||
|
max: 10
|
||||||
|
}, true));
|
||||||
|
return returnValue;
|
||||||
}, "", this);
|
}, "", this);
|
||||||
}
|
}
|
||||||
else this.injectMutualGuilds(e.returnvalue, e.instance.props.mutualGuilds);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
injectMutualGuilds (returnvalue, mutualGuilds) {
|
|
||||||
let [children, index] = BDFDB.ReactUtils.findParent(returnvalue, {filter: n => n && n.props && n.props.subText && n.props.user});
|
|
||||||
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildSummaryItem, {
|
|
||||||
className: BDFDB.disCN._betterfriendlistmutualguilds,
|
|
||||||
guilds: mutualGuilds,
|
|
||||||
showTooltip: true,
|
|
||||||
max: 10
|
|
||||||
}, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
createBadge (amount, text, red) {
|
createBadge (amount, text, red) {
|
||||||
let badge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.NumberBadge, {
|
let badge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.NumberBadge, {
|
||||||
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.peoplesbadge),
|
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.peoplesbadge),
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @name GameActivityToggle
|
* @name GameActivityToggle
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 1.1.7
|
* @version 1.1.8
|
||||||
* @description Adds a Quick-Toggle Game Activity Button
|
* @description Adds a Quick-Toggle Game Activity Button
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -86,8 +86,6 @@ module.exports = (_ => {
|
||||||
onLoad () {
|
onLoad () {
|
||||||
_this = this;
|
_this = this;
|
||||||
|
|
||||||
sounds = [(BDFDB.ModuleUtils.findByString("undeafen", "deafen", "robot_man", "mute", {defaultExport: false}) || {exports: {keys: (_ => [])}}).exports.keys()].flat(10).filter(n => n).map(s => s.replace("./", "").split(".")[0]).sort();
|
|
||||||
|
|
||||||
this.defaults = {
|
this.defaults = {
|
||||||
general: {
|
general: {
|
||||||
showButton: {value: true, description: "Show Quick Toggle Button"},
|
showButton: {value: true, description: "Show Quick Toggle Button"},
|
||||||
|
@ -119,6 +117,8 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onStart () {
|
onStart () {
|
||||||
|
sounds = [BDFDB.LibraryModules.SoundParser && BDFDB.LibraryModules.SoundParser.keys()].flat(10).filter(n => n).map(s => s.replace("./", "").split(".")[0]).sort();
|
||||||
|
|
||||||
let cachedState = BDFDB.DataUtils.load(this, "cachedState");
|
let cachedState = BDFDB.DataUtils.load(this, "cachedState");
|
||||||
let state = BDFDB.DiscordUtils.getSetting("status", "showCurrentGame");
|
let state = BDFDB.DiscordUtils.getSetting("status", "showCurrentGame");
|
||||||
if (!cachedState.date || (new Date() - cachedState.date) > 1000*60*60*24*3) {
|
if (!cachedState.date || (new Date() - cachedState.date) > 1000*60*60*24*3) {
|
||||||
|
@ -238,6 +238,7 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
activateKeybind () {
|
activateKeybind () {
|
||||||
|
console.log(keybind);
|
||||||
if (keybind && keybind.length) BDFDB.ListenerUtils.addGlobal(this, "GAMEACTIVITY_TOGGLE", keybind, _ => this.toggle());
|
if (keybind && keybind.length) BDFDB.ListenerUtils.addGlobal(this, "GAMEACTIVITY_TOGGLE", keybind, _ => this.toggle());
|
||||||
else BDFDB.ListenerUtils.removeGlobal(this, "GAMEACTIVITY_TOGGLE");
|
else BDFDB.ListenerUtils.removeGlobal(this, "GAMEACTIVITY_TOGGLE");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue