stuff
This commit is contained in:
parent
0d29711218
commit
b61406e497
|
@ -2,7 +2,7 @@
|
|||
* @name BDFDB
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 2.1.1
|
||||
* @version 2.1.2
|
||||
* @description Required Library for DevilBro's Plugins
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -19,7 +19,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "BDFDB",
|
||||
"author": "DevilBro",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.2",
|
||||
"description": "Required Library for DevilBro's Plugins"
|
||||
},
|
||||
"rawUrl": `https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js`,
|
||||
|
@ -8235,20 +8235,19 @@ module.exports = (_ => {
|
|||
plugin = plugin == BDFDB && InternalBDFDB || plugin;
|
||||
if (!module.default.displayName || module.default.displayName.indexOf("ContextMenu") == -1) {
|
||||
BDFDB.PatchUtils.patch(plugin, module, "default", {after: e => {
|
||||
if (e.returnValue && e.returnValue.props.children && e.returnValue.props.children.type && e.returnValue.props.children.type.displayName) {
|
||||
if (typeof plugin[`on${type}`] != "function") return;
|
||||
else if (e.returnValue && e.returnValue.props.children && e.returnValue.props.children.type && e.returnValue.props.children.type.displayName) {
|
||||
let name = e.returnValue.props.children.type.displayName;
|
||||
let originalReturn = e.returnValue.props.children.type(e.returnValue.props.children.props);
|
||||
let newType = props => {
|
||||
const returnValue = BDFDB.ReactUtils.createElement(originalReturn.type, originalReturn.props);
|
||||
if (returnValue.props.children) {
|
||||
plugin[`on${type}`]({
|
||||
instance: {props: props},
|
||||
returnvalue: returnValue,
|
||||
component: module,
|
||||
methodname: "default",
|
||||
type: name
|
||||
});
|
||||
}
|
||||
if (returnValue.props.children) plugin[`on${type}`]({
|
||||
instance: {props: props},
|
||||
returnvalue: returnValue,
|
||||
component: module,
|
||||
methodname: "default",
|
||||
type: name
|
||||
});
|
||||
else BDFDB.PatchUtils.patch(plugin, returnValue, "type", {after: e2 => {
|
||||
if (e2.returnValue && typeof plugin[`on${type}`] == "function") plugin[`on${type}`]({
|
||||
instance: {props: e2.methodArguments[0]},
|
||||
|
@ -8266,13 +8265,23 @@ module.exports = (_ => {
|
|||
}}, {name: type});
|
||||
}
|
||||
else BDFDB.PatchUtils.patch(plugin, module, "default", {after: e => {
|
||||
if (e.returnValue && typeof plugin[`on${type}`] == "function") plugin[`on${type}`]({
|
||||
if (typeof plugin[`on${type}`] != "function") return;
|
||||
else if (e.returnValue.props.children) plugin[`on${type}`]({
|
||||
instance: {props: e.methodArguments[0]},
|
||||
returnvalue: e.returnValue,
|
||||
component: module,
|
||||
methodname: "default",
|
||||
type: module.default.displayName
|
||||
});
|
||||
else BDFDB.PatchUtils.patch(plugin, e.returnValue, "type", {after: e2 => {
|
||||
if (e2.returnValue && typeof plugin[`on${type}`] == "function") plugin[`on${type}`]({
|
||||
instance: {props: e2.methodArguments[0]},
|
||||
returnvalue: e2.returnValue,
|
||||
component: module,
|
||||
methodname: "default",
|
||||
type: module.default.displayName
|
||||
});
|
||||
}});
|
||||
}});
|
||||
};
|
||||
|
||||
|
|
|
@ -3354,6 +3354,7 @@
|
|||
"settings_toastPosition_note": "Променя само позицията на тостове, създадени от моите приставки",
|
||||
"settings_useChromium_description": "Отворете връзки в Discord вместо вашия браузър",
|
||||
"sort_by": "Сортиране по",
|
||||
"status": "Състояние",
|
||||
"time": "Време",
|
||||
"timezone": "Часова зона",
|
||||
"to": "Да се",
|
||||
|
@ -3414,6 +3415,7 @@
|
|||
"settings_toastPosition_note": "Změní pouze pozici toastů vytvořených mými pluginy",
|
||||
"settings_useChromium_description": "Otevřete odkazy v programu Discord namísto v prohlížeči",
|
||||
"sort_by": "Seřazeno podle",
|
||||
"status": "Postavení",
|
||||
"time": "Čas",
|
||||
"timezone": "Časové pásmo",
|
||||
"to": "Na",
|
||||
|
@ -3474,6 +3476,7 @@
|
|||
"settings_toastPosition_note": "Ændrer kun placeringen af skåle oprettet af mine plugins",
|
||||
"settings_useChromium_description": "Åbn Links i Discord i stedet for din browser",
|
||||
"sort_by": "Sorter efter",
|
||||
"status": "Status",
|
||||
"time": "Tid",
|
||||
"timezone": "Tidszone",
|
||||
"to": "Til",
|
||||
|
@ -3534,6 +3537,7 @@
|
|||
"settings_toastPosition_note": "Ändert nur die Position von Toasts, die von meinen Plugins erstellt wurden",
|
||||
"settings_useChromium_description": "Öffne Links in Discord anstelle deines Browsers",
|
||||
"sort_by": "Sortieren nach",
|
||||
"status": "Status",
|
||||
"time": "Zeit",
|
||||
"timezone": "Zeitzone",
|
||||
"to": "Zu",
|
||||
|
@ -3594,6 +3598,7 @@
|
|||
"settings_toastPosition_note": "Αλλάζει μόνο τη θέση των Τοστ που δημιουργήθηκαν από τις προσθήκες μου",
|
||||
"settings_useChromium_description": "Ανοίξτε τους συνδέσμους στο Discord αντί για το πρόγραμμα περιήγησής σας",
|
||||
"sort_by": "Ταξινόμηση κατά",
|
||||
"status": "Κατάσταση",
|
||||
"time": "Χρόνος",
|
||||
"timezone": "Ζώνη ώρας",
|
||||
"to": "Προς το",
|
||||
|
@ -3654,6 +3659,7 @@
|
|||
"settings_toastPosition_note": "Solo cambia la posición de los brindis creados por mis complementos",
|
||||
"settings_useChromium_description": "Abra enlaces en Discord en lugar de su navegador",
|
||||
"sort_by": "Ordenar por",
|
||||
"status": "Estado",
|
||||
"time": "Hora",
|
||||
"timezone": "Zona horaria",
|
||||
"to": "A",
|
||||
|
@ -3714,6 +3720,7 @@
|
|||
"settings_toastPosition_note": "Muuttaa vain laajennukset luomien paahtoleivien sijaintia",
|
||||
"settings_useChromium_description": "Avaa Linkit ristiriidassa selaimen sijaan",
|
||||
"sort_by": "Järjestä",
|
||||
"status": "Tila",
|
||||
"time": "Aika",
|
||||
"timezone": "Aikavyöhyke",
|
||||
"to": "Vastaanottaja",
|
||||
|
@ -3774,6 +3781,7 @@
|
|||
"settings_toastPosition_note": "Modifie uniquement la position des toasts créés par mes plugins",
|
||||
"settings_useChromium_description": "Ouvrez les liens dans Discord au lieu de votre navigateur",
|
||||
"sort_by": "Trier par",
|
||||
"status": "Statut",
|
||||
"time": "Temps",
|
||||
"timezone": "Fuseau horaire",
|
||||
"to": "À",
|
||||
|
@ -3834,6 +3842,7 @@
|
|||
"settings_toastPosition_note": "केवल मेरे प्लगइन्स द्वारा बनाए गए टोस्ट की स्थिति बदलता है",
|
||||
"settings_useChromium_description": "अपने ब्राउज़र के बजाय डिस्कॉर्ड में लिंक खोलें",
|
||||
"sort_by": "इसके अनुसार क्रमबद्ध करें",
|
||||
"status": "स्थिति",
|
||||
"time": "समय",
|
||||
"timezone": "समय क्षेत्र",
|
||||
"to": "सेवा",
|
||||
|
@ -3894,6 +3903,7 @@
|
|||
"settings_toastPosition_note": "Mijenja samo položaj zdravica koje su stvorili moji dodatke",
|
||||
"settings_useChromium_description": "Otvorite veze u Discordu umjesto u pregledniku",
|
||||
"sort_by": "Poredati po",
|
||||
"status": "Status",
|
||||
"time": "Vrijeme",
|
||||
"timezone": "Vremenska zona",
|
||||
"to": "Do",
|
||||
|
@ -3954,6 +3964,7 @@
|
|||
"settings_toastPosition_note": "Csak a bővítményeket által létrehozott pirítósok pozícióját változtatja meg",
|
||||
"settings_useChromium_description": "Nyissa meg a Linkeket a diszkordban a böngészője helyett",
|
||||
"sort_by": "Sorrend",
|
||||
"status": "Állapot",
|
||||
"time": "Idő",
|
||||
"timezone": "Időzóna",
|
||||
"to": "Erre",
|
||||
|
@ -4014,6 +4025,7 @@
|
|||
"settings_toastPosition_note": "Cambia solo la posizione dei toast creati dai miei plugins",
|
||||
"settings_useChromium_description": "Apri link in Discord invece che nel tuo browser",
|
||||
"sort_by": "Ordina per",
|
||||
"status": "Stato",
|
||||
"time": "Tempo",
|
||||
"timezone": "Fuso orario",
|
||||
"to": "Per",
|
||||
|
@ -4074,6 +4086,7 @@
|
|||
"settings_toastPosition_note": "プラグインによって作成されたトーストの位置のみを変更します",
|
||||
"settings_useChromium_description": "ブラウザの代わりに Discord でリンクを開く",
|
||||
"sort_by": "並び替え",
|
||||
"status": "状態",
|
||||
"time": "時間",
|
||||
"timezone": "タイムゾーン",
|
||||
"to": "に",
|
||||
|
@ -4134,6 +4147,7 @@
|
|||
"settings_toastPosition_note": "위 옵션은 내 플러그인에 의해 생성된 토스트창에만 해당됩니다.",
|
||||
"settings_useChromium_description": "브라우저 대신 Discord 에서 링크 열기",
|
||||
"sort_by": "정렬 기준",
|
||||
"status": "상태",
|
||||
"time": "시각",
|
||||
"timezone": "시간대",
|
||||
"to": "에",
|
||||
|
@ -4194,6 +4208,7 @@
|
|||
"settings_toastPosition_note": "Keičia tik mano įskiepiai sukurtų tostų poziciją",
|
||||
"settings_useChromium_description": "Vietoj savo naršyklės atidarykite nuorodas nesantaikoje",
|
||||
"sort_by": "Rūšiuoti pagal",
|
||||
"status": "Būsena",
|
||||
"time": "Laikas",
|
||||
"timezone": "Laiko zona",
|
||||
"to": "Į",
|
||||
|
@ -4254,6 +4269,7 @@
|
|||
"settings_toastPosition_note": "Verandert alleen de positie van toast gemaakt door mijn plugins",
|
||||
"settings_useChromium_description": "Open links in Discord in plaats van uw browser",
|
||||
"sort_by": "Sorteer op",
|
||||
"status": "Toestand",
|
||||
"time": "Tijd",
|
||||
"timezone": "Tijdzone",
|
||||
"to": "Naar",
|
||||
|
@ -4314,6 +4330,7 @@
|
|||
"settings_toastPosition_note": "Endrer bare posisjonen for ristet brød opprettet av plugins mine",
|
||||
"settings_useChromium_description": "Åpne koblinger i Discord i stedet for nettleseren din",
|
||||
"sort_by": "Sorter etter",
|
||||
"status": "Status",
|
||||
"time": "Tid",
|
||||
"timezone": "Tidssone",
|
||||
"to": "Til",
|
||||
|
@ -4374,6 +4391,7 @@
|
|||
"settings_toastPosition_note": "Zmienia tylko pozycję toastów utworzonych przez moje wtyczki",
|
||||
"settings_useChromium_description": "Otwieraj linki w Discordzie zamiast w przeglądarce",
|
||||
"sort_by": "Sortuj według",
|
||||
"status": "Status",
|
||||
"time": "Czas",
|
||||
"timezone": "Strefa czasowa",
|
||||
"to": "Do",
|
||||
|
@ -4434,6 +4452,7 @@
|
|||
"settings_toastPosition_note": "Apenas altera a posição dos brindes criados pelos meus plugins",
|
||||
"settings_useChromium_description": "Abra links no Discord em vez do seu navegador",
|
||||
"sort_by": "Ordenar por",
|
||||
"status": "Status",
|
||||
"time": "Tempo",
|
||||
"timezone": "Fuso horário",
|
||||
"to": "Para",
|
||||
|
@ -4494,6 +4513,7 @@
|
|||
"settings_toastPosition_note": "Modifică doar poziția toastelor create de pluginuri mele",
|
||||
"settings_useChromium_description": "Deschideți linkuri în discordie în loc de browser",
|
||||
"sort_by": "Filtrează după",
|
||||
"status": "Stare",
|
||||
"time": "Timp",
|
||||
"timezone": "Fus orar",
|
||||
"to": "La",
|
||||
|
@ -4554,6 +4574,7 @@
|
|||
"settings_toastPosition_note": "Изменяет только положение тостов, созданных моими плагины",
|
||||
"settings_useChromium_description": "Открывайте ссылки в Discord, а не в браузере",
|
||||
"sort_by": "Сортировать по",
|
||||
"status": "Статус",
|
||||
"time": "Время",
|
||||
"timezone": "Часовой пояс",
|
||||
"to": "Чтобы",
|
||||
|
@ -4614,6 +4635,7 @@
|
|||
"settings_toastPosition_note": "Ändrar bara positionen för rostat bröd som skapats av mina plugins",
|
||||
"settings_useChromium_description": "Öppna Länkar i Discord istället för din webbläsare",
|
||||
"sort_by": "Sortera efter",
|
||||
"status": "Status",
|
||||
"time": "Tid",
|
||||
"timezone": "Tidszon",
|
||||
"to": "Till",
|
||||
|
@ -4674,6 +4696,7 @@
|
|||
"settings_toastPosition_note": "เปลี่ยนเฉพาะตำแหน่งของขนมปังที่สร้างโดยปลั๊กอินของฉัน",
|
||||
"settings_useChromium_description": "เปิดลิงค์ใน Discord แทนเบราว์เซอร์ของคุณ",
|
||||
"sort_by": "จัดเรียงตาม",
|
||||
"status": "สถานะ",
|
||||
"time": "เวลา",
|
||||
"timezone": "เขตเวลา",
|
||||
"to": "ถึง",
|
||||
|
@ -4734,6 +4757,7 @@
|
|||
"settings_toastPosition_note": "Yalnızca Eklentileri tarafından oluşturulan Toastların Konumunu değiştirir",
|
||||
"settings_useChromium_description": "Tarayıcınız yerine Discord'da Bağlantıları Açın",
|
||||
"sort_by": "Göre sırala",
|
||||
"status": "Durum",
|
||||
"time": "Zaman",
|
||||
"timezone": "Saat dilimi",
|
||||
"to": "İçin",
|
||||
|
@ -4794,6 +4818,7 @@
|
|||
"settings_toastPosition_note": "Змінює лише позицію тостів, створених моїми плагіни",
|
||||
"settings_useChromium_description": "Відкрийте посилання в Discord замість браузера",
|
||||
"sort_by": "Сортувати за",
|
||||
"status": "Статус",
|
||||
"time": "Час",
|
||||
"timezone": "Часовий пояс",
|
||||
"to": "До",
|
||||
|
@ -4854,6 +4879,7 @@
|
|||
"settings_toastPosition_note": "Chỉ thay đổi Vị trí của Bánh nướng được tạo bởi plugins của tôi",
|
||||
"settings_useChromium_description": "Mở Liên kết trong Discord thay vì Trình duyệt của bạn",
|
||||
"sort_by": "Sắp xếp theo",
|
||||
"status": "Trạng thái",
|
||||
"time": "Thời gian",
|
||||
"timezone": "Múi giờ",
|
||||
"to": "Đến",
|
||||
|
@ -4914,6 +4940,7 @@
|
|||
"settings_toastPosition_note": "仅更改由我的插件创建的吐司位置",
|
||||
"settings_useChromium_description": "在 Discord (而不是浏览器)中打开链接",
|
||||
"sort_by": "排序方式",
|
||||
"status": "地位",
|
||||
"time": "时间",
|
||||
"timezone": "时区",
|
||||
"to": "至",
|
||||
|
@ -4974,6 +5001,7 @@
|
|||
"settings_toastPosition_note": "僅更改由我的插件創建的吐司位置",
|
||||
"settings_useChromium_description": "在 Discord (而不是瀏覽器)中打開鏈接",
|
||||
"sort_by": "排序方式",
|
||||
"status": "地位",
|
||||
"time": "時間",
|
||||
"timezone": "時區",
|
||||
"to": "至",
|
||||
|
@ -5034,6 +5062,7 @@
|
|||
"settings_toastPosition_note": "Only changes Position of Toasts created by my Plugins",
|
||||
"settings_useChromium_description": "Open Links in Discord instead of your Browser",
|
||||
"sort_by": "Sort by",
|
||||
"status": "Status",
|
||||
"time": "Time",
|
||||
"timezone": "Timezone",
|
||||
"to": "To",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @name BetterFriendList
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 1.4.1
|
||||
* @version 1.4.2
|
||||
* @description Adds extra Controls to the Friends Page, for example sort by Name/Status, Search and All/Request/Blocked Amount
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "BetterFriendList",
|
||||
"author": "DevilBro",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"description": "Adds extra Controls to the Friends Page, for example sort by Name/Status, Search and All/Request/Blocked Amount"
|
||||
}
|
||||
};
|
||||
|
@ -60,7 +60,7 @@ module.exports = (_ => {
|
|||
return template.content.firstElementChild;
|
||||
}
|
||||
} : (([Plugin, BDFDB]) => {
|
||||
var rerenderTimeout, sortKey, sortReversed, searchQuery, searchTimeout;
|
||||
var rerenderTimeout, sortKey, sortReversed;
|
||||
|
||||
const favorizedFriendsSection = "FAVORIZED_FRIENDS";
|
||||
const hiddenFriendsSection = "HIDDEN_FRIENDS";
|
||||
|
@ -87,7 +87,6 @@ module.exports = (_ => {
|
|||
addFavorizedCategory: {value: true, description: "Adds Favorites Category"},
|
||||
addHiddenCategory: {value: true, description: "Adds Hidden Category"},
|
||||
addSortOptions: {value: true, description: "Adds Sort Options"},
|
||||
addSearchbar: {value: true, description: "Adds a Searchbar"},
|
||||
addMutualGuild: {value: true, description: "Adds mutual Servers in Friend List"}
|
||||
}
|
||||
};
|
||||
|
@ -102,6 +101,7 @@ module.exports = (_ => {
|
|||
TabBar: "render",
|
||||
PeopleListSectionedLazy: "default",
|
||||
PeopleListSectionedNonLazy: "default",
|
||||
PeopleList: "default",
|
||||
FriendRow: "render",
|
||||
PendingRow: "default",
|
||||
BlockedRow: "render",
|
||||
|
@ -118,7 +118,7 @@ module.exports = (_ => {
|
|||
width: 200px;
|
||||
}
|
||||
${BDFDB.dotCN._betterfriendlistnamecell} {
|
||||
width: 150px;
|
||||
width: 200px;
|
||||
}
|
||||
${BDFDB.dotCN.peoplesuser} {
|
||||
flex: 1 1 auto;
|
||||
|
@ -136,7 +136,6 @@ module.exports = (_ => {
|
|||
onStart () {
|
||||
sortKey = null;
|
||||
sortReversed = false;
|
||||
searchQuery = "";
|
||||
isFavoritesSelected = false;
|
||||
isHiddenSelected = false;
|
||||
|
||||
|
@ -280,103 +279,41 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processPeopleListSectionedNonLazy (e) {
|
||||
if (this.settings.general.addFavorizedCategory) {
|
||||
if (isFavoritesSelected) e.instance.props.statusSections = [].concat(e.instance.props.statusSections).map(section => [].concat(section).filter(entry => entry && entry.user && favorizedFriends.indexOf(entry.user.id) > -1));
|
||||
if (!e.returnvalue) {
|
||||
if (this.settings.general.addFavorizedCategory) {
|
||||
if (isFavoritesSelected) e.instance.props.statusSections = [].concat(e.instance.props.statusSections).map(section => [].concat(section).filter(entry => entry && entry.user && favorizedFriends.indexOf(entry.user.id) > -1));
|
||||
}
|
||||
if (this.settings.general.addHiddenCategory) {
|
||||
if (isHiddenSelected) e.instance.props.statusSections = [].concat(e.instance.props.statusSections).map(section => [].concat(section).filter(entry => entry && entry.user && hiddenFriends.indexOf(entry.user.id) > -1));
|
||||
else if (([].concat(e.instance.props.statusSections).flat(10)[0] || {}).type == BDFDB.DiscordConstants.RelationshipTypes.FRIEND) e.instance.props.statusSections = [].concat(e.instance.props.statusSections).map(section => [].concat(section).filter(entry => entry && entry.user && hiddenFriends.indexOf(entry.user.id) == -1));
|
||||
}
|
||||
if (sortKey) e.instance.props.statusSections = [].concat(e.instance.props.statusSections).map(section => {
|
||||
let newSection = [].concat(section);
|
||||
if (sortKey) {
|
||||
newSection = BDFDB.ArrayUtils.keySort(newSection.map(entry => Object.assign({}, entry, {statusIndex: statusSortOrder[entry.status]})), sortKey);
|
||||
if (sortReversed) newSection.reverse();
|
||||
}
|
||||
if (!newSection.length) {
|
||||
let placeholder = new BDFDB.DiscordObjects.User({
|
||||
id: placeHolderId,
|
||||
username: placeHolderId
|
||||
});
|
||||
if (placeholder) newSection.push(new BDFDB.DiscordObjects.Relationship({
|
||||
activities: [],
|
||||
applicationStream: null,
|
||||
isMobile: false,
|
||||
key: placeHolderId,
|
||||
mutualGuilds: [],
|
||||
mutualGuildsLength: 0,
|
||||
status: "offline",
|
||||
type: BDFDB.DiscordConstants.RelationshipTypes.NONE,
|
||||
user: placeholder,
|
||||
usernameLower: placeholder.usernameNormalized
|
||||
}));
|
||||
}
|
||||
return newSection;
|
||||
});
|
||||
}
|
||||
if (this.settings.general.addHiddenCategory) {
|
||||
if (isHiddenSelected) e.instance.props.statusSections = [].concat(e.instance.props.statusSections).map(section => [].concat(section).filter(entry => entry && entry.user && hiddenFriends.indexOf(entry.user.id) > -1));
|
||||
else if (([].concat(e.instance.props.statusSections).flat(10)[0] || {}).type == BDFDB.DiscordConstants.RelationshipTypes.FRIEND) e.instance.props.statusSections = [].concat(e.instance.props.statusSections).map(section => [].concat(section).filter(entry => entry && entry.user && hiddenFriends.indexOf(entry.user.id) == -1));
|
||||
}
|
||||
if (sortKey || searchQuery) e.instance.props.statusSections = [].concat(e.instance.props.statusSections).map(section => {
|
||||
let newSection = [].concat(section);
|
||||
if (searchQuery) {
|
||||
let usedSearchQuery = searchQuery.toLowerCase();
|
||||
newSection = newSection.filter(entry => entry && typeof entry.usernameLower == "string" && entry.usernameLower.indexOf(usedSearchQuery) > -1);
|
||||
}
|
||||
if (sortKey) {
|
||||
newSection = BDFDB.ArrayUtils.keySort(newSection.map(entry => Object.assign({}, entry, {statusIndex: statusSortOrder[entry.status]})), sortKey);
|
||||
if (sortReversed) newSection.reverse();
|
||||
}
|
||||
if (!newSection.length) {
|
||||
let placeholder = new BDFDB.DiscordObjects.User({
|
||||
id: placeHolderId,
|
||||
username: placeHolderId
|
||||
});
|
||||
if (placeholder) newSection.push(new BDFDB.DiscordObjects.Relationship({
|
||||
activities: [],
|
||||
applicationStream: null,
|
||||
isMobile: false,
|
||||
key: placeHolderId,
|
||||
mutualGuilds: [],
|
||||
mutualGuildsLength: 0,
|
||||
status: "offline",
|
||||
type: BDFDB.DiscordConstants.RelationshipTypes.NONE,
|
||||
user: placeholder,
|
||||
usernameLower: placeholder.usernameNormalized
|
||||
}));
|
||||
}
|
||||
return newSection;
|
||||
});
|
||||
BDFDB.PatchUtils.patch(this, e.instance.props, "getSectionTitle", {after: e2 => {
|
||||
if (typeof e2.returnValue == "string") {
|
||||
let users = e.instance.props.statusSections.flat(10);
|
||||
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
|
||||
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
|
||||
children: [
|
||||
BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.disCN._betterfriendlisttitle,
|
||||
children: this.settings.general.addFavorizedCategory && isFavoritesSelected ? `${this.labels.favorites} - ${users.filter(u => u && u.key != placeHolderId).length}` : this.settings.general.addHiddenCategory && isHiddenSelected ? `${this.labels.hidden} - ${users.filter(u => u && u.key != placeHolderId).length}` : e2.returnValue.replace(users.length, users.filter(u => u && u.key != placeHolderId).length)
|
||||
}),
|
||||
this.settings.general.addSortOptions && [
|
||||
{key: "usernameLower", label: BDFDB.LanguageUtils.LanguageStrings.USER_SETTINGS_LABEL_USERNAME},
|
||||
{key: "statusIndex", label: BDFDB.LanguageUtils.LibraryStrings.status}
|
||||
].filter(n => n).map(data => BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.tableheadercellwrapper, BDFDB.disCN.tableheadercell, BDFDB.disCN._betterfriendlistnamecell, sortKey == data.key && BDFDB.disCN.tableheadercellsorted, BDFDB.disCN.tableheadercellclickable),
|
||||
children: BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.disCN.tableheadercellcontent,
|
||||
children: [
|
||||
data.label,
|
||||
sortKey == data.key && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
||||
className: BDFDB.disCN.tableheadersorticon,
|
||||
name: BDFDB.LibraryComponents.SvgIcon.Names[sortReversed ? "ARROW_UP" : "ARROW_DOWN"]
|
||||
})
|
||||
].filter(n => n)
|
||||
}),
|
||||
onClick: event => {
|
||||
if (sortKey == data.key) {
|
||||
if (!sortReversed) sortReversed = true;
|
||||
else {
|
||||
sortKey = null;
|
||||
sortReversed = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sortKey = data.key;
|
||||
sortReversed = false;
|
||||
}
|
||||
this.rerenderList();
|
||||
}
|
||||
})),
|
||||
this.settings.general.addSearchbar && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
|
||||
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SearchBar, {
|
||||
query: searchQuery,
|
||||
onChange: value => {
|
||||
BDFDB.TimeUtils.clear(searchTimeout);
|
||||
searchTimeout = BDFDB.TimeUtils.timeout(_ => {
|
||||
searchQuery = value;
|
||||
this.rerenderList();
|
||||
}, 1000);
|
||||
},
|
||||
onClear: _ => {
|
||||
searchQuery = "";
|
||||
this.rerenderList();
|
||||
}
|
||||
})
|
||||
})
|
||||
].flat(10).filter(n => n)
|
||||
});
|
||||
}
|
||||
}}, {force: true, noCache: true});
|
||||
if (e.returnvalue && !e.instance.props.statusSections.flat(10).length) e.returnvalue.props.children = BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.disCN.peopleslistempty,
|
||||
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FriendsEmptyState, {
|
||||
|
@ -385,6 +322,60 @@ module.exports = (_ => {
|
|||
});
|
||||
}
|
||||
|
||||
processPeopleList (e) {
|
||||
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "SectionTitle"});
|
||||
if (index > -1) {
|
||||
let users = (BDFDB.ReactUtils.findChild(e.returnvalue, {props: ["statusSections"]}) || {props: {statusSections: []}}).props.statusSections.flat(10);
|
||||
let filteredUsers = users;
|
||||
if (this.settings.general.addFavorizedCategory) {
|
||||
if (isFavoritesSelected) filteredUsers = filteredUsers.filter(n => n && n.user && favorizedFriends.indexOf(n.user.id) > -1);
|
||||
}
|
||||
if (this.settings.general.addHiddenCategory) {
|
||||
if (isHiddenSelected) filteredUsers = filteredUsers.filter(n => n && n.user && hiddenFriends.indexOf(n.user.id) > -1);
|
||||
else filteredUsers = filteredUsers.filter(n => n && n.user && hiddenFriends.indexOf(n.user.id) == -1);
|
||||
}
|
||||
children[index].props.title = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
|
||||
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
|
||||
children: [
|
||||
BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.disCN._betterfriendlisttitle,
|
||||
children: this.settings.general.addFavorizedCategory && isFavoritesSelected ? `${this.labels.favorites} - ${filteredUsers.filter(u => u && u.key != placeHolderId).length}` : this.settings.general.addHiddenCategory && isHiddenSelected ? `${this.labels.hidden} - ${filteredUsers.filter(u => u && u.key != placeHolderId).length}` : children[index].props.title.replace(users.length, filteredUsers.filter(u => u && u.key != placeHolderId).length)
|
||||
}),
|
||||
this.settings.general.addSortOptions && [
|
||||
{key: "usernameLower", label: BDFDB.LanguageUtils.LanguageStrings.USER_SETTINGS_LABEL_USERNAME},
|
||||
{key: "statusIndex", label: BDFDB.LanguageUtils.LibraryStrings.status}
|
||||
].filter(n => n).map(data => BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.tableheadercellwrapper, BDFDB.disCN.tableheadercell, BDFDB.disCN._betterfriendlistnamecell, sortKey == data.key && BDFDB.disCN.tableheadercellsorted, BDFDB.disCN.tableheadercellclickable),
|
||||
children: BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.disCN.tableheadercellcontent,
|
||||
children: [
|
||||
data.label,
|
||||
sortKey == data.key && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
||||
className: BDFDB.disCN.tableheadersorticon,
|
||||
name: BDFDB.LibraryComponents.SvgIcon.Names[sortReversed ? "ARROW_UP" : "ARROW_DOWN"]
|
||||
})
|
||||
].filter(n => n)
|
||||
}),
|
||||
onClick: event => {
|
||||
if (sortKey == data.key) {
|
||||
if (!sortReversed) sortReversed = true;
|
||||
else {
|
||||
sortKey = null;
|
||||
sortReversed = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sortKey = data.key;
|
||||
sortReversed = false;
|
||||
}
|
||||
this.rerenderList();
|
||||
}
|
||||
}))
|
||||
].flat(10).filter(n => n)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
processFriendRow (e) {
|
||||
e.returnvalue.props.mutualGuilds = e.instance.props.mutualGuilds;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue