new plugin

This commit is contained in:
Mirco Wittrien 2020-05-06 11:20:03 +02:00
parent 92306ca2c1
commit 05e3354ec3
7 changed files with 108 additions and 43 deletions

View File

@ -5319,7 +5319,6 @@
layerbase: ["Layers", "baseLayer"],
layers: ["Layers", "layers"],
layersbg: ["Layers", "bg"],
linethrough: ["TextStyle", "strikethrough"],
listavatar: ["UserProfile", "listAvatar"],
listdiscriminator: ["UserProfile", "listDiscriminator"],
listname: ["UserProfile", "listName"],

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,79 @@
//META{"name":"HideMutedCategories","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/HideMutedCategories","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/HideMutedCategories/HideMutedCategories.plugin.js"}*//
var HideMutedCategories = (_ => {
return class HideMutedCategories {
getName () {return "HideMutedCategories";}
getVersion () {return "1.0.0";}
getAuthor () {return "DevilBro";}
getDescription () {return "Hides muted categories the same way muted channels are hidden, when the server is set to hide muted channels.";}
constructor () {
this.patchPriority = 10;
this.patchedModules = {
before: {
Channels: "render"
}
};
}
// Legacy
load () {}
start () {
if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
let libraryScript = document.querySelector("head script#BDFDBLibraryScript");
if (!libraryScript || (performance.now() - libraryScript.getAttribute("date")) > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("id", "BDFDBLibraryScript");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.min.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", _ => {this.initialize();});
document.head.appendChild(libraryScript);
}
else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(_ => {
try {return this.initialize();}
catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
}, 30000);
}
initialize () {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
}
else {
console.error(`%c[${this.getName()}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
}
}
stop () {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}
}
// Begin of own functions
processChannels (e) {
if (!e.instance.props.guild || !e.instance.props.collapseMuted) return;
e.instance.props.categories = Object.assign({}, e.instance.props.categories);
for (let catId in e.instance.props.categories) if (BDFDB.LibraryModules.MutedUtils.isChannelMuted(e.instance.props.guild.id, catId)) e.instance.props.categories[catId] = [];
}
}
})();

View File

@ -0,0 +1,12 @@
# Hide Muted Categories- [![Downlad][download-badge]][download-link] [![Paypal][paypal-badge]][paypal-link] [![Patreon][patreon-badge]][patreon-link]
[download-badge]: https://img.shields.io/badge/Download-Plugin-brightgreen.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADGGlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjaY2BgnuDo4uTKJMDAUFBUUuQe5BgZERmlwH6egY2BmYGBgYGBITG5uMAxIMCHgYGBIS8/L5UBFTAyMHy7xsDIwMDAcFnX0cXJlYE0wJpcUFTCwMBwgIGBwSgltTiZgYHhCwMDQ3p5SUEJAwNjDAMDg0hSdkEJAwNjAQMDg0h2SJAzAwNjCwMDE09JakUJAwMDg3N+QWVRZ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rER+YYrXaI2D8EZyAEfangj2Fq0NrnBWry8YI5yb7rkRbBrDAK7X9NevlAYCL7Kns79iQKcunOU0+iO0fuSzV1QyUNjkU2b9wS66qm2nt8L3Q/oO7Gk3tWO2InzPtv3isU9RP9jqxmR8LMKsqdPVqFoC8qiDM/HiAcFUQZ34IYDr0VUGW+QEfK8BkVZBmfqkAWVWQZ37JAOA+n/nEtnh/wGd8JWP81Nt0P0r8Wu4ADvAHAOq2fsaP4N8BvFXi/ZoB3FYCcJMNKDbQw9Kc7YdoYfDzB+6xjUuM5mY+wsXYHvgeABIzsPkSOM/lAAAAAElFTkSuQmCC&style=flat
[download-link]: https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/HideMutedCategories/HideMutedCategories.plugin.js
[paypal-badge]: https://img.shields.io/badge/Paypal-Donate!-%23003087.svg?logo=paypal&style=flat
[paypal-link]: https://paypal.me/MircoWittrien
[patreon-badge]: https://img.shields.io/badge/Patreon-Support!-%23F96854.svg?logo=patreon&style=flat
[patreon-link]: https://patreon.com/MircoWittrien
Hides muted categories the same way muted channels are hidden, when the server is set to hide muted channels.

View File

@ -73,6 +73,7 @@ https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/F
https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/FriendNotifications/FriendNotifications.plugin.js
https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/GoogleSearchReplace/GoogleSearchReplace.plugin.js
https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/GoogleTranslateOption/GoogleTranslateOption.plugin.js
https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/HideMutedCategories/HideMutedCategories.plugin.js
https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/ImageGallery/ImageGallery.plugin.js
https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/ImageZoom/ImageZoom.plugin.js
https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/JoinedAtDate/JoinedAtDate.plugin.js

View File

@ -27,6 +27,7 @@
- [Friend Notifications](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/FriendNotifications) - Notifies you when a Friend or a User your choose to observe changing his online status, can be configured individually in the settings.
- [Google Search Replace](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/GoogleSearchReplace) - Replaces the default Google Text Search with a selection menu of several search engines.
- [Google Translate Option](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/GoogleTranslateOption) - Adds a Google Translate option to your context menu, which will open the selected text in Google Translate.
- [Hide Muted Categories](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/HideMutedCategories) - Hides muted categories the same way muted channels are hidden, when the server is set to hide muted channels.
- [Image Gallery](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/ImageGallery) - Allows the user to browse through images sent inside the same message.
- [Image Zoom](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/ImageZoom) - Allows you to zoom in opened Images by holding left clicking on them in the Image Modal.
- [Joined At Date](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/JoinedAtDate) - Displays the Joined At Date of a Member in the UserPopout and UserModal.

View File

@ -1,7 +1,7 @@
//META{"name":"ShowHiddenChannels","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/ShowHiddenChannels","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/ShowHiddenChannels/ShowHiddenChannels.plugin.js"}*//
var ShowHiddenChannels = (_ => {
var blacklist, changedInstances;
var blacklist;
const settingsMap = {
GUILD_TEXT: "showText",
@ -28,20 +28,16 @@ var ShowHiddenChannels = (_ => {
return class ShowHiddenChannels {
getName () {return "ShowHiddenChannels";}
getVersion () {return "2.7.3";}
getVersion () {return "2.7.4";}
getAuthor () {return "DevilBro";}
getDescription () {return "Displays channels that are hidden from you by role restrictions.";}
constructor () {
this.changelog = {
"fixed":[["Access Modal","Users that could not be loaded (deleted users or no-cached users) are now displayed via their ID and not blank"]]
};
this.patchedModules = {
before: {
GuildSidebar: "render"
Channels: "render"
},
after: {
ChannelItem: ["render", "componentDidMount", "componentDidUpdate"]
@ -50,8 +46,6 @@ var ShowHiddenChannels = (_ => {
}
initConstructor () {
changedInstances = {};
this.defaults = {
settings: {
sortNative: {value:false, description:"Sort hidden Channels in the native Order"},
@ -196,8 +190,8 @@ var ShowHiddenChannels = (_ => {
stop () {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
for (let guildid in changedInstances) this.resetInstance(guildid, true);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}
@ -209,10 +203,8 @@ var ShowHiddenChannels = (_ => {
onSettingsClosed (instance, wrapper, returnvalue) {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
for (let guildid in changedInstances) this.resetInstance(guildid, false);
BDFDB.TimeUtils.timeout(_ => {BDFDB.ModuleUtils.forceAllUpdates(this)}, 3000);
BDFDB.ModuleUtils.forceAllUpdates(this);
}
}
@ -237,13 +229,18 @@ var ShowHiddenChannels = (_ => {
}
}
}
processGuildSidebar (e) {
processChannels (e) {
if (!e.instance.props.guild || blacklist.includes(e.instance.props.guild.id)) return;
let [hiddenChannels, amount] = this.getHiddenChannels(e.instance.props.guild);
if (amount) {
e.instance.props.categories = Object.assign({}, e.instance.props.categories);
for (let catId in e.instance.props.categories) e.instance.props.categories[catId] = [].concat(e.instance.props.categories[catId]);
e.instance.props.channels = Object.assign({}, e.instance.props.channels);
for (let type in e.instance.props.channels) e.instance.props.channels[type] = [].concat(e.instance.props.channels[type]);
let settings = BDFDB.DataUtils.get(this, "settings"), index = -1;
for (let catId in e.instance.props.categories) for (let channelObj of e.instance.props.categories[catId]) if (channelObj.index > index) index = channelObj.index;
for (let catId in e.instance.props.categories) for (let channelObj of e.instance.props.categories[catId]) if (channelObj.index >= index) index = channelObj.index;
if (!settings.sortNative) {
let hiddenCategory = new BDFDB.DiscordObjects.Channel({
guild_id: e.instance.props.guild.id,
@ -291,8 +288,6 @@ var ShowHiddenChannels = (_ => {
for (let parent_id in e.instance.props.categories) BDFDB.ArrayUtils.keySort(e.instance.props.categories[parent_id], "index");
for (let channelType in e.instance.props.channels) BDFDB.ArrayUtils.keySort(e.instance.props.channels[channelType], "comparator");
changedInstances[e.instance.props.guild.id] = e.instance;
}
}
@ -332,28 +327,6 @@ var ShowHiddenChannels = (_ => {
}
}
resetInstance (guildid, update) {
let instance = changedInstances[guildid];
if (instance) {
delete instance.props.categories[guildid + "_hidden"];
let removedCategories = [];
for (let categoryObj of instance.props.categories._categories) if (categoryObj.channel.id.endsWith("hidden")) removedCategories.push(categoryObj);
for (let categoryObj of removedCategories) BDFDB.ArrayUtils.remove(instance.props.categories._categories, categoryObj);
for (let id in instance.props.categories) if (BDFDB.ArrayUtils.is(instance.props.categories[id])) {
let removedChannels = [];
for (let channelObj of instance.props.categories[id]) if (this.isChannelHidden(channelObj.channel.id) && (channelObj.channel.type != BDFDB.DiscordConstants.ChannelTypes.GUILD_CATEGORY || channelObj.channel.id.endsWith("hidden"))) removedChannels.push(channelObj);
for (let channelObj of removedChannels) BDFDB.ArrayUtils.remove(instance.props.categories[id], channelObj);
}
for (let type in instance.props.channels) if (BDFDB.ArrayUtils.is(instance.props.channels[type])) {
let removedChannels = [];
for (let channelObj of instance.props.channels[type]) if (this.isChannelHidden(channelObj.channel.id) && (channelObj.channel.type != BDFDB.DiscordConstants.ChannelTypes.GUILD_CATEGORY || channelObj.channel.id.endsWith("hidden"))) removedChannels.push(channelObj);
for (let channelObj of removedChannels) BDFDB.ArrayUtils.remove(instance.props.channels[type], channelObj);
}
delete changedInstances[guildid].instance;
if (update) BDFDB.ReactUtils.forceUpdate(instance);
}
}
isChannelHidden (channelId) {
return !BDFDB.DMUtils.isDMChannel(channelId) && !BDFDB.UserUtils.can("VIEW_CHANNEL", BDFDB.UserUtils.me.id, channelId);
}