removed bdv2 plugins

This commit is contained in:
Mirco Wittrien 2019-03-10 22:04:14 +01:00
parent 0f7058a1df
commit cfa83873cd
120 changed files with 0 additions and 17510 deletions

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Better Friend Count - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/BetterFriendCount/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/BetterFriendCount/config.json)
Shows the amount of total and online friends and blocked users in the friends tab.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "BadgesEverywhere",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Displays Badges (Nitro, Hypesquad, etc...) in the chat/memberlist/userpopout. Thanks for Zerebos' help. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,202 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"NameTag":"componentDidMount",
"MessageUsername":"componentDidMount"
};
this.css = `
.BE-badge {
display: inline-block;
height: 17px !important;
margin: 0 2px !important;
}
.BE-badge.BE-badge-chat {
margin-bottom: -3px !important;
}
.BE-badge.BE-badge-popout {
margin-bottom: -2px !important;
}
.BE-badge.BE-badge:first-of-type {
margin-left: 5px !important;
}
.BE-badge.BE-badge:last-of-type {
margin-right: 5px !important;
}
.BE-badge.BE-badge-Staff {width:17px !important; min-width:17px !important;}
.BE-badge.BE-badge-Partner {width:22px !important; min-width:22px !important;}
.BE-badge.BE-badge-HypeSquad {width:17px !important; min-width:17px !important;}
.BE-badge.BE-badge-BugHunter {width:17px !important; min-width:17px !important;}
.BE-badge.BE-badge-HypeSquadBravery {width:17px !important; min-width:17px !important;}
.BE-badge.BE-badge-HypeSquadBrilliance {width:17px !important; min-width:17px !important;}
.BE-badge.BE-badge-HypeSquadBalance {width:17px !important; min-width:17px !important;}
.BE-badge.BE-badge-EarlySupporter {width:24px !important; min-width:24px !important;}
.BE-badge.BE-badge-Nitro {width:21px !important; min-width:21px !important;}
.BE-badge.BE-badge-settings {width:30px !important; min-width:30px !important;}`;
this.requestedusers = {};
this.loadedusers = {};
this.defaults = {
settings: {
showInPopout: {value:true, description:"Show Badge in User Popout."},
showInChat: {value:true, description:"Show Badge in Chat Window."},
showInMemberList: {value:true, description:"Show Badge in Member List."},
useColoredVersion: {value:true, description:"Use colored version of the Badges for Chat and Members."}
},
badges: {
1: {value:true, name:"Staff", selector:"profileBadgeStaff"},
2: {value:true, name:"Partner", selector:"profileBadgePartner"},
4: {value:true, name:"HypeSquad", selector:"profileBadgeHypesquad"},
8: {value:true, name:"BugHunter", selector:"profileBadgeBugHunter"},
16: {value:false, name:"MFASMS", selector:false},
32: {value:false, name:"PROMODISMISSED", selector:false},
64: {value:true, name:"HypeSquad Bravery", selector:"profileBadgeHypeSquadOnlineHouse1"},
128: {value:true, name:"HypeSquad Brilliance", selector:"profileBadgeHypeSquadOnlineHouse2"},
256: {value:true, name:"HypeSquad Balance", selector:"profileBadgeHypeSquadOnlineHouse3"},
512: {value:true, name:"Early Supporter", selector:"profileBadgeEarlySupporter"},
2048: {value:true, name:"Nitro", selector:"profileBadgePremium"}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.APIModule = BDFDB.WebModules.findByProperties("getAPIBaseURL");
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
this.BadgeClasses = BDFDB.WebModules.findByProperties("profileBadgeStaff","profileBadgePremium");
for (let flag in this.defaults.badges) if (!this.defaults.badges[flag].selector) delete this.defaults.badges[flag];
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".BE-badges");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
processNameTag (instance, wrapper) {
if (!wrapper.classList || !instance || !instance.props) return;
else if (BDFDB.containsClass(wrapper, BDFDB.disCN.membernametag) && BDFDB.getData("showInMemberList", this, "settings")) {
this.addBadges(instance.props.user, wrapper, "list");
}
else if (BDFDB.containsClass(wrapper, BDFDB.disCN.userpopoutheadertag) && BDFDB.getData("showInPopout", this, "settings")) {
wrapper = BDFDB.containsClass(wrapper, BDFDB.disCN.userpopoutheadertagwithnickname) && wrapper.previousSibling ? wrapper.previousSibling : wrapper;
this.addBadges(instance.props.user, wrapper, "popout");
}
}
processMessageUsername (instance, wrapper) {
let message = BDFDB.getReactValue(instance, "props.message");
if (message) {
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
if (username && BDFDB.getData("showInChat", this, "settings")) this.addBadges(message.author, wrapper, "chat");
}
}
addBadges (info, wrapper, type) {
if (!info || info.bot || !wrapper) return;
if (!this.requestedusers[info.id]) {
this.requestedusers[info.id] = [[wrapper,type]];
this.APIModule.get(this.DiscordConstants.Endpoints.USER_PROFILE(info.id)).then(result => {
let usercopy = Object.assign({},result.body.user);
if (result.body.premium_since) usercopy.flags += 2048;
this.loadedusers[info.id] = usercopy;
for (let queredobj of this.requestedusers[info.id]) this.addToWrapper(info, queredobj[0], queredobj[1]);
});
}
else if (!this.loadedusers[info.id]) {
this.requestedusers[info.id].push([wrapper,type]);
}
else {
this.addToWrapper(info, wrapper, type);
}
}
addToWrapper (info, wrapper, type) {
BDFDB.removeEles(wrapper.querySelectorAll(".BE-badges"));
let badges = BDFDB.getAllData(this, "badges");
let settings = BDFDB.getAllData(this, "settings");
let header = BDFDB.getParentEle(BDFDB.dotCN.userpopoutheader, wrapper);
let badgewrapper = BDFDB.htmlToElement(`<span class="BE-badges ${!settings.useColoredVersion || (header && !BDFDB.containsClass(header, BDFDB.disCN.userpopoutheadernormal)) ? BDFDB.disCN.userprofiletopsectionplaying : BDFDB.disCN.userprofiletopsectionnormal}" style="all: unset !important; order: 9 !important;"></span>`);
for (let flag in this.defaults.badges) {
if ((this.loadedusers[info.id].flags | flag) == this.loadedusers[info.id].flags && badges[flag]) {
let badge = BDFDB.htmlToElement(`<div class="BE-badge BE-badge-${this.defaults.badges[flag].name.replace(/ /g, "")} BE-badge-${type} ${this.BadgeClasses[this.defaults.badges[flag].selector]}"></div>`);
badgewrapper.appendChild(badge);
badge.addEventListener("mouseenter", () => {BDFDB.createTooltip(this.defaults.badges[flag].name, badge, {"type":type == "list" ? "left" : "top"});});
}
}
if (badgewrapper.firstChild) wrapper.insertBefore(badgewrapper, wrapper.querySelector(".owner-tag,.TRE-tag,svg[name=MobileDevice]"));
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var badges = BDFDB.getAllData(this, "badges");
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">Display Badges:</h3></div><div class="DevilBro-settings-inner-list">`;
for (let flag in badges) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.badges[flag].name}</h3><span class="BE-badges ${BDFDB.disCN.userprofiletopsectionplaying}" style="all: unset !important;"><div class="BE-badge BE-badge-${this.defaults.badges[flag].name.replace(/ /g, "")} BE-badge-settings ${this.BadgeClasses[this.defaults.badges[flag].selector]}"></div></span><span class="BE-badges ${BDFDB.disCN.userprofiletopsectionnormal}" style="all: unset !important;"><div class="BE-badge BE-badge-${this.defaults.badges[flag].name.replace(/ /g, "")} BE-badge-settings ${this.BadgeClasses[this.defaults.badges[flag].selector]}"></div></span><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="badges ${flag}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${badges[flag] ? " checked" : ""}></div></div>`;
}
settingshtml += `</div></div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
return settingspanel;
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
BDFDB.WebModules.forceAllUpdates(this);
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Better Friend Count - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/BetterFriendCount/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/BetterFriendCount/config.json)
Shows the amount of total and online friends and blocked users in the friends tab.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "BetterFriendCount",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Shows the amount of total and online friends and blocked users in the friends tab. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,100 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"TabBar":"componentDidMount",
"NameTag":["componentWillMount","componentWillUnmount"]
};
this.css = `
${BDFDB.dotCNS.friends + BDFDB.dotCNS.settingstabbar + BDFDB.dotCN.badge}:not(.betterfriendcount-badge),
${BDFDB.dotCNS.friends + BDFDB.dotCNS.settingstabbar + BDFDB.dotCN.badgewrapper}:not(.betterfriendcount-badge) {
display: none !important;
}
${BDFDB.dotCNS.friends + BDFDB.dotCNS.settingstabbar + BDFDB.dotCN.badgewrapper}.betterfriendcount-badge {
margin-left: 5px !important;
}
`;
this.relationshipTypes = {};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.FriendUtils = BDFDB.WebModules.findByProperties("getFriendIDs", "getRelationships");
this.UserMetaStore = BDFDB.WebModules.findByProperties("getStatus", "getOnlineFriendCount");
let RelationshipTypes = BDFDB.WebModules.findByProperties("RelationshipTypes").RelationshipTypes;
for (let type in RelationshipTypes) this.relationshipTypes[RelationshipTypes[type]] = type;
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".betterfriendcount-badge");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
processTabBar (instance, wrapper) {
if (instance.props && instance.props.children && instance.props.children[0].key == "ADD_FRIEND") this.addCountNumbers(wrapper);
}
processNameTag (instance, wrapper) {
if (wrapper.parentElement && BDFDB.containsClass(wrapper.parentElement, BDFDB.disCN.friendscolumn)) this.addCountNumbers();
}
addCountNumbers (wrapper = document.querySelector(BDFDB.dotCNS.friends + BDFDB.dotCN.settingstabbar)) {
if (!wrapper) return;
let tabitems = wrapper.querySelectorAll(BDFDB.dotCN.settingsitem);
if (!tabitems || tabitems.length < 5) return;
BDFDB.removeEles(".betterfriendcount-badge");
let relationships = this.FriendUtils.getRelationships(), relationshipCount = {};
for (let type in this.relationshipTypes) relationshipCount[this.relationshipTypes[type]] = 0;
for (let id in relationships) relationshipCount[this.relationshipTypes[relationships[id]]]++;
let badgeclass = BDFDB.disCN.badgewrapper;
tabitems[1].appendChild(BDFDB.htmlToElement(`<div class="${badgeclass} betterfriendcount-badge friendcount">${relationshipCount.FRIEND}</div>`));
tabitems[2].appendChild(BDFDB.htmlToElement(`<div class="${badgeclass} betterfriendcount-badge onlinefriendcount">${this.UserMetaStore.getOnlineFriendCount()}</div>`));
tabitems[3].appendChild(BDFDB.htmlToElement(`<div class="${badgeclass} betterfriendcount-badge requestincount">${relationshipCount.PENDING_INCOMING}</div>`));
tabitems[3].appendChild(BDFDB.htmlToElement(`<div class="${badgeclass} betterfriendcount-badge requestoutcount">${relationshipCount.PENDING_OUTGOING}</div>`));
tabitems[4].appendChild(BDFDB.htmlToElement(`<div class="${badgeclass} betterfriendcount-badge blockedcount">${relationshipCount.BLOCKED}</div>`));
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Better NSFW Tag - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/BetterNsfwTag/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/BetterNsfwTag/config.json)
Adds a more noticeable tag to NSFW channels.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "BetterNsfwTag",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Adds a more noticeable tag to NSFW channels. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,64 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"ChannelItem":"componentDidMount"
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".NSFW-tag");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
processChannelItem (instance, wrapper) {
if (instance.props && instance.props.channel && instance.props.channel.nsfw) {
let channelname = wrapper.querySelector(BDFDB.dotCN.channelname);
if (channelname) channelname.appendChild(BDFDB.htmlToElement(`<span class="NSFW-tag ${BDFDB.disCNS.bottag + BDFDB.disCNS.bottagregular + BDFDB.disCN.bottagnametag}" style="background-color: rgb(241, 71, 71) !important; color: white !important; top: -3px; position: relative;">NSFW</span>`));
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Better Friend Count - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/BetterFriendCount/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/BetterFriendCount/config.json)
Shows the amount of total and online friends and blocked users in the friends tab.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "BetterPageSearch",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Adds some extra controls to the search results page. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,216 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"SearchResults":["componentDidMount","componentDidUpdate"]
};
this.css = `
.BSP-pagination-button {
background: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" width="30" height="25"><g fill="#737f8d" fill-rule="evenodd" clip-rule="evenodd"><path xmlns="http://www.w3.org/2000/svg" d="M17.338 12.485c-4.156 4.156-8.312 8.312-12.468 12.467-1.402-1.402-2.805-2.804-4.207-4.206 2.756-2.757 5.513-5.514 8.27-8.27C6.176 9.72 3.419 6.963.663 4.207L4.87 0c-.058-.059 12.555 12.562 12.468 12.485z"/><path xmlns="http://www.w3.org/2000/svg" d="M17.338 12.485c-4.156 4.156-8.312 8.312-12.468 12.467-1.402-1.402-2.805-2.804-4.207-4.206 2.756-2.757 5.513-5.514 8.27-8.27C6.176 9.72 3.419 6.963.663 4.207L4.87 0c-.058-.059 12.555 12.562 12.468 12.485z" transform="translate(12 0)"/></g></svg>') 50%/9px 12px no-repeat;
border: 1px solid rgba(79,84,92,.16);
border-radius: 2px;
cursor: pointer;
height: 18px;
left: 20px;
opacity: .7;
top: 20px;
width: 18px;
}
${BDFDB.dotCN.themedark} .BSP-pagination-button {
background-image: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" width="30" height="25"><g fill="#FFF" fill-rule="evenodd" clip-rule="evenodd"><path xmlns="http://www.w3.org/2000/svg" d="M17.338 12.485c-4.156 4.156-8.312 8.312-12.468 12.467-1.402-1.402-2.805-2.804-4.207-4.206 2.756-2.757 5.513-5.514 8.27-8.27C6.176 9.72 3.419 6.963.663 4.207L4.87 0c-.058-.059 12.555 12.562 12.468 12.485z" /><path xmlns="http://www.w3.org/2000/svg" d="M17.338 12.485c-4.156 4.156-8.312 8.312-12.468 12.467-1.402-1.402-2.805-2.804-4.207-4.206 2.756-2.757 5.513-5.514 8.27-8.27C6.176 9.72 3.419 6.963.663 4.207L4.87 0c-.058-.059 12.555 12.562 12.468 12.485z" transform="translate(12 0)"/></g></svg>');
border: 1px solid hsla(0,0%,100%,.16);
}
.BSP-pagination-button.BSP-pagination-first {
margin-right: 10px;
transform: rotate(180deg);
}
.BSP-pagination-button.BSP-pagination-last {
margin-left: 10px;
margin-right: 10px;
}
.BSP-pagination-button.BSP-pagination-jump {
margin-left: 10px;
transform: rotate(90deg);
}
.BSP-pagination-button${BDFDB.dotCN.searchresultspaginationdisabled} {
cursor: default;
opacity: .3;
}
.BSP-pagination-button${BDFDB.notCN.searchresultspaginationdisabled}:hover {
opacity: 1;
}
`;
this.defaults = {
settings: {
addFirstLast: {value:true, description:"Adds a first and last page button."},
addJumpTo: {value:true, description:"Adds a jump to input field (press enter to jump)."},
cloneToTheTop: {value:true, description:"Clones the controls to the top of the results page."}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.SearchNavigation = BDFDB.WebModules.findByProperties("searchNextPage","searchPreviousPage");
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".BSP-pagination",".BSP-pagination-button",".BSP-pagination-jumpinput");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
processSearchResults (instance, wrapper) {
if (instance.props && instance.props.searchId) this.addNewControls(wrapper.querySelector(BDFDB.dotCN.searchresultspagination), instance.props.searchId);
}
addNewControls (pagination, searchId) {
if (!pagination || !searchId || document.querySelector(".BSP-pagination, .BSP-pagination-button, .BSP-pagination-jumpinput")) return;
let searchResultsWrapper = BDFDB.getParentEle(BDFDB.dotCN.searchresultswrapper, pagination);
if (!searchResultsWrapper) return;
let currentpage, maxpage;
for (let word of pagination.textContent.split(" ")) {
let number = parseInt(word.replace(/\./g,""));
if (!isNaN(number) && !currentpage) currentpage = number;
else if (!isNaN(number)) {
maxpage = number;
break;
}
}
if (!currentpage || !maxpage) return;
let temppage = currentpage;
currentpage = currentpage < maxpage ? currentpage : maxpage;
maxpage = temppage < maxpage ? maxpage : temppage;
if (maxpage > 201) {
if (currentpage == 201) BDFDB.showToast("Discord doesn't allow you to go further than page 201.",{type:"error"});
maxpage = 201;
}
if (currentpage == maxpage && maxpage == 201) BDFDB.addClass(pagination.querySelector(BDFDB.dotCN.searchresultspaginationnext), BDFDB.disCN.searchresultspaginationdisabled);
let settings = BDFDB.getAllData(this, "settings");
for (let btn of pagination.querySelectorAll(BDFDB.dotCNC.searchresultspaginationprevious + BDFDB.dotCN.searchresultspaginationnext)) BDFDB.addClass(btn, "pagination-button");
if (settings.addFirstLast) {
pagination.insertBefore(BDFDB.htmlToElement(`<div aria-label="First" class="${currentpage == 1 ? BDFDB.disCNS.searchresultspaginationdisabled : ""}pagination-button BSP-pagination-button BSP-pagination-first"></div>`), pagination.firstElementChild);
pagination.appendChild(BDFDB.htmlToElement(`<div aria-label="Last" class="${currentpage == maxpage ? BDFDB.disCNS.searchresultspaginationdisabled : ""}pagination-button BSP-pagination-button BSP-pagination-last"></div>`));
}
if (settings.addJumpTo) {
pagination.appendChild(BDFDB.htmlToElement(`<div class="inputNumberWrapper inputNumberWrapperMini BSP-pagination-jumpinput ${BDFDB.disCN.inputwrapper}"><span class="numberinput-buttons-zone"><span class="numberinput-button-up"></span><span class="numberinput-button-down"></span></span><input type="number" min="1" max="${maxpage}" placeholder="${currentpage}" value="${currentpage}" class="${BDFDB.disCNS.inputmini + BDFDB.disCNS.input + BDFDB.disCN.size16}"></div>`));
pagination.appendChild(BDFDB.htmlToElement(`<div aria-label="Go To" class="pagination-button BSP-pagination-button BSP-pagination-jump"></div>`));
}
BDFDB.initElements(pagination, this);
if (settings.cloneToTheTop) {
let BSPpaginaton = pagination.cloneNode(true);
BDFDB.addClass(BSPpaginaton, "BSP-pagination");
searchResultsWrapper.insertBefore(BSPpaginaton, searchResultsWrapper.firstElementChild);
BDFDB.initElements(BSPpaginaton, this);
}
var doJump = (input) => {
let value = input.value;
if (value < 1 || value > maxpage) {
input.value = currentpage;
if (maxpage == 201 && value > maxpage) BDFDB.showToast("Discord doesn't allow you to go further than page 201.",{type:"error"});
}
else if (value < currentpage) {
for (; currentpage - value > 0; value++) {
this.SearchNavigation.searchPreviousPage(searchId);
}
}
else if (value > currentpage) {
for (; value - currentpage > 0; value--) {
this.SearchNavigation.searchNextPage(searchId);
}
}
};
BDFDB.addEventListener(this, searchResultsWrapper, "click", BDFDB.dotCN.searchresultspaginationdisabled, e => {
e.preventDefault();
e.stopPropagation();
});
BDFDB.addEventListener(this, searchResultsWrapper, "click", `.BSP-pagination ${BDFDB.dotCN.searchresultspaginationprevious + BDFDB.notCN.searchresultspaginationdisabled}`, () => {
this.SearchNavigation.searchPreviousPage(searchId);
});
BDFDB.addEventListener(this, searchResultsWrapper, "click", `.BSP-pagination ${BDFDB.dotCN.searchresultspaginationnext + BDFDB.notCN.searchresultspaginationdisabled}`, () => {
this.SearchNavigation.searchNextPage(searchId);
});
BDFDB.addEventListener(this, searchResultsWrapper, "click", `.BSP-pagination-first${BDFDB.notCN.searchresultspaginationdisabled}`, () => {
for (let i = 0; currentpage - 1 - i > 0; i++) this.SearchNavigation.searchPreviousPage(searchId);
});
BDFDB.addEventListener(this, searchResultsWrapper, "click", `.BSP-pagination-last${BDFDB.notCN.searchresultspaginationdisabled}`, () => {
for (let i = 0; maxpage - currentpage - i > 0; i++) this.SearchNavigation.searchNextPage(searchId);
});
BDFDB.addEventListener(this, searchResultsWrapper, "click", `.BSP-pagination-jump${BDFDB.notCN.searchresultspaginationdisabled}`, e => {
doJump(e.currentTarget.parentElement.querySelector(`.BSP-pagination-jumpinput ${BDFDB.dotCN.inputmini}`));
});
BDFDB.addEventListener(this, searchResultsWrapper, "keydown", `.BSP-pagination-jumpinput ${BDFDB.dotCN.inputmini}`, e => {
let label = e.currentTarget.getAttribute("aria-label");
if (label) BDFDB.createTooltip(label, e.currentTarget, {type:"top"});
});
BDFDB.addEventListener(this, searchResultsWrapper, "mouseenter", `.pagination-button${BDFDB.notCN.searchresultspaginationdisabled}`, e => {
let label = e.currentTarget.getAttribute("aria-label");
if (label) BDFDB.createTooltip(label, e.currentTarget, {type:"top"});
});
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
return settingspanel;
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
BDFDB.removeEles(".BSP-pagination",".BSP-pagination-button",".BSP-pagination-jumpinput");
BDFDB.WebModules.forceAllUpdates(this);
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Char Counter - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/CharCounter/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/CharCounter/config.json)
Adds a character counter to your textarea.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "CharCounter",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Adds a charcounter in the chat. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,166 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"ChannelTextArea":"componentDidMount",
"Note":"componentDidMount",
"Modal":"componentDidMount"
};
this.maxLenghts = {
normal: 2000,
edit: 2000,
form: 2000,
nickname: 32,
popout: 256,
profile: 256
}
this.css = `
${BDFDB.dotCN.themelight} #charcounter {
color: #747f8d;
opacity: .7;
}
${BDFDB.dotCN.themedark} #charcounter {
color: #ccc;
opacity: .5;
}
${BDFDB.dotCNS.typing + BDFDB.dotCN.cooldownwrapper} {
margin-right: 64px;
}
.charcounter-added {
position: relative !important;
}
#charcounter {
display: block;
position: absolute;
z-index: 1000;
pointer-events: none;
}
#charcounter.normal {
right: 0;
bottom: -1.3em;
}
#charcounter.edit {
left: 0;
bottom: -1.3em;
}
#charcounter.form {
right: 0;
bottom: -1.0em;
}
#charcounter.nickname {
right: 0 !important;
top: 0 !important;
}
#charcounter.popout {
right: 3px !important;
bottom: 1px !important;
font-size: 10px !important;
}
#charcounter.profile {
right: -5px !important;
bottom: 3px !important;
font-size: 12px !important;
}
${BDFDB.dotCN.usernote} textarea:not(:focus) + #charcounter {
display: none;
}`;
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".charcounter");
BDFDB.removeClasses("charcounter-added");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
processChannelTextArea (instance, wrapper) {
if (instance.props && instance.props.type && this.maxLenghts[instance.props.type]) this.appendCounter(wrapper.querySelector("textarea"), instance.props.type);
}
processNote (instance, wrapper) {
this.appendCounter(wrapper.firstElementChild, BDFDB.containsClass(wrapper, BDFDB.disCN.usernotepopout) ? "popout" : (BDFDB.containsClass(wrapper, BDFDB.disCN.usernoteprofile) ? "profile" : null));
}
processModal (instance, wrapper) {
if (instance.props && instance.props.tag == "form") {
let reset = wrapper.querySelector(BDFDB.dotCN.reset);
if (reset && BDFDB.getInnerText(reset.firstElementChild) == BDFDB.LanguageStrings.RESET_NICKNAME) this.appendCounter(wrapper.querySelector(BDFDB.dotCN.inputdefault), "nickname");
}
}
appendCounter (input, type) {
if (!input || !type) return;
BDFDB.removeEles(input.parentElement.querySelectorAll("#charcounter"));
var counter = BDFDB.htmlToElement(`<div id="charcounter" class="charcounter ${type}"></div>`);
input.parentElement.appendChild(counter);
var updateCounter = () => {counter.innerText = input.value.length + "/" + (this.maxLenghts[type] || 2000) + (input.selectionEnd - input.selectionStart == 0 ? "" : " (" + (input.selectionEnd - input.selectionStart) + ")");};
BDFDB.addClass(input.parentElement.parentElement, "charcounter-added");
if (type == "nickname") input.setAttribute("maxlength", 32);
BDFDB.addEventListener(this, input, "keydown click", e => {
clearTimeout(input.charcountertimeout);
input.charcountertimeout = setTimeout(() => {updateCounter();},100);
});
BDFDB.addEventListener(this, input, "mousedown", e => {
BDFDB.addEventListener(this, document, "mouseup", () => {
BDFDB.removeEventListener(this, document);
if (input.selectionEnd - input.selectionStart) setImmediate(() => {BDFDB.addEventListener(this, document, "click", () => {
input.selectionStart = 0;
input.selectionEnd = 0;
updateCounter();
BDFDB.removeEventListener(this, document);
});});
});
BDFDB.addEventListener(this, document, "mousemove", () => {setTimeout(() => {updateCounter();},10);});
});
updateCounter();
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Chat Aliases - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ChatAliases/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ChatAliases/config.json)
Allows the user to configure their own chat-aliases which will automatically be replaced before the message is being sent.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "ChatAliases",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Allows the user to configure their own chat-aliases which will automatically be replaced before the message is being sent. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,426 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"ChannelTextArea":"componentDidMount"
};
this.configs = ["case","exact","autoc","regex","file"];
this.defaults = {
settings: {
addAutoComplete: {value:true, description:"Add an Autocomplete-Menu for Non-Regex Aliases:"}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.UploadModule = BDFDB.WebModules.findByProperties("instantBatchUpload");
this.CurrentUserPerms = BDFDB.WebModules.findByProperties("getChannelPermissions", "can");
this.Permissions = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes").Permissions;
this.aliases = BDFDB.loadAllData(this, "words");
BDFDB.addEventListener(document, "click", e => {
if (!e.target.tagName === "TEXTAREA") BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
});
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
updateContainer (settingspanel, ele) {
var update = false, wordvalue = null, replacevalue = null;
var action = ele.getAttribute("action");
if (action == "add") {
var wordinput = settingspanel.querySelector("#input-wordvalue");
var replaceinput = settingspanel.querySelector("#input-replacevalue");
var fileselection = settingspanel.querySelector("#input-file");
wordvalue = wordinput.value;
replacevalue = replaceinput.value;
if (wordvalue && wordvalue.trim().length > 0 && replacevalue && replacevalue.trim().length > 0) {
wordvalue = wordvalue.trim();
replacevalue = replacevalue.trim();
var filedata = null;
var fs = require("fs");
if (fileselection.files && fileselection.files[0] && fs.existsSync(replacevalue)) {
filedata = JSON.stringify({
data: fs.readFileSync(replacevalue).toString("base64"),
name: fileselection.files[0].name,
type: fileselection.files[0].type
});
}
this.aliases[wordvalue] = {
replace: replacevalue,
filedata: filedata,
case: false,
exact: wordvalue.indexOf(" ") == -1,
autoc: true,
regex: false,
file: filedata != null
};
wordinput.value = null;
replaceinput.value = null;
update = true;
}
}
else if (action == "remove") {
wordvalue = ele.getAttribute("word");
if (wordvalue) {
delete this.aliases[wordvalue];
update = true;
}
}
else if (action == "removeall") {
if (confirm("Are you sure you want to remove all added Words from your list?")) {
this.aliases = {};
update = true;
}
}
if (update) {
BDFDB.saveAllData(this.aliases, this, "words");
var containerhtml = ``;
for (let word in this.aliases) {
containerhtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} word-name" value="${BDFDB.encodeToHTML(word)}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} replace-name" value="${BDFDB.encodeToHTML(this.aliases[word].replace)}">`;
for (let config of this.configs) {
containerhtml += `<div class="${BDFDB.disCNS.checkboxcontainer + BDFDB.disCN.marginreset}" style="flex: 0 0 auto;"><label class="${BDFDB.disCN.checkboxwrapper}"><input word="${word}" config="${config}" type="checkbox" class="${BDFDB.disCNS.checkboxinputdefault + BDFDB.disCN.checkboxinput}"${this.aliases[word][config] ? " checked" : ""}><div class="${BDFDB.disCNS.checkbox + BDFDB.disCNS.flexcenter + BDFDB.disCNS.flex + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.checkboxround}"><svg name="Checkmark" width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><polyline stroke="transparent" stroke-width="2" points="3.5 9.5 7 13 15 5"></polyline></g></svg></div></label></div>`;
}
containerhtml += `</div><div word="${word}" action="remove" class="${BDFDB.disCN.hovercardbutton} remove-word"></div></div>`;
}
settingspanel.querySelector(".alias-list").innerHTML = containerhtml;
BDFDB.initElements(settingspanel, this);
}
}
updateWord (ele) {
clearTimeout(ele.updateTimeout);
ele.updateTimeout = setTimeout(() => {
var card = ele.parentElement.parentElement;
var oldwordvalue = ele.getAttribute("word");
if (oldwordvalue && this.aliases[oldwordvalue]) {
var wordinput = card.querySelector(".word-name");
var replaceinput = card.querySelector(".replace-name");
var removebutton = card.querySelector(".remove-word");
var newwordvalue = wordinput.value;
var newreplacevalue = replaceinput.value;
wordinput.setAttribute("word", newwordvalue);
wordinput.setAttribute("value", newwordvalue);
replaceinput.setAttribute("word", newwordvalue);
replaceinput.setAttribute("value", newreplacevalue);
removebutton.setAttribute("word", newwordvalue);
this.aliases[newwordvalue] = this.aliases[oldwordvalue];
this.aliases[newwordvalue].replace = newreplacevalue;
if (newwordvalue != oldwordvalue) delete this.aliases[oldwordvalue];
BDFDB.saveAllData(this.aliases, this, "words");
}
},500);
}
updateConfig (ele) {
var wordvalue = ele.getAttribute("word");
var config = ele.getAttribute("config");
if (wordvalue && this.aliases[wordvalue] && config) {
this.aliases[wordvalue][config] = ele.checked;
BDFDB.saveAllData(this.aliases, this, "words");
}
}
toggleInfo (ele) {
BDFDB.toggleClass(ele, BDFDB.disCN.categorywrappercollapsed);
BDFDB.toggleClass(ele, BDFDB.disCN.categorywrapperdefault);
var svg = ele.querySelector(BDFDB.dotCN.categoryicontransition);
BDFDB.toggleClass(svg, BDFDB.disCN.directionright);
BDFDB.toggleClass(svg, BDFDB.disCN.categoryiconcollapsed);
BDFDB.toggleClass(svg, BDFDB.disCN.categoryicondefault);
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
}
processChannelTextArea (instance, wrapper) {
if (instance.props && instance.props.type) {
var textarea = wrapper.querySelector("textarea");
if (!textarea) return;
var channel = BDFDB.getSelectedChannel();
if (!channel) return;
var settings = BDFDB.getAllData(this, "settings");
BDFDB.addEventListener(this, textarea, "input", () => {
if (this.format) {
this.format = false;
textarea.focus();
textarea.selectionStart = 0;
textarea.selectionEnd = textarea.value.length;
if (document.activeElement == textarea) {
var messageInput = this.formatText(textarea.value);
if (messageInput && messageInput.text != null) {
document.execCommand("insertText", false, messageInput.text ? messageInput.text + " " : "");
}
if (messageInput && messageInput.files.length > 0 && (channel.type == 1 || this.CurrentUserPerms.can(this.Permissions.ATTACH_FILES, channel))) {
this.UploadModule.instantBatchUpload(channel.id, messageInput.files);
}
}
}
});
BDFDB.addEventListener(this, textarea, "keydown", e => {
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
if (BDFDB.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteAliasesRow")) {
e.originalEvent.preventDefault();
e.originalEvent.stopPropagation();
this.swapWordWithAlias(textarea);
}
}
else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
let autocompleteitems = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable + ":not(.autocompleteAliasesSelector)");
let selected = autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected);
if (BDFDB.containsClass(selected, "autocompleteAliasesSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
e.originalEvent.preventDefault();
e.originalEvent.stopPropagation();
let next = this.getNextSelection(autocompletemenu, null, e.which == 38 ? false : true);
BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
BDFDB.addClass(next, BDFDB.disCN.autocompleteselected);
}
}
else if (textarea.value && !e.shiftKey && e.which == 13 && !autocompletemenu && textarea.value.indexOf("s/") != 0) {
this.format = true;
textarea.dispatchEvent(new Event("input"));
}
else if (!e.ctrlKey && e.which != 16 && settings.addAutoComplete && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) {
clearTimeout(textarea.ChatAliasAutocompleteTimeout);
textarea.ChatAliasAutocompleteTimeout = setTimeout(() => {this.addAutoCompleteMenu(textarea);},100);
}
if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
});
BDFDB.addEventListener(this, textarea, "click", e => {
if (settings.addAutoComplete && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) setImmediate(() => {this.addAutoCompleteMenu(textarea);});
});
}
}
addAutoCompleteMenu (textarea) {
if (textarea.parentElement.querySelector(".autocompleteAliasesRow")) return;
let words = textarea.value.split(/\s/);
let lastword = words[words.length-1].trim();
if (words.length == 1 && BDFDB.isPluginEnabled("WriteUpperCase")) {
let first = lastword.charAt(0);
if (first === first.toUpperCase() && lastword.toLowerCase().indexOf("http") == 0) {
lastword = lastword.charAt(0).toLowerCase() + lastword.slice(1);
}
else if (first === first.toLowerCase() && first !== first.toUpperCase() && lastword.toLowerCase().indexOf("http") != 0) {
lastword = lastword.charAt(0).toUpperCase() + lastword.slice(1);
}
}
if (lastword) {
let matchedaliases = {};
for (let word in this.aliases) {
let aliasdata = this.aliases[word];
if (!aliasdata.regex && aliasdata.autoc) {
if (aliasdata.exact) {
if (aliasdata.case && word.indexOf(lastword) == 0) matchedaliases[word] = aliasdata;
else if (!aliasdata.case && word.toLowerCase().indexOf(lastword.toLowerCase()) == 0) matchedaliases[word] = aliasdata;
}
else {
if (aliasdata.case && word.indexOf(lastword) > -1) matchedaliases[word] = aliasdata;
else if (!aliasdata.case && word.toLowerCase().indexOf(lastword.toLowerCase()) > -1) matchedaliases[word] = aliasdata;
}
}
}
if (!BDFDB.isObjectEmpty(matchedaliases)) {
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCNS.autocomplete + BDFDB.dotCN.autocompleteinner), amount = 15;
if (!autocompletemenu) {
autocompletemenu = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocomplete + BDFDB.disCN.autocomplete2} autocompleteAliases"><div class="${BDFDB.disCN.autocompleteinner}"></div></div>`);
textarea.parentElement.appendChild(autocompletemenu);
autocompletemenu = autocompletemenu.firstElementChild;
}
else {
amount -= autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable).length;
}
let autocompleterowheader = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteAliasesRow"><div class="${BDFDB.disCN.autocompleteselector} autocompleteAliasesSelector"><div class="${BDFDB.disCNS.autocompletecontenttitle + BDFDB.disCNS.small + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCN.weightsemibold}">Aliases: <strong class="lastword">${BDFDB.encodeToHTML(lastword)}</strong></div></div></div>`);
autocompletemenu.appendChild(autocompleterowheader);
BDFDB.addEventListener(this, autocompletemenu, "mouseenter", BDFDB.dotCN.autocompleteselectable, e => {
var selected = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselected);
BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
BDFDB.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
});
for (let word in matchedaliases) {
if (amount-- < 1) break;
let autocompleterow = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteAliasesRow"><div class="${BDFDB.disCNS.autocompleteselector + BDFDB.disCN.autocompleteselectable} autocompleteAliasesSelector"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletecontent}" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.flexchild} aliasword" style="flex: 1 1 auto;">${BDFDB.encodeToHTML(word)}</div><div class="${BDFDB.disCNS.autocompletedescription + BDFDB.disCN.flexchild}">${BDFDB.encodeToHTML(matchedaliases[word].replace)}</div></div></div></div>`);
autocompleterow.querySelector(BDFDB.dotCN.autocompleteselectable).addEventListener("click", () => {this.swapWordWithAlias(textarea);});
autocompletemenu.appendChild(autocompleterow);
}
if (!autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected)) {
BDFDB.addClass(autocompletemenu.querySelector(".autocompleteAliasesRow " + BDFDB.dotCN.autocompleteselectable), BDFDB.disCN.autocompleteselected);
}
}
}
}
getNextSelection (menu, selected, forward) {
selected = selected ? selected : menu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement;
let next, sibling = forward ? selected.nextElementSibling : selected.previousElementSibling;
if (sibling) {
next = sibling.querySelector(BDFDB.dotCN.autocompleteselectable);
}
else {
let items = menu.querySelectorAll(BDFDB.dotCN.autocompleteselectable);
next = forward ? items[0] : items[items.length-1];
}
return next ? next : this.getNextSelection(menu, sibling, forward);
}
swapWordWithAlias (textarea) {
let aliasword = textarea.parentElement.querySelector(".autocompleteAliasesRow " + BDFDB.dotCN.autocompleteselected + " .aliasword").innerText;
let lastword = textarea.parentElement.querySelector(".autocompleteAliasesRow .lastword").innerText;
if (aliasword && lastword) {
BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
textarea.focus();
textarea.selectionStart = textarea.value.length - lastword.length;
textarea.selectionEnd = textarea.value.length;
document.execCommand("insertText", false, aliasword);
textarea.selectionStart = textarea.value.length;
textarea.selectionEnd = textarea.value.length;
}
}
formatText (text) {
text = text.replace(/([\n\t\r])/g, " $1 ");
var newText = [], files = [], wordAliases = {}, multiAliases = {};
for (let word in this.aliases) {
if (!this.aliases[word].regex && word.indexOf(" ") == -1) wordAliases[word] = this.aliases[word];
else multiAliases[word] = this.aliases[word];
}
for (let word of text.trim().split(" ")) {
newText.push(this.useAliases(word, wordAliases, files, true));
}
newText = newText.length == 1 ? newText[0] : newText.join(" ");
newText = newText.replace(/ ([\n\t\r]) /g, "$1");
newText = this.useAliases(newText, multiAliases, files, false);
return {text:newText, files};
}
useAliases (string, aliases, files, singleword) {
for (let word in aliases) {
let aliasdata = aliases[word];
let escpAlias = aliasdata.regex ? word : BDFDB.regEscape(word);
let result = true, replaced = false, tempstring1 = string, tempstring2 = "";
let regstring = aliasdata.exact ? "^" + escpAlias + "$" : escpAlias;
while (result != null) {
result = new RegExp(regstring, (aliasdata.case ? "" : "i") + (aliasdata.exact ? "" : "g")).exec(tempstring1);
if (result) {
replaced = true;
let replace = aliasdata.file ? "" : BDFDB.insertNRST(aliasdata.replace);
if (result.length > 1) for (var i = 1; i < result.length; i++) replace = replace.replace(new RegExp("\\\\" + i + "|\\$" + i, "g"), result[i]);
tempstring2 += tempstring1.slice(0, result.index + result[0].length).replace(result[0], replace);
tempstring1 = tempstring1.slice(result.index + result[0].length);
if (aliasdata.file && typeof aliasdata.filedata == "string") {
var filedata = JSON.parse(aliasdata.filedata);
files.push(new File([Buffer.from(filedata.data, "base64")], filedata.name, {type:filedata.type}));
}
if (aliasdata.regex && regstring.indexOf("^") == 0) result = null;
}
if (!result) tempstring2 += tempstring1;
}
if (replaced) {
string = tempstring2;
if (singleword) break;
}
}
return string;
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">Replace:</h3><input action="add" type="text" placeholder="Wordvalue" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} wordInputs" id="input-wordvalue" style="flex: 1 1 auto;"><button action="add" type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} btn-add btn-addword" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}"></div></button></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">With:</h3><input action="add" type="text" placeholder="Replacevalue" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} wordInputs" id="input-replacevalue" style="flex: 1 1 auto;"><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} file-navigator" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}"></div><input id="input-file" type="file" style="display:none!important;"></button></div>`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto; max-width: ${560 - (this.configs.length * 33)}px;">List of Chataliases:</h3><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifycenter + BDFDB.disCNS.alignend + BDFDB.disCN.nowrap}" style="flex: 1 1 auto; max-width: ${this.configs.length * 34}px;">`;
for (let config of this.configs) {
settingshtml += `<div class="${BDFDB.disCNS.margintop8 + BDFDB.disCNS.tableheadersize + BDFDB.disCNS.size10 + BDFDB.disCNS.primary + BDFDB.disCN.weightbold}" style="flex: 1 1 auto; width: 34px !important; text-align: center;">${config.toUpperCase()}</div>`;
}
settingshtml += `</div></div><div class="DevilBro-settings-inner-list alias-list ${BDFDB.disCNS.gamesettings + BDFDB.disCN.marginbottom8}">`;
for (let word in this.aliases) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} word-name" value="${BDFDB.encodeToHTML(word)}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} replace-name" value="${BDFDB.encodeToHTML(this.aliases[word].replace)}">`;
for (let config of this.configs) {
settingshtml += `<div class="${BDFDB.disCNS.checkboxcontainer + BDFDB.disCN.marginreset}" style="flex: 0 0 auto;"><label class="${BDFDB.disCN.checkboxwrapper}"><input word="${word}" config="${config}" type="checkbox" class="${BDFDB.disCNS.checkboxinputdefault + BDFDB.disCN.checkboxinput}"${this.aliases[word][config] ? " checked" : ""}><div class="${BDFDB.disCNS.checkbox + BDFDB.disCNS.flexcenter + BDFDB.disCNS.flex + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.checkboxround}"><svg name="Checkmark" width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><polyline stroke="transparent" stroke-width="2" points="3.5 9.5 7 13 15 5"></polyline></g></svg></div></label></div>`;
}
settingshtml += `</div><div word="${word}" action="remove" class="${BDFDB.disCN.hovercardbutton} remove-word"></div></div>`;
}
settingshtml += `</div>`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Remove all added words.</h3><button action="removeall" type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} remove-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
var infoHidden = BDFDB.loadData("hideInfo", this, "hideInfo");
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.cursorpointer + (infoHidden ? BDFDB.disCN.categorywrappercollapsed : BDFDB.disCN.categorywrapperdefault)} toggle-info" style="flex: 1 1 auto;"><svg class="${BDFDB.disCNS.categoryicontransition + BDFDB.disCNS.directionright + (infoHidden ? BDFDB.disCN.categoryiconcollapsed : BDFDB.disCN.categoryicondefault)}" width="12" height="12" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 10L12 15 17 10"></path></svg><div class="${BDFDB.disCNS.categorycolortransition + BDFDB.disCNS.categoryoverflowellipsis + BDFDB.disCN.categorynamecollapsed}" style="flex: 1 1 auto;">Information</div></div>`;
settingshtml += `<div class="DevilBro-settings-inner-list info-container" ${infoHidden ? "style='display:none;'" : ""}><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Case: Will replace words while comparing lowercase/uppercase. apple => apple, not APPLE or AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Case: Will replace words while ignoring lowercase/uppercase. apple => apple, APPLE and AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Exact: Will replace words that are exactly the replaceword. apple to pear => applepie stays applepie</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Exact: Will replace words anywhere they appear. apple to pear => applepieapple to pearpiepear</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Autoc: Will appear in the Autocomplete Menu (if enabled).</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Regex: Will treat the entered wordvalue as a regular expression. <a class="${BDFDB.disCNS.anchor + BDFDB.disCN.anchorunderlineonhover}" target="_blank" href="https://regexr.com/">Help</a></div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">File: If the replacevalue is a filepath it will try to upload the file located at the filepath.</div></div>`;
settingshtml += `</div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "keypress", ".wordInputs", e => {if (e.which == 13) this.updateContainer(settingspanel, e.currentTarget);});
BDFDB.addEventListener(this, settingspanel, "keyup", BDFDB.dotCN.gamenameinput, e => {this.updateWord(e.currentTarget);});
BDFDB.addEventListener(this, settingspanel, "click", ".btn-addword, .remove-word, .remove-all", e => {this.updateContainer(settingspanel, e.currentTarget);});
BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.checkboxinput, e => {this.updateConfig(e.currentTarget);});
BDFDB.addEventListener(this, settingspanel, "click", ".toggle-info", e => {this.toggleInfo(e.currentTarget);});
return settingspanel;
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
BDFDB.WebModules.forceAllUpdates(this);
}
}
}
};

View File

@ -1,6 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Chat Filter - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ChatFilter/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ChatFilter/config.json)
Allows the user to censor words or block complete messages based on words in the chatwindow. Blocked in this case means, that a message that contains one of the words will be completely blocked in your chat window. Censored means you will still be able to read the message but the censored words will be unreadable. You can also completely hide blocked messages and enable the option to see the original message while hovering over a censored/blocked message.
Supports Regular Expressions.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "ChatFilter",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Allows the user to censor words or block complete messages based on words in the chatwindow. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,368 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"Message":["componentDidMount","componentDidUpdate"]
};
this.configs = ["empty","case","exact"];
this.css = `
${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messageaccessory}.blocked:not(.revealed),
${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messagemarkup}.blocked:not(.revealed) {
font-weight: bold;
font-style: italic;
}`;
this.defaults = {
replaces: {
blocked: {value:"~~BLOCKED~~", title:"Block:", description:"Default Replace Word for blocked Messages:"},
censored: {value:"$!%&%!&", title:"Censor:", description:"Default Replace Word for censored Messages:"}
},
settings: {
showMessageOnClick: {value:{blocked:true, censored:true}, enabled:{blocked:true, censored:true}, description:"Show original Message on Click:"},
hideMessage: {value:{blocked:false, censored:false}, enabled:{blocked:true, censored:false}, description:"Completely hide targeted Messages:"}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
document.querySelectorAll(`${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored, ${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored`).forEach(message => {this.resetMessage(message);});
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
updateContainer (settingspanel, ele) {
var wordvalue = null, replacevalue = null, action = ele.getAttribute("action"), rtype = ele.getAttribute("rtype"), words = BDFDB.loadData(rtype, this, "words") || {};
var update = () => {
BDFDB.saveData(rtype, words, this, "words");
var containerhtml = ``;
for (let word in words) {
containerhtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis}" style="flex: 1 1 auto;">${BDFDB.encodeToHTML(word)} (${BDFDB.encodeToHTML(words[word].replace)})</div>`
for (let config of this.configs) {
containerhtml += `<div class="${BDFDB.disCNS.checkboxcontainer + BDFDB.disCN.marginreset}" style="flex: 0 0 auto;"><label class="${BDFDB.disCN.checkboxwrapper}"><input word="${word}" rtype="${rtype}" config="${config}" type="checkbox" class="${BDFDB.disCNS.checkboxinputdefault + BDFDB.disCN.checkboxinput}"${words[word][config] ? " checked" : ""}><div class="${BDFDB.disCNS.checkbox + BDFDB.disCNS.flexcenter + BDFDB.disCNS.flex + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.checkboxround}"><svg name="Checkmark" width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><polyline stroke="transparent" stroke-width="2" points="3.5 9.5 7 13 15 5"></polyline></g></svg></div></label></div>`;
}
containerhtml += `</div><div word="${word}" rtype="${rtype}" action="remove" class="${BDFDB.disCN.hovercardbutton} remove-word"></div></div>`;
}
containerhtml += `</div>`;
settingspanel.querySelector("." + rtype + "-list").innerHTML = containerhtml;
BDFDB.initElements(settingspanel, this);
this.SettingsUpdated = true;
};
if (action == "add") {
var wordinput = settingspanel.querySelector("#input-" + rtype + "-wordvalue");
var replaceinput = settingspanel.querySelector("#input-" + rtype + "-replacevalue");
wordvalue = wordinput.value;
replacevalue = replaceinput.value;
if (wordvalue && wordvalue.trim().length > 0) {
wordvalue = wordvalue.trim();
replacevalue = replacevalue.trim();
words[wordvalue] = {
replace: replacevalue,
empty: false,
case: false,
exact: true,
regex: false
};
wordinput.value = null;
replaceinput.value = null;
update();
}
}
else if (action == "remove") {
wordvalue = ele.getAttribute("word");
if (wordvalue) {
delete words[wordvalue];
update();
}
}
else if (action == "removeall") {
BDFDB.openConfirmModal(this, "Are you sure you want to remove all added Words from your list?", () => {
words = {};
update();
});
}
}
saveReplace (input) {
var rtype = input.getAttribute("rtype");
var wordvalue = input.value;
if (rtype) {
var replaces = BDFDB.getData(rtype, this, "replaces");
BDFDB.saveData(rtype, wordvalue.trim(), this, "replaces");
}
}
updateConfig (ele) {
var wordvalue = ele.getAttribute("word");
var config = ele.getAttribute("config");
var rtype = ele.getAttribute("rtype");
var words = BDFDB.loadData(rtype, this, "words") || {};
if (wordvalue && words[wordvalue] && config) {
words[wordvalue][config] = ele.checked;
BDFDB.saveData(rtype, words, this, "words");
}
}
toggleInfo (ele) {
BDFDB.toggleClass(ele, BDFDB.disCN.categorywrappercollapsed);
BDFDB.toggleClass(ele, BDFDB.disCN.categorywrapperdefault);
var svg = ele.querySelector(BDFDB.dotCN.categoryicontransition);
BDFDB.toggleClass(svg, BDFDB.disCN.directionright);
BDFDB.toggleClass(svg, BDFDB.disCN.categoryiconcollapsed);
BDFDB.toggleClass(svg, BDFDB.disCN.categoryicondefault);
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
}
processMessage (instance, wrapper) {
wrapper.querySelectorAll(`${BDFDB.dotCNC.messagemarkup + BDFDB.dotCN.messageaccessory}`).forEach(message => {this.hideMessage(message);});
}
hideMessage (message) {
if (message.tagName && !BDFDB.containsClass(message, "blocked", "censored", false)) {
var orightml = message.innerHTML;
var newhtml = "";
if (orightml) {
var blocked = null;
var strings = [];
var count = 0;
orightml.split("").forEach((chara) => {
if (chara == "<") {
if (strings[count]) count++;
}
strings[count] = strings[count] ? strings[count] + chara : chara;
if (chara == ">") {
count++;
}
});
var settings = BDFDB.getAllData(this, "settings");
var replaces = BDFDB.getAllData(this, "replaces");
var blockedWords = BDFDB.loadData("blocked", this, "words");
var blocked = false;
for (let bWord in blockedWords) {
var blockedReplace = blockedWords[bWord].empty ? "" : (blockedWords[bWord].replace || replaces.blocked);
var reg = this.createReg(bWord, blockedWords[bWord]);
strings.forEach(string => {
if (this.testForEmoji(string, reg)) blocked = true;
else if (string.indexOf('<img src="http') == 0) {
var url = string.split('src="').length > 0 ? string.split('src="')[1] : null;
url = url ? url.split('"')[0] : null;
if (reg.test(url)) blocked = true;
}
else if (string.indexOf("<") != 0) {
string.replace(/\n/g, " \n ").split(" ").forEach((word) => {
let wordWithoutSpecial = word.replace(/[\?\¿\!\¡\.\"]/g, "");
if (word && reg.test(word) || wordWithoutSpecial && reg.test(wordWithoutSpecial)) blocked = true;
});
}
});
if (blocked) break;
}
if (blocked) {
if (settings.hideMessage.blocked) BDFDB.toggleEles(message, false);
newhtml = BDFDB.encodeToHTML(blockedReplace);
message.innerHTML = newhtml;
BDFDB.addClass(message, "blocked");
message.ChatFilterOriginalHTML = orightml;
message.ChatFilterNewHTML = newhtml;
this.addClickListener(message, settings.showMessageOnClick.blocked);
}
else {
var censoredWords = BDFDB.loadData("censored", this, "words");
var censored = false;
for (let cWord in censoredWords) {
var censoredReplace = censoredWords[cWord].empty ? "" : (censoredWords[cWord].replace || replaces.censored);
var reg = this.createReg(cWord, censoredWords[cWord]);
strings.forEach((string,i) => {
if (this.testForEmoji(string, reg)) {
censored = true;
strings[i] = BDFDB.encodeToHTML(censoredReplace);
if (strings[i+1] && strings[i+1].indexOf("<input") == 0) {
strings[i+1] = "";
if (strings[i-1] && strings[i-1].indexOf("<span") == 0) strings[i-1] = "";
if (strings[i+2] && strings[i+2].indexOf("</span") == 0) strings[i+2] = "";
}
}
else if (string.indexOf('<img src="http') == 0) {
var url = string.split('src="').length > 0 ? string.split('src="')[1] : null;
url = url ? url.split('"')[0] : null;
if (reg.test(url)) {
censored = true;
strings = [BDFDB.encodeToHTML(censoredReplace)];
}
}
else if (string.indexOf("<") != 0) {
var newstring = [];
string.replace(/\n/g, " \n ").split(" ").forEach((word) => {
let wordWithoutSpecial = word.replace(/[\?\¿\!\¡\.\"]/g, "");
if (word && reg.test(word) || wordWithoutSpecial && reg.test(wordWithoutSpecial)) {
censored = true;
newstring.push(BDFDB.encodeToHTML(censoredReplace));
}
else {
newstring.push(word);
}
});
strings[i] = newstring.join(" ").replace(/ \n /g, "\n");
}
});
}
if (censored) {
newhtml = strings.join("");
message.innerHTML = newhtml;
BDFDB.addClass(message, "censored");
message.ChatFilterOriginalHTML = orightml;
message.ChatFilterNewHTML = newhtml;
this.addClickListener(message, settings.showMessageOnClick.censored);
}
}
}
}
}
createReg (word, config) {
return new RegExp(BDFDB.encodeToHTML(config.exact ? "^" + BDFDB.regEscape(word) + "$" : BDFDB.regEscape(word)), config.case ? "" : "i");
}
testForEmoji (string, reg) {
if (string.indexOf("<img ") == 0 && (string.indexOf('class="emote') > -1 || string.indexOf('class="emoji') > -1)) {
var emojiname = string.split('alt="').length > 0 ? string.split('alt="')[1].split('"')[0] : null;
return emojiname = !emojiname ? false : (reg.test(emojiname) || reg.test(emojiname.replace(/:/g, "")));
}
return false;
}
resetMessage (message) {
message.innerHTML = message.ChatFilterOriginalHTML;
BDFDB.removeClass(message, "blocked", "censored", "revealed");
BDFDB.toggleEles(message, true);
delete message.ChatFilterOriginalHTML;
delete message.ChatFilterNewHTML;
message.removeEventListener("click", message.clickChatFilterListener);
}
addClickListener (message, addListener) {
message.removeEventListener("click", message.clickChatFilterListener);
if (addListener) {
message.clickChatFilterListener = () => {
if (BDFDB.containsClass(message, "revealed")) {
BDFDB.removeClass(message, "revealed");
message.innerHTML = message.ChatFilterNewHTML;
}
else {
BDFDB.addClass(message, "revealed");
message.innerHTML = message.ChatFilterOriginalHTML;
}
};
message.addEventListener("click", message.clickChatFilterListener);
}
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var replaces = BDFDB.getAllData(this, "replaces");
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let rtype in replaces) {
var words = BDFDB.loadData(rtype, this, "words");
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto; min-width:55px;">${this.defaults.replaces[rtype].title}</h3><input rtype="${rtype}" action="add" type="text" placeholder="Wordvalue" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} wordInputs" id="input-${rtype}-wordvalue" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">With:</h3><input rtype="${rtype}" action="add" type="text" placeholder="Replacevalue" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} wordInputs" id="input-${rtype}-replacevalue" style="flex: 1 1 auto;"><button rtype="${rtype}" action="add" type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} btn-add btn-addword" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}"></div></button></div>`;
for (let key in settings) {
if (this.defaults.settings[key].enabled[rtype]) settingshtml += `<div value="${key}" class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key} ${rtype}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key][rtype] ? " checked" : ""}></div></div>`;
}
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto; min-width: 320px;">${this.defaults.replaces[rtype].description}</h3><input rtype="${rtype}" type="text" placeholder="${this.defaults.replaces[rtype].value}" value="${replaces[rtype]}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} defaultInputs" id="input-${rtype}-defaultvalue" style="flex: 1 1 auto;"></div>`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto; max-width: ${560 - (this.configs.length * 33)}px;">List of ${rtype} Words:</h3><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifycenter + BDFDB.disCNS.alignend + BDFDB.disCN.nowrap}" style="flex: 1 1 auto; max-width: ${this.configs.length * 34}px;">`;
for (let config of this.configs) {
settingshtml += `<div class="${BDFDB.disCNS.margintop8 + BDFDB.disCNS.tableheadersize + BDFDB.disCNS.size10 + BDFDB.disCNS.primary + BDFDB.disCN.weightbold}" style="flex: 1 1 auto; width: 34px !important; text-align: center;">${config.toUpperCase()}</div>`;
}
settingshtml += `</div></div><div class="DevilBro-settings-inner-list ${rtype}-list">`;
for (let word in words) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis}" style="flex: 1 1 auto;">${BDFDB.encodeToHTML(word)} (${BDFDB.encodeToHTML(words[word].replace)})</div>`
for (let config of this.configs) {
settingshtml += `<div class="${BDFDB.disCNS.checkboxcontainer + BDFDB.disCN.marginreset}" style="flex: 0 0 auto;"><label class="${BDFDB.disCN.checkboxwrapper}"><input word="${word}" rtype="${rtype}" config="${config}" type="checkbox" class="${BDFDB.disCNS.checkboxinputdefault + BDFDB.disCN.checkboxinput}"${words[word][config] ? " checked" : ""}><div class="${BDFDB.disCNS.checkbox + BDFDB.disCNS.flexcenter + BDFDB.disCNS.flex + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.checkboxround}"><svg name="Checkmark" width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><polyline stroke="transparent" stroke-width="2" points="3.5 9.5 7 13 15 5"></polyline></g></svg></div></label></div>`;
}
settingshtml += `</div><div word="${word}" rtype="${rtype}" action="remove" class="${BDFDB.disCN.hovercardbutton} remove-word"></div></div>`;
}
settingshtml += `</div>`
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Remove all added words.</h3><button rtype="${rtype}" action="removeall" type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} remove-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
settingshtml += `<div class="${BDFDB.disCNS.modaldivider + BDFDB.disCNS.modaldividerdefault + BDFDB.disCN.marginbottom40}"></div>`;
}
var infoHidden = BDFDB.loadData("hideInfo", this, "hideInfo");
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.cursorpointer + (infoHidden ? BDFDB.disCN.categorywrappercollapsed : BDFDB.disCN.categorywrapperdefault)} toggle-info" style="flex: 1 1 auto;"><svg class="${BDFDB.disCNS.categoryicontransition + BDFDB.disCNS.directionright + (infoHidden ? BDFDB.disCN.categoryiconcollapsed : BDFDB.disCN.categoryicondefault)}" width="12" height="12" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 10L12 15 17 10"></path></svg><div class="${BDFDB.disCNS.categorycolortransition + BDFDB.disCNS.categoryoverflowellipsis + BDFDB.disCN.categorynamecollapsed}" style="flex: 1 1 auto;">Information</div></div>`;
settingshtml += `<div class="DevilBro-settings-inner-list info-container" ${infoHidden ? "style='display:none;'" : ""}><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Case: Will block/censor words while comparing lowercase/uppercase. apple => apple, not APPLE or AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Case: Will block/censor words while ignoring lowercase/uppercase. apple => apple, APPLE and AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Exact: Will block/censor words that are exactly the selected word. apple => apple, not applepie or pineapple</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Exact: Will block/censor all words containing the selected word. apple => apple, applepie and pineapple</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Empty: Ignores the default and set replace word and removes the word/message instead.</div></div>`;
settingshtml += `</div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "keypress", ".wordInputs", e => {if (e.which == 13) this.updateContainer(settingspanel, e.currentTarget);});
BDFDB.addEventListener(this, settingspanel, "keyup", ".defaultInputs", e => {this.saveReplace(e.currentTarget);});
BDFDB.addEventListener(this, settingspanel, "click", ".btn-addword, .remove-word, .remove-all", e => {this.updateContainer(settingspanel, e.currentTarget);});
BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.checkboxinput, e => {this.updateConfig(e.currentTarget);});
BDFDB.addEventListener(this, settingspanel, "click", ".toggle-info", e => {this.toggleInfo(e.currentTarget);});
return settingspanel;
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
document.querySelectorAll(`${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored, ${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored`).forEach(message => {this.resetMessage(message);});
BDFDB.WebModules.forceAllUpdates(this);
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Complete Timestamp - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/CompleteTimestamps/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/CompleteTimestamps/config.json)
Replace all timestamps with complete timestamps.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "CompleteTimestamps",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Replace all timestamps with complete timestamps. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,334 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"MessageGroup":["componentDidMount","componentDidUpdate"]
};
this.languages;
this.defaults = {
settings: {
showInChat: {value:true, description:"Replace Chat Timestamp with Complete Timestamp:"},
showOnHover: {value:false, description:"Also show Timestamp when you hover over a message:"},
changeForEdit: {value:false, description:"Change the Time for the Edited Time Tooltips:"},
displayTime: {value:true, description:"Display the Time in the Timestamp:"},
displayDate: {value:true, description:"Display the Date in the Timestamp:"},
cutSeconds: {value:false, description:"Cut off Seconds of the Time:"},
forceZeros: {value:false, description:"Force leading Zeros:"},
otherOrder: {value:false, description:"Show the Time before the Date:"}
},
choices: {
creationDateLang: {value:"$discord", description:"Timestamp Format:"}
},
formats: {
ownFormat: {value:"$hour:$minute:$second, $day.$month.$year", description:"Own Format:"}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}},BDFDB.languages);
BDFDB.addEventListener(this, document, "mouseenter", BDFDB.dotCNS.message + BDFDB.dotCN.messagecontent, e => {
if (BDFDB.getData("showOnHover", this, "settings")) {
let message = e.currentTarget;
let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, message);
if (!messagegroup || !messagegroup.tagName) return;
let info = this.getMessageData(message, messagegroup);
if (!info || !info.timestamp || !info.timestamp._i) return;
let choice = BDFDB.getData("creationDateLang", this, "choices");
BDFDB.createTooltip(this.getTimestamp(this.languages[choice].id, info.timestamp._i), message, {type:"left",selector:"completetimestamp-tooltip"});
}
});
BDFDB.addEventListener(this, document, "mouseenter", BDFDB.dotCNS.message + BDFDB.dotCN.messageedited, e => {
if (BDFDB.getData("changeForEdit", this, "settings")) {
let marker = e.currentTarget;
let time = marker.getAttribute("datetime");
if (!time) return;
let choice = BDFDB.getData("creationDateLang", this, "choices");
let customTooltipCSS = `
body ${BDFDB.dotCN.tooltip}:not(.completetimestampedit-tooltip) {
display: none !important;
}`;
BDFDB.createTooltip(this.getTimestamp(this.languages[choice].id, time), marker, {type:"top",selector:"completetimestampedit-tooltip",css:customTooltipCSS});
}
});
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".complete-timestamp-divider");
BDFDB.removeClasses("complete-timestamp");
BDFDB.removeLocalStyle(this.name + "CompactCorrection");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
saveInputs (settingspanel) {
let formats = {};
for (let input of settingspanel.querySelectorAll(BDFDB.dotCN.input)) {
formats[input.getAttribute("option")] = input.value;
}
BDFDB.saveAllData(formats, this, "formats");
this.updateSettingsPanel(settingspanel);
}
updateSettingsPanel (settingspanel) {
let choices = BDFDB.getAllData(this, "choices");
for (let key in choices) {
settingspanel.querySelector(`${BDFDB.dotCN.select}[option='${key}'] .languageTimestamp`).innerText = this.getTimestamp(this.languages[choices[key]].id);
}
this.SettingsUpdated = true;
}
toggleInfo (ele) {
BDFDB.toggleClass(ele, BDFDB.disCN.categorywrappercollapsed);
BDFDB.toggleClass(ele, BDFDB.disCN.categorywrapperdefault);
var svg = ele.querySelector(BDFDB.dotCN.categoryicontransition);
BDFDB.toggleClass(svg, BDFDB.disCN.directionright);
BDFDB.toggleClass(svg, BDFDB.disCN.categoryiconcollapsed);
BDFDB.toggleClass(svg, BDFDB.disCN.categoryicondefault);
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
}
openDropdownMenu (e) {
let selectControl = e.currentTarget;
let selectWrap = selectControl.parentElement;
let plugincard = BDFDB.getParentEle("li", selectWrap);
if (!plugincard || BDFDB.containsClass(selectWrap, BDFDB.disCN.selectisopen)) return;
BDFDB.addClass(selectWrap, BDFDB.disCN.selectisopen);
plugincard.style.setProperty("overflow", "visible", "important");
let selectMenu = this.createDropdownMenu(selectWrap.getAttribute("value"));
selectWrap.appendChild(selectMenu);
BDFDB.addChildEventListener(selectMenu, "mousedown", BDFDB.dotCN.selectoption, e2 => {
let language = e2.currentTarget.getAttribute("value");
selectWrap.setAttribute("value", language);
selectControl.querySelector(".languageName").innerText = this.languages[language].name;
selectControl.querySelector(".languageTimestamp").innerText = this.getTimestamp(this.languages[language].id);
BDFDB.saveData(selectWrap.getAttribute("option"), language, this, "choices");
});
var removeMenu = e2 => {
if (e2.target.parentElement != selectMenu) {
document.removeEventListener("mousedown", removeMenu);
selectMenu.remove();
plugincard.style.removeProperty("overflow");
setTimeout(() => {BDFDB.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
}
};
document.addEventListener("mousedown", removeMenu);
}
createDropdownMenu (choice) {
let menuhtml = `<div class="${BDFDB.disCN.selectmenuouter}"><div class="${BDFDB.disCN.selectmenu}">`;
for (let key in this.languages) {
let isSelected = key == choice ? ` ${BDFDB.disCN.selectselected}` : ``;
menuhtml += `<div value="${key}" class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectoption + isSelected}" style="flex: 1 1 auto; display:flex;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}" style="flex: 1 1 42%;">${this.languages[key].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}" style="flex: 1 1 58%;">${this.getTimestamp(this.languages[key].id)}</div></div>`
}
menuhtml += `</div></div>`;
return BDFDB.htmlToElement(menuhtml);
}
processMessageGroup (instance, wrapper) {
if (BDFDB.getData("showInChat", this, "settings")) for (let stamp of wrapper.querySelectorAll("time[datetime]")) this.changeTimestamp(stamp);
}
changeTimestamp (stamp) {
if (!stamp.className || stamp.className.toLowerCase().indexOf("timestamp") == -1 || BDFDB.containsClass(stamp, "complete-timestamp")) return;
let time = stamp.getAttribute("datetime");
if (time) {
this.setMaxWidth();
BDFDB.addClass(stamp, "complete-timestamp");
let stampdivider = document.createElement("span");
stampdivider.className = "complete-timestamp-divider arabic-fix";
stampdivider.style.setProperty("display", "inline", "important");
stampdivider.style.setProperty("height", "0px", "important");
stampdivider.style.setProperty("width", "0px", "important");
stampdivider.style.setProperty("font-size", "0px", "important");
stampdivider.innerText = "ARABIC FIX";
stamp.parentElement.insertBefore(stampdivider, stamp);
BDFDB.setInnerText(stamp, this.getTimestamp(this.languages[BDFDB.getData("creationDateLang", this, "choices")].id, time));
}
}
getMessageData (div, messagegroup) {
let pos = Array.from(messagegroup.querySelectorAll("." + div.className.replace(/ /g, "."))).indexOf(div);
let instance = BDFDB.getReactInstance(messagegroup);
if (!instance) return;
let info = instance.return.stateNode.props.messages;
return info && pos > -1 ? info[pos] : null;
}
getTimestamp (languageid, time) {
let timeobj = time ? time : new Date();
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.getAllData(this, "settings"), timestring = "";
if (languageid != "own") {
let timestamp = [];
if (settings.displayDate) timestamp.push(timeobj.toLocaleDateString(languageid));
if (settings.displayTime) timestamp.push(settings.cutSeconds ? this.cutOffSeconds(timeobj.toLocaleTimeString(languageid)) : timeobj.toLocaleTimeString(languageid));
if (settings.otherOrder) timestamp.reverse();
timestring = timestamp.length > 1 ? timestamp.join(", ") : (timestamp.length > 0 ? timestamp[0] : "");
if (timestring && settings.forceZeros) timestring = this.addLeadingZeros(timestring);
}
else {
let ownformat = BDFDB.getData("ownFormat", this, "formats");
languageid = BDFDB.getDiscordLanguage().id;
let hour = timeobj.getHours(), minute = timeobj.getMinutes(), second = timeobj.getSeconds(), msecond = timeobj.getMilliseconds(), day = timeobj.getDate(), month = timeobj.getMonth()+1, timemode = "";
if (ownformat.indexOf("$timemode") > -1) {
timemode = hour >= 12 ? "PM" : "AM";
hour = hour % 12;
hour = hour ? hour : 12;
}
timestring = ownformat
.replace("$hour", settings.forceZeros && hour < 10 ? "0" + hour : hour)
.replace("$minute", minute < 10 ? "0" + minute : minute)
.replace("$second", second < 10 ? "0" + second : second)
.replace("$msecond", msecond)
.replace("$timemode", timemode)
.replace("$weekdayL", timeobj.toLocaleDateString(languageid,{weekday: "long"}))
.replace("$weekdayS", timeobj.toLocaleDateString(languageid,{weekday: "short"}))
.replace("$monthnameL", timeobj.toLocaleDateString(languageid,{month: "long"}))
.replace("$monthnameS", timeobj.toLocaleDateString(languageid,{month: "short"}))
.replace("$day", settings.forceZeros && day < 10 ? "0" + day : day)
.replace("$month", settings.forceZeros && month < 10 ? "0" + month : month)
.replace("$year", timeobj.getFullYear());
}
return timestring;
}
cutOffSeconds (timestring) {
return timestring.replace(/(.*):(.*):(.{2})(.*)/, "$1:$2$4");
}
addLeadingZeros (timestring) {
let chararray = timestring.split("");
let numreg = /[0-9]/;
for (let i = 0; i < chararray.length; i++) {
if (!numreg.test(chararray[i-1]) && numreg.test(chararray[i]) && !numreg.test(chararray[i+1])) chararray[i] = "0" + chararray[i];
}
return chararray.join("");
}
setMaxWidth () {
if (this.currentMode != BDFDB.getDiscordMode()) {
this.currentMode = BDFDB.getDiscordMode();
let timestamp = document.querySelector(BDFDB.dotCN.messagetimestampcompact);
if (timestamp) {
let choice = BDFDB.getData("creationDateLang", this, "choices");
let testtimestamp = BDFDB.htmlToElement(`<time class="${timestamp.className}" style="width: auto !important;">${this.getTimestamp(this.languages[choice].id, new Date(253402124399995))}</time>`);
document.body.appendChild(testtimestamp);
let width = BDFDB.getRects(testtimestamp).width + 5;
testtimestamp.remove();
BDFDB.appendLocalStyle(this.name + "CompactCorrection", `
${BDFDB.dotCN.messagetimestampcompact} {
width: ${width}px !important;
}
${BDFDB.dotCN.messagetimestampcompactismentioned} {
width: ${width + 2}px !important;
}
${BDFDB.dotCN.messagemarkupiscompact} {
margin-left: ${width}px !important;
text-indent: -${width}px !important;
}
${BDFDB.dotCN.messageaccessorycompact} {
padding-left: ${width}px !important;
}
`);
}
else BDFDB.removeLocalStyle(this.name + "CompactCorrection");
}
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let choices = BDFDB.getAllData(this, "choices");
let formats = BDFDB.getAllData(this, "formats");
let settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
for (let key in choices) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCN.flexchild}" style="flex: 0 0 30%;">${this.defaults.choices[key].description}</h3><div class="${BDFDB.disCN.selectwrap}" style="flex: 1 1 70%;"><div class="${BDFDB.disCNS.select + BDFDB.disCNS.selectsingle + BDFDB.disCN.selecthasvalue}" option="${key}" value="${choices[key]}"><div class="${BDFDB.disCN.selectcontrol}"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectvalue}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal} languageName" style="flex: 1 1 42%; padding:0;">${this.languages[choices[key]].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal} languageTimestamp" style="flex: 1 1 58%; padding:0;">${this.getTimestamp(this.languages[choices[key]].id)}</div></div><span class="${BDFDB.disCN.selectarrowzone}"><span class="${BDFDB.disCN.selectarrow}"></span></span></div></div></div></div>`;
}
for (let key in formats) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCN.flexchild}" style="flex: 0 0 30%;">${this.defaults.formats[key].description}</h3><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCN.directioncolumn}" style="flex: 1 1 auto;"><input type="text" option="${key}" value="${formats[key]}" placeholder="${this.defaults.formats[key].value}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16}"></div></div>`;
}
let infoHidden = BDFDB.loadData("hideInfo", this, "hideInfo");
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.cursorpointer + (infoHidden ? BDFDB.disCN.categorywrappercollapsed : BDFDB.disCN.categorywrapperdefault)} toggle-info" style="flex: 1 1 auto;"><svg class="${BDFDB.disCNS.categoryicontransition + BDFDB.disCNS.directionright + (infoHidden ? BDFDB.disCN.categoryiconcollapsed : BDFDB.disCN.categoryicondefault)}" width="12" height="12" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 10L12 15 17 10"></path></svg><div class="${BDFDB.disCNS.categorycolortransition + BDFDB.disCNS.categoryoverflowellipsis + BDFDB.disCN.categorynamecollapsed}" style="flex: 1 1 auto;">Information</div></div>`;
settingshtml += `<div class="DevilBro-settings-inner-list info-container" ${infoHidden ? "style='display:none;'" : ""}>`;
settingshtml += `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$hour will be replaced with the current hour</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$minute will be replaced with the current minutes</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$second will be replaced with the current seconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$msecond will be replaced with the current milliseconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$timemode will change $hour to a 12h format and will be replaced with AM/PM</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$year will be replaced with the current year</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$month will be replaced with the current month</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$day will be replaced with the current day</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameL will be replaced with the monthname in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameS will be replaced with the monthname in short format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayL will be replaced with the weekday in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayS will be replaced with the weekday in short format based on the Discord Language</div>`;
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "click", ".settings-switch", () => {this.updateSettingsPanel(settingspanel);});
BDFDB.addEventListener(this, settingspanel, "keyup", BDFDB.dotCN.input, () => {this.saveInputs(settingspanel);});
BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {this.openDropdownMenu(e);});
BDFDB.addEventListener(this, settingspanel, "click", ".toggle-info", e => {this.toggleInfo(e.currentTarget);});
return settingspanel;
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
BDFDB.WebModules.forceAllUpdates(this);
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Creation Date - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/CreationDate/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/CreationDate/config.json)
Displays the Creation Date of an Account in the UserPopout and UserModal.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "CreationDate",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Displays the Creation Date of an Account in the UserPopout and UserModal. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,299 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.labels = {};
this.patchModules = {
"UserPopout":"componentDidMount",
"UserProfile":"componentDidMount"
};
this.languages;
this.css = `
${BDFDB.dotCNS.userpopout + BDFDB.dotCN.nametag} {
margin-bottom: 4px;
}
${BDFDB.dotCN.userprofile} .creationDate {
margin-right: 20px;
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.userpopoutheadernormal} .creationDate {
color: #b9bbbe;
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.userpopoutheader + BDFDB.notCN.userpopoutheadernormal} .creationDate,
${BDFDB.dotCNS.themedark + BDFDB.dotCN.userpopoutheader} .creationDate {
color: hsla(0,0%,100%,.6);
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.userprofiletopsectionnormal} .creationDate {
color: hsla(216,4%,74%,.6);
}
${BDFDB.dotCN.themelight} [class*='topSection']${BDFDB.notCN.userprofiletopsectionnormal} .creationDate,
${BDFDB.dotCN.themedark} [class*='topSection'] .creationDate {
color: hsla(0,0%,100%,.6);
}`;
this.defaults = {
settings: {
addInUserPopout: {value:true, description:"Add in User Popouts:"},
addInUserProfil: {value:true, description:"Add in User Profil Modal:"},
addCreationTime: {value:true, description:"Display the Time of Creation:"},
forceZeros: {value:false, description:"Force leading Zeros:"}
},
choices: {
creationDateLang: {value:"$discord", description:"Creation Date Format:"}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.languages = Object.assign({},BDFDB.languages);
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".creationDate");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
openDropdownMenu (e) {
let selectControl = e.currentTarget;
let selectWrap = selectControl.parentElement;
let plugincard = BDFDB.getParentEle("li", selectWrap);
if (!plugincard || BDFDB.containsClass(selectWrap, BDFDB.disCN.selectisopen)) return;
BDFDB.addClass(selectWrap, BDFDB.disCN.selectisopen);
plugincard.style.setProperty("overflow", "visible", "important");
let type = selectWrap.getAttribute("type");
let selectMenu = this.createDropdownMenu(selectWrap.getAttribute("value"));
selectWrap.appendChild(selectMenu);
BDFDB.addChildEventListener(selectMenu, "mousedown", BDFDB.dotCN.selectoption, e2 => {
let language = e2.currentTarget.getAttribute("value");
selectWrap.setAttribute("value", language);
selectControl.querySelector(".languageName").innerText = this.languages[language].name;
selectControl.querySelector(".languageTimestamp").innerText = this.getCreationTime(language);
BDFDB.saveData(type, language, this, "choices");
});
var removeMenu = e2 => {
if (e2.target.parentElement != selectMenu) {
document.removeEventListener("mousedown", removeMenu);
selectMenu.remove();
plugincard.style.removeProperty("overflow");
setTimeout(() => {BDFDB.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
}
};
document.addEventListener("mousedown", removeMenu);
}
createDropdownMenu (choice) {
let menuhtml = `<div class="${BDFDB.disCN.selectmenuouter}"><div class="${BDFDB.disCN.selectmenu}">`;
for (let key in this.languages) {
let isSelected = key == choice ? ` ${BDFDB.disCN.selectselected}` : ``;
menuhtml += `<div value="${key}" class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectoption + isSelected}" style="flex: 1 1 auto; display:flex;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}" style="flex: 1 1 42%;">${this.languages[key].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}" style="flex: 1 1 58%;">${this.getCreationTime(this.languages[key].id)}</div></div>`
}
menuhtml += `</div></div>`;
return BDFDB.htmlToElement(menuhtml);
}
processUserPopout (instance, wrapper) {
if (instance.props && instance.props.user && BDFDB.getData("addInUserPopout", this, "settings")) {
this.addCreationDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), wrapper.parentElement);
}
}
processUserProfile (instance, wrapper) {
if (instance.props && instance.props.user && BDFDB.getData("addInUserProfil", this, "settings")) {
this.addCreationDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userprofileheaderinfo), null);
}
}
addCreationDate (info, container, popout) {
if (!info || !container || container.querySelector(".creationDate")) return;
let choice = BDFDB.getData("creationDateLang", this, "choices");
let nametag = container.querySelector(BDFDB.dotCN.nametag);
let joinedAtDate = container.querySelector(".joinedAtDate");
container.insertBefore(BDFDB.htmlToElement(`<div class="creationDate DevilBro-textscrollwrapper ${BDFDB.disCN.textrow}" style="max-width: ${BDFDB.getRects(BDFDB.getParentEle(popout ? BDFDB.dotCN.userpopoutheader : BDFDB.dotCN.userprofileheaderinfo, container)).width - 20}px !important;"><div class="DevilBro-textscroll">${this.labels.createdat_text + " " + this.getCreationTime(this.languages[choice].id, info.createdAt)}</div></div>`), joinedAtDate ? joinedAtDate.nextSibling : (nametag ? nametag.nextSibling : null));
BDFDB.initElements(container.parentElement, this);
if (popout && popout.style.transform.indexOf("translateY(-1") == -1) {
let arect = BDFDB.getRects(document.querySelector(BDFDB.dotCN.appmount));
let prect = BDFDB.getRects(popout);
popout.style.setProperty("top", (prect.y + prect.height > arect.height ? (arect.height - prect.height) : prect.y) + "px");
}
}
getCreationTime (languageid, timestamp = new Date()) {
let settings = BDFDB.getAllData(this, "settings");
let timestring = settings.addCreationTime ? timestamp.toLocaleString(languageid) : timestamp.toLocaleDateString(languageid);
if (timestring && settings.forceZeros) timestring = this.addLeadingZeros(timestring);
return timestring;
}
addLeadingZeros (timestring) {
let chararray = timestring.split("");
let numreg = /[0-9]/;
for (let i = 0; i < chararray.length; i++) {
if (!numreg.test(chararray[i-1]) && numreg.test(chararray[i]) && !numreg.test(chararray[i+1])) chararray[i] = "0" + chararray[i];
}
return chararray.join("");
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let choices = BDFDB.getAllData(this, "choices");
let settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
for (let key in choices) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCN.flexchild}" style="flex: 0 0 30%;">${this.defaults.choices[key].description}</h3><div class="${BDFDB.disCN.selectwrap}" style="flex: 1 1 70%;"><div class="${BDFDB.disCNS.select + BDFDB.disCNS.selectsingle + BDFDB.disCN.selecthasvalue}" type="${key}" value="${choices[key]}"><div class="${BDFDB.disCN.selectcontrol}"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectvalue}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal} languageName" style="flex: 1 1 42%; padding:0;">${this.languages[choices[key]].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal} languageTimestamp" style="flex: 1 1 58%; padding:0;">${this.getCreationTime(this.languages[choices[key]].id)}</div></div><span class="${BDFDB.disCN.selectarrowzone}"><span class="${BDFDB.disCN.selectarrow}"></span></span></div></div></div></div>`;
}
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "click", ".settings-switch", () => {
let choices = BDFDB.getAllData(this, "choices");
for (let key in choices) settingspanel.querySelector(`${BDFDB.dotCN.select}[type='${key}'] .languageTimestamp`).innerText = this.getCreationTime(this.languages[choices[key]].id);
});
BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {this.openDropdownMenu(e);});
return settingspanel;
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {
createdat_text: "Izrađen"
};
case "da": //danish
return {
createdat_text: "Oprettet den"
};
case "de": //german
return {
createdat_text: "Erstellt am"
};
case "es": //spanish
return {
createdat_text: "Creado el"
};
case "fr": //french
return {
createdat_text: "Créé le"
};
case "it": //italian
return {
createdat_text: "Creato il"
};
case "nl": //dutch
return {
createdat_text: "Gemaakt op"
};
case "no": //norwegian
return {
createdat_text: "Opprettet på"
};
case "pl": //polish
return {
createdat_text: "Utworzono"
};
case "pt-BR": //portuguese (brazil)
return {
createdat_text: "Criado em"
};
case "fi": //finnish
return {
createdat_text: "Luotu"
};
case "sv": //swedish
return {
createdat_text: "Skapat den"
};
case "tr": //turkish
return {
createdat_text: "Oluşturma tarihi"
};
case "cs": //czech
return {
createdat_text: "Vytvořeno dne"
};
case "bg": //bulgarian
return {
createdat_text: "Създадена на"
};
case "ru": //russian
return {
createdat_text: "Создано"
};
case "uk": //ukrainian
return {
createdat_text: "Створено"
};
case "ja": //japanese
return {
createdat_text: "作成日"
};
case "zh-TW": //chinese (traditional)
return {
createdat_text: "創建於"
};
case "ko": //korean
return {
createdat_text: "생성 일"
};
default: //default: english
return {
createdat_text: "Created on"
};
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Display Servers As Channels - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/DisplayServersAsChannels/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/DisplayServersAsChannels/config.json)
Display servers in a similar way as channels.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "DisplayServersAsChannels",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Display servers in a similar way as channels. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,301 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.verificationBadgeMarkup =
`<svg class="DSAC-verification-badge" name="Verified" width="24" height="24" viewBox="0 0 20 20">
<g fill="none" fill-rule="evenodd">
<path fill="transparent" d="M10,19.9894372 C10.1068171,19.9973388 10.2078869,20.000809 10.3011305,19.9998419 C11.2600164,19.8604167 12.3546966,19.5885332 12.8510541,19.0579196 C13.25685,18.6241176 13.617476,18.0901301 13.7559228,17.5412583 C14.9847338,18.4452692 17.0357846,18.1120142 18.1240732,16.9486174 C19.1632035,15.8377715 18.521192,14.1691402 18.1240732,13.1586037 C18.4557396,12.9959068 18.8016154,12.6966801 19.0750308,12.4043949 C19.7126372,11.7227841 20.0201294,10.9139249 19.9989792,10.0282152 C20.0201294,9.14250542 19.7126372,8.3336462 19.0750308,7.65203538 C18.8016154,7.35975019 18.4557396,7.06052352 18.1240732,6.89782664 C18.521192,5.88729007 19.1632035,4.21865882 18.1240732,3.10781287 C17.0357846,1.94441607 14.9847338,1.61116112 13.7559228,2.51517206 C13.617476,1.96630024 13.25685,1.4323127 12.8510541,0.998510722 C12.3546966,0.467897141 11.2584098,0.139640848 10.2995239,0.036840309 C10.2065991,-0.000647660524 10.1059015,0.00279555358 9.99948865,0.0106399384 C9.87772075,0.00268415336 9.76807998,-0.00081194858 9.67455589,0.000158000197 C8.88885259,0.157529668 7.63153446,0.482616331 7.14894593,0.998510722 C6.74314998,1.4323127 6.382524,1.96630024 6.24407717,2.51517206 C5.01526618,1.61116112 2.96421535,1.94441607 1.87592682,3.10781287 C0.836796482,4.21865882 1.47880798,5.88729007 1.87592682,6.89782664 C1.54426039,7.06052352 1.19838464,7.35975019 0.924969216,7.65203538 C0.287362828,8.3336462 -0.0201294289,9.14250542 0.00102081603,10.0282151 C-0.0201294289,10.9139249 0.287362828,11.7227841 0.924969216,12.4043949 C1.19838464,12.6966801 1.54426039,12.9959068 1.87592682,13.1586037 C1.47880798,14.1691402 0.836796482,15.8377715 1.87592682,16.9486174 C2.96421535,18.1120142 5.01526618,18.4452692 6.24407717,17.5412583 C6.382524,18.0901301 6.74314998,18.6241176 7.14894593,19.0579196 C7.63153446,19.573814 8.89045919,19.8426283 9.6761625,19.9541287 C9.7694061,20.000809 9.87866986,19.9973388 10,19.9894372 Z"/>
<path fill="#4f545c" d="M10.0004091,17.9551224 C10.0858672,17.9614327 10.1667272,17.964204 10.2413259,17.9634317 C11.0084737,17.8520863 11.8842627,17.6349594 12.281369,17.2112099 C12.6060224,16.8647745 12.8945379,16.4383305 13.005301,16 C13.9884001,16.7219456 15.6293247,16.4558073 16.5,15.5267154 C17.3313468,14.6395908 16.8177113,13.3070173 16.5,12.5 C16.7653467,12.3700698 17.0420615,12.1311066 17.260805,11.8976868 C17.7709162,11.3533505 18.0169226,10.7073933 18.0000015,10.0000632 C18.0169226,9.29273289 17.7709162,8.64677569 17.260805,8.10243942 C17.0420615,7.86901966 16.7653467,7.63005642 16.5,7.50012624 C16.8177113,6.69310896 17.3313468,5.36053545 16.5,4.47341082 C15.6293247,3.54431894 13.9884001,3.27818062 13.005301,4.00012624 C12.8945379,3.5617957 12.6060224,3.13535178 12.281369,2.78891632 C11.8842627,2.36516686 11.0071884,2.10302048 10.2400405,2.02092369 C10.1656968,1.99098569 10.0851346,1.99373545 10,2 C9.9025807,1.99364649 9.8148636,1.99085449 9.7400405,1.9916291 C9.11144571,2.11730654 8.10553978,2.37692165 7.71944921,2.78891632 C7.39479585,3.13535178 7.10628031,3.5617957 6.99551718,4.00012624 C6.01241812,3.27818062 4.37149355,3.54431894 3.5008182,4.47341082 C2.66947142,5.36053545 3.18310688,6.69310896 3.5008182,7.50012624 C3.23547149,7.63005642 2.95875674,7.86901966 2.74001321,8.10243942 C2.22990202,8.64677569 1.98389563,9.29273289 2.00081669,10.0000631 C1.98389563,10.7073933 2.22990202,11.3533505 2.74001321,11.8976868 C2.95875674,12.1311066 3.23547149,12.3700698 3.5008182,12.5 C3.18310688,13.3070173 2.66947142,14.6395908 3.5008182,15.5267154 C4.37149355,16.4558073 6.01241812,16.7219456 6.99551718,16 C7.10628031,16.4383305 7.39479585,16.8647745 7.71944921,17.2112099 C8.10553978,17.6232046 9.11273107,17.8378805 9.74132585,17.926925 C9.81592455,17.964204 9.90334002,17.9614327 10.0004091,17.9551224 Z"/>
<path fill="#ffffff" d="M8.84273967,12.8167603 L13.8643,7.7952 C14.0513,7.6072 14.0513,7.3042 13.8643,7.1172 C13.6773,6.9312 13.3743,6.9312 13.1863,7.1172 L8.52303089,11.78139 L6.8883,10.1475 C6.6843,9.9445 6.3553,9.9445 6.1523,10.1475 C5.9493,10.3515 5.9493,10.6805 6.1523,10.8835 L8.08381122,12.8160053 C8.09561409,12.8309877 8.10844368,12.8454178 8.1223,12.8592 C8.3093,13.0472 8.6123,13.0472 8.8003,12.8592 L8.82157566,12.8379243 C8.82518839,12.8345112 8.82876362,12.8310364 8.8323,12.8275 C8.83584168,12.8239583 8.83932157,12.820378 8.84273967,12.8167603 Z"/>
</g>
</svg>`;
this.css = `
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildswrapper},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildsscrollerwrap},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guilds} {
width: 160px;
}
body.DSAC-styled .bd-settings-button,
.DSAC-styled ${BDFDB.dotCN.guildswrapper},
.DSAC-styled ${BDFDB.dotCN.guildsscrollerwrap},
.DSAC-styled ${BDFDB.dotCN.guilds} {
width: 240px;
}
.DSAC-styled ${BDFDB.dotCN.guilds}::-webkit-scrollbar-track-piece {
background-color: rgb(27, 29, 32);
border-color: rgb(32, 34, 37);
}
.DSAC-styled ${BDFDB.dotCN.guilds}::-webkit-scrollbar-thumb {
background-color: rgb(17, 19, 22);
border-color: rgb(32, 34, 37);
}
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guild} {
margin-left: 55px;
}
.bd-minimal .DSAC-styled ${BDFDB.dotCN.friendsonline} {
margin-left: 40px;
}
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner} a,
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy,
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner} a,
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror} {
height: 20px;
}
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon} {
line-height: 20px;
}
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild},
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner},
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner} a,
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon},
.DSAC-styled ${BDFDB.dotCN.guild}.copy,
.DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner},
.DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner} a,
.DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon},
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror} {
margin-left: 0px;
height: 32px;
}
.DSAC-styled ${BDFDB.dotCN.guildseparator} {
margin-left: 0px;
}
.DSAC-styled ${BDFDB.dotCN.guild},
.DSAC-styled ${BDFDB.dotCN.friendsonline} {
margin-left: 80px;
}
.DSAC-styled ${BDFDB.dotCN.guild}.folder.open ${BDFDB.dotCN.guildicon} {
text-decoration: underline;
}
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy,
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror} {
width: 130px;
}
.DSAC-styled ${BDFDB.dotCN.guildseparator},
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild},
.DSAC-styled ${BDFDB.dotCN.guild}.copy,
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror} {
width: 215px;
box-sizing: border-box;
opacity: 0.4;
padding-left: 5px;
border-radius: 3px;
align-items: center;
justify-content: flex-start;
}
.DSAC-styled ${BDFDB.dotCN.guildseparator}:not([style*="display: none"]),
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild}:not([style*="display: none"]),
.DSAC-styled ${BDFDB.dotCN.guild}.copy:not([style*="display: none"]),
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror}:not([style*="display: none"]) {
display: flex;
}
.DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildunread}.copy.
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildunread} {
opacity: 0.7;
}
.DSAC-styled ${BDFDB.dotCN.guild}.copy:not(${BDFDB.dotCN.guildselected}):hover,
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.notCN.guildselected}:hover {
opacity: 0.9;
background-color: rgba(79,84,92,.3);
}
.DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildselected}.copy,
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildselected} {
opacity: 1;
background-color: rgba(79,84,92,.6);
}
.DSAC-styled ${BDFDB.dotCN.guild}.copy > div[draggable],
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild} > div[draggable] {
flex: 1 1 auto;
}
.DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildaudio}.copy > div[draggable],
.DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildvideo}.copy > div[draggable],
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildaudio} > div[draggable],
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildvideo} > div[draggable] {
padding-right: 20px;
margin-right: 5px;
}
.DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildaudio}.copy > div[draggable],
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildaudio} > div[draggable] {
background: url(/assets/382ca83d9dc390c4be715248bb4864f4.svg) right no-repeat !important;
}
.DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildvideo}.copy > div[draggable],
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildvideo} > div[draggable] {
background: url(/assets/c46f51f425c824899b6138ea2b61b41d.svg) right no-repeat !important;
}
.DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.badge},
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.badge} {
position: static;
margin: 0 3px;
}
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner} {
width: unset;
}
.DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner},
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner} {
background: transparent !important;
border-radius: 0px !important;
position: relative;
}
.DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildaudio}.copy ${BDFDB.dotCN.guildinner}:after,
.DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildvideo}.copy ${BDFDB.dotCN.guildinner}:after,
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCNS.guildaudio + BDFDB.dotCN.guildinner}:after,
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCNS.guildvideo + BDFDB.dotCN.guildinner}:after {
display: none !important;
}
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildicon},
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildicon} {
font-size: 14px !important;
}
.DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildicon},
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildicon} {
background: transparent !important;
font-size: 16px !important;
line-height: 32px;
white-space: nowrap;
text-align: left;
position: absolute;
left: 0;
right: 0;
width: unset;
}
.DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner} .DSAC-verification-badge,
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner} .DSAC-verification-badge {
position: absolute;
left: 0;
}
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror} {
margin-left: -5px;
line-height: 28px;
}
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror},
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildsadd} {
display: block !important;
}
.bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCNS.guildsadd + BDFDB.dotCN.guildsaddinner} {
top: -0.2em;
}
.DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCNS.guildsadd + BDFDB.dotCN.guildsaddinner} {
top: -6px;
}`;
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
var observer = null;
observer = new MutationObserver((changes, _) => {
changes.forEach(
(change, i) => {
var addedNodes = change.addedNodes;
if (change.attributeName == "class" && change.oldValue && change.oldValue.indexOf(BDFDB.disCN.guildplaceholder) > -1) addedNodes = [change.target];
if (change.attributeName == "draggable" && change.oldValue && change.oldValue == "false") addedNodes = [change.target.parentElement];
if (addedNodes) {
addedNodes.forEach((node) => {
if (node && BDFDB.containsClass(node, BDFDB.disCN.guild) && !node.querySelector(BDFDB.dotCN.guildserror)) {
if (BDFDB.containsClass(node, "folder")) this.changeServer(this.getFolderObject(node));
else this.changeServer(BDFDB.getServerData(node));
}
});
}
}
);
});
BDFDB.addObserver(this, BDFDB.dotCN.guilds, {name:"serverListObserver",instance:observer}, {childList: true, subtree:true, attributes:true, attributeFilter: ["class", "draggable"], attributeOldValue: true});
BDFDB.readServerList().forEach(info => {this.changeServer(info);});
document.querySelectorAll(BDFDB.dotCN.guild + ".folder").forEach(folderdiv => {this.changeServer(this.getFolderObject(folderdiv));});
var appcontainer = document.querySelector(BDFDB.dotCN.appcontainer);
if (appcontainer) {
BDFDB.addEventListener(this, appcontainer, "mouseenter", `${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild}, ${BDFDB.dotCN.guild}.copy`, e => {
if (e.currentTarget.tagName && e.currentTarget.querySelector(BDFDB.dotCN.guildserror)) return;
BDFDB.appendLocalStyle("HideAllToolTips" + this.name, `${BDFDB.dotCN.tooltip} {display: none !important;}`);
});
BDFDB.addEventListener(this, appcontainer, "mouseleave", `${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild}, ${BDFDB.dotCN.guild}.copy`, e => {
if (e.currentTarget.tagName && e.currentTarget.querySelector(BDFDB.dotCN.guildserror)) return;
BDFDB.removeLocalStyle("HideAllToolTips" + this.name);
});
}
BDFDB.addClass([document.body, appcontainer], "DSAC-styled");
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.readServerList().forEach(info => {this.resetServer(info);});
document.querySelectorAll(BDFDB.dotCN.guild + ".folder").forEach(folderdiv => {this.resetServer(this.getFolderObject(folderdiv));});
BDFDB.removeClasses("DSAC-styled");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
changeServer (info) {
if (!info || !info.div) return;
var avatar = info.div.querySelector(BDFDB.dotCN.guildicon);
if (avatar) {
avatar.DSAColdName = avatar.textContent;
avatar.innerHTML = `<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">${BDFDB.encodeToHTML(info.name || info.folderName || "")}</div></span>`;
BDFDB.initElements(avatar, this);
if (info.features && info.features.has("VERIFIED")) avatar.parentElement.insertBefore(BDFDB.htmlToElement(this.verificationBadgeMarkup), avatar);
}
}
resetServer (info) {
if (!info || !info.div) return;
var avatar = info.div.querySelector(BDFDB.dotCN.guildicon);
if (avatar) {
avatar.innerHTML = BDFDB.encodeToHTML(avatar.DSAColdName);
BDFDB.removeEles(info.div.querySelector(".DSAC-verification-badge"));
}
}
getFolderObject (folderdiv) {
var data = BDFDB.loadData(folderdiv.id, "ServerFolders", "folders");
return data ? Object.assign({div:folderdiv}, data) : null;
}
}
};

View File

@ -1,8 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Edit Channels - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditChannels/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditChannels/config.json)
Adds two options on your channel context menu.
- You can open a popout, where you can change the local name and color for the selected channel.
- You can set the selected channel back to its original state.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "EditChannels",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Allows you to rename and recolor channelnames. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,814 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.labels = {};
this.patchModules = {
"ChannelTextArea":"componentDidMount",
"AuditLog":"componentDidMount",
"ChannelCategoryItem":"componentDidMount",
"ChannelItem":"componentDidMount",
"HeaderBar":["componentDidMount","componentDidUpdate"],
"Clickable":"componentDidMount"
};
this.channelContextEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} localchannelsettings-item ${BDFDB.disCN.contextmenuitemsubmenu}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_localchannelsettings_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>`;
this.channelContextSubMenuMarkup =
`<div class="${BDFDB.disCN.contextmenu} editchannels-submenu">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} channelsettings-item">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_submenu_channelsettings_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
<div class="${BDFDB.disCN.contextmenuitem} resetsettings-item ${BDFDB.disCN.contextmenuitemdisabled}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_submenu_resetsettings_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>
</div>`;
this.channelSettingsModalMarkup =
`<span class="${this.name}-modal DevilBro-modal">
<div class="${BDFDB.disCN.backdrop}"></div>
<div class="${BDFDB.disCN.modal}">
<div class="${BDFDB.disCN.modalinner}">
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">REPLACE_modal_header_text</h4>
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCN.primary}"></div>
</div>
<button type="button" class="${BDFDB.disCNS.modalclose + BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">
<svg name="Close" width="18" height="18" viewBox="0 0 12 12" style="flex: 0 1 auto;">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h12v12H0"></path>
<path class="fill" fill="currentColor" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path>
</g>
</svg>
</div>
</button>
</div>
<div class="${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.modalcontent + BDFDB.disCNS.scrollerthemed + BDFDB.disCN.themeghosthairline}">
<div class="${BDFDB.disCNS.scroller + BDFDB.disCN.modalsubinner}">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 1 1 auto;">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">REPLACE_modal_channelname_text</h3>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">
<div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16}" id="input-channelname"></div>
</div>
<div class="${BDFDB.disCNS.modaldivider + BDFDB.disCNS.modaldividerdefault + BDFDB.disCN.margintop20}"></div>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 1 1 auto;">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">REPLACE_modal_colorpicker1_text</h3>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} swatches" style="flex: 1 1 auto;"></div>
</div>
</div>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
<button type="button" class="btn-save ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_save_text</div>
</button>
</div>
</div>
</div>
</div>
</span>`;
this.css = `
${BDFDB.dotCN.channelheadertitletext}[custom-editchannelsheader] ${BDFDB.dotCN.channelheaderchannelicon} {
opacity: 0.6;
}
`;
this.defaults = {
settings: {
changeChannelIcon: {value:true, description:"Change color of Channel Icon."},
changeUnreadIndicator: {value:true, description:"Change color of Unread Indicator."}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers","getUser");
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
this.CurrentChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getDefaultChannel");
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
let data = BDFDB.loadAllData(this, "channels");
BDFDB.removeAllData(this, "channels");
BDFDB.WebModules.forceAllUpdates(this);
BDFDB.saveAllData(data, this, "channels");
BDFDB.removeEles(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
changeLanguageStrings () {
this.channelContextEntryMarkup = this.channelContextEntryMarkup.replace("REPLACE_context_localchannelsettings_text", this.labels.context_localchannelsettings_text);
this.channelContextSubMenuMarkup = this.channelContextSubMenuMarkup.replace("REPLACE_submenu_channelsettings_text", this.labels.submenu_channelsettings_text);
this.channelContextSubMenuMarkup = this.channelContextSubMenuMarkup.replace("REPLACE_submenu_resetsettings_text", this.labels.submenu_resetsettings_text);
this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_modal_channelname_text", this.labels.modal_channelname_text);
this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_modal_colorpicker1_text", this.labels.modal_colorpicker1_text);
this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_btn_save_text", this.labels.btn_save_text);
}
onChannelContextMenu (instance, menu) {
if (instance.props && instance.props.channel && !menu.querySelector(".localchannelsettings-item")) {
let channelContextEntry = BDFDB.htmlToElement(this.channelContextEntryMarkup);
menu.appendChild(channelContextEntry);
let settingsitem = channelContextEntry.querySelector(".localchannelsettings-item");
settingsitem.addEventListener("mouseenter", () => {
let channelContextSubMenu = BDFDB.htmlToElement(this.channelContextSubMenuMarkup);
let channelitem = channelContextSubMenu.querySelector(".channelsettings-item");
channelitem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
this.showChannelSettings(instance.props.channel);
});
if (BDFDB.loadData(instance.props.channel.id, this, "channels")) {
let resetitem = channelContextSubMenu.querySelector(".resetsettings-item");
BDFDB.removeClass(resetitem, BDFDB.disCN.contextmenuitemdisabled);
resetitem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
BDFDB.removeData(instance.props.channel.id, this, "channels");
BDFDB.WebModules.forceAllUpdates(this);
});
}
BDFDB.appendSubMenu(settingsitem, channelContextSubMenu);
});
}
}
showChannelSettings (info) {
var {name,color} = BDFDB.loadData(info.id, this, "channels") || {}
let channelSettingsModal = BDFDB.htmlToElement(this.channelSettingsModalMarkup);
let channelnameinput = channelSettingsModal.querySelector("#input-channelname");
channelSettingsModal.querySelector(BDFDB.dotCN.modalguildname).innerText = info.name;
channelnameinput.value = name || "";
channelnameinput.setAttribute("placeholder", info.name);
BDFDB.setColorSwatches(channelSettingsModal, color);
BDFDB.appendModal(channelSettingsModal);
BDFDB.addChildEventListener(channelSettingsModal, "click", ".btn-save", e => {
e.preventDefault();
name = channelnameinput.value.trim();
name = name ? name : null;
color = BDFDB.getSwatchColor(channelSettingsModal, 1);
if (color) {
if (color[0] < 30 && color[1] < 30 && color[2] < 30) color = BDFDB.colorCHANGE(color, 30);
else if (color[0] > 225 && color[1] > 225 && color[2] > 225) color = BDFDB.colorCHANGE(color, -30);
}
if (name == null && color == null) {
BDFDB.removeData(info.id, this, "channels");
}
else {
BDFDB.saveData(info.id, {name,color}, this, "channels");
}
BDFDB.WebModules.forceAllUpdates(this);
});
channelnameinput.focus();
}
processChannelTextArea (instance, wrapper) {
let channel = BDFDB.getReactValue(instance, "props.channel");
if (channel) {
var textarea = wrapper.querySelector("textarea");
if (!textarea) return;
if (channel.type == 0 && instance.props.type == "normal") {
let data = BDFDB.loadData(channel.id, this, "channels") || {};
wrapper.querySelector("textarea").setAttribute("placeholder", BDFDB.LanguageStrings.TEXTAREA_PLACEHOLDER.replace("{{channel}}", "#" + (data.name || channel.name)));
}
BDFDB.addEventListener(this, textarea, "keydown", e => {
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
if (BDFDB.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteEditChannelsRow")) {
e.originalEvent.preventDefault();
e.originalEvent.stopPropagation();
this.swapWordWithMention(textarea);
}
}
else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
let autocompleteitems = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable + ":not(.autocompleteEditChannelsSelector)");
let selected = autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected);
if (BDFDB.containsClass(selected, "autocompleteEditChannelsSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
e.originalEvent.preventDefault();
e.originalEvent.stopPropagation();
let next = this.getNextSelection(autocompletemenu, null, e.which == 38 ? false : true);
BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
BDFDB.addClass(next, BDFDB.disCN.autocompleteselected);
}
}
else if (textarea.value && !e.shiftKey && e.which == 13 && !autocompletemenu && textarea.value.indexOf("s/") != 0) {
this.format = true;
textarea.dispatchEvent(new Event("input"));
}
else if (!e.ctrlKey && e.which != 16 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) {
clearTimeout(textarea.EditChannelsAutocompleteTimeout);
textarea.EditChannelsAutocompleteTimeout = setTimeout(() => {this.addAutoCompleteMenu(textarea, channel);},100);
}
if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.removeEles(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
});
BDFDB.addEventListener(this, textarea, "click", e => {
if (textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) setImmediate(() => {this.addAutoCompleteMenu(textarea, channel);});
});
}
}
processAuditLog (instance, wrapper) {
let channel = BDFDB.getReactValue(instance, "props.log.options.channel");
if (channel) {
let hooks = wrapper.querySelectorAll(`${BDFDB.dotCN.flexchild} > span${BDFDB.notCN.auditloguserhook}`);
if (hooks.length > 0) this.changeChannel2(channel, hooks[0].firstChild);
}
}
processChannelCategoryItem (instance, wrapper) {
if (instance.props && instance.props.channel) {
this.changeChannel(instance.props.channel, wrapper.querySelector(BDFDB.dotCN.categorycolortransition));
}
}
processChannelItem (instance, wrapper) {
if (instance.props && instance.props.channel) {
this.changeChannel(instance.props.channel, wrapper.querySelector(BDFDB.dotCN.channelname));
}
}
processHeaderBar (instance, wrapper) {
let channel_id = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.channelId");
if (channel_id) {
let channelname = wrapper.querySelector(BDFDB.dotCN.channelheaderchannelname);
if (channelname) {
let channel = this.ChannelUtils.getChannel(channel_id);
if (channel) {
if (channel.type == 0) this.changeChannel(channel, wrapper.querySelector(BDFDB.dotCN.channelheaderchannelname));
else {
if (channel.type == 1) channel = this.UserUtils.getUser(channel.recipients[0]) || channel;
if (channelname.EditChannelsChangeObserver && typeof channelname.EditChannelsChangeObserver.disconnect == "function") channelname.EditChannelsChangeObserver.disconnect();
channelname.style.removeProperty("color");
channelname.style.removeProperty("background");
BDFDB.setInnerText(channelname, channel.name || channel.username);
}
}
}
}
}
processClickable (instance, wrapper) {
if (!instance.props || !instance.props.className) return;
else if (instance.props.tag == "span" && instance.props.className.indexOf(BDFDB.disCN.mentionwrapper) > -1 && instance.props.className.indexOf(BDFDB.disCN.mention) == -1) {
let children = BDFDB.getReactValue(instance, "_reactInternalFiber.memoizedProps.children");
if (children && typeof children[0] == "string") {
let channelname = children[0].slice(1);
let categoryname = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.type.displayName") == "Tooltip" ? BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.memoizedProps.text") : null;
for (let channel of this.CurrentChannelUtils.getChannels(this.LastGuildStore.getGuildId())[0]) {
if (channelname == channel.channel.name) {
let category = categoryname ? this.ChannelUtils.getChannel(channel.channel.parent_id) : null;
if (!category || category && categoryname == category.name) {
this.changeMention(channel.channel, wrapper, category || {});
break;
}
}
}
}
}
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.quickswitchresult) > -1) {
let result = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.result");
if (result && result.type.indexOf("_CHANNEL") != -1) {
this.changeChannel(result.record, wrapper.querySelector(BDFDB.dotCN.quickswitchresultmatch));
if (result.record.parent_id) {
this.changeChannel(this.ChannelUtils.getChannel(result.record.parent_id), wrapper.querySelector(BDFDB.dotCN.quickswitchresultnote));
}
}
}
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.autocompleterow) > -1) {
let channel = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.channel");
if (channel) {
this.changeChannel(channel, wrapper.querySelector(BDFDB.dotCN.marginleft4));
let category = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.category");
if (category) this.changeChannel(category, wrapper.querySelector(BDFDB.dotCN.autocompletedescription));
}
}
else if (instance.props.tag == "span" && instance.props.className.indexOf(BDFDB.disCN.messagespopoutchannelname) > -1) {
let channel = BDFDB.getReactValue(instance, "_reactInternalFiber.return.sibling.child.child.memoizedProps.channel");
if (channel) this.changeChannel2(channel, wrapper);
}
}
changeChannel (info, channelname) {
if (!info || !channelname || !channelname.parentElement) return;
if (channelname.EditChannelsChangeObserver && typeof channelname.EditChannelsChangeObserver.disconnect == "function") channelname.EditChannelsChangeObserver.disconnect();
let data = BDFDB.loadData(info.id, this, "channels") || {};
let settings = BDFDB.getAllData(this, "settings");
let color = this.chooseColor(channelname, data.color);
channelname.style.setProperty("color", color, "important");
BDFDB.setInnerText(channelname, data.name || info.name);
let iconparent = BDFDB.containsClass(channelname, BDFDB.disCN.quickswitchresultmatch) ? channelname.parentElement.parentElement : channelname.parentElement;
if (!BDFDB.containsClass(channelname, BDFDB.disCN.autocompletedescription)) {
iconparent.querySelectorAll('svg [stroke]:not([stroke="none"]').forEach(icon => {
if (!icon.getAttribute("oldstroke")) icon.setAttribute("oldstroke", icon.getAttribute("stroke"));
icon.setAttribute("stroke", color && settings.changeChannelIcon ? color : icon.getAttribute("oldstroke"), "important");
icon.style.setProperty("stroke", color && settings.changeChannelIcon ? color : icon.getAttribute("oldstroke"), "important");
});
iconparent.querySelectorAll('svg [fill]:not([fill="none"]').forEach(icon => {
if (!icon.getAttribute("oldfill")) icon.setAttribute("oldfill", icon.getAttribute("fill"));
icon.setAttribute("fill", color && settings.changeChannelIcon ? color : icon.getAttribute("oldfill"), "important");
icon.style.setProperty("fill", color && settings.changeChannelIcon ? color : icon.getAttribute("oldfill"), "important");
});
let unread = iconparent.parentElement.querySelector(BDFDB.dotCN.channelunread);
if (unread) unread.style.setProperty("background-color", color && settings.changeUnreadIndicator ? color : null, "important");
}
if (color) {
channelname.EditChannelsChangeObserver = new MutationObserver((changes, _) => {
changes.forEach(
(change, i) => {
if (change.type == "childList" && change.addedNodes.length && change.target.tagName && (change.target.tagName == "SVG" || change.target.querySelector("svg")) || change.type == "attributes" && change.attributeName == "class" && change.target.className.length && change.target.className.indexOf("name") > -1 || change.type == "attributes" && change.attributeName == "style" && BDFDB.containsClass(change.target, BDFDB.disCN.channelheaderchannelname)) {
channelname.EditChannelsChangeObserver.disconnect();
this.changeChannel(info, channelname);
}
}
);
});
channelname.EditChannelsChangeObserver.observe(iconparent, {attributes:true, childList:true, subtree:true});
}
}
changeChannel2 (info, channelname) {
if (!info || !channelname || !channelname.parentElement) return;
if (channelname.EditChannelsChangeObserver && typeof channelname.EditChannelsChangeObserver.disconnect == "function") channelname.EditChannelsChangeObserver.disconnect();
let data = BDFDB.loadData(info.id, this, "channels") || {};
let color = this.chooseColor(channelname, data.color);
channelname.style.setProperty("color", color, "important");
BDFDB.setInnerText(channelname, "#" + (data.name || info.name));
if (color) {
channelname.EditChannelsChangeObserver = new MutationObserver((changes, _) => {
changes.forEach(
(change, i) => {
if (change.type == "childList" && change.addedNodes.length && change.target.tagName && (change.target.tagName == "SVG" || change.target.querySelector("svg")) || change.type == "attributes" && change.attributeName == "class" && change.target.className.length && change.target.className.indexOf("name") > -1) {
channelname.EditChannelsChangeObserver.disconnect();
this.changeChannel2(info, channelname);
}
}
);
});
channelname.EditChannelsChangeObserver.observe(channelname.parentElement, {attributes:true, childList:true, subtree:true});
}
}
changeMention (info, mention, categoryinfo) {
if (!info || !mention || !mention.parentElement) return;
if (mention.EditChannelsChangeObserver && typeof mention.EditChannelsChangeObserver.disconnect == "function") mention.EditChannelsChangeObserver.disconnect();
mention.removeEventListener("mouseover", mention.mouseoverListenerEditChannels);
mention.removeEventListener("mouseout", mention.mouseoutListenerEditChannels);
let data = BDFDB.loadData(info.id, this, "channels") || {};
let color = BDFDB.colorCONVERT(data.color, "RGBCOMP");
BDFDB.setInnerText(mention, "#" + (data.name || info.name));
if (mention.EditChannelsHovered) colorHover();
else colorDefault();
mention.mouseoverListenerEditChannels = () => {
mention.EditChannelsHovered = true;
colorHover();
let categorydata = BDFDB.loadData(categoryinfo.id, this, "channels") || {};
if (categorydata.name) BDFDB.createTooltip(categorydata.name, mention, {type:"top",selector:"EditChannels-tooltip",css:`body ${BDFDB.dotCN.tooltip}:not(.EditChannels-tooltip) {display: none !important;}`});
};
mention.mouseoutListenerEditChannels = () => {
delete mention.EditChannelsHovered;
colorDefault();
};
mention.addEventListener("mouseover", mention.mouseoverListenerEditChannels);
mention.addEventListener("mouseout", mention.mouseoutListenerEditChannels);
mention.EditChannelsChangeObserver = new MutationObserver((changes, _) => {
mention.EditChannelsChangeObserver.disconnect();
this.changeMention(info, mention, categoryinfo);
});
mention.EditChannelsChangeObserver.observe(mention, {attributes:true});
function colorDefault() {
mention.style.setProperty("color", color ? "rgb(" + color[0] + "," + color[1] + "," + color[2] + ")" : null, "important");
mention.style.setProperty("background", color ? "rgba(" + color[0] + "," + color[1] + "," + color[2] + ",.1)" : null, "important");
}
function colorHover() {
mention.style.setProperty("color", color ? "#FFFFFF" : null, "important");
mention.style.setProperty("background", color ? "rgba(" + color[0] + "," + color[1] + "," + color[2] + ",.7)" : null, "important");
}
}
chooseColor (channelname, color) {
if (color && channelname) {
let classname = channelname.className ? channelname.className.toLowerCase() : "";
if (classname.indexOf("muted") > -1 || classname.indexOf("locked") > -1) color = BDFDB.colorCHANGE(color, -0.5);
else if (classname.indexOf("selected") > -1 || classname.indexOf("hovered") > -1 || classname.indexOf("unread") > -1) color = BDFDB.colorCHANGE(color, 0.5);
return BDFDB.colorCONVERT(color, "RGB");
}
return null;
}
addAutoCompleteMenu (textarea, channel) {
if (textarea.parentElement.querySelector(".autocompleteEditChannelsRow")) return;
let words = textarea.value.split(/\s/);
let lastword = words[words.length-1].trim();
if (lastword && lastword.length > 1 && lastword[0] == "#") {
let channels = BDFDB.loadAllData(this, "channels");
if (!channels) return;
let channelarray = [];
for (let id in channels) if (channels[id].name) {
let channel = this.ChannelUtils.getChannel(id);
let category = channel && channel.parent_id ? this.ChannelUtils.getChannel(channel.parent_id) : null;
let catdata = (category ? channels[category.id] : null) || {};
if (channel && channel.type == 0) channelarray.push(Object.assign({lowercasename:channels[id].name.toLowerCase(),lowercasecatname:(catdata && catdata.name ? catdata.name.toLowerCase() : null),channel,category,catdata},channels[id]));
}
channelarray = BDFDB.sortArrayByKey(channelarray.filter(n => n.lowercasename.indexOf(lastword.toLowerCase().slice(1)) != -1 || (n.lowercasecatname && n.lowercasecatname.indexOf(lastword.toLowerCase().slice(1)) != -1)), "lowercasename");
if (channelarray.length) {
let settings = BDFDB.getAllData(this, "settings");
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCNS.autocomplete + BDFDB.dotCN.autocompleteinner), amount = 15;
if (!autocompletemenu) {
autocompletemenu = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocomplete + BDFDB.disCN.autocomplete2} autocompleteEditChannels"><div class="${BDFDB.disCN.autocompleteinner}"><div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditChannelsRow"><div class="${BDFDB.disCN.autocompleteselector} autocompleteEditChannelsSelector"><div class="${BDFDB.disCNS.autocompletecontenttitle + BDFDB.disCNS.small + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCN.weightsemibold}">${BDFDB.LanguageStrings.TEXT_CHANNELS_MATCHING.replace("{{prefix}}", BDFDB.encodeToHTML(lastword))}</strong></div></div></div></div></div>`);
textarea.parentElement.appendChild(autocompletemenu);
autocompletemenu = autocompletemenu.firstElementChild;
}
else {
amount -= autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable).length;
}
BDFDB.addEventListener(this, autocompletemenu, "mouseenter", BDFDB.dotCN.autocompleteselectable, e => {
var selected = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselected);
BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
BDFDB.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
});
for (let data of channelarray) {
if (amount-- < 1) break;
let color = BDFDB.colorCONVERT(data.color, "RGB");
let catcolor = BDFDB.colorCONVERT(data.catdata.color, "RGB");
let autocompleterow = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditChannelsRow"><div channelid="${data.channel.id}" class="${BDFDB.disCNS.autocompleteselector + BDFDB.disCN.autocompleteselectable} autocompleteEditChannelsSelector"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletecontent}" style="flex: 1 1 auto;"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" class="${BDFDB.disCN.autocompleteicon}"><path class="${BDFDB.disCN.autocompleteiconforeground}" d="M2.27333333,12 L2.74666667,9.33333333 L0.08,9.33333333 L0.313333333,8 L2.98,8 L3.68666667,4 L1.02,4 L1.25333333,2.66666667 L3.92,2.66666667 L4.39333333,0 L5.72666667,0 L5.25333333,2.66666667 L9.25333333,2.66666667 L9.72666667,0 L11.06,0 L10.5866667,2.66666667 L13.2533333,2.66666667 L13.02,4 L10.3533333,4 L9.64666667,8 L12.3133333,8 L12.08,9.33333333 L9.41333333,9.33333333 L8.94,12 L7.60666667,12 L8.08,9.33333333 L4.08,9.33333333 L3.60666667,12 L2.27333333,12 L2.27333333,12 Z M5.02,4 L4.31333333,8 L8.31333333,8 L9.02,4 L5.02,4 L5.02,4 Z" transform="translate(1.333 2)" ${settings.changeChannelIcon && color ? ('fill="' + color + '" oldfill="currentColor" style="fill: ' + color + ' !important;"') : 'fill="currentColor"'}></path></svg><div class="${BDFDB.disCN.marginleft4}" changed-by-editchannels="true" style="flex: 1 1 auto;${color ? (' color: ' + color + ' !important;') : ''}">${BDFDB.encodeToHTML(data.name || data.channel.name)}</div>${data.category ? '<div class="${BDFDB.disCN.autocompletedescription}"' + (catcolor ? (' style="color: ' + catcolor + ' !important;"') : '') + '>' + BDFDB.encodeToHTML(data.catdata.name || data.category.name) + '</div>' : ''}</div></div></div>`);
autocompleterow.querySelector(BDFDB.dotCN.autocompleteselectable).addEventListener("click", () => {this.swapWordWithMention(textarea);});
autocompletemenu.appendChild(autocompleterow);
}
if (!autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected)) {
BDFDB.addClass(autocompletemenu.querySelector(".autocompleteEditChannelsRow " + BDFDB.dotCN.autocompleteselectable), BDFDB.disCN.autocompleteselected);
}
}
}
}
getNextSelection (menu, selected, forward) {
selected = selected ? selected : menu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement;
let next, sibling = forward ? selected.nextElementSibling : selected.previousElementSibling;
if (sibling) {
next = sibling.querySelector(BDFDB.dotCN.autocompleteselectable);
}
else {
let items = menu.querySelectorAll(BDFDB.dotCN.autocompleteselectable);
next = forward ? items[0] : items[items.length-1];
}
return next ? next : this.getNextSelection(menu, sibling, forward);
}
swapWordWithMention (textarea) {
let selected = textarea.parentElement.querySelector(".autocompleteEditChannelsRow " + BDFDB.dotCN.autocompleteselected);
let channelid = selected ? selected.getAttribute("channelid") : null;
let words = textarea.value.split(/\s/);
let lastword = words[words.length-1].trim();
if (channelid && lastword) {
BDFDB.removeEles(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
textarea.focus();
textarea.selectionStart = textarea.value.length - lastword.length;
textarea.selectionEnd = textarea.value.length;
document.execCommand("insertText", false, `<#${channelid}> `);
textarea.selectionStart = textarea.value.length;
textarea.selectionEnd = textarea.value.length;
}
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Reset all Channels.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} reset-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to reset all channels?", () => {
BDFDB.removeAllData(this, "channels");
BDFDB.WebModules.forceAllUpdates(this);
});
});
return settingspanel;
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
BDFDB.WebModules.forceAllUpdates(this);
}
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {
context_localchannelsettings_text: "Postavke lokalnih kanala",
submenu_channelsettings_text: "Promijeni postavke",
submenu_resetsettings_text: "Vraćanje kanala",
modal_header_text: "Postavke lokalnih kanala",
modal_channelname_text: "Naziv lokalnog kanala",
modal_colorpicker1_text: "Boja lokalnog kanala",
btn_cancel_text: "Prekid",
btn_save_text: "Uštedjeti"
};
case "da": //danish
return {
context_localchannelsettings_text: "Lokal kanalindstillinger",
submenu_channelsettings_text: "Skift indstillinger",
submenu_resetsettings_text: "Nulstil kanal",
modal_header_text: "Lokal kanalindstillinger",
modal_channelname_text: "Lokalt kanalnavn",
modal_colorpicker1_text: "Lokal kanalfarve",
btn_cancel_text: "Afbryde",
btn_save_text: "Spare"
};
case "de": //german
return {
context_localchannelsettings_text: "Lokale Kanaleinstellungen",
submenu_channelsettings_text: "Einstellungen ändern",
submenu_resetsettings_text: "Kanal zurücksetzen",
modal_header_text: "Lokale Kanaleinstellungen",
modal_channelname_text: "Lokaler Kanalname",
modal_colorpicker1_text: "Lokale Kanalfarbe",
btn_cancel_text: "Abbrechen",
btn_save_text: "Speichern"
};
case "es": //spanish
return {
context_localchannelsettings_text: "Ajustes local de canal",
submenu_channelsettings_text: "Cambiar ajustes",
submenu_resetsettings_text: "Restablecer canal",
modal_header_text: "Ajustes local de canal",
modal_channelname_text: "Nombre local del canal",
modal_colorpicker1_text: "Color local del canal",
btn_cancel_text: "Cancelar",
btn_save_text: "Guardar"
};
case "fr": //french
return {
context_localchannelsettings_text: "Paramètres locale du canal",
submenu_channelsettings_text: "Modifier les paramètres",
submenu_resetsettings_text: "Réinitialiser le canal",
modal_header_text: "Paramètres locale du canal",
modal_channelname_text: "Nom local du canal",
modal_colorpicker1_text: "Couleur locale de la chaîne",
btn_cancel_text: "Abandonner",
btn_save_text: "Enregistrer"
};
case "it": //italian
return {
context_localchannelsettings_text: "Impostazioni locale canale",
submenu_channelsettings_text: "Cambia impostazioni",
submenu_resetsettings_text: "Ripristina canale",
modal_header_text: "Impostazioni locale canale",
modal_channelname_text: "Nome locale canale",
modal_colorpicker1_text: "Colore locale canale",
btn_cancel_text: "Cancellare",
btn_save_text: "Salvare"
};
case "nl": //dutch
return {
context_localchannelsettings_text: "Lokale kanaalinstellingen",
submenu_channelsettings_text: "Verandere instellingen",
submenu_resetsettings_text: "Reset kanaal",
modal_header_text: "Lokale kanaalinstellingen",
modal_channelname_text: "Lokale kanaalnaam",
modal_colorpicker1_text: "Lokale kanaalkleur",
btn_cancel_text: "Afbreken",
btn_save_text: "Opslaan"
};
case "no": //norwegian
return {
context_localchannelsettings_text: "Lokal kanalinnstillinger",
submenu_channelsettings_text: "Endre innstillinger",
submenu_resetsettings_text: "Tilbakestill kanal",
modal_header_text: "Lokal kanalinnstillinger",
modal_channelname_text: "Lokalt kanalnavn",
modal_colorpicker1_text: "Lokal kanalfarge",
btn_cancel_text: "Avbryte",
btn_save_text: "Lagre"
};
case "pl": //polish
return {
context_localchannelsettings_text: "Lokalne ustawienia kanału",
submenu_channelsettings_text: "Zmień ustawienia",
submenu_resetsettings_text: "Resetuj ustawienia",
modal_header_text: "Lokalne ustawienia kanału",
modal_channelname_text: "Lokalna nazwa kanału",
modal_colorpicker1_text: "Lokalny kolor kanału",
btn_cancel_text: "Anuluj",
btn_save_text: "Zapisz"
};
case "pt-BR": //portuguese (brazil)
return {
context_localchannelsettings_text: "Configurações local do canal",
submenu_channelsettings_text: "Mudar configurações",
submenu_resetsettings_text: "Redefinir canal",
modal_header_text: "Configurações local do canal",
modal_channelname_text: "Nome local do canal",
modal_colorpicker1_text: "Cor local do canal",
btn_cancel_text: "Cancelar",
btn_save_text: "Salvar"
};
case "fi": //finnish
return {
context_localchannelsettings_text: "Paikallinen kanavan asetukset",
submenu_channelsettings_text: "Vaihda asetuksia",
submenu_resetsettings_text: "Nollaa kanava",
modal_header_text: "Paikallinen kanavan asetukset",
modal_channelname_text: "Paikallinen kanavanimi",
modal_colorpicker1_text: "Paikallinen kanavanväri",
btn_cancel_text: "Peruuttaa",
btn_save_text: "Tallentaa"
};
case "sv": //swedish
return {
context_localchannelsettings_text: "Lokal kanalinställningar",
submenu_channelsettings_text: "Ändra inställningar",
submenu_resetsettings_text: "Återställ kanal",
modal_header_text: "Lokal kanalinställningar",
modal_channelname_text: "Lokalt kanalnamn",
modal_colorpicker1_text: "Lokal kanalfärg",
btn_cancel_text: "Avbryta",
btn_save_text: "Spara"
};
case "tr": //turkish
return {
context_localchannelsettings_text: "Yerel Kanal Ayarları",
submenu_channelsettings_text: "Ayarları Değiştir",
submenu_resetsettings_text: "Kanal Sıfırla",
modal_header_text: "Yerel Kanal Ayarları",
modal_channelname_text: "Yerel Kanal Adı",
modal_colorpicker1_text: "Yerel Kanal Rengi",
btn_cancel_text: "Iptal",
btn_save_text: "Kayıt"
};
case "cs": //czech
return {
context_localchannelsettings_text: "Místní nastavení kanálu",
submenu_channelsettings_text: "Změnit nastavení",
submenu_resetsettings_text: "Obnovit kanál",
modal_header_text: "Místní nastavení kanálu",
modal_channelname_text: "Místní název kanálu",
modal_colorpicker1_text: "Místní barvy kanálu",
btn_cancel_text: "Zrušení",
btn_save_text: "Uložit"
};
case "bg": //bulgarian
return {
context_localchannelsettings_text: "Настройки за локални канали",
submenu_channelsettings_text: "Промяна на настройките",
submenu_resetsettings_text: "Възстановяване на канал",
modal_header_text: "Настройки за локални канали",
modal_channelname_text: "Локално име на канал",
modal_colorpicker1_text: "Локален цветен канал",
btn_cancel_text: "Зъбести",
btn_save_text: "Cпасяване"
};
case "ru": //russian
return {
context_localchannelsettings_text: "Настройки локального канала",
submenu_channelsettings_text: "Изменить настройки",
submenu_resetsettings_text: "Сбросить канал",
modal_header_text: "Настройки локального канала",
modal_channelname_text: "Имя локального канала",
modal_colorpicker1_text: "Цвет локального канала",
btn_cancel_text: "Отмена",
btn_save_text: "Cпасти"
};
case "uk": //ukrainian
return {
context_localchannelsettings_text: "Налаштування локального каналу",
submenu_channelsettings_text: "Змінити налаштування",
submenu_resetsettings_text: "Скидання каналу",
modal_header_text: "Налаштування локального каналу",
modal_channelname_text: "Локальне ім'я каналу",
modal_colorpicker1_text: "Колір місцевого каналу",
btn_cancel_text: "Скасувати",
btn_save_text: "Зберегти"
};
case "ja": //japanese
return {
context_localchannelsettings_text: "ローカルチャネル設定",
submenu_channelsettings_text: "設定を変更する",
submenu_resetsettings_text: "チャネルをリセットする",
modal_header_text: "ローカルチャネル設定",
modal_channelname_text: "ローカルチャネル名",
modal_colorpicker1_text: "ローカルチャネルの色",
btn_cancel_text: "キャンセル",
btn_save_text: "セーブ"
};
case "zh-TW": //chinese (traditional)
return {
context_localchannelsettings_text: "本地頻道設置",
submenu_channelsettings_text: "更改設置",
submenu_resetsettings_text: "重置通道",
modal_header_text: "本地頻道設置",
modal_channelname_text: "本地頻道名稱",
modal_colorpicker1_text: "本地頻道顏色",
btn_cancel_text: "取消",
btn_save_text: "保存"
};
case "ko": //korean
return {
context_localchannelsettings_text: "로컬 채널 설정",
submenu_channelsettings_text: "설정 변경",
submenu_resetsettings_text: "채널 재설정",
modal_header_text: "로컬 채널 설정",
modal_channelname_text: "로컬 채널 이름",
modal_colorpicker1_text: "지역 채널 색깔",
btn_cancel_text: "취소",
btn_save_text: "저장"
};
default: //default: english
return {
context_localchannelsettings_text: "Local Channelsettings",
submenu_channelsettings_text: "Change Settings",
submenu_resetsettings_text: "Reset Channel",
modal_header_text: "Local Channelsettings",
modal_channelname_text: "Local Channelname",
modal_colorpicker1_text: "Local Channelcolor",
btn_cancel_text: "Cancel",
btn_save_text: "Save"
};
}
}
}
};

View File

@ -1,8 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Edit Servers - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditServers/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditServers/config.json)
Adds two options on your server context menu.
- You can open a popout, where you can change the local name, initials, icon and color for the selected server.
- You can set the selected server back to its original state.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "EditServers",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Allows you to change the icon, name and color of servers. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,951 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.labels = {};
this.patchModules = {
"GuildIcon":"componentDidMount",
"GuildHeader":["componentDidMount","componentDidUpdate"],
"Clickable":"componentDidMount"
};
this.serverContextEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} localserversettings-item ${BDFDB.disCN.contextmenuitemsubmenu}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_localserversettings_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>`;
this.serverContextSubMenuMarkup =
`<div class="${BDFDB.disCN.contextmenu} editservers-submenu">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} serversettings-item">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_submenu_serversettings_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
<div class="${BDFDB.disCN.contextmenuitem} resetsettings-item ${BDFDB.disCN.contextmenuitemdisabled}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_submenu_resetsettings_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>
</div>`;
this.serverSettingsModalMarkup =
`<span class="${this.name}-modal DevilBro-modal">
<div class="${BDFDB.disCN.backdrop}"></div>
<div class="${BDFDB.disCN.modal}">
<div class="${BDFDB.disCN.modalinner}">
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto; padding-bottom: 10px;">
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">REPLACE_modal_header_text</h4>
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCN.primary}"></div>
</div>
<button type="button" class="${BDFDB.disCNS.modalclose + BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">
<svg name="Close" width="18" height="18" viewBox="0 0 12 12" style="flex: 0 1 auto;">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h12v12H0"></path>
<path class="fill" fill="currentColor" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path>
</g>
</svg>
</div>
</button>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.marginbottom8 + BDFDB.disCN.tabbarcontainer}" style="flex: 0 0 auto; padding-right: 12px;">
<div class="${BDFDB.disCNS.tabbar + BDFDB.disCN.tabbartop}">
<div tab="server" class="${BDFDB.disCNS.settingsitemdefault + BDFDB.disCNS.settingsitem + BDFDB.disCNS.settingsnotselected + BDFDB.disCN.tabbaritem}">REPLACE_modal_tabheader1_text</div>
<div tab="icon" class="${BDFDB.disCNS.settingsitemdefault + BDFDB.disCNS.settingsitem + BDFDB.disCNS.settingsnotselected + BDFDB.disCN.tabbaritem}">REPLACE_modal_tabheader2_text</div>
<div tab="tooltip" class="${BDFDB.disCNS.settingsitemdefault + BDFDB.disCNS.settingsitem + BDFDB.disCNS.settingsnotselected + BDFDB.disCN.tabbaritem}">REPLACE_modal_tabheader3_text</div>
</div>
</div>
<div class="${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.modalcontent + BDFDB.disCNS.scrollerthemed + BDFDB.disCN.themeghosthairline}">
<div class="${BDFDB.disCNS.scroller + BDFDB.disCN.modalsubinner}">
<div tab="server" class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20} tab-content" style="flex: 1 1 auto;">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">REPLACE_modal_servername_text</h3>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">
<div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16}" id="input-servername"></div>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">REPLACE_modal_servershortname_text</h3>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">
<div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16}" id="input-servershortname"></div>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">REPLACE_modal_serverurl_text</h3>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">
<div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16}" id="input-serverurl"></div>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">REPLACE_modal_removeicon_text</h3>
<div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;">
<input type="checkbox" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner}" id="input-removeicon">
</div>
</div>
</div>
<div tab="icon" class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20} tab-content" style="flex: 1 1 auto;">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">REPLACE_modal_colorpicker1_text</h3>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} swatches" style="flex: 1 1 auto;"></div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">REPLACE_modal_colorpicker2_text</h3>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} swatches" style="flex: 1 1 auto;"></div>
</div>
<div tab="tooltip" class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20} tab-content" style="flex: 1 1 auto;">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">REPLACE_modal_colorpicker3_text</h3>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} swatches" style="flex: 1 1 auto;"></div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">REPLACE_modal_colorpicker4_text</h3>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} swatches" style="flex: 1 1 auto;"></div>
</div>
</div>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
<button type="button" class="btn-save ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_save_text</div>
</button>
</div>
</div>
</div>
</div>
</span>`;
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
let data = BDFDB.loadAllData(this, "servers");
BDFDB.removeAllData(this, "servers");
BDFDB.WebModules.forceAllUpdates(this);
BDFDB.saveAllData(data, this, "servers");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
changeLanguageStrings () {
this.serverContextEntryMarkup = this.serverContextEntryMarkup.replace("REPLACE_context_localserversettings_text", this.labels.context_localserversettings_text);
this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_serversettings_text", this.labels.submenu_serversettings_text);
this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_resetsettings_text", this.labels.submenu_resetsettings_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_servername_text", this.labels.modal_servername_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_servershortname_text", this.labels.modal_servershortname_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_serverurl_text", this.labels.modal_serverurl_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_removeicon_text", this.labels.modal_removeicon_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_tabheader1_text", this.labels.modal_tabheader1_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_tabheader2_text", this.labels.modal_tabheader2_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_tabheader3_text", this.labels.modal_tabheader3_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_colorpicker1_text", this.labels.modal_colorpicker1_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_colorpicker2_text", this.labels.modal_colorpicker2_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_colorpicker3_text", this.labels.modal_colorpicker3_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_colorpicker4_text", this.labels.modal_colorpicker4_text);
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_btn_save_text", this.labels.btn_save_text);
}
onGuildContextMenu (instance, menu) {
if (instance.props && instance.props.target && instance.props.guild && !menu.querySelector(".localserversettings-item")) {
let serverContextEntry = BDFDB.htmlToElement(this.serverContextEntryMarkup);
menu.appendChild(serverContextEntry);
let settingsitem = serverContextEntry.querySelector(".localserversettings-item");
settingsitem.addEventListener("mouseenter", () => {
let serverContextSubMenu = BDFDB.htmlToElement(this.serverContextSubMenuMarkup);
let serveritem = serverContextSubMenu.querySelector(".serversettings-item");
serveritem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
this.showServerSettings(instance.props.guild);
});
if (BDFDB.loadData(instance.props.guild.id, this, "servers")) {
let resetitem = serverContextSubMenu.querySelector(".resetsettings-item");
BDFDB.removeClass(resetitem, BDFDB.disCN.contextmenuitemdisabled);
resetitem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
BDFDB.removeData(instance.props.guild.id, this, "servers");
BDFDB.WebModules.forceAllUpdates(this);
});
}
BDFDB.appendSubMenu(settingsitem, serverContextSubMenu);
});
}
}
showServerSettings (info) {
var {name,shortName,url,removeIcon,color1,color2,color3,color4} = BDFDB.loadData(info.id, this, "servers") || {};
let serverSettingsModal = BDFDB.htmlToElement(this.serverSettingsModalMarkup);
let servernameinput = serverSettingsModal.querySelector("#input-servername");
let servershortnameinput = serverSettingsModal.querySelector("#input-servershortname");
let serverurlinput = serverSettingsModal.querySelector("#input-serverurl");
let removeiconinput = serverSettingsModal.querySelector("#input-removeicon");
serverSettingsModal.querySelector(BDFDB.dotCN.modalguildname).innerText = info.name;
servernameinput.value = name || "";
servernameinput.setAttribute("placeholder", info.name);
servershortnameinput.value = shortName || (info.icon ? "" : info.acronym);
servershortnameinput.setAttribute("placeholder", info.acronym);
serverurlinput.value = url || "";
serverurlinput.setAttribute("placeholder", BDFDB.getGuildIcon(info.id) || "");
BDFDB.toggleClass(serverurlinput, "valid", serverurlinput.value.length > 0);
serverurlinput.disabled = removeIcon;
removeiconinput.checked = removeIcon;
BDFDB.setColorSwatches(serverSettingsModal, color1);
BDFDB.setColorSwatches(serverSettingsModal, color2);
BDFDB.setColorSwatches(serverSettingsModal, color3);
BDFDB.setColorSwatches(serverSettingsModal, color4);
BDFDB.appendModal(serverSettingsModal);
removeiconinput.addEventListener("click", () => {
serverurlinput.disabled = removeiconinput.checked;
});
serverurlinput.addEventListener("input", () => {
this.checkUrl(serverurlinput);
});
serverurlinput.addEventListener("mouseenter", () => {
BDFDB.addClass(serverurlinput, "hovering");
this.createNoticeTooltip(serverurlinput);
});
serverurlinput.addEventListener("mouseleave", () => {
BDFDB.removeClass(serverurlinput, "hovering");
BDFDB.removeEles(BDFDB.dotCNS.tooltips + ".notice-tooltip");
});
BDFDB.addChildEventListener(serverSettingsModal, "click", ".btn-save", e => {
e.preventDefault();
name = servernameinput.value.trim();
name = name ? name : null;
shortName = servershortnameinput.value.trim();
shortName = shortName && shortName != info.acronym ? shortName : null;
removeIcon = removeiconinput.checked;
url = !removeIcon && BDFDB.containsClass(serverurlinput, "valid") ? serverurlinput.value.trim() : null;
url = url ? url : null;
color1 = BDFDB.getSwatchColor(serverSettingsModal, 1);
color2 = BDFDB.getSwatchColor(serverSettingsModal, 2);
color3 = BDFDB.getSwatchColor(serverSettingsModal, 3);
color4 = BDFDB.getSwatchColor(serverSettingsModal, 4);
if (name == null && shortName == null && url == null && !removeIcon && color1 == null && color2 == null && color3 == null && color4 == null) {
BDFDB.removeData(info.id, this, "servers");
}
else {
BDFDB.saveData(info.id, {name,shortName,url,removeIcon,color1,color2,color3,color4}, this, "servers");
}
BDFDB.WebModules.forceAllUpdates(this);
});
servernameinput.focus();
}
checkUrl (input) {
BDFDB.removeEles(BDFDB.dotCNS.tooltips + ".notice-tooltip");
if (!input.value) {
BDFDB.removeClass(input, "valid");
BDFDB.removeClass(input, "invalid");
}
else {
require("request")(input.value, (error, response, result) => {
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
BDFDB.addClass(input, "valid");
BDFDB.removeClass(input, "invalid");
}
else {
BDFDB.removeClass(input, "valid");
BDFDB.addClass(input, "invalid");
}
if (BDFDB.containsClass(input, "hovering")) this.createNoticeTooltip(input);
});
}
}
createNoticeTooltip (input) {
var disabled = input.disabled;
var valid = BDFDB.containsClass(input, "valid");
var invalid = BDFDB.containsClass(input, "invalid");
if (disabled || valid || invalid) {
BDFDB.createTooltip(disabled ? this.labels.modal_ignoreurl_text : valid ? this.labels.modal_validurl_text : this.labels.modal_invalidurl_text, input, {type:"right",selector:"notice-tooltip",color: disabled ? "black" : invalid ? "red" : "green"});
}
}
processGuildIcon (instance, wrapper) {
if (instance.props && instance.props.guild) {
let icon = wrapper.classList && BDFDB.containsClass(wrapper, BDFDB.disCN.avataricon) ? wrapper : wrapper.querySelector(BDFDB.dotCN.avataricon);
if (!icon) return;
this.changeGuildIcon(instance.props.guild, icon);
if (BDFDB.getParentEle(BDFDB.dotCN.guild, icon)) this.changeTooltip(instance.props.guild, wrapper, "right");
else if (BDFDB.getParentEle(BDFDB.dotCN.friendscolumn, icon)) this.changeTooltip(instance.props.guild, icon.parentElement, "top");
}
}
processGuildHeader (instance, wrapper) {
if (instance.props && instance.props.guild) {
this.changeGuildName(instance.props.guild, wrapper.querySelector(BDFDB.dotCN.guildheadername));
}
}
processClickable (instance, wrapper) {
if (!wrapper || !instance.props || !instance.props.className) return;
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.userprofilelistrow) > -1) {
let guild = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.guild");
if (guild && BDFDB.getReactValue(instance, "_reactInternalFiber.return.type.displayName") == "GuildRow") {
this.changeGuildName(guild, wrapper.querySelector(BDFDB.dotCN.userprofilelistname));
}
}
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.quickswitchresult) > -1) {
let result = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.result");
if (result && result.type == "GUILD") {
this.changeGuildName(result.record, wrapper.querySelector(BDFDB.dotCN.quickswitchresultmatch));
}
else if (result && result.type.indexOf("_CHANNEL") != -1 && result.record && result.record.guild_id) {
this.changeGuildName(this.GuildUtils.getGuild(result.record.guild_id), wrapper.querySelector(BDFDB.dotCN.quickswitchresultmisccontainer));
}
}
}
changeGuildName (info, guildname) {
if (!info || !guildname || !guildname.parentElement) return;
if (guildname.EditServersChangeObserver && typeof guildname.EditServersChangeObserver.disconnect == "function") guildname.EditServersChangeObserver.disconnect();
let data = BDFDB.loadData(info.id, this, "servers") || {};
if (data.name || data.color2 || guildname.getAttribute("changed-by-editservers")) {
guildname.style.setProperty("color", BDFDB.colorCONVERT(data.color2, "RGB"), "important");
BDFDB.setInnerText(guildname, data.name || info.name);
if (data.name || data.color2) {
guildname.setAttribute("changed-by-editservers", true);
guildname.EditServersChangeObserver = new MutationObserver((changes, _) => {
guildname.EditServersChangeObserver.disconnect();
this.changeName(info, guildname);
});
guildname.EditServersChangeObserver.observe(guildname, {attributes:true});
}
else guildname.removeAttribute("changed-by-editservers");
}
}
changeGuildIcon (info, icon) {
if (!info || !icon || !icon.parentElement) return;
if (icon.EditServersChangeObserver && typeof icon.EditServersChangeObserver.disconnect == "function") icon.EditServersChangeObserver.disconnect();
let data = BDFDB.loadData(info.id, this, "servers") || {};
if (data.url || data.removeIcon || icon.getAttribute("changed-by-editservers")) {
if (icon.tagName == "IMG") icon.setAttribute("src", data.removeIcon ? null : (data.url || BDFDB.getGuildIcon(info.id)));
else {
BDFDB.setInnerText(icon, data.url ? "" : (data.shortName || (info.icon && !data.removeIcon ? "" : info.acronym)));
icon.style.setProperty("background-image", data.removeIcon || data.shortName ? null : `url(${data.url || BDFDB.getGuildIcon(info.id)})`);
icon.style.setProperty("background-color", BDFDB.colorCONVERT(data.color1, "RGB"), "important");
icon.style.setProperty("color", BDFDB.colorCONVERT(data.color2, "RGB", "important"));
icon.style.setProperty("font-size", this.getFontSize(icon));
let hasicon = icon.style.getPropertyValue("background-image");
if (hasicon) BDFDB.removeClass(icon, this.getNoIconClasses(icon));
else BDFDB.addClass(icon, this.getNoIconClasses(icon));
if (data.url && !data.removeIcon) {
icon.style.setProperty("background-position", "center");
icon.style.setProperty("background-size", "cover");
}
}
if (data.url || data.removeIcon) {
icon.setAttribute("changed-by-editservers", true);
icon.EditServersChangeObserver = new MutationObserver((changes, _) => {
changes.forEach(
(change, i) => {
icon.EditServersChangeObserver.disconnect();
this.changeGuildIcon(info, icon);
}
);
});
icon.EditServersChangeObserver.observe(icon, {attributes:true});
}
else icon.removeAttribute("changed-by-editservers");
}
}
changeTooltip (info, wrapper, type) {
if (!info || !wrapper || !wrapper.parentElement) return;
let data = BDFDB.loadData(info.id, this, "servers") || {};
wrapper.removeEventListener("mouseenter", wrapper.tooltipListenerEditServers);
if (data.name || data.color3 || data.color4) {
var bgColor = data.color3 ? BDFDB.colorCONVERT(data.color3, "RGB") : "";
var fontColor = data.color4 ? BDFDB.colorCONVERT(data.color4, "RGB") : "";
wrapper.tooltipListenerEditServers = () => {
BDFDB.createTooltip(data.name || info.name, wrapper, {type,selector:"EditServers-tooltip",style:`color: ${fontColor} !important; background-color: ${bgColor} !important; border-color: ${bgColor} !important;`,css:`body ${BDFDB.dotCN.tooltip}:not(.EditServers-tooltip) {display: none !important;}`});
};
wrapper.addEventListener("mouseenter", wrapper.tooltipListenerEditServers);
}
}
getFontSize (icon) {
if (icon.style.getPropertyValue("background-image")) return null;
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizexlarge)) return "12px";
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizelarge)) return "10px";
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizemedium)) return "8px";
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizesmall)) return "4.8px";
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizemini)) return "4px";
else return "10px";
}
getNoIconClasses (icon) {
let noiconclasses = [BDFDB.disCN.avatarnoicon];
if (BDFDB.containsClass(icon, BDFDB.disCN.userprofilelistavatar)) noiconclasses.push(BDFDB.disCN.userprofilelistguildavatarwithouticon);
return noiconclasses;
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Reset all Servers.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} reset-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to reset all servers?", () => {
BDFDB.removeAllData(this, "servers");
BDFDB.WebModules.forceAllUpdates(this);
});
});
return settingspanel;
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {
context_localserversettings_text: "Lokalne postavke poslužitelja",
submenu_serversettings_text: "Promijeni postavke",
submenu_resetsettings_text: "Ponovno postavite poslužitelj",
modal_header_text: "Lokalne postavke poslužitelja",
modal_servername_text: "Naziv lokalnog poslužitelja",
modal_servershortname_text: "Poslužitelj prečaca",
modal_serverurl_text: "Ikona",
modal_removeicon_text: "Ukloni ikonu",
modal_tabheader1_text: "Poslužitelja",
modal_tabheader2_text: "Boja ikona",
modal_tabheader3_text: "Boja tooltip",
modal_colorpicker1_text: "Boja ikona",
modal_colorpicker2_text: "Boja fonta",
modal_colorpicker3_text: "Boja tooltip",
modal_colorpicker4_text: "Boja fonta",
modal_ignoreurl_text: "URL ignorirati",
modal_validurl_text: "Vrijedi URL",
modal_invalidurl_text: "Nevažeći URL",
btn_cancel_text: "Prekid",
btn_save_text: "Uštedjeti"
};
case "da": //danish
return {
context_localserversettings_text: "Lokal serverindstillinger",
submenu_serversettings_text: "Skift indstillinger",
submenu_resetsettings_text: "Nulstil server",
modal_header_text: "Lokal serverindstillinger",
modal_servername_text: "Lokalt servernavn",
modal_servershortname_text: "Initialer",
modal_serverurl_text: "Ikon",
modal_removeicon_text: "Fjern ikon",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Ikonfarve",
modal_tabheader3_text: "Tooltipfarve",
modal_colorpicker1_text: "Ikonfarve",
modal_colorpicker2_text: "Skriftfarve",
modal_colorpicker3_text: "Tooltipfarve",
modal_colorpicker4_text: "Skriftfarve",
modal_ignoreurl_text: "Ignorer URL",
modal_validurl_text: "Gyldig URL",
modal_invalidurl_text: "Ugyldig URL",
btn_cancel_text: "Afbryde",
btn_save_text: "Spare"
};
case "de": //german
return {
context_localserversettings_text: "Lokale Servereinstellungen",
submenu_serversettings_text: "Einstellungen ändern",
submenu_resetsettings_text: "Server zurücksetzen",
modal_header_text: "Lokale Servereinstellungen",
modal_servername_text: "Lokaler Servername",
modal_servershortname_text: "Serverkürzel",
modal_serverurl_text: "Icon",
modal_removeicon_text: "Entferne Icon",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Iconfarbe",
modal_tabheader3_text: "Tooltipfarbe",
modal_colorpicker1_text: "Iconfarbe",
modal_colorpicker2_text: "Schriftfarbe",
modal_colorpicker3_text: "Tooltipfarbe",
modal_colorpicker4_text: "Schriftfarbe",
modal_ignoreurl_text: "URL ignorieren",
modal_validurl_text: "Gültige URL",
modal_invalidurl_text: "Ungültige URL",
btn_cancel_text: "Abbrechen",
btn_save_text: "Speichern"
};
case "es": //spanish
return {
context_localserversettings_text: "Ajustes local de servidor",
submenu_serversettings_text: "Cambiar ajustes",
submenu_resetsettings_text: "Restablecer servidor",
modal_header_text: "Ajustes local de servidor",
modal_servername_text: "Nombre local del servidor",
modal_servershortname_text: "Iniciales",
modal_serverurl_text: "Icono",
modal_removeicon_text: "Eliminar icono",
modal_tabheader1_text: "Servidor",
modal_tabheader2_text: "Color del icono",
modal_tabheader3_text: "Color de tooltip",
modal_colorpicker1_text: "Color del icono",
modal_colorpicker2_text: "Color de fuente",
modal_colorpicker3_text: "Color de tooltip",
modal_colorpicker4_text: "Color de fuente",
modal_ignoreurl_text: "Ignorar URL",
modal_validurl_text: "URL válida",
modal_invalidurl_text: "URL inválida",
btn_cancel_text: "Cancelar",
btn_save_text: "Guardar"
};
case "fr": //french
return {
context_localserversettings_text: "Paramètres locale du serveur",
submenu_serversettings_text: "Modifier les paramètres",
submenu_resetsettings_text: "Réinitialiser le serveur",
modal_header_text: "Paramètres locale du serveur",
modal_servername_text: "Nom local du serveur",
modal_servershortname_text: "Initiales",
modal_serverurl_text: "Icône",
modal_removeicon_text: "Supprimer l'icône",
modal_tabheader1_text: "Serveur",
modal_tabheader2_text: "Couleur de l'icône",
modal_tabheader3_text: "Couleur de tooltip",
modal_colorpicker1_text: "Couleur de l'icône",
modal_colorpicker2_text: "Couleur de la police",
modal_colorpicker3_text: "Couleur de tooltip",
modal_colorpicker4_text: "Couleur de la police",
modal_ignoreurl_text: "Ignorer l'URL",
modal_validurl_text: "URL valide",
modal_invalidurl_text: "URL invalide",
btn_cancel_text: "Abandonner",
btn_save_text: "Enregistrer"
};
case "it": //italian
return {
context_localserversettings_text: "Impostazioni locale server",
submenu_serversettings_text: "Cambia impostazioni",
submenu_resetsettings_text: "Ripristina server",
modal_header_text: "Impostazioni locale server",
modal_servername_text: "Nome locale server",
modal_servershortname_text: "Iniziali",
modal_serverurl_text: "Icona",
modal_removeicon_text: "Rimuova l'icona",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Colore dell'icona",
modal_tabheader3_text: "Colore della tooltip",
modal_colorpicker1_text: "Colore dell'icona",
modal_colorpicker2_text: "Colore del carattere",
modal_colorpicker3_text: "Colore della tooltip",
modal_colorpicker4_text: "Colore del carattere",
modal_ignoreurl_text: "Ignora l'URL",
modal_validurl_text: "URL valido",
modal_invalidurl_text: "URL non valido",
btn_cancel_text: "Cancellare",
btn_save_text: "Salvare"
};
case "nl": //dutch
return {
context_localserversettings_text: "Lokale serverinstellingen",
submenu_serversettings_text: "Verandere instellingen",
submenu_resetsettings_text: "Reset server",
modal_header_text: "Lokale serverinstellingen",
modal_servername_text: "Lokale servernaam",
modal_servershortname_text: "Initialen",
modal_serverurl_text: "Icoon",
modal_removeicon_text: "Verwijder icoon",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Icoonkleur",
modal_tabheader3_text: "Tooltipkleur",
modal_colorpicker1_text: "Icoonkleur",
modal_colorpicker2_text: "Doopvontkleur",
modal_colorpicker3_text: "Tooltipkleur",
modal_colorpicker4_text: "Doopvontkleur",
modal_ignoreurl_text: "URL negeren",
modal_validurl_text: "Geldige URL",
modal_invalidurl_text: "Ongeldige URL",
btn_cancel_text: "Afbreken",
btn_save_text: "Opslaan"
};
case "no": //norwegian
return {
context_localserversettings_text: "Lokal serverinnstillinger",
submenu_serversettings_text: "Endre innstillinger",
submenu_resetsettings_text: "Tilbakestill server",
modal_header_text: "Lokal serverinnstillinger",
modal_servername_text: "Lokalt servernavn",
modal_servershortname_text: "Initialer",
modal_serverurl_text: "Ikon",
modal_removeicon_text: "Fjern ikon",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Ikonfarge",
modal_tabheader3_text: "Tooltipfarge",
modal_colorpicker1_text: "Ikonfarge",
modal_colorpicker2_text: "Skriftfarge",
modal_colorpicker3_text: "Tooltipfarge",
modal_colorpicker4_text: "Skriftfarge",
modal_ignoreurl_text: "Ignorer URL",
modal_validurl_text: "Gyldig URL",
modal_invalidurl_text: "Ugyldig URL",
btn_cancel_text: "Avbryte",
btn_save_text: "Lagre"
};
case "pl": //polish
return {
context_localserversettings_text: "Lokalne ustawienia serwera",
submenu_serversettings_text: "Zmień ustawienia",
submenu_resetsettings_text: "Resetuj ustawienia",
modal_header_text: "Lokalne ustawienia serwera",
modal_servername_text: "Lokalna nazwa serwera",
modal_servershortname_text: "Krótka nazwa",
modal_serverurl_text: "Ikona",
modal_removeicon_text: "Usuń ikonę",
modal_tabheader1_text: "Serwer",
modal_tabheader2_text: "Kolor ikony",
modal_tabheader3_text: "Kolor podpowiedzi",
modal_colorpicker1_text: "Kolor ikony",
modal_colorpicker2_text: "Kolor czcionki",
modal_colorpicker3_text: "Kolor podpowiedzi",
modal_colorpicker4_text: "Kolor czcionki",
modal_ignoreurl_text: "Ignoruj URL",
modal_validurl_text: "Prawidłowe URL",
modal_invalidurl_text: "Nieprawidłowe URL",
btn_cancel_text: "Anuluj",
btn_save_text: "Zapisz"
};
case "pt-BR": //portuguese (brazil)
return {
context_localserversettings_text: "Configurações local do servidor",
submenu_serversettings_text: "Mudar configurações",
submenu_resetsettings_text: "Redefinir servidor",
modal_header_text: "Configurações local do servidor",
modal_servername_text: "Nome local do servidor",
modal_servershortname_text: "Iniciais",
modal_serverurl_text: "Icone",
modal_removeicon_text: "Remover ícone",
modal_tabheader1_text: "Servidor",
modal_tabheader2_text: "Cor do ícone",
modal_tabheader3_text: "Cor da tooltip",
modal_colorpicker1_text: "Cor do ícone",
modal_colorpicker2_text: "Cor da fonte",
modal_colorpicker3_text: "Cor da tooltip",
modal_colorpicker4_text: "Cor da fonte",
modal_ignoreurl_text: "Ignorar URL",
modal_validurl_text: "URL válido",
modal_invalidurl_text: "URL inválida",
btn_cancel_text: "Cancelar",
btn_save_text: "Salvar"
};
case "fi": //finnish
return {
context_localserversettings_text: "Paikallinen palvelimen asetukset",
submenu_serversettings_text: "Vaihda asetuksia",
submenu_resetsettings_text: "Nollaa palvelimen",
modal_header_text: "Paikallinen palvelimen asetukset",
modal_servername_text: "Paikallinen palvelimenimi",
modal_servershortname_text: "Nimikirjaimet",
modal_serverurl_text: "Ikonin",
modal_removeicon_text: "Poista kuvake",
modal_tabheader1_text: "Palvelimen",
modal_tabheader2_text: "Ikoninväri",
modal_tabheader3_text: "Tooltipväri",
modal_colorpicker1_text: "Ikoninväri",
modal_colorpicker2_text: "Fontinväri",
modal_colorpicker3_text: "Tooltipväri",
modal_colorpicker4_text: "Fontinväri",
modal_ignoreurl_text: "Ohita URL",
modal_validurl_text: "Voimassa URL",
modal_invalidurl_text: "Virheellinen URL",
btn_cancel_text: "Peruuttaa",
btn_save_text: "Tallentaa"
};
case "sv": //swedish
return {
context_localserversettings_text: "Lokal serverinställningar",
submenu_serversettings_text: "Ändra inställningar",
submenu_resetsettings_text: "Återställ server",
modal_header_text: "Lokal serverinställningar",
modal_servername_text: "Lokalt servernamn",
modal_servershortname_text: "Initialer",
modal_serverurl_text: "Ikon",
modal_removeicon_text: "Ta bort ikonen",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Ikonfärg",
modal_tabheader3_text: "Tooltipfärg",
modal_colorpicker1_text: "Ikonfärg",
modal_colorpicker2_text: "Fontfärg",
modal_colorpicker3_text: "Tooltipfärg",
modal_colorpicker4_text: "Fontfärg",
modal_ignoreurl_text: "Ignorera URL",
modal_validurl_text: "Giltig URL",
modal_invalidurl_text: "Ogiltig URL",
btn_cancel_text: "Avbryta",
btn_save_text: "Spara"
};
case "tr": //turkish
return {
context_localserversettings_text: "Yerel Sunucu Ayarları",
submenu_serversettings_text: "Ayarları Değiştir",
submenu_resetsettings_text: "Sunucu Sıfırla",
modal_header_text: "Yerel Sunucu Ayarları",
modal_servername_text: "Yerel Sunucu Adı",
modal_servershortname_text: "Baş harfleri",
modal_serverurl_text: "Simge",
modal_removeicon_text: "Simge kaldır",
modal_tabheader1_text: "Sunucu",
modal_tabheader2_text: "Simge rengi",
modal_tabheader3_text: "Tooltip rengi",
modal_colorpicker1_text: "Simge rengi",
modal_colorpicker2_text: "Yazı rengi",
modal_colorpicker3_text: "Tooltip rengi",
modal_colorpicker4_text: "Yazı rengi",
modal_ignoreurl_text: "URL yoksay",
modal_validurl_text: "Geçerli URL",
modal_invalidurl_text: "Geçersiz URL",
btn_cancel_text: "Iptal",
btn_save_text: "Kayıt"
};
case "cs": //czech
return {
context_localserversettings_text: "Místní nastavení serveru",
submenu_serversettings_text: "Změnit nastavení",
submenu_resetsettings_text: "Obnovit server",
modal_header_text: "Místní nastavení serveru",
modal_servername_text: "Místní název serveru",
modal_servershortname_text: "Iniciály",
modal_serverurl_text: "Ikony",
modal_removeicon_text: "Odstranit ikonu",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Barva ikony",
modal_tabheader3_text: "Barva tooltip",
modal_colorpicker1_text: "Barva ikony",
modal_colorpicker2_text: "Barva fontu",
modal_colorpicker3_text: "Barva tooltip",
modal_colorpicker4_text: "Barva fontu",
modal_ignoreurl_text: "Ignorovat URL",
modal_validurl_text: "Platná URL",
modal_invalidurl_text: "Neplatná URL",
btn_cancel_text: "Zrušení",
btn_save_text: "Uložit"
};
case "bg": //bulgarian
return {
context_localserversettings_text: "Настройки за локални cървър",
submenu_serversettings_text: "Промяна на настройките",
submenu_resetsettings_text: "Възстановяване на cървър",
modal_header_text: "Настройки за локални cървър",
modal_servername_text: "Локално име на cървър",
modal_servershortname_text: "Инициали",
modal_serverurl_text: "Икона",
modal_removeicon_text: "Премахване на иконата",
modal_tabheader1_text: "Cървър",
modal_tabheader2_text: "Цвят на иконата",
modal_tabheader3_text: "Цвят на подсказка",
modal_colorpicker1_text: "Цвят на иконата",
modal_colorpicker2_text: "Цвят на шрифта",
modal_colorpicker3_text: "Цвят на подсказка",
modal_colorpicker4_text: "Цвят на шрифта",
modal_ignoreurl_text: "Игнориране на URL",
modal_validurl_text: "Валиден URL",
modal_invalidurl_text: "Невалиден URL",
btn_cancel_text: "Зъбести",
btn_save_text: "Cпасяване"
};
case "ru": //russian
return {
context_localserversettings_text: "Настройки локального cервер",
submenu_serversettings_text: "Изменить настройки",
submenu_resetsettings_text: "Сбросить cервер",
modal_header_text: "Настройки локального cервер",
modal_servername_text: "Имя локального cервер",
modal_servershortname_text: "Инициалы",
modal_serverurl_text: "Значок",
modal_removeicon_text: "Удалить значок",
modal_tabheader1_text: "Cервер",
modal_tabheader2_text: "Цвет значков",
modal_tabheader3_text: "Цвет подсказка",
modal_colorpicker1_text: "Цвет значков",
modal_colorpicker2_text: "Цвет шрифта",
modal_colorpicker3_text: "Цвет подсказка",
modal_colorpicker4_text: "Цвет шрифта",
modal_ignoreurl_text: "Игнорировать URL",
modal_validurl_text: "Действительный URL",
modal_invalidurl_text: "Неверная URL",
btn_cancel_text: "Отмена",
btn_save_text: "Cпасти"
};
case "uk": //ukrainian
return {
context_localserversettings_text: "Налаштування локального cервер",
submenu_serversettings_text: "Змінити налаштування",
submenu_resetsettings_text: "Скидання cервер",
modal_header_text: "Налаштування локального cервер",
modal_servername_text: "Локальне ім'я cервер",
modal_servershortname_text: "Ініціали",
modal_serverurl_text: "Іконка",
modal_removeicon_text: "Видалити піктограму",
modal_tabheader1_text: "Cервер",
modal_tabheader2_text: "Колір ікони",
modal_tabheader3_text: "Колір підказка",
modal_colorpicker1_text: "Колір ікони",
modal_colorpicker2_text: "Колір шрифту",
modal_colorpicker3_text: "Колір підказка",
modal_colorpicker4_text: "Колір шрифту",
modal_ignoreurl_text: "Ігнорувати URL",
modal_validurl_text: "Дійсна URL",
modal_invalidurl_text: "Недійсна URL",
btn_cancel_text: "Скасувати",
btn_save_text: "Зберегти"
};
case "ja": //japanese
return {
context_localserversettings_text: "ローカルサーバー設定",
submenu_serversettings_text: "設定を変更する",
submenu_resetsettings_text: "サーバーをリセットする",
modal_header_text: "ローカルサーバー設定",
modal_servername_text: "ローカルサーバー名",
modal_servershortname_text: "イニシャル",
modal_serverurl_text: "アイコン",
modal_removeicon_text: "アイコンを削除",
modal_tabheader1_text: "サーバー",
modal_tabheader2_text: "アイコンの色",
modal_tabheader3_text: "ツールチップの色",
modal_colorpicker1_text: "アイコンの色",
modal_colorpicker2_text: "フォントの色",
modal_colorpicker3_text: "ツールチップの色",
modal_colorpicker4_text: "フォントの色",
modal_ignoreurl_text: "URL を無視する",
modal_validurl_text: "有効な URL",
modal_invalidurl_text: "無効な URL",
btn_cancel_text: "キャンセル",
btn_save_text: "セーブ"
};
case "zh-TW": //chinese (traditional)
return {
context_localserversettings_text: "本地服務器設置",
submenu_serversettings_text: "更改設置",
submenu_resetsettings_text: "重置服務器",
modal_header_text: "本地服務器設置",
modal_servername_text: "服務器名稱",
modal_servershortname_text: "聲母",
modal_serverurl_text: "圖標",
modal_removeicon_text: "刪除圖標",
modal_tabheader1_text: "服務器",
modal_tabheader2_text: "圖標顏色",
modal_tabheader3_text: "工具提示顏色",
modal_colorpicker1_text: "圖標顏色",
modal_colorpicker2_text: "字體顏色",
modal_colorpicker3_text: "工具提示顏色",
modal_colorpicker4_text: "字體顏色",
modal_ignoreurl_text: "忽略 URL",
modal_validurl_text: "有效的 URL",
modal_invalidurl_text: "無效的 URL",
btn_cancel_text: "取消",
btn_save_text: "保存"
};
case "ko": //korean
return {
context_localserversettings_text: "로컬 서버 설정",
submenu_serversettings_text: "설정 변경",
submenu_resetsettings_text: "서버 재설정",
modal_header_text: "로컬 서버 설정",
modal_servername_text: "로컬 서버 이름",
modal_servershortname_text: "머리 글자",
modal_serverurl_text: "상",
modal_removeicon_text: "상 삭제",
modal_tabheader1_text: "서버",
modal_tabheader2_text: "상 색깔",
modal_tabheader3_text: "툴팁 색깔",
modal_colorpicker1_text: "상 색깔",
modal_colorpicker2_text: "글꼴 색깔",
modal_colorpicker3_text: "툴팁 색깔",
modal_colorpicker4_text: "글꼴 색깔",
modal_ignoreurl_text: "URL 무시",
modal_validurl_text: "유효한 URL",
modal_invalidurl_text: "잘못된 URL",
btn_cancel_text: "취소",
btn_save_text: "저장"
};
default: //default: english
return {
context_localserversettings_text: "Local Serversettings",
submenu_serversettings_text: "Change Settings",
submenu_resetsettings_text: "Reset Server",
modal_header_text: "Local Serversettings",
modal_servername_text: "Local Servername",
modal_servershortname_text: "Initials",
modal_serverurl_text: "Icon",
modal_removeicon_text: "Remove Icon",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Iconcolor",
modal_tabheader3_text: "Tooltipcolor",
modal_colorpicker1_text: "Iconcolor",
modal_colorpicker2_text: "Fontcolor",
modal_colorpicker3_text: "Tooltipcolor",
modal_colorpicker4_text: "Fontcolor",
modal_ignoreurl_text: "Ignore URL",
modal_validurl_text: "Valid URL",
modal_invalidurl_text: "Invalid URL",
btn_cancel_text: "Cancel",
btn_save_text: "Save"
};
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Edit Users - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditUsers/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditUsers/config.json)
Allows you to change the icon, name, tag and color of users.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "EditUsers",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Allows you to change the icon, name, tag and color of users. Does not work in compact mode. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Emoji Statistics - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EmojiStatistics/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EmojiStatistics/config.json)
Adds several options to get more information about emojis and emojiservers.
- You can enable/disable the option to get the name and server of an emoji when you hover over it inside the emojipicker.
- You can enable/disable the option to add a button in the emojipicker to open an overview of your servers with some information.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "EmojiStatistics",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Adds some helpful options to show you more information about emojis and emojiservers. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,593 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.labels = {};
this.patchModules = {
"EmojiPicker":"componentDidMount"
};
this.css = `
.emojistatistics-tooltip,
.emoji-tooltip {
z-index: 2002;
}
.${this.name}-modal .titles {
height: 20px;
}
.${this.name}-modal .emojiserver-entry {
height: 50px;
padding-top: 5px;
padding-bottom: 5px;
}
.${this.name}-modal .emojiserver-entry .modal-emojiserver-icon {
display: inline-block;
}
.${this.name}-modal .titles-entry label,
.${this.name}-modal .emojiserver-entry label {
color: #b9bbbe;
display: inline-block;
flex: 1;
font-size: 12px;
font-weight: 600;
letter-spacing: .5px;
margin-left: 10px;
margin-top: 20px;
overflow: hidden;
vertical-align: top;
text-transform: uppercase;
}
.${this.name}-modal .emojiserver-entry label {
height: 12px;
overflow: hidden;
}
.${this.name}-modal .titles-entry label {
margin-top: 0px;
}
.${this.name}-modal .titles-entry .modal-titlesicon-label {
margin-left: 0px;
text-align: center;
width: 50px;
}
.${this.name}-modal .titles-entry .modal-titlesname-label,
.${this.name}-modal .emojiserver-entry .modal-emojiname-label {
width: 300px;
}
.${this.name}-modal .titles-entry .modal-sorttitle-label {
cursor: pointer;
}
.${this.name}-modal .titles-entry .modal-titlestotal-label,
.${this.name}-modal .titles-entry .modal-titlesglobal-label,
.${this.name}-modal .titles-entry .modal-titleslocal-label,
.${this.name}-modal .titles-entry .modal-titlescopies-label,
.${this.name}-modal .emojiserver-entry .modal-emojitotal-label,
.${this.name}-modal .emojiserver-entry .modal-emojiglobal-label,
.${this.name}-modal .emojiserver-entry .modal-emojilocal-label,
.${this.name}-modal .emojiserver-entry .modal-emojicopies-label {
text-align: center;
width: 82px;
}
.emojistatistics-button {
background-image: url("/assets/f24711dae4f6d6b28335e866a93e9d9b.png");
background-position: -770px -374px;
background-size: 924px 704px;
cursor: pointer;
height: 22px;
margin-right: 10px;
width: 22px;
}`;
this.emojiInformationModalMarkup =
`<span class="${this.name}-modal DevilBro-modal">
<div class="${BDFDB.disCN.backdrop}"></div>
<div class="${BDFDB.disCN.modal}">
<div class="${BDFDB.disCN.modalinner}">
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizelarge}">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">REPLACE_modal_header_text</h4>
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCN.primary}"></div>
</div>
<button type="button" class="${BDFDB.disCNS.modalclose + BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">
<svg name="Close" width="18" height="18" viewBox="0 0 12 12" style="flex: 0 1 auto;">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h12v12H0"></path>
<path class="fill" fill="currentColor" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path>
</g>
</svg>
</div>
</button>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalsubinner} titles" style="flex: 0 0 auto;"></div>
<div class="${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.modalcontent + BDFDB.disCNS.scrollerthemed + BDFDB.disCN.themeghosthairline}">
<div class="${BDFDB.disCNS.scroller + BDFDB.disCN.modalsubinner} entries"></div>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
<button type="button" class="btn-ok ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_ok_text</div>
</button>
</div>
</div>
</div>
</div>
</span>`;
this.emojiserverTitlesMarkup =
`<div class="titles-entry">
<label class="modal-titlesicon-label">REPLACE_modal_titlesicon-label</label>
<label class="modal-sorttitle-label modal-titlesname-label" sortkey="name">REPLACE_modal_titlesname_text</label>
<label class="modal-sorttitle-label modal-titlestotal-label" sortkey="total">REPLACE_modal_titlestotal_text</label>
<label class="modal-sorttitle-label modal-titlesglobal-label" sortkey="global">REPLACE_modal_titlesglobal_text</label>
<label class="modal-sorttitle-label modal-titleslocal-label" sortkey="local">REPLACE_modal_titleslocal_text</label>
<label class="modal-sorttitle-label modal-titlescopies-label" sortkey="copies">REPLACE_modal_titlescopies_text</label>
</div>`;
this.emojiserverEntryMarkup =
`<div class="emojiserver-entry">
<div class="modal-emojiserver-icon"></div>
<label class="modal-emojiname-label">modal-emojiname-label</label>
<label class="modal-emojitotal-label">modal-emojitotal-label</label>
<label class="modal-emojiglobal-label">modal-emojiglobal-label</label>
<label class="modal-emojilocal-label">modal-emojilocal-label</label>
<label class="modal-emojicopies-label">modal-emojicopies-label</label>
</div>`;
this.defaults = {
settings: {
enableEmojiHovering: {value:true, description:"Show Information about Emojis on hover over an Emoji in the Emojipicker."},
enableEmojiStatisticsButton: {value:true, description:"Add a Button in the Emojipicker to open the Statistics Overview."}
},
amounts: {
hoverDelay: {value:1000, description:"Tooltip delay in millisec:"}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.GuildEmojis = BDFDB.WebModules.findByProperties("getGuildEmoji", "getDisambiguatedEmojiContext");
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".emoji-tooltip",".emojistatistics-button");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
changeLanguageStrings () {
this.emojiInformationModalMarkup = this.emojiInformationModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
this.emojiInformationModalMarkup = this.emojiInformationModalMarkup.replace("REPLACE_btn_ok_text", this.labels.btn_ok_text);
this.emojiInformationModalMarkup = this.emojiInformationModalMarkup.replace("REPLACE_btn_all_text", this.labels.btn_all_text);
this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlesicon-label", this.labels.modal_titlesicon_text);
this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlesname_text", this.labels.modal_titlesname_text);
this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlestotal_text", this.labels.modal_titlestotal_text);
this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlesglobal_text", this.labels.modal_titlesglobal_text);
this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titleslocal_text", this.labels.modal_titleslocal_text);
this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlescopies_text", this.labels.modal_titlescopies_text);
}
processEmojiPicker (instance, wrapper) {
if (!wrapper.querySelector(".emojistatistics-button")) {
let emojipickerdiversityselector = document.querySelector(BDFDB.dotCN.emojipickerdiversityselector);
if (!emojipickerdiversityselector) return;
this.loadEmojiList();
let settings = BDFDB.getAllData(this, "settings");
if (settings.enableEmojiStatisticsButton) {
let emojiStatisticsButton = BDFDB.htmlToElement(`<div class="emojistatistics-button"></div>`);
emojipickerdiversityselector.parentElement.insertBefore(emojiStatisticsButton, emojipickerdiversityselector);
emojiStatisticsButton.addEventListener("click", () => {
instance._reactInternalFiber.return.return.return.return.stateNode.close();
this.showEmojiInformationModal();
});
emojiStatisticsButton.addEventListener("mouseenter", e => {
BDFDB.createTooltip("Emoji Statistics", emojiStatisticsButton, {type:"top",selector:"emojistatistics-tooltip"});
});
}
if (settings.enableEmojiHovering) {
BDFDB.addEventListener(this, wrapper, "mouseenter", BDFDB.dotCN.emojipickeremojiitem, e => {
let data = this.emojiToServerList[e.target.style.getPropertyValue("background-image").replace('url("',"").replace('")',"")];
if (data) BDFDB.createTooltip(`${BDFDB.encodeToHTML(data.emoji)}\n${BDFDB.encodeToHTML(data.server)}`, e.target, {type:"right",selector:"emoji-tooltip",delay:BDFDB.getData("hoverDelay", this, "amounts")});
});
}
}
}
loadEmojiList () {
this.emojiReplicaList = {};
this.emojiToServerList = {};
for (let serverObj of BDFDB.readServerList()) {
for (let emoji of this.GuildEmojis.getGuildEmoji(serverObj.id)) {
this.emojiToServerList[emoji.url] = {emoji:emoji.allNamesString, server:serverObj.name};
if (emoji.managed) this.emojiReplicaList[emoji.name] = this.emojiReplicaList[emoji.name] != undefined;
}
}
}
showEmojiInformationModal () {
var emojiInformationModal = BDFDB.htmlToElement(this.emojiInformationModalMarkup);
let titlescontainer = emojiInformationModal.querySelector(".titles");
let entriescontainer = emojiInformationModal.querySelector(".entries");
if (!titlescontainer || !entriescontainer) return;
var titleEntry = BDFDB.htmlToElement(this.emojiserverTitlesMarkup);
titlescontainer.appendChild(titleEntry);
BDFDB.addChildEventListener(titleEntry, "click", ".modal-sorttitle-label ", e => {
var oldTitle = e.currentTarget.innerText;
var reverse = oldTitle.indexOf("▼") < 0 ? false : true;
titleEntry.querySelector(".modal-titlesname-label").innerText = this.labels.modal_titlesname_text;
titleEntry.querySelector(".modal-titlestotal-label").innerText = this.labels.modal_titlestotal_text;
titleEntry.querySelector(".modal-titlesglobal-label").innerText = this.labels.modal_titlesglobal_text;
titleEntry.querySelector(".modal-titleslocal-label").innerText = this.labels.modal_titleslocal_text;
titleEntry.querySelector(".modal-titlescopies-label").innerText = this.labels.modal_titlescopies_text;
var sortKey = "index";
if (oldTitle.indexOf("▲") < 0) {
sortKey = e.currentTarget.getAttribute("sortkey");
var title = this.labels["modal_titles" + sortKey + "_text"];
e.currentTarget.innerText = oldTitle.indexOf("▼") < 0 ? title + "▼" : title + "▲";
}
BDFDB.sortArrayByKey(entries, sortKey);
if (reverse) entries.reverse();
this.updateAllEntries(entriescontainer, entries);
});
var entries = [], index = 0;
for (let info of BDFDB.readServerList()) {
let amountGlobal = 0, amountLocal = 0, amountCopies = 0;
for (let emoji of this.GuildEmojis.getGuildEmoji(info.id)) {
if (emoji.managed) {
amountGlobal++;
if (this.emojiReplicaList[emoji.name]) amountCopies++;
}
else {
amountLocal++;
}
}
var emojiEntry = BDFDB.htmlToElement(this.emojiserverEntryMarkup);
emojiEntry.querySelector(".modal-emojiserver-icon").innerHTML = this.createCopyOfServer(info).outerHTML;
emojiEntry.querySelector(".modal-emojiname-label").innerText = info.name || "";
emojiEntry.querySelector(".modal-emojitotal-label").innerText = amountGlobal + amountLocal;
emojiEntry.querySelector(".modal-emojiglobal-label").innerText = amountGlobal;
emojiEntry.querySelector(".modal-emojilocal-label").innerText = amountLocal;
emojiEntry.querySelector(".modal-emojicopies-label").innerText = amountCopies;
entries.push({div:emojiEntry, index:index++, name:info.name || "", total:amountGlobal+amountLocal, global:amountGlobal, local:amountLocal, copies:amountCopies});
}
BDFDB.appendModal(emojiInformationModal);
this.updateAllEntries(entriescontainer, entries);
}
updateAllEntries (entriescontainer, entries) {
BDFDB.removeEles(entriescontainer.childNodes);
for (let entry of entries) {
if (entriescontainer.childElementCount) entriescontainer.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCN.modaldivider}"></div>`));
entriescontainer.appendChild(entry.div);
}
}
createCopyOfServer (info) {
let serverCopy = info.div.cloneNode(true);
BDFDB.toggleEles(serverCopy, true);
BDFDB.removeClass(serverCopy, BDFDB.disCN.guildunread, BDFDB.disCN.guildselected);
return serverCopy;
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var amounts = BDFDB.getAllData(this, "amounts");
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
for (let key in amounts) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCN.flexchild}" style="flex: 0 0 50%;">${this.defaults.amounts[key].description}</h3><div class="${BDFDB.disCN.inputwrapper} inputNumberWrapper ${BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn}" style="flex: 1 1 auto;"><span class="numberinput-buttons-zone"><span class="numberinput-button-up"></span><span class="numberinput-button-down"></span></span><input type="number" min="0" option="${key}" value="${amounts[key]}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} amountInput"></div></div>`;
}
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "input", ".amountInput", e => {
var input = parseInt(e.currentTarget.value);
if (!isNaN(input) && input > -1) BDFDB.saveData(e.currentTarget.getAttribute("option"), input, this, "amounts");
});
return settingspanel;
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {
modal_header_text: "Statistike o emojima",
modal_titlesicon_text: "Ikona",
modal_titlesname_text: "Naziv poslužitelja",
modal_titlestotal_text: "Cjelokupni:",
modal_titlesglobal_text: "Globalno:",
modal_titleslocal_text: "Kokalne:",
modal_titlescopies_text: "Kopije:",
btn_ok_text: "OK"
};
case "da": //danish
return {
modal_header_text: "Statistikker af emojis",
modal_titlesicon_text: "Icon",
modal_titlesname_text: "Servernavn",
modal_titlestotal_text: "Total:",
modal_titlesglobal_text: "Global:",
modal_titleslocal_text: "Lokal:",
modal_titlescopies_text: "Copies:",
btn_ok_text: "OK"
};
case "de": //german
return {
modal_header_text: "Statistiken über Emojis",
modal_titlesicon_text: "Icon",
modal_titlesname_text: "Servername",
modal_titlestotal_text: "Gesamt:",
modal_titlesglobal_text: "Global:",
modal_titleslocal_text: "Lokal:",
modal_titlescopies_text: "Kopien:",
btn_ok_text: "OK"
};
case "es": //spanish
return {
modal_header_text: "Estadísticas de emojis",
modal_titlesicon_text: "Icono",
modal_titlesname_text: "Nombre del servidor",
modal_titlestotal_text: "Total:",
modal_titlesglobal_text: "Global:",
modal_titleslocal_text: "Local:",
modal_titlescopies_text: "Copias:",
btn_ok_text: "OK"
};
case "fr": //french
return {
modal_header_text: "Statistiques des emojis",
modal_titlesicon_text: "Icône",
modal_titlesname_text: "Nom du serveur",
modal_titlestotal_text: "Total:",
modal_titlesglobal_text: "Global:",
modal_titleslocal_text: "Local:",
modal_titlescopies_text: "Copies:",
btn_ok_text: "OK"
};
case "it": //italian
return {
modal_header_text: "Statistiche di emojis",
modal_titlesicon_text: "Icona",
modal_titlesname_text: "Nome del server",
modal_titlestotal_text: "Totale:",
modal_titlesglobal_text: "Globale:",
modal_titleslocal_text: "Locale:",
modal_titlescopies_text: "Copie:",
btn_ok_text: "OK"
};
case "nl": //dutch
return {
modal_header_text: "Statistieken van emojis",
modal_titlesicon_text: "Icoon",
modal_titlesname_text: "Servernaam",
modal_titlestotal_text: "Totaal:",
modal_titlesglobal_text: "Globaal:",
modal_titleslocal_text: "Lokaal:",
modal_titlescopies_text: "Kopieën:",
btn_ok_text: "OK"
};
case "no": //norwegian
return {
modal_header_text: "Statistikk av emojis",
modal_titlesicon_text: "Ikon",
modal_titlesname_text: "Servernavn",
modal_titlestotal_text: "Total:",
modal_titlesglobal_text: "Global:",
modal_titleslocal_text: "Lokal:",
modal_titlescopies_text: "Kopier:",
btn_ok_text: "OK"
};
case "pl": //polish
return {
modal_header_text: "Statystyki emoji",
modal_titlesicon_text: "Ikona",
modal_titlesname_text: "Nazwa",
modal_titlestotal_text: "Całkowity:",
modal_titlesglobal_text: "Światowy:",
modal_titleslocal_text: "Lokalny:",
modal_titlescopies_text: "Kopie:",
btn_ok_text: "OK"
};
case "pt-BR": //portuguese (brazil)
return {
modal_header_text: "Estatísticas de emojis",
modal_titlesicon_text: "Ícone",
modal_titlesname_text: "Nome do servidor",
modal_titlestotal_text: "Total:",
modal_titlesglobal_text: "Global:",
modal_titleslocal_text: "Local:",
modal_titlescopies_text: "Cópias:",
btn_ok_text: "OK"
};
case "fi": //finnish
return {
modal_header_text: "Tilastot emojista",
modal_titlesicon_text: "Ikoni",
modal_titlesname_text: "Palvelimen nimi",
modal_titlestotal_text: "Koko:",
modal_titlesglobal_text: "Globaali:",
modal_titleslocal_text: "Paikallinen:",
modal_titlescopies_text: "Kopiot:",
btn_ok_text: "OK"
};
case "sv": //swedish
return {
modal_header_text: "Statistik för emojis",
modal_titlesicon_text: "Ikon",
modal_titlesname_text: "Servernamn",
modal_titlestotal_text: "Total:",
modal_titlesglobal_text: "Global:",
modal_titleslocal_text: "Lokal:",
modal_titlescopies_text: "Kopior:",
btn_ok_text: "OK"
};
case "tr": //turkish
return {
modal_header_text: "Emojis istatistikleri",
modal_titlesicon_text: "Icon",
modal_titlesname_text: "Sunucuadı",
modal_titlestotal_text: "Toplam:",
modal_titlesglobal_text: "Global:",
modal_titleslocal_text: "Yerel:",
modal_titlescopies_text: "Kopya:",
btn_ok_text: "Okey"
};
case "cs": //czech
return {
modal_header_text: "Statistiky emojis",
modal_titlesicon_text: "Ikona",
modal_titlesname_text: "Název serveru",
modal_titlestotal_text: "Celkový:",
modal_titlesglobal_text: "Globální:",
modal_titleslocal_text: "Místní:",
modal_titlescopies_text: "Kopie:",
btn_ok_text: "OK"
};
case "bg": //bulgarian
return {
modal_header_text: "Статистика на емотис",
modal_titlesicon_text: "Икона",
modal_titlesname_text: "Име на сървъра",
modal_titlestotal_text: "Oбщо:",
modal_titlesglobal_text: "Cветовен:",
modal_titleslocal_text: "Mестен:",
modal_titlescopies_text: "Копия:",
btn_ok_text: "Добре"
};
case "ru": //russian
return {
modal_header_text: "Статистика emojis",
modal_titlesicon_text: "Значок",
modal_titlesname_text: "Имя сервера",
modal_titlestotal_text: "Всего:",
modal_titlesglobal_text: "Mировой:",
modal_titleslocal_text: "Местный:",
modal_titlescopies_text: "Копии:",
btn_ok_text: "ОК"
};
case "uk": //ukrainian
return {
modal_header_text: "Статистика емідій",
modal_titlesicon_text: "Ікона",
modal_titlesname_text: "Ім'я сервера",
modal_titlestotal_text: "Всього:",
modal_titlesglobal_text: "Cвітовий:",
modal_titleslocal_text: "Місцевий:",
modal_titlescopies_text: "Копії:",
btn_ok_text: "Добре"
};
case "ja": //japanese
return {
modal_header_text: "エモジスの統計",
modal_titlesicon_text: "アイコン",
modal_titlesname_text: "サーバーの名前",
modal_titlestotal_text: "合計:",
modal_titlesglobal_text: "グローバル:",
modal_titleslocal_text: "地元:",
modal_titlescopies_text: "コピー:",
btn_ok_text: "はい"
};
case "zh-TW": //chinese (traditional)
return {
modal_header_text: "表情統計",
modal_titlesicon_text: "圖標",
modal_titlesname_text: "服務器名稱",
modal_titlestotal_text: "總:",
modal_titlesglobal_text: "全球:",
modal_titleslocal_text: "本地:",
modal_titlescopies_text: "副本:",
btn_ok_text: "好"
};
case "ko": //korean
return {
modal_header_text: "그림 이모티콘의 통계",
modal_titlesicon_text: "상",
modal_titlesname_text: "서버 이름",
modal_titlestotal_text: "합계:",
modal_titlesglobal_text: "글로벌:",
modal_titleslocal_text: "지방의:",
modal_titlescopies_text: "사본:",
btn_ok_text: "승인"
};
default: //default: english
return {
modal_header_text: "Statistics of emojis",
modal_titlesicon_text: "Icon",
modal_titlesname_text: "Servername",
modal_titlestotal_text: "Total:",
modal_titlesglobal_text: "Global:",
modal_titleslocal_text: "Local:",
modal_titlescopies_text: "Copies:",
btn_ok_text: "OK"
};
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Force Image Previews - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ForceImagePreviews/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ForceImagePreviews/config.json)
Forces embedded Image Previews, if Discord doesn't do it itself.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "ForceImagePreviews",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Forces embedded Image Previews, if Discord doesn't do it itself. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,137 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"Message":"componentDidMount"
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".FIP-embed");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
processMessage (instance, wrapper) {
if (instance.props && instance.props.message) {
let accessory = wrapper.querySelector(BDFDB.dotCN.messageaccessory);
if (accessory) {
let links = [];
for (let word of instance.props.message.content.split(/\n|\s|\r|\t|\0/g)) {
if (word.indexOf("https://") > -1 || word.indexOf("http://") > -1) {
if (word.indexOf("<") == 0 && word.indexOf(">") == word.length-1) links.push({src:word.slice(1,-1),embedded:false});
else if (!accessory.querySelector(`${BDFDB.dotCN.embedimage}[href="${this.parseSrc(word)}"]`) && !accessory.querySelector(`${BDFDB.dotCN.embedtitlelink}[href="${this.parseSrc(word)}"]`)) {
links.push({src:word,embedded:false});
}
else links.push({src:word,embedded:true});
}
}
if (links.length > 0) this.addItemToAccessory(null, links, accessory);
}
}
}
addItemToAccessory (previmage, links, accessory) {
let item = links.shift();
if (!item) return;
else if (item.embedded) this.addItemToAccessory(item, links, accessory);
else {
let itemsrc = this.parseSrc(item.src);
require("request")(itemsrc, (error, response, result) => {
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") > -1) {
let imagethrowaway = document.createElement("img");
imagethrowaway.src = itemsrc;
imagethrowaway.onload = () => {
let width = imagethrowaway.naturalWidth > 400 ? 400 : imagethrowaway.naturalWidth;
let height = Math.round(width*(imagethrowaway.naturalHeight/imagethrowaway.naturalWidth));
if (height > 300) {
width = Math.round(width*(300/height));
height = 300;
}
let checkedsrc = itemsrc.indexOf("imgur.com/") > -1 ? ("imgur.com/" + itemsrc.split("/")[3].split(".")[0]) : itemsrc;
if (!accessory.querySelector(`${BDFDB.dotCN.embedimage}[href*="${checkedsrc}"]`)) {
let embed = BDFDB.htmlToElement(`<div class="FIP-embed ${BDFDB.disCNS.embed + BDFDB.disCN.embedwrapper}"><a class="${BDFDB.disCNS.imagewrapper + BDFDB.disCNS.imagezoom + BDFDB.disCN.embedimage}" href="${itemsrc}" rel="noreferrer noopener" target="_blank" style="width: ${width}px; height: ${height}px;"><img src="${itemsrc}" style="width: ${width}px; height: ${height}px;"></a></div>`);
this.insertEmbed(embed, previmage, links, accessory);
}
this.addItemToAccessory(item, links, accessory);
};
}
else if (response && response.headers["server"] && response.headers["server"].toLowerCase().indexOf("youtube") > -1 && result.indexOf("yt-user-info") > -1) {
if (!accessory.querySelector(`${BDFDB.dotCN.embedtitlelink}[href="${itemsrc}"]`)) {
result = result.replace(new RegExp("[\\r|\\n|\\t]|[\\s]{2,}", "g"), "");
let width = 400;
let height = Math.round(width*(result.split('<meta itemprop="height" content="')[1].split('"')[0]/result.split('<meta itemprop="width" content="')[1].split('"')[0]));
let embed = BDFDB.htmlToElement(`<div class="FIP-embed ${BDFDB.disCNS.embed + BDFDB.disCN.embedwrapper}" style="max-width: 426px;"><div class="${BDFDB.disCN.embedpill}" style="background-color: rgb(255, 0, 0);"></div><div class="${BDFDB.disCN.embedinner}"><div class="${BDFDB.disCNS.embedcontent + BDFDB.disCN.flex}"><div class="${BDFDB.disCN.embedcontentinner}"><div class=""><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.embedproviderlink + BDFDB.disCNS.embedlink + BDFDB.disCNS.embedprovider + BDFDB.disCNS.size12 + BDFDB.disCN.weightnormal}" href="https://www.youtube.com/" rel="noreferrer noopener" target="_blank">YouTube</a></div><div class="${BDFDB.disCNS.embedauthor + BDFDB.disCNS.flex + BDFDB.disCNS.aligncenter + BDFDB.disCNS.embedmargin + BDFDB.disCN.margintop4}"><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.embedauthornamelink + BDFDB.disCNS.embedlink + BDFDB.disCNS.embedauthorname + BDFDB.disCNS.weightmedium + BDFDB.disCN.size14}" href="https://www.youtube.com${result.split('<div class="yt-user-info"><a href="')[1].split('"')[0]}" rel="noreferrer noopener" target="_blank">${BDFDB.encodeToHTML(result.split('<div class="yt-user-info"><a href="')[1].split('>')[1].split('<')[0])}</a></div><div class="${BDFDB.disCNS.embedmargin + BDFDB.disCN.margintop4}"><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.embedtitlelink + BDFDB.disCNS.embedlink + BDFDB.disCNS.embedtitle + BDFDB.disCNS.size14 + BDFDB.disCN.weightmedium}" href="${itemsrc}" rel="noreferrer noopener" target="_blank">${BDFDB.encodeToHTML(result.split('<meta property="og:title" content="')[1].split('"')[0])}</a></div></div></div><div class="${BDFDB.disCNS.embedvideo + BDFDB.disCNS.embedimage + BDFDB.disCNS.embedmarginlarge + BDFDB.disCN.margintop8}" style="width: ${width}px; height: ${height}px;"><div class="${BDFDB.disCNS.imagewrapper + BDFDB.disCNS.imageclickable + BDFDB.disCN.embedvideoimagecomponent}" style="width: ${width}px; height: ${height}px;"><img alt="" src="${result.split('<link itemprop="thumbnailUrl" href="')[1].split('"')[0]}" style="width: ${width}px; height: ${height}px;"></div><div class="${BDFDB.disCN.embedvideoactions}"><div class="${BDFDB.disCN.embedcentercontent}"><div class="${BDFDB.disCN.iconactionswrapper}"><div tabindex="0" class="${BDFDB.disCNS.iconwrapper + BDFDB.disCN.iconwrapperactive}" role="button"><svg name="Play" class="${BDFDB.disCNS.iconplay + BDFDB.disCN.icon}" width="16" height="16" viewBox="0 0 24 24"><polygon fill="currentColor" points="0 0 0 14 11 7" transform="translate(7 5)"></polygon></svg></div><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.anchorunderlineonhover + BDFDB.disCNS.iconwrapper + BDFDB.disCN.iconwrapperactive}" href="${itemsrc}" rel="noreferrer noopener" target="_blank"><svg name="OpenExternal" class="${BDFDB.disCNS.iconexternalmargins + BDFDB.disCN.icon}" width="16" height="16" viewBox="0 0 24 24"><path fill="currentColor" transform="translate(3.000000, 4.000000)" d="M16 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h4v-2H2V4h14v10h-4v2h4c1.1 0 2-.9 2-2V2a2 2 0 0 0-2-2zM9 6l-4 4h3v6h2v-6h3L9 6z"></path></svg></a></div></div></div></div></div></div></div>`);
BDFDB.addChildEventListener(embed, "click", BDFDB.dotCN.iconplay, () => {
let videowrapper = embed.querySelector(BDFDB.dotCN.embedvideo);
BDFDB.removeEles(videowrapper.childNodes);
videowrapper.appendChild(BDFDB.htmlToElement(`<iframe src="${result.split('<link itemprop="embedURL" href="')[1].split('"')[0]}?start=0&amp;autoplay=1&amp;auto_play=1" width="${width}" height="${height}" frameborder="0" allowfullscreen=""></iframe>`));
});
this.insertEmbed(embed, previmage, links, accessory);
}
this.addItemToAccessory(item, links, accessory);
}
else this.addItemToAccessory(item, links, accessory);
});
}
}
insertEmbed (embed, previmage, links, accessory) {
let prev = accessory.querySelector(`${BDFDB.dotCNS.embed + BDFDB.dotCN.embedimage}[href="${previmage ? this.parseSrc(previmage.src) : void 0}"]`);
let next = accessory.querySelector(`${BDFDB.dotCNS.embed + BDFDB.dotCN.embedimage}[href="${links[0] ? this.parseSrc(links[0].src) : void 0}"]`);
prev = prev ? prev : accessory.querySelector(`${BDFDB.dotCNS.embed + BDFDB.dotCN.embedtitlelink}[href="${previmage ? this.parseSrc(previmage.src) : void 0}"]`);
next = next ? next : accessory.querySelector(`${BDFDB.dotCNS.embed + BDFDB.dotCN.embedtitlelink}[href="${links[0] ? this.parseSrc(links[0].src) : void 0}"]`);
let isempty = accessory.childElementCount == 0;
if (BDFDB.containsClass(embed.firstElementChild, BDFDB.disCN.embedimage)) embed.style.setProperty("pointer-events", "none", "important");
accessory.insertBefore(embed, prev ? prev.nextSibling : next);
let scroller = document.querySelector(BDFDB.dotCNS.chat + BDFDB.dotCN.messages);
if (scroller) scroller.scrollTop += (BDFDB.getRects(embed).height + (isempty ? 15 : 0));
}
parseSrc (src) {
return src.replace(/"/g, "");
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Friend Notifications - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/FriendNotifications/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/FriendNotifications/config.json)
Notifies you when a friend either logs in or out. Click the Online Friend-Counter to display a timelog of the current session.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "FriendNotifications",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Notifies you when a friend either logs in or out. Click the Online Friend-Counter to display a timelog of the current session. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,349 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"FluxContainer(FriendsOnline)":["componentDidMount","componentDidUpdate"]
};
this.friendsOnlineList = {};
this.timeLog = [];
this.timeLogModalMarkup =
`<span class="${this.name}-modal DevilBro-modal">
<div class="${BDFDB.disCN.backdrop}"></div>
<div class="${BDFDB.disCN.modal}">
<div class="${BDFDB.disCN.modalinner}">
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">Friends LogIn/-Out Timelog</h4>
</div>
<button type="button" class="${BDFDB.disCNS.modalclose + BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">
<svg name="Close" width="18" height="18" viewBox="0 0 12 12" style="flex: 0 1 auto;">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h12v12H0"></path>
<path class="fill" fill="currentColor" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path>
</g>
</svg>
</div>
</button>
</div>
<div class="${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.modalcontent + BDFDB.disCNS.scrollerthemed + BDFDB.disCN.themeghosthairline}">
<div class="${BDFDB.disCNS.scroller + BDFDB.disCN.modalsubinner} entries">
</div>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
<button type="button" class="btn-ok ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}"></div>
</button>
</div>
</div>
</div>
</div>
</span>`;
this.logEntryMarkup =
`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCN.marginbottom4} entry" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCNS.flexchild + BDFDB.disCNS.overflowellipsis} log-time" style="flex: 0 0 auto;"></h3>
<div class="log-avatar"></div>
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCNS.flexchild + BDFDB.disCNS.overflowellipsis} log-description" style="flex: 1 1 auto;"></h3>
</div>`;
this.css = `
${BDFDB.dotCN.guilds} > ${BDFDB.dotCN.friendsonline} {
cursor: pointer;
}
.${this.name}-modal .log-time {
width: 110px;
}
.${this.name}-modal .log-avatar {
width: 35px;
height: 35px;
background-size: cover;
background-position: center;
border-radius: 50%;
}
.${this.name}-settings .avatar-list {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.${this.name}-settings .type-toast, .${this.name}-settings .type-desktop {
border-radius: 3px;
padding: 0 3px;
}
.${this.name}-settings .type-toast {
background-color: #7289DA;
}
.${this.name}-settings .type-desktop {
background-color: #43B581;
}
.${this.name}-settings .settings-avatar.desktop {
border-color: #43B581;
}
.${this.name}-settings .settings-avatar {
margin: 5px;
width: 50px;
height: 50px;
background-size: cover;
background-position: center;
border: 5px solid #7289DA;
border-radius: 50%;
box-sizing: border-box;
cursor: pointer;
}
.${this.name}-settings .settings-avatar.desktop {
border-color: #43B581;
}
.${this.name}-settings .settings-avatar.disabled {
border-color: #36393F;
filter: grayscale(100%) brightness(50%);
}`;
this.defaults = {
settings: {
muteOnDND: {value:false, description:"Do not notify me when I am DnD:"},
onlyOnOnline: {value:false, description:"Only notify me when a User logs in:"},
openOnClick: {value:false, description:"Open the DM when you click a Notification:"}
},
notificationsounds: {
toastonline: {value:{url:null,song:null,mute:false}},
toastoffline: {value:{url:null,song:null,mute:false}},
desktoponline: {value:{url:null,song:null,mute:false}},
desktopoffline: {value:{url:null,song:null,mute:false}}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.FriendUtils = BDFDB.WebModules.findByProperties("getFriendIDs", "getRelationships");
this.ChannelUtils = BDFDB.WebModules.findByProperties("getDMFromUserId");
this.ChannelSwitchUtils = BDFDB.WebModules.findByProperties("selectPrivateChannel");
this.PrivateChannelUtils = BDFDB.WebModules.findByProperties("openPrivateChannel");
this.UserMetaStore = BDFDB.WebModules.findByProperties("getStatus", "getOnlineFriendCount");
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers");
for (let id of this.FriendUtils.getFriendIDs()) {
this.friendsOnlineList[id] = this.UserMetaStore.getStatus(id) != "offline";
}
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
saveAudio (settingspanel, option) {
let successSavedAudio = (parsedurl, parseddata) => {
if (parsedurl && parseddata) BDFDB.showToast(`Sound was saved successfully.`, {type:"success"});
let notificationsound = BDFDB.getData(option, this, "notificationsounds");
notificationsound.url = parsedurl;
notificationsound.song = parseddata;
BDFDB.saveData(option, notificationsound, this, "notificationsounds");
};
let url = settingspanel.querySelector(`.songInput[option="${option}"]`).value;
if (url.length == 0) {
BDFDB.showToast(`Sound file was removed.`, {type:"warn"});
successSavedAudio(url, url);
}
else if (url.indexOf("http") == 0) {
require("request")(url, (error, response, result) => {
if (response) {
let type = response.headers["content-type"];
if (type && (type.indexOf("octet-stream") > -1 || type.indexOf("audio") > -1 || type.indexOf("video") > -1)) {
successSavedAudio(url, url);
return;
}
}
BDFDB.showToast("Use a valid direct link to a video or audio source. They usually end on something like .mp3, .mp4 or .wav.", {type:"danger"});
});
}
else {
require("fs").readFile(url, (error, response) => {
if (error) BDFDB.showToast("Could not fetch file. Please make sure the file exists.", {type:"danger"});
else successSavedAudio(url, `data:audio/mpeg;base64,${response.toString("base64")}`);
});
}
}
processFluxContainerFriendsOnline (instance, wrapper) {
BDFDB.addEventListener(this, wrapper, "mouseenter", () => {BDFDB.createTooltip("Timelog", wrapper, {type:"right"});});
BDFDB.addEventListener(this, wrapper, "click", () => {this.showTimeLog();});
let settings = BDFDB.getAllData(this, "settings");
for (let id of this.FriendUtils.getFriendIDs()) {
let online = this.UserMetaStore.getStatus(id) != "offline";
let user = this.UserUtils.getUser(id);
if (user && this.friendsOnlineList[id] != online && !BDFDB.loadData(id, this, "disabled")) {
this.timeLog.push({user, online, time: new Date()});
if (!(settings.onlyOnOnline && !online) && !(settings.muteOnDND && BDFDB.getUserStatus() == "dnd")) {
let data = BDFDB.loadData(user.id, "EditUsers", "users") || {};
let string = `${BDFDB.encodeToHTML(data.name ? data.name : user.username)} is ${online ? "online" : "offline"}.`;
let avatar = data.removeIcon ? "" : (data.url ? data.url : BDFDB.getUserAvatar(user.id));
let openChannel = () => {
if (settings.openOnClick) {
let DMid = this.ChannelUtils.getDMFromUserId(user.id)
if (DMid) this.ChannelSwitchUtils.selectPrivateChannel(DMid);
else this.PrivateChannelUtils.openPrivateChannel(BDFDB.myData.id, user.id);
require("electron").remote.getCurrentWindow().maximize();
}
};
if (!BDFDB.loadData(id, this, "desktop")) {
let toast = BDFDB.showToast(`<div class="toast-inner"><div class="toast-avatar" style="background-image:url(${avatar});"></div><div>${string}</div></div>`, {html:true, timeout:5000, type:(online ? "success" : null), icon:false, selector:`friendnotifications-${online ? "online" : "offline"}-toast`});
toast.addEventListener("click", openChannel);
let notificationsound = BDFDB.getData(online ? "toastonline" : "toastoffline", this, "notificationsounds");
if (!notificationsound.mute && notificationsound.song) {
let audio = new Audio();
audio.src = notificationsound.song;
audio.play();
}
}
else {
let notificationsound = BDFDB.getData(online ? "desktoponline" : "desktopoffline", this, "notificationsounds");
BDFDB.showDesktopNotification(string, {icon:avatar, timeout:5000, click:openChannel, silent:notificationsound.mute, sound:notificationsound.song});
}
}
}
this.friendsOnlineList[id] = online;
}
}
showTimeLog () {
let timeLogModal = BDFDB.htmlToElement(this.timeLogModalMarkup);
let container = timeLogModal.querySelector(".entries");
if (!container) return;
let logs = this.timeLog.slice(0).reverse();
for (let log of logs) {
if (container.childElementCount) container.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCN.modaldivider}"></div>`));
let data = BDFDB.loadData(log.user.id, "EditUsers", "users") || {};
let entry = BDFDB.htmlToElement(this.logEntryMarkup);
entry.querySelector(".log-time").innerText = `[${log.time.toLocaleTimeString()}]`;
entry.querySelector(".log-avatar").style.setProperty("background-image", `url(${data.removeIcon ? "" : (data.url ? data.url : BDFDB.getUserAvatar(log.user.id))})`);
entry.querySelector(".log-description").innerText = `${data.name || log.user.username} is ${log.online ? "online" : "offline"}.`;
container.appendChild(entry)
}
BDFDB.appendModal(timeLogModal);
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let notificationsounds = BDFDB.getAllData(this, "notificationsounds");
let desktop = BDFDB.loadAllData(this, "desktop");
let disabled = BDFDB.loadAllData(this, "disabled");
let settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
for (let key in notificationsounds) {
if (key.indexOf("desktop") == -1 || "Notification" in window) settingshtml += `<div class="${BDFDB.disCNS.flexchild + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h5 class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin}" style="flex: 1 1 auto;">${key} notification sound:</h5><h5 class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin}" style="flex: 0 0 auto;">Mute:</h5><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" option="${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} mute-checkbox"${notificationsounds[key].mute ? " checked" : ""}></div></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" option="${key}" value="${notificationsounds[key].url ? notificationsounds[key].url : ""}" placeholder="Url or Filepath" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} songInput"></div><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} file-navigator" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}"></div><input type="file" accept="audio/*,video/*" style="display:none!important;"></button><button type="button" option="${key}" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} btn-save btn-savesong" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}"></div></button></div></div>`;
}
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">Click on a Icon to toggle <label class="type-toast">Toast</label> Notifications for that User:</h3></div>`;
if ("Notification" in window) settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">Rightclick on a Icon to toggle <label class="type-desktop">Desktop</label> Notifications for that User:</h3></div>`;
settingshtml += `<div class="avatar-list ${BDFDB.disCN.marginbottom8}">`;
for (let id of this.FriendUtils.getFriendIDs()) {
let user = this.UserUtils.getUser(id);
if (user) {
let data = BDFDB.loadData(user.id, "EditUsers", "users") || {};
settingshtml += `<div class="settings-avatar${desktop[id] ? " desktop" : ""}${disabled[id] ? " disabled" : ""}" user-id="${id}" style="background-image: url(${data.removeIcon ? "" : (data.url ? data.url : BDFDB.getUserAvatar(user.id))});"></div>`;
}
}
settingshtml += `</div>`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Batch set Users:</h3><button type="button" do-disable=true class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttoncolorprimary + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} disable-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Disable</div></button><button type="button" do-toast=true class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} toast-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Toast</div></button>${"Notification" in window ? `<button type="button" do-desktop=true class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorgreen + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} desktop-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Desktop</div></button>` : ``}</div>`;
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "click", ".btn-savesong", e => {this.saveAudio(settingspanel, e.currentTarget.getAttribute("option"));});
BDFDB.addEventListener(this, settingspanel, "click", ".mute-checkbox", e => {
let option = e.currentTarget.getAttribute("option");
let notificationsound = BDFDB.getData(option, this, "notificationsounds");
notificationsound.mute = e.currentTarget.checked;
BDFDB.saveData(option, notificationsound, this, "notificationsounds");
});
BDFDB.addEventListener(this, settingspanel, "mouseenter", ".settings-avatar", e => {
let user = this.UserUtils.getUser(e.currentTarget.getAttribute("user-id"));
let data = BDFDB.loadData(user.id, "EditUsers", "users") || {};
BDFDB.createTooltip(data.name ? data.name : user.username, e.currentTarget, {type:"top"});
});
BDFDB.addEventListener(this, settingspanel, "contextmenu", ".settings-avatar", e => {
if (!("Notification" in window)) return;
let desktopoff = !BDFDB.containsClass(e.currentTarget, "desktop");
let id = e.currentTarget.getAttribute("user-id");
BDFDB.removeClass(e.currentTarget, "disabled");
BDFDB.toggleClass(e.currentTarget, "desktop", desktopoff);
BDFDB.saveData(id, desktopoff, this, "desktop");
BDFDB.removeData(id, this, "disabled");
});
BDFDB.addEventListener(this, settingspanel, "click", ".settings-avatar", e => {
let disableoff = !BDFDB.containsClass(e.currentTarget, "disabled");
let id = e.currentTarget.getAttribute("user-id");
BDFDB.removeClass(e.currentTarget, "desktop");
BDFDB.toggleClass(e.currentTarget, "disabled", disableoff);
BDFDB.saveData(id, disableoff, this, "disabled");
BDFDB.removeData(id, this, "desktop");
});
BDFDB.addEventListener(this, settingspanel, "click", ".disable-all, .toast-all, .desktop-all", e => {
let disableon = e.currentTarget.getAttribute("do-disable");
let desktopon = e.currentTarget.getAttribute("do-desktop");
let disabledata = BDFDB.loadAllData(this, "disabled");
let desktopdata = BDFDB.loadAllData(this, "desktop");
settingspanel.querySelectorAll(".settings-avatar").forEach(avatar => {
let id = avatar.getAttribute("user-id");
BDFDB.toggleClass(avatar, "disabled", disableon);
BDFDB.toggleClass(avatar, "desktop", desktopon);
disableon ? disabledata[id] = true : delete disabledata[id];
desktopon ? desktopdata[id] = true : delete desktopdata[id];
});
BDFDB.saveAllData(disabledata, this, "disabled");
BDFDB.saveAllData(desktopdata, this, "desktop");
});
return settingspanel;
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Google Search Replace - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/GoogleSearchReplace/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/GoogleSearchReplace/config.json)
Replaces the default Google Text Search with a selection menu of several search engines.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "GoogleSearchReplace",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Replaces the default Google Text Search with a selection menu of several search engines. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,261 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.labels = {};
this.textUrlReplaceString = "DEVILBRO_BD_GOOGLESEARCHREPLACE_REPLACE_TEXTURL";
this.defaults = {
engines: {
_all: {value:true, name:BDFDB.getLibraryStrings().btn_all_text, url:null},
Ask: {value:true, name:"Ask", url:"https://ask.com/web?q=" + this.textUrlReplaceString},
Bing: {value:true, name:"Bing", url:"https://www.bing.com/search?q=" + this.textUrlReplaceString},
DogPile: {value:true, name:"DogPile", url:"http://www.dogpile.com/search/web?q=" + this.textUrlReplaceString},
DuckDuckGo: {value:true, name:"DuckDuckGo", url:"https://duckduckgo.com/?q=" + this.textUrlReplaceString},
Google: {value:true, name:"Google", url:"https://www.google.com/search?q=" + this.textUrlReplaceString},
GoogleScholar: {value:true, name:"Google Scholar", url:"https://scholar.google.com/scholar?q=" + this.textUrlReplaceString},
Quora: {value:true, name:"Quora", url:"https://www.quora.com/search?q=" + this.textUrlReplaceString},
Qwant: {value:true, name:"Qwant", url:"https://www.qwant.com/?t=all&q=" + this.textUrlReplaceString},
UrbanDictionary: {value:true, name:"Urban Dictionary", url:"https://www.urbandictionary.com/define.php?term=" + this.textUrlReplaceString},
Searx: {value:true, name:"Searx", url:"https://searx.me/?q=" + this.textUrlReplaceString},
WolframAlpha: {value:true, name:"Wolfram Alpha", url:"https://www.wolframalpha.com/input/?i=" + this.textUrlReplaceString},
Yandex: {value:true, name:"Yandex", url:"https://yandex.com/search/?text=" + this.textUrlReplaceString},
Yahoo: {value:true, name:"Yahoo", url:"https://search.yahoo.com/search?p=" + this.textUrlReplaceString},
YouTube: {value:true, name:"YouTube", url:"https://www.youtube.com/results?q=" + this.textUrlReplaceString}
}
};
this.messageContextEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitem} googlereplacesearch-item ${BDFDB.disCN.contextmenuitemsubmenu}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_googlesearchreplace_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>`;
this.messageContextSubMenuMarkup =
`<div class="${BDFDB.disCN.contextmenu} googlereplacesearch-submenu">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} alldisabled-item ${BDFDB.disCN.contextmenuitemdisabled}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_submenu_disabled_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
${Object.keys(this.defaults.engines).map((key, i) => `<div engine="${key}" class="${BDFDB.disCN.contextmenuitem} GRS-item"><span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">${this.defaults.engines[key].name}</div></span><div class="${BDFDB.disCN.contextmenuhint}"></div></div>`).join("")}
</div>
</div>`;
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
changeLanguageStrings () {
this.messageContextEntryMarkup = this.messageContextEntryMarkup.replace("REPLACE_context_googlesearchreplace_text", this.labels.context_googlesearchreplace_text);
this.messageContextSubMenuMarkup = this.messageContextSubMenuMarkup.replace("REPLACE_submenu_disabled_text", this.labels.submenu_disabled_text);
}
onNativeContextMenu (instance, menu) {
if (instance.props && instance.props.type == "NATIVE_TEXT" && instance.props.value && !menu.querySelector(".reverseimagesearch-item")) {
let searchentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleSearchWithGoogle"]}));
if (searchentry) this.appendItem(instance, searchentry, instance.props.value);
}
}
onMessageContextMenu (instance, menu) {
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".googlereplacesearch-item")) {
let text = document.getSelection().toString();
if (text) {
let searchentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleSearchWithGoogle"]}));
if (searchentry) this.appendItem(instance, searchentry, text);
}
}
}
appendItem (instance, target, text) {
let messageContextEntry = BDFDB.htmlToElement(this.messageContextEntryMarkup);
target.parentElement.insertBefore(messageContextEntry, target.nextElementSibling);
messageContextEntry.addEventListener("mouseenter", () => {
let messageContextSubMenu = BDFDB.htmlToElement(this.messageContextSubMenuMarkup);
let engines = BDFDB.getAllData(this, "engines");
for (let key in engines) if (!engines[key]) BDFDB.removeEles(messageContextSubMenu.querySelector("[engine='" + key + "']"));
if (messageContextSubMenu.querySelector(".GRS-item")) BDFDB.removeEles(messageContextSubMenu.querySelector(".alldisabled-item"));
BDFDB.addChildEventListener(messageContextSubMenu, "click", ".GRS-item", e => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
let engine = e.currentTarget.getAttribute("engine");
if (engine == "_all") {
for (let key in engines) if (key != "_all" && engines[key]) window.open(this.defaults.engines[key].url.replace(this.textUrlReplaceString, encodeURIComponent(text)), "_blank");
}
else window.open(this.defaults.engines[engine].url.replace(this.textUrlReplaceString, encodeURIComponent(text)), "_blank");
});
BDFDB.appendSubMenu(messageContextEntry, messageContextSubMenu);
});
BDFDB.toggleEles(target, false);
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let engines = BDFDB.getAllData(this, "engines");
let settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">Search Engines:</h3></div><div class="DevilBro-settings-inner-list">`;
for (let key in engines) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.engines[key].name}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="engines ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${engines[key] ? " checked" : ""}></div></div>`;
}
settingshtml += `</div>`;
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
return settingspanel;
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {
context_googlesearchreplace_text: "Pretražujte s ...",
submenu_disabled_text: "Svi su onemogućeni"
};
case "da": //danish
return {
context_googlesearchreplace_text: "Søg med ...",
submenu_disabled_text: "Alle deaktiveret"
};
case "de": //german
return {
context_googlesearchreplace_text: "Suche mit ...",
submenu_disabled_text: "Alle deaktiviert"
};
case "es": //spanish
return {
context_googlesearchreplace_text: "Buscar con ...",
submenu_disabled_text: "Todo desactivado"
};
case "fr": //french
return {
context_googlesearchreplace_text: "Rechercher avec ...",
submenu_disabled_text: "Tous désactivés"
};
case "it": //italian
return {
context_googlesearchreplace_text: "Cerca con ...",
submenu_disabled_text: "Tutto disattivato"
};
case "nl": //dutch
return {
context_googlesearchreplace_text: "Zoeken met ...",
submenu_disabled_text: "Alles gedeactiveerd"
};
case "no": //norwegian
return {
context_googlesearchreplace_text: "Søk med ...",
submenu_disabled_text: "Alle deaktivert"
};
case "pl": //polish
return {
context_googlesearchreplace_text: "Szukaj za pomocą ...",
submenu_disabled_text: "Wszystkie wyłączone"
};
case "pt-BR": //portuguese (brazil)
return {
context_googlesearchreplace_text: "Pesquisar com ...",
submenu_disabled_text: "Todos desativados"
};
case "fi": //finnish
return {
context_googlesearchreplace_text: "Etsi ...",
submenu_disabled_text: "Kaikki on poistettu käytöstä"
};
case "sv": //swedish
return {
context_googlesearchreplace_text: "Sök med ...",
submenu_disabled_text: "Alla avaktiverade"
};
case "tr": //turkish
return {
context_googlesearchreplace_text: "Ile ara ...",
submenu_disabled_text: "Hepsi deaktive"
};
case "cs": //czech
return {
context_googlesearchreplace_text: "Hledat s ...",
submenu_disabled_text: "Všechny deaktivované"
};
case "bg": //bulgarian
return {
context_googlesearchreplace_text: "Търсене с ...",
submenu_disabled_text: "Всички са деактивирани"
};
case "ru": //russian
return {
context_googlesearchreplace_text: "Поиск с ...",
submenu_disabled_text: "Все деактивированные"
};
case "uk": //ukrainian
return {
context_googlesearchreplace_text: "Пошук з ...",
submenu_disabled_text: "Всі вимкнені"
};
case "ja": //japanese
return {
context_googlesearchreplace_text: "で検索する ...",
submenu_disabled_text: "すべて非アクティブ化"
};
case "zh-TW": //chinese (traditional)
return {
context_googlesearchreplace_text: "搜索 ...",
submenu_disabled_text: "全部停用"
};
case "ko": //korean
return {
context_googlesearchreplace_text: "다음으로 검색 ...",
submenu_disabled_text: "모두 비활성화 됨"
};
default: //default: english
return {
context_googlesearchreplace_text: "Search with ...",
submenu_disabled_text: "All disabled"
};
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Google Translate Option - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/GoogleTranslateOption/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/GoogleTranslateOption/config.json)
Adds a Google Translate option to your context menu, which shows a preview of the translated text and on click will open the selected text in Google Translate. Also adds a translation button to your textareas, which will automatically translate the text for you before it is being send.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "GoogleTranslateOption",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Adds a Google Translate option to your context menu, which shows a preview of the translated text and on click will open the selected text in Google Translate. Also adds a translation button to your textareas, which will automatically translate the text for you before it is being send. DeepLApi written by square. Thanks ;) \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Image Gallery - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ImageGallery/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ImageGallery/config.json)
Allows the user to browse through images sent inside the same message.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "ImageGallery",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Allows the user to browse through images sent inside the same message. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,206 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"ImageModal":["componentDidMount","componentWillUnmount"]
}
this.eventFired = false;
this.imageMarkup = `<div class="${BDFDB.disCN.imagewrapper}" style="width: 100px; height: 100px;"><img src="" style="width: 100px; height: 100px; display: inline;"></div>`;
this.css = `
.image-gallery ${BDFDB.dotCN.imagewrapper}.prev,
.image-gallery ${BDFDB.dotCN.imagewrapper}.next {
position: absolute;
}
.image-gallery ${BDFDB.dotCN.imagewrapper}.prev {
right: 90%;
}
.image-gallery ${BDFDB.dotCN.imagewrapper}.next {
left: 90%;
}`;
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.closemodal = true;
BDFDB.WebModules.forceAllUpdates(this, "ImageModal");
delete this.closemodal;
document.removeEventListener("keydown", document.keydownImageGalleryListener);
document.removeEventListener("keyup", document.keyupImageGalleryListener);
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
processImageModal (instance, wrapper, methodnames) {
if (this.closemodal && instance.props && instance.props.onClose) instance.props.onClose();
else if (methodnames.includes("componentDidMount")) {
let modal = BDFDB.getParentEle(BDFDB.dotCN.modal, wrapper);
if (!modal) return;
let start = performance.now();
let waitForImg = setInterval(() => {
let img = modal.querySelector(BDFDB.dotCNS.imagewrapper + "img");
if (img && img.src) {
clearInterval(waitForImg);
let message = this.getMessageGroupOfImage(img);
if (message) {
BDFDB.addClass(modal, "image-gallery");
this.addImages(modal, message.querySelectorAll(BDFDB.dotCNS.imagewrapper + "img"), img);
}
}
else if (performance.now() - start > 10000) {
clearInterval(waitForImg);
}
}, 100);
}
else if (methodnames.includes("componentWillUnmount")) {
document.removeEventListener("keydown", document.keydownImageGalleryListener);
document.removeEventListener("keyup", document.keyupImageGalleryListener);
}
}
getMessageGroupOfImage (thisimg) {
if (thisimg && thisimg.src) {
for (let group of document.querySelectorAll(BDFDB.dotCN.messagegroup)) {
for (let img of group.querySelectorAll(BDFDB.dotCNS.imagewrapper + "img")) {
if (img.src && this.getSrcOfImage(img) == this.getSrcOfImage(thisimg)) {
return group;
}
}
}
}
return null;
}
getSrcOfImage (img) {
return (img.src || (img.querySelector("canvas") ? img.querySelector("canvas").src : "")).split("?width=")[0];
}
addImages (modal, imgs, img) {
BDFDB.removeEles(modal.querySelector(`${BDFDB.dotCN.imagewrapper}.prev, ${BDFDB.dotCN.imagewrapper}.next`));
let inner = modal.querySelector(BDFDB.dotCN.modalinner);
if (!inner) return;
var prevImg, nextImg, index;
for (index = 0; index < imgs.length; index++) {
if (this.getSrcOfImage(img) == this.getSrcOfImage(imgs[index])) {
prevImg = imgs[index-1];
img = imgs[index];
nextImg = imgs[index+1];
break;
}
}
var imagesrc = this.getSrcOfImage(img);
modal.querySelector(BDFDB.dotCN.downloadlink).setAttribute("href", imagesrc);
var imagewrapper = modal.querySelector(BDFDB.dotCN.imagewrapper);
BDFDB.addClass(imagewrapper, "current");
var imagewrapperimage = imagewrapper.querySelector("img");
imagewrapperimage.setAttribute("src", imagesrc);
this.resizeImage(modal, img, imagewrapperimage);
if (prevImg) inner.appendChild(this.createImage(modal, imgs, prevImg, "prev"));
if (nextImg) inner.appendChild(this.createImage(modal, imgs, nextImg, "next"));
document.removeEventListener("keydown", document.keydownImageGalleryListener);
document.removeEventListener("keyup", document.keyupImageGalleryListener);
document.keydownImageGalleryListener = e => {this.keyPressed({modal, imgs, prevImg, nextImg}, e);};
document.keyupImageGalleryListener = e => {this.eventFired = false;};
document.addEventListener("keydown", document.keydownImageGalleryListener);
document.addEventListener("keyup", document.keyupImageGalleryListener);
}
createImage (modal, imgs, img, type) {
var imagewrapper = BDFDB.htmlToElement(this.imageMarkup);
BDFDB.addClass(imagewrapper, type);
imagewrapper.addEventListener("click", () => {this.addImages(modal, imgs, img);});
var imagewrapperimage = imagewrapper.querySelector("img");
imagewrapperimage.setAttribute("src", this.getSrcOfImage(img));
this.resizeImage(modal, img, imagewrapperimage);
return imagewrapper;
}
resizeImage (container, src, img) {
BDFDB.toggleEles(img, false);
var temp = new Image();
temp.src = src.src.split("?width=")[0];
temp.onload = function () {
var resizeX = (container.clientWidth/src.clientWidth) * 0.71;
var resizeY = (container.clientHeight/src.clientHeight) * 0.57;
var resize = resizeX < resizeY ? resizeX : resizeY;
var newWidth = src.clientWidth * resize;
var newHeight = src.clientHeight * resize;
newWidth = temp.width > newWidth ? newWidth : temp.width;
newHeight = temp.height > newHeight ? newHeight : temp.height;
var wrapper = img.parentElement;
if (!BDFDB.containsClass(wrapper, "current")) wrapper.style.setProperty("top", (container.clientHeight - newHeight) / 2 + "px");
wrapper.style.setProperty("width", newWidth + "px");
wrapper.style.setProperty("height", newHeight + "px");
img.style.setProperty("width", newWidth + "px");
img.style.setProperty("height", newHeight + "px");
BDFDB.toggleEles(img, true);
};
}
keyPressed ({modal, imgs, prevImg, nextImg}, e) {
if (!this.eventFired) {
this.eventFired = true;
if (e.keyCode == 37 && prevImg) this.addImages(modal, imgs, prevImg);
else if (e.keyCode == 39 && nextImg) this.addImages(modal, imgs, nextImg);
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## MessageUtilities - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/MessageUtilities/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/MessageUtilities/config.json)
Offers a number of useful message options. Remap the keybindings in the settings.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "MessageUtilities",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Offers a number of useful message options. Remap the keybindings in the settings. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,377 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.bindings = {};
this.firedEvents = [];
this.clickMap = ["CLICK" /*[0]*/, "DBLCLICK" /*[1]*/];
this.keyboardMap = [
"NONE" /*[0]*/, "" /*[1]*/, "" /*[2]*/, "CANCEL" /*[3]*/, "" /*[4]*/, "" /*[5]*/, "HELP" /*[6]*/, "" /*[7]*/, "BACK_SPACE" /*[8]*/, "TAB" /*[9]*/, "" /*[10]*/, "" /*[11]*/, "CLEAR" /*[12]*/, "ENTER" /*[13]*/, "ENTER_SPECIAL" /*[14]*/, "" /*[15]*/, "SHIFT" /*[16]*/, "CONTROL" /*[17]*/, "ALT" /*[18]*/, "PAUSE" /*[19]*/, "CAPS_LOCK" /*[20]*/, "KANA" /*[21]*/, "EISU" /*[22]*/, "JUNJA" /*[23]*/, "FINAL" /*[24]*/, "HANJA" /*[25]*/, "" /*[26]*/, "ESCAPE" /*[27]*/, "CONVERT" /*[28]*/, "NONCONVERT" /*[29]*/, "ACCEPT" /*[30]*/, "MODECHANGE" /*[31]*/, "SPACE" /*[32]*/, "PAGE_UP" /*[33]*/, "PAGE_DOWN" /*[34]*/, "END" /*[35]*/, "HOME" /*[36]*/, "LEFT" /*[37]*/, "UP" /*[38]*/, "RIGHT" /*[39]*/, "DOWN" /*[40]*/, "SELECT" /*[41]*/, "PRINT" /*[42]*/, "EXECUTE" /*[43]*/, "PRINTSCREEN" /*[44]*/, "INSERT" /*[45]*/, "DELETE" /*[46]*/, "" /*[47]*/,"0" /*[48]*/, "1" /*[49]*/, "2" /*[50]*/, "3" /*[51]*/, "4" /*[52]*/, "5" /*[53]*/, "6" /*[54]*/, "7" /*[55]*/, "8" /*[56]*/, "9" /*[57]*/, "COLON" /*[58]*/, "SEMICOLON" /*[59]*/, "LESS_THAN" /*[60]*/, "EQUALS" /*[61]*/, "GREATER_THAN" /*[62]*/, "QUESTION_MARK" /*[63]*/, "AT" /*[64]*/, "A" /*[65]*/, "B" /*[66]*/, "C" /*[67]*/, "D" /*[68]*/, "E" /*[69]*/, "F" /*[70]*/, "G" /*[71]*/, "H" /*[72]*/, "I" /*[73]*/, "J" /*[74]*/, "K" /*[75]*/, "L" /*[76]*/, "M" /*[77]*/, "N" /*[78]*/, "O" /*[79]*/, "P" /*[80]*/, "Q" /*[81]*/, "R" /*[82]*/, "S" /*[83]*/, "T" /*[84]*/, "U" /*[85]*/, "V" /*[86]*/, "W" /*[87]*/, "X" /*[88]*/, "Y" /*[89]*/, "Z" /*[90]*/, "OS_KEY" /*[91]*/, "" /*[92]*/, "CONTEXT_MENU" /*[93]*/, "" /*[94]*/, "SLEEP" /*[95]*/, "NUMPAD0" /*[96]*/, "NUMPAD1" /*[97]*/, "NUMPAD2" /*[98]*/, "NUMPAD3" /*[99]*/, "NUMPAD4" /*[100]*/, "NUMPAD5" /*[101]*/, "NUMPAD6" /*[102]*/, "NUMPAD7" /*[103]*/, "NUMPAD8" /*[104]*/, "NUMPAD9" /*[105]*/, "MULTIPLY" /*[106]*/, "ADD" /*[107]*/, "SEPARATOR" /*[108]*/, "SUBTRACT" /*[109]*/, "DECIMAL" /*[110]*/, "DIVIDE" /*[111]*/, "F1" /*[112]*/, "F2" /*[113]*/, "F3" /*[114]*/, "F4" /*[115]*/, "F5" /*[116]*/, "F6" /*[117]*/, "F7" /*[118]*/, "F8" /*[119]*/, "F9" /*[120]*/, "F10" /*[121]*/, "F11" /*[122]*/, "F12" /*[123]*/, "F13" /*[124]*/, "F14" /*[125]*/, "F15" /*[126]*/, "F16" /*[127]*/, "F17" /*[128]*/, "F18" /*[129]*/, "F19" /*[130]*/, "F20" /*[131]*/, "F21" /*[132]*/, "F22" /*[133]*/, "F23" /*[134]*/, "F24" /*[135]*/, "" /*[136]*/, "" /*[137]*/, "" /*[138]*/, "" /*[139]*/, "" /*[140]*/, "" /*[141]*/, "" /*[142]*/, "" /*[143]*/, "NUM_LOCK" /*[144]*/, "SCROLL_LOCK" /*[145]*/, "WIN_OEM_FJ_JISHO" /*[146]*/, "WIN_OEM_FJ_MASSHOU" /*[147]*/, "WIN_OEM_FJ_TOUROKU" /*[148]*/, "WIN_OEM_FJ_LOYA" /*[149]*/, "WIN_OEM_FJ_ROYA" /*[150]*/, "" /*[151]*/, "" /*[152]*/, "" /*[153]*/, "" /*[154]*/, "" /*[155]*/, "" /*[156]*/, "" /*[157]*/, "" /*[158]*/, "" /*[159]*/, "CIRCUMFLEX" /*[160]*/, "EXCLAMATION" /*[161]*/, "DOUBLE_QUOTE" /*[162]*/, "HASH" /*[163]*/, "DOLLAR" /*[164]*/, "PERCENT" /*[165]*/, "AMPERSAND" /*[166]*/, "UNDERSCORE" /*[167]*/, "OPEN_PAREN" /*[168]*/, "CLOSE_PAREN" /*[169]*/, "ASTERISK" /*[170]*/, "PLUS" /*[171]*/, "PIPE" /*[172]*/, "HYPHEN_MINUS" /*[173]*/, "OPEN_CURLY_BRACKET" /*[174]*/, "CLOSE_CURLY_BRACKET" /*[175]*/, "TILDE" /*[176]*/, "" /*[177]*/, "" /*[178]*/, "" /*[179]*/, "" /*[180]*/, "VOLUME_MUTE" /*[181]*/, "VOLUME_DOWN" /*[182]*/, "VOLUME_UP" /*[183]*/, "" /*[184]*/, "" /*[185]*/, "SEMICOLON" /*[186]*/, "EQUALS" /*[187]*/, "COMMA" /*[188]*/, "MINUS" /*[189]*/, "PERIOD" /*[190]*/, "SLASH" /*[191]*/, "BACK_QUOTE" /*[192]*/, "" /*[193]*/, "" /*[194]*/, "" /*[195]*/, "" /*[196]*/, "" /*[197]*/, "" /*[198]*/, "" /*[199]*/, "" /*[200]*/, "" /*[201]*/, "" /*[202]*/, "" /*[203]*/, "" /*[204]*/, "" /*[205]*/, "" /*[206]*/, "" /*[207]*/, "" /*[208]*/, "" /*[209]*/, "" /*[210]*/, "" /*[211]*/, "" /*[212]*/, "" /*[213]*/, "" /*[214]*/, "" /*[215]*/, "" /*[216]*/, "" /*[217]*/, "" /*[218]*/, "OPEN_BRACKET" /*[219]*/, "BACK_SLASH" /*[220]*/, "CLOSE_BRACKET" /*[221]*/, "QUOTE" /*[222]*/, "" /*[223]*/, "META" /*[224]*/, "ALTGR" /*[225]*/, "" /*[226]*/, "WIN_ICO_HELP" /*[227]*/, "WIN_ICO_00" /*[228]*/, "" /*[229]*/, "WIN_ICO_CLEAR" /*[230]*/, "" /*[231]*/,"" /*[232]*/, "WIN_OEM_RESET" /*[233]*/, "WIN_OEM_JUMP" /*[234]*/, "WIN_OEM_PA1" /*[235]*/, "WIN_OEM_PA2" /*[236]*/, "WIN_OEM_PA3" /*[237]*/, "WIN_OEM_WSCTRL" /*[238]*/,"WIN_OEM_CUSEL" /*[239]*/, "WIN_OEM_ATTN" /*[240]*/, "WIN_OEM_FINISH" /*[241]*/, "WIN_OEM_COPY" /*[242]*/, "WIN_OEM_AUTO" /*[243]*/, "WIN_OEM_ENLW" /*[244]*/, "WIN_OEM_BACKTAB" /*[245]*/, "ATTN" /*[246]*/, "CRSEL" /*[247]*/, "EXSEL" /*[248]*/, "EREOF" /*[249]*/, "PLAY" /*[250]*/, "ZOOM" /*[251]*/, "" /*[252]*/, "PA1" /*[253]*/, "WIN_OEM_CLEAR" /*[254]*/, "" /*[255]*/
];
this.clicks = ["click"];
this.keys = ["key1","key2"];
this.defaults = {
settings: {
"clearOnEscape": {value:true, description:"Clear chat input when Escape is pressed:"},
"Edit_Message": {value:true},
"Delete_Message": {value:true},
"Pin/Unpin_Message": {value:true},
"React_to_Message": {value:true},
"__Note_Message": {value:false},
"__Translate_Message": {value:false},
"__Quote_Message": {value:false},
"__Citate_Message": {value:false}
},
bindings: {
"Edit_Message": {name:"Edit Message", func:this.doEdit, value:{click:1, key1:0, key2:0}},
"Delete_Message": {name:"Delete Message", func:this.doDelete, value:{click:0, key1:46, key2:0}},
"Pin/Unpin_Message": {name:"Pin/Unpin Message", func:this.doPinUnPin, value:{click:0, key1:17, key2:0}},
"React_to_Message": {name:"React to Message", func:this.doOpenReact, value:{click:0, key1:9, key2:0}},
"__Note_Message": {name:"Note Message (Pesonal Pins)", func:this.doNote, value:{click:0, key1:16, key2:0}, plugin:"PersonalPins"},
"__Translate_Message": {name:"Translate Message (Google Translate Option)", func:this.doTranslate, value:{click:0, key1:20, key2:0}, plugin:"GoogleTranslateOption"},
"__Quote_Message": {name:"Quote Message (Quoter)", func:this.doQuote, value:{click:0, key1:113, key2:0}, plugin:"Quoter"},
"__Citate_Message": {name:"Quote Message (Citador)", func:this.doCitate, value:{click:0, key1:114, key2:0}, plugin:"Citador"}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
this.MessageActions = BDFDB.WebModules.findByProperties("startEditMessage", "endEditMessage");
this.PinActions = BDFDB.WebModules.findByProperties("pinMessage", "unpinMessage");
this.CurrentUserPerms = BDFDB.WebModules.findByProperties("getChannelPermissions", "can");
this.Permissions = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes").Permissions
BDFDB.addEventListener(this, document, "click", BDFDB.dotCNC.message + BDFDB.dotCN.messagesystem, e => {
this.onClick(e.currentTarget, 0, "onSglClick");
})
BDFDB.addEventListener(this, document, "dblclick", BDFDB.dotCNC.message + BDFDB.dotCN.messagesystem, e => {
this.onClick(e.currentTarget, 1, "onDblClick");
});
BDFDB.addEventListener(this, document, "keydown", BDFDB.dotCN.textareawrapchat, e => {
this.onKeyDown(e.currentTarget, e.which, "onKeyDown");
});
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
//begin of own functions
resetAll (settingspanel) {
BDFDB.openConfirmModal(this, "Are you sure you want to delete all key bindings?", () => {
BDFDB.removeAllData(this, "bindings");
let bindings = BDFDB.getAllData(this, "bindings");
settingspanel.querySelectorAll(BDFDB.dotCN.select).forEach((wrap) => {
let action = wrap.getAttribute("type");
let option = wrap.getAttribute("option");
wrap.setAttribute("value", bindings[action][option]);
wrap.querySelector(BDFDB.dotCN.title).innerText = this.clickMap[bindings[action][option]];
});
settingspanel.querySelectorAll(BDFDB.dotCN.hotkeycontainer).forEach((wrap) => {
let action = wrap.getAttribute("type");
let option = wrap.getAttribute("option");
wrap.setAttribute("value", bindings[action][option]);
wrap.querySelector("input").setAttribute("value", this.keyboardMap[bindings[action][option]]);
});
});
}
openDropdownMenu (e) {
let selectControl = e.currentTarget;
let selectWrap = selectControl.parentElement;
let plugincard = BDFDB.getParentEle("li", selectWrap);
if (!plugincard || BDFDB.containsClass(selectWrap, BDFDB.disCN.selectisopen)) return;
BDFDB.addClass(selectWrap, BDFDB.disCN.selectisopen);
plugincard.style.setProperty("overflow", "visible", "important");
let action = selectWrap.getAttribute("type");
let option = selectWrap.getAttribute("option");
let value = selectWrap.getAttribute("value");
let selectMenu = this.createDropdownMenu(action, value);
selectWrap.appendChild(selectMenu);
BDFDB.addChildEventListener(selectMenu, "mousedown", BDFDB.dotCN.selectoption, e2 => {
let binding = BDFDB.getData(action, this, "bindings");
let selection = e2.currentTarget.getAttribute("value");
selectWrap.setAttribute("value", selection);
selectControl.querySelector(BDFDB.dotCN.title).innerText = e2.currentTarget.textContent;
binding[option] = parseInt(selection);
BDFDB.saveData(action, binding, this, "bindings");
});
var removeMenu = e2 => {
if (e2.target.parentElement != selectMenu) {
document.removeEventListener("mousedown", removeMenu);
selectMenu.remove();
plugincard.style.removeProperty("overflow");
setTimeout(() => {BDFDB.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
}
};
document.addEventListener("mousedown", removeMenu);
}
createDropdownMenu (action, value) {
let menuhtml = `<div class="${BDFDB.disCN.selectmenuouter}"><div class="${BDFDB.disCN.selectmenu}">`;
for (let i in this.clickMap) {
let isSelected = i == value ? ` ${BDFDB.disCN.selectselected}` : ``;
menuhtml += `<div value="${i}" class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectoption + isSelected}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}">${this.clickMap[i]}</div></div>`
}
menuhtml += `</div></div>`;
return BDFDB.htmlToElement(menuhtml);
}
startRecording (settingspanel, e) {
let recorderWrap = e.currentTarget;
if (BDFDB.containsClass(recorderWrap, BDFDB.disCN.hotkeyrecording)) return;
let recorderInput = recorderWrap.querySelector("input");
let recorderText = recorderWrap.querySelector(BDFDB.dotCN.hotkeytext);
let action = recorderWrap.getAttribute("type");
let option = recorderWrap.getAttribute("option");
BDFDB.addClass(recorderWrap, BDFDB.disCN.hotkeyrecording);
BDFDB.removeClass(recorderWrap, BDFDB.disCN.hotkeyhasvalue);
recorderText.innerText = BDFDB.LanguageStrings.SHORTCUT_RECORDER_BUTTON_RECORDING;
var saveRecording = e => {
recorderWrap.setAttribute("value", e.which);
recorderInput.setAttribute("value", this.keyboardMap[e.which]);
};
var stopRecording = e => {
document.removeEventListener("mousedown", stopRecording);
document.removeEventListener("keydown", saveRecording);
let binding = BDFDB.getData(action, this, "bindings");
binding[option] = parseInt(recorderWrap.getAttribute("value"));
BDFDB.saveData(action, binding, this, "bindings");
setTimeout(() => {
BDFDB.removeClass(recorderWrap, BDFDB.disCN.hotkeyrecording);
BDFDB.addClass(recorderWrap, BDFDB.disCN.hotkeyhasvalue);
recorderText.innerText = BDFDB.LanguageStrings.SHORTCUT_RECORDER_BUTTON_EDIT;
},100);
};
document.addEventListener("mousedown", stopRecording);
document.addEventListener("keydown", saveRecording);
}
resetRecorder (settingspanel, e) {
let resetButton = e.currentTarget;
let recorderWrap = e.currentTarget.parentElement.parentElement.querySelector(BDFDB.dotCN.hotkeycontainer);
let recorderInput = recorderWrap.querySelector("input");
let action = recorderWrap.getAttribute("type");
let option = recorderWrap.getAttribute("option");
recorderWrap.setAttribute("value", 0);
recorderInput.setAttribute("value", this.keyboardMap[0]);
let binding = BDFDB.getData(action, this, "bindings");
binding[option] = parseInt(recorderWrap.getAttribute("value"));
BDFDB.saveData(action, binding, this, "bindings");
}
onClick (div, click, name) {
if (!this.isEventFired(name)) {
this.fireEvent(name);
let settings = BDFDB.getAllData(this, "settings");
let bindings = BDFDB.getAllData(this, "bindings");
for (let action in bindings) {
if (settings[action] && this.checkIfBindingIsValid(bindings[action], click)) {
let {messagediv, pos, message} = this.getMessageData(div);
if (messagediv && pos > -1 && message) this.defaults.bindings[action].func.bind(this)({messagediv, pos, message});
break;
}
}
this.cancelEvent(name);
}
}
checkIfBindingIsValid (binding, doneclick) {
let valid = true;
for (let click of this.clicks) {
if (binding[click] != doneclick) valid = false;
}
for (let key of this.keys) {
if (!BDFDB.pressedKeys.includes(binding[key]) && binding[key] != 0) valid = false;
}
return valid;
}
doDelete ({messagediv, pos, message}) {
let channel = this.ChannelUtils.getChannel(message.channel_id);
if ((channel && this.CurrentUserPerms.can(this.Permissions.MANAGE_MESSAGES, channel)) || message.author.id == BDFDB.myData.id) {
this.MessageActions.deleteMessage(message.channel_id, message.id);
}
}
doEdit ({messagediv, pos, message}) {
if (message.author.id == BDFDB.myData.id && !messagediv.querySelector("textarea")) {
this.MessageActions.startEditMessage(message.channel_id, message.id, message.content);
}
}
doOpenReact ({messagediv, pos, message}) {
let reactButton = messagediv.querySelector(BDFDB.dotCN.emojipickerbutton);
if (reactButton) reactButton.click();
}
doPinUnPin ({messagediv, pos, message}) {
let channel = this.ChannelUtils.getChannel(message.channel_id);
if (channel && this.CurrentUserPerms.can(this.Permissions.MANAGE_MESSAGES, channel)) {
if (message.pinned) this.PinActions.unpinMessage(channel, message.id);
else this.PinActions.pinMessage(channel, message.id);
}
}
doNote ({messagediv, pos, message}) {
if (BDFDB.isPluginEnabled(this.defaults.bindings.__Note_Message.plugin)) {
let channel = this.ChannelUtils.getChannel(message.channel_id);
if (channel) bdplugins[this.defaults.bindings.__Note_Message.plugin].plugin.addMessageToNotes(message, messagediv, channel);
}
}
doTranslate ({messagediv, pos, message}) {
if (BDFDB.isPluginEnabled(this.defaults.bindings.__Translate_Message.plugin)) {
let channel = this.ChannelUtils.getChannel(message.channel_id);
if (channel) bdplugins[this.defaults.bindings.__Translate_Message.plugin].plugin.translateMessage(message, messagediv, channel);
}
}
doQuote ({messagediv, pos, message}) {
if (BDFDB.isPluginEnabled(this.defaults.bindings.__Quote_Message.plugin)) {
let quoteButton = messagediv.querySelector(".btn-quote");
if (quoteButton) quoteButton.click();
}
}
doCitate ({messagediv, pos, message}) {
if (BDFDB.isPluginEnabled(this.defaults.bindings.__Citate_Message.plugin)) {
let citarButton = messagediv.parentElement.querySelector(".citar-btn");
if (citarButton) citarButton.click();
}
}
onKeyDown (div, key, name) {
if (!this.isEventFired(name)) {
this.fireEvent(name);
if (key == 27 && BDFDB.getData("clearOnEscape", this, "settings")) {
let instance = BDFDB.getOwnerInstance({"node":div, "name":"ChannelTextAreaForm", "up":true});
if (instance) {
instance.setState({textValue:""});
}
}
this.cancelEvent(name);
}
}
getActiveShortcutString (action) {
let str = "";
if (BDFDB.getData(action, this, "settings")) {
let binding = BDFDB.getData(action, this, "bindings");
if (binding) for (let type in binding) {
let typename = type.indexOf("click") == 0 ? this.clickMap[binding[type]] : this.keyboardMap[binding[type]];
if (typename && typename != "NONE") str += typename + "+";
}
}
return str ? str.slice(0,-1) : null;
}
getMessageData (target) {
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.message, target);
let pos = messagediv ? Array.from(messagediv.parentElement.querySelectorAll(BDFDB.dotCN.message)).indexOf(messagediv) : -1;
let instance = BDFDB.getReactInstance(messagediv);
let message = instance && instance.return && instance.return.memoizedProps && instance.return.memoizedProps.message ? instance.return.memoizedProps.message : null;
return {messagediv, pos, message};
}
fireEvent (name) {
this.firedEvents.push(name);
}
isEventFired (name) {
return this.firedEvents.includes(name);
}
cancelEvent (name) {
BDFDB.removeFromArray(this.firedEvents, name);
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let bindings = BDFDB.getAllData(this, "bindings");
let settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
if (this.defaults.settings[key].description) settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
for (let action in bindings) {
if (!this.defaults.bindings[action].plugin || BDFDB.isPluginEnabled(this.defaults.bindings[action].plugin)) {
settingshtml += `<div class="${action}-key-settings"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.bindings[action].name}:</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="${action}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner}"${settings[action] ? " checked" : ""}></div></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">`;
for (let click of this.clicks) {
settingshtml += `<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 20%;"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin + BDFDB.disCN.marginbottom4}">${click}:</h5><div class="${BDFDB.disCN.selectwrap}"><div type="${action}" option="${click}" value="${bindings[action][click]}" class="${BDFDB.disCNS.select + BDFDB.disCNS.selectsingle + BDFDB.disCN.selecthasvalue}"><div class="${BDFDB.disCN.selectcontrol}"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectvalue}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}" style="padding:0;">${this.clickMap[bindings[action][click]]}</div></div><span class="${BDFDB.disCN.selectarrowzone}"><span class="${BDFDB.disCN.selectarrow}"></span></span></div></div></div></div>`;
}
for (let key of this.keys) {
settingshtml += `<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 40%;"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin + BDFDB.disCN.marginbottom4}">${key}:<label class="reset-recorder" style="float: right; padding-right: 5px; cursor: pointer;">✖</label></h5><div type="${action}" option="${key}" value="${bindings[action][key]}" class="${BDFDB.disCNS.hotkeycontainer + BDFDB.disCNS.hotkeycontainer2 + BDFDB.disCN.hotkeyhasvalue}"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.hotkeylayout + BDFDB.disCN.hotkeylayout2}" style="flex: 1 1 auto;"><input type="text" placeholder="${this.keyboardMap[bindings[action][key]]}" readonly="" value="${this.keyboardMap[bindings[action][key]]}" class="${BDFDB.disCNS.hotkeyinput + BDFDB.disCNS.hotkeyinput2 + BDFDB.disCN.hotkeybase}" style="flex: 1 1 auto;"></input><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCN.nowrap}" style="flex: 0 1 auto; margin: 0px;"><button type="button" class="${BDFDB.disCNS.hotkeybutton + BDFDB.disCNS.hotkeybutton2 + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookghost + BDFDB.disCNS.buttoncolorgrey + BDFDB.disCNS.buttonsizemin + BDFDB.disCN.buttongrow}"><div class="${BDFDB.disCN.buttoncontents}"><span class="${BDFDB.disCN.hotkeytext}">${BDFDB.LanguageStrings.SHORTCUT_RECORDER_BUTTON_EDIT}</span><span class="${BDFDB.disCN.hotkeyediticon}"/></div></button></div></div></div></div>`;
}
settingshtml += `</div></div>`;
}
}
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Reset all key bindings.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} reset-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {this.openDropdownMenu(e);})
BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.hotkeycontainer, e => {this.startRecording(settingspanel, e);})
BDFDB.addEventListener(this, settingspanel, "click", ".reset-recorder", e => {this.resetRecorder(settingspanel, e);})
BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {this.resetAll(settingspanel);});
return settingspanel;
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Moveable Popups - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/MoveablePopups/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/MoveablePopups/config.json)
Adds the feature to move all popups and modals around like on a normal desktop. Ctrl + drag with your left mousebutton to drag element.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "MoveablePopups",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Adds the feature to move all popups and modals around like on a normal desktop. Ctrl + drag with your left mousebutton to drag element. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,124 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
var observer = null;
observer = new MutationObserver((changes, _) => {
changes.forEach(
(change, i) => {
if (change.addedNodes) {
change.addedNodes.forEach((node) => {
if (node && BDFDB.containsClass(node, BDFDB.disCN.popout)) {
this.makeMoveable(node);
}
});
}
}
);
});
BDFDB.addObserver(this, BDFDB.dotCN.popouts, {name:"popoutObserver",instance:observer}, {childList: true});
observer = new MutationObserver((changes, _) => {
changes.forEach(
(change, i) => {
if (change.addedNodes) {
change.addedNodes.forEach((node) => {
if (node && BDFDB.containsClass(node, BDFDB.disCN.modal) && !node.querySelector(BDFDB.dotCN.downloadlink)) {
this.makeMoveable(node.querySelector(BDFDB.dotCN.modalinner));
}
else if (node.tagName && node.querySelector(BDFDB.dotCN.modal) && !node.querySelector(BDFDB.dotCN.downloadlink)) {
this.makeMoveable(node.querySelector(BDFDB.dotCN.modalinner));
}
});
}
}
);
});
BDFDB.addObserver(this, BDFDB.dotCN.app + " ~ [class^='theme-']:not([class*='popouts'])", {name:"modalObserver",instance:observer}, {childList: true});
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
makeMoveable (div) {
div.removeEventListener("click", div.clickMovablePopups);
div.removeEventListener("mousedown", div.mousedownMovablePopups);
div.clickMovablePopups = e => {
if (this.dragging) {
e.stopPropagation();
e.preventDefault();
}
};
div.mousedownMovablePopups = e => {
if (!e.ctrlKey) return;
div.style.setProperty("position", "fixed", "important");
this.dragging = true;
var rects = BDFDB.getRects(div);
var transform = getComputedStyle(div,null).getPropertyValue("transform").replace(/[^0-9,-]/g,"").split(",");
var left = rects.left - (transform.length > 4 ? parseFloat(transform[4]) : 0);
var top = rects.top - (transform.length > 4 ? parseFloat(transform[5]) : 0);
var oldX = e.pageX;
var oldY = e.pageY;
var mouseup = e2 => {
BDFDB.removeLocalStyle("disableTextSelection");
document.removeEventListener("mouseup", mouseup);
document.removeEventListener("mousemove", mousemove);
setTimeout(() => {this.dragging = false},1);
};
var mousemove = e2 => {
left = left - (oldX - e2.pageX);
top = top - (oldY - e2.pageY);
oldX = e2.pageX;
oldY = e2.pageY;
div.style.setProperty("left", left + "px", "important");
div.style.setProperty("top", top + "px", "important");
};
document.addEventListener("mouseup", mouseup);
document.addEventListener("mousemove", mousemove);
};
div.addEventListener("click", div.clickMovablePopups);
div.addEventListener("mousedown", div.mousedownMovablePopups);
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Notification Sounds - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/NotificationSounds/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/NotificationSounds/config.json)
Allows you to replace the native sounds of Discord with your own.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "NotificationSounds",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Allows you to replace the native sounds of Discord with your own. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,472 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"IncomingCalls":"componentDidMount",
"PrivateChannelCall":"componentDidMount"
};
this.types = {
"message1": {implemented:true, name:"New Chatmessage", src:"/assets/dd920c06a01e5bb8b09678581e29d56f.mp3", mute:true},
"dm": {implemented:true, name:"Direct Message", src:"/assets/84c9fa3d07da865278bd77c97d952db4.mp3", mute:true},
"mentioned": {implemented:true, name:"Mention Ping", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true},
"deafen": {implemented:true, name:"Voicechat Deafen", src:"/assets/e4d539271704b87764dc465b1a061abd.mp3", mute:false},
"mute": {implemented:true, name:"Voicechat Mute", src:"/assets/429d09ee3b86e81a75b5e06d3fb482be.mp3", mute:false},
"disconnect": {implemented:true, name:"Voicechat Disconnect", src:"/assets/7e125dc075ec6e5ae796e4c3ab83abb3.mp3", mute:false},
"undeafen": {implemented:true, name:"Voicechat Undeafen", src:"/assets/5a000a0d4dff083d12a1d4fc2c7cbf66.mp3", mute:false},
"unmute": {implemented:true, name:"Voicechat Unmute", src:"/assets/43805b9dd757ac4f6b9b58c1a8ee5f0d.mp3", mute:false},
"user_join": {implemented:true, name:"Voicechat User Joined", src:"/assets/5dd43c946894005258d85770f0d10cff.mp3", mute:false},
"user_leave": {implemented:true, name:"Voicechat User Left", src:"/assets/4fcfeb2cba26459c4750e60f626cebdc.mp3", mute:false},
"user_moved": {implemented:true, name:"Voicechat User Moved", src:"/assets/e81d11590762728c1b811eadfa5be766.mp3", mute:false},
"ptt_start": {implemented:true, name:"Push2Talk Start", src:"/assets/8b63833c8d252fedba6b9c4f2517c705.mp3", mute:false},
"ptt_stop": {implemented:true, name:"Push2Talk Stop", src:"/assets/74ab980d6890a0fa6aa0336182f9f620.mp3", mute:false},
"call_calling": {implemented:true, name:"Outgoing Call", src:"/assets/c6e92752668dde4eee5923d70441579f.mp3", mute:false},
"call_ringing": {implemented:true, name:"Incoming Call", src:"/assets/84a1b4e11d634dbfa1e5dd97a96de3ad.mp3", mute:true},
"call_ringing_beat": {implemented:false, name:"Incoming Call Beat", src:"/assets/b9411af07f154a6fef543e7e442e4da9.mp3", mute:true},
"ddr-down": {implemented:true, name:"HotKeys Window Down", src:"/assets/71f048f8aa7d4b24bf4268a87cbbb192.mp3", mute:true},
"ddr-left": {implemented:true, name:"HotKeys Window Left", src:"/assets/1de04408e62b5d52ae3ebbb91e9e1978.mp3", mute:true},
"ddr-right": {implemented:true, name:"HotKeys Window Right", src:"/assets/2c0433f93db8449e4a82b76dc520cb29.mp3", mute:true},
"ddr-up": {implemented:true, name:"HotKeys Window Up", src:"/assets/68472713f7a62c7c37e0a6a5d5a1faeb.mp3", mute:true},
"human_man": {implemented:false, name:"Human Man Voice", src:"/assets/a37dcd6272ae41cf49295d58c9806fe3.mp3", mute:true},
"mention1": {implemented:false, name:"Mention Ping 1", src:"/assets/fa4d62c3cbc80733bf1f01b9c6f181de.mp3", mute:true},
"mention2": {implemented:false, name:"Mention Ping 2", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true},
"mention3": {implemented:false, name:"Mention Ping 3", src:"/assets/84c9fa3d07da865278bd77c97d952db4.mp3", mute:true},
"message2": {implemented:false, name:"New Chatmessage 2", src:"/assets/15fe810f6cfab609c7fcda61652b9b34.mp3", mute:true},
"message3": {implemented:false, name:"New Chatmessage 3", src:"/assets/53ce6a92d3c233e8b4ac529d34d374e4.mp3", mute:true},
"overlayunlock": {implemented:false, name:"Overlay Unlocked", src:"/assets/ad322ffe0a88436296158a80d5d11baa.mp3", mute:true},
"reconnect": {implemented:false, name:"Voicechat Reconnect", src:"/assets/471cfd0005b112ff857705e894bf41a6.mp3", mute:true},
"robot_man": {implemented:false, name:"Robot Man Voice", src:"/assets/66598bea6e59eb8acdf32cf2d9d75ba9.mp3", mute:true}
};
this.defaults = {
"---": {
"---": null
},
"Default": {
"Communication Channel": "https://notificationsounds.com/soundfiles/63538fe6ef330c13a05a3ed7e599d5f7/file-sounds-917-communication-channel.wav",
"Isn't it": "https://notificationsounds.com/soundfiles/ba2fd310dcaa8781a9a652a31baf3c68/file-sounds-969-isnt-it.wav",
"Job Done": "https://notificationsounds.com/soundfiles/5b69b9cb83065d403869739ae7f0995e/file-sounds-937-job-done.wav",
"Served": "https://notificationsounds.com/soundfiles/b337e84de8752b27eda3a12363109e80/file-sounds-913-served.wav",
"Solemn": "https://notificationsounds.com/soundfiles/53fde96fcc4b4ce72d7739202324cd49/file-sounds-882-solemn.wav",
"System Fault": "https://notificationsounds.com/soundfiles/ebd9629fc3ae5e9f6611e2ee05a31cef/file-sounds-990-system-fault.wav",
"You wouldn't believe": "https://notificationsounds.com/soundfiles/087408522c31eeb1f982bc0eaf81d35f/file-sounds-949-you-wouldnt-believe.wav"
},
"Discord": {
"HotKeys Window Down": "/assets/71f048f8aa7d4b24bf4268a87cbbb192.mp3",
"HotKeys Window Left": "/assets/1de04408e62b5d52ae3ebbb91e9e1978.mp3",
"HotKeys Window Right": "/assets/2c0433f93db8449e4a82b76dc520cb29.mp3",
"HotKeys Window Up": "/assets/68472713f7a62c7c37e0a6a5d5a1faeb.mp3",
"Human Man Voice": "/assets/a37dcd6272ae41cf49295d58c9806fe3.mp3",
"Incoming Call": "/assets/84a1b4e11d634dbfa1e5dd97a96de3ad.mp3",
"Incoming Call Beat": "/assets/b9411af07f154a6fef543e7e442e4da9.mp3",
"Mention Ping 1": "/assets/fa4d62c3cbc80733bf1f01b9c6f181de.mp3",
"Mention Ping 2": "/assets/a5f42064e8120e381528b14fd3188b72.mp3",
"Mention Ping 3": "/assets/84c9fa3d07da865278bd77c97d952db4.mp3",
"New Chatmessage 1": "/assets/dd920c06a01e5bb8b09678581e29d56f.mp3",
"New Chatmessage 2": "/assets/15fe810f6cfab609c7fcda61652b9b34.mp3",
"New Chatmessage 3": "/assets/53ce6a92d3c233e8b4ac529d34d374e4.mp3",
"Outgoing Call": "/assets/c6e92752668dde4eee5923d70441579f.mp3",
"Overlay Unlocked": "/assets/ad322ffe0a88436296158a80d5d11baa.mp3",
"Push2Talk Start": "/assets/8b63833c8d252fedba6b9c4f2517c705.mp3",
"Push2Talk Stop": "/assets/74ab980d6890a0fa6aa0336182f9f620.mp3",
"Robot Man Voice": "/assets/66598bea6e59eb8acdf32cf2d9d75ba9.mp3",
"Voicechat Deafen": "/assets/e4d539271704b87764dc465b1a061abd.mp3",
"Voicechat Disconnect": "/assets/7e125dc075ec6e5ae796e4c3ab83abb3.mp3",
"Voicechat Mute": "/assets/429d09ee3b86e81a75b5e06d3fb482be.mp3",
"Voicechat Undeafen": "/assets/5a000a0d4dff083d12a1d4fc2c7cbf66.mp3",
"Voicechat Unmute": "/assets/43805b9dd757ac4f6b9b58c1a8ee5f0d.mp3",
"Voicechat User Joined": "/assets/5dd43c946894005258d85770f0d10cff.mp3",
"Voicechat User Left": "/assets/4fcfeb2cba26459c4750e60f626cebdc.mp3",
"Voicechat User Moved": "/assets/e81d11590762728c1b811eadfa5be766.mp3",
"Voicechat Reconnect": "/assets/471cfd0005b112ff857705e894bf41a6.mp3"
}
};
this.settingsaudio = new Audio();
this.audios = {};
this.choices = [];
this.firedEvents = {};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.ChannelSettingsUtils = BDFDB.WebModules.findByProperties("isGuildOrCategoryOrChannelMuted");
BDFDB.WebModules.patch(BDFDB.WebModules.findByProperties("receiveMessage"), "receiveMessage", this, {before: e => {
let message = e.methodArguments[1];
let guildid = message.guild_id ? message.guild_id : null;
if (!this.ChannelSettingsUtils.isGuildOrCategoryOrChannelMuted(guildid, message.channel_id) && message.author.id != BDFDB.myData.id) {
if (!guildid) {
this.fireEvent("dm");
this.playAudio("dm");
}
else if (message.mentions) {
for (let mention of message.mentions) if (mention.id == BDFDB.myData.id) {
this.fireEvent("mentioned");
this.playAudio("mentioned");
break;
}
}
}
}});
BDFDB.WebModules.patch(BDFDB.WebModules.findByProperties("playSound"), "playSound", this, {instead: e => {
setImmediate(() => {
var type = e.methodArguments[0];
if (type == "message1") {
if (this.firedEvents["dm"]) this.firedEvents["dm"] = false;
else if (this.firedEvents["mentioned"]) this.firedEvents["mentioned"] = false;
else this.playAudio(type);
}
else this.playAudio(type);
});
}});
this.loadAudios();
this.loadChoices();
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
openDropdownMenu (settingspanel, e) {
let selectControl = e.currentTarget;
let selectWrap = selectControl.parentElement;
let plugincard = BDFDB.getParentEle("li", selectWrap);
if (!plugincard || BDFDB.containsClass(selectWrap, BDFDB.disCN.selectisopen)) return;
BDFDB.addClass(selectWrap, BDFDB.disCN.selectisopen);
var type = selectWrap.getAttribute("type");
var option = selectWrap.getAttribute("option");
var categorySelect = settingspanel.querySelector(`${BDFDB.dotCN.select}[type="${type}"][option="category"]`);
var songSelect = settingspanel.querySelector(`${BDFDB.dotCN.select}[type="${type}"][option="song"]`);
var category = categorySelect.getAttribute("value");
var song = songSelect.getAttribute("value");
var selectMenu = this.createDropdownMenu({type, option, category, song});
selectWrap.appendChild(selectMenu);
BDFDB.addChildEventListener(selectMenu, "mousedown", BDFDB.dotCN.selectoption, e2 => {
var choice = BDFDB.loadData(type, this, "choices");
var selection = e2.currentTarget.textContent;
selectWrap.setAttribute("value", selection);
selectControl.querySelector(BDFDB.dotCN.title).innerText = selection;
choice[option] = selection;
if (option == "category") {
choice.song = Object.keys(this.audios[selection])[0];
songSelect.outerHTML = `<div type="${type}" option="song" value="${choice.song}" class="${BDFDB.disCNS.select + BDFDB.disCNS.selectsingle + BDFDB.disCN.selecthasvalue}"><div class="${BDFDB.disCN.selectcontrol}"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectvalue}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}" style="padding:0;">${choice.song}</div></div><span class="${BDFDB.disCN.selectarrowzone}"><span class="${BDFDB.disCN.selectarrow}"></span></span></div></div>`;
}
choice.src = this.audios[choice.category][choice.song];
choice.src = choice.src ? choice.src : this.types[type].src;
this.saveChoice(type, choice, true);
});
var removeMenu = e2 => {
if (e2.target.parentElement != selectMenu) {
document.removeEventListener("mousedown", removeMenu);
selectMenu.remove();
setTimeout(() => {BDFDB.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
}
};
document.addEventListener("mousedown", removeMenu);
}
createDropdownMenu ({type, option, category, song} = data) {
var choice = BDFDB.loadData(type, this, "choices");
var eles = option == "song" ? this.audios[category] : this.audios;
var menuhtml = `<div class="${BDFDB.disCN.selectmenuouter}"><div class="${BDFDB.disCN.selectmenu}">`;
for (var ele in eles) {
var isSelected = choice[option] == ele ? ` ${BDFDB.disCN.selectselected}` : ``;
menuhtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectoption + isSelected}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}">${ele}</div></div>`
}
menuhtml += `</div></div>`;
return BDFDB.htmlToElement(menuhtml);
}
dragSlider (settingspanel, e) {
var grabber = e.target;
var track = grabber.parentNode;
var slider = track.parentNode;
var input = slider.querySelector(".volumeInput");
var bar = slider.querySelector(BDFDB.dotCN.sliderbarfill);
BDFDB.appendLocalStyle("disableTextSelection", `*{user-select: none !important;}`);
var volume = 0;
var sY = 0;
var sHalfW = BDFDB.getRects(grabber).width/2;
var sMinX = BDFDB.getRects(track).left;
var sMaxX = sMinX + BDFDB.getRects(track).width;
var mouseup = () => {
document.removeEventListener("mouseup", mouseup);
document.removeEventListener("mousemove", mousemove);
BDFDB.removeLocalStyle("disableTextSelection");
var type = slider.getAttribute("type");
var choice = this.choices[type];
choice.volume = volume;
this.saveChoice(type, choice, true);
};
var mousemove = e2 => {
sY = e2.clientX > sMaxX ? sMaxX - sHalfW : (e2.clientX < sMinX ? sMinX - sHalfW : e2.clientX - sHalfW);
volume = BDFDB.mapRange([sMinX - sHalfW, sMaxX - sHalfW], [0, 100], sY);
grabber.style.setProperty("left", volume + "%");
bar.style.setProperty("width", volume + "%");
input.value = volume;
};
document.addEventListener("mouseup", mouseup);
document.addEventListener("mousemove", mousemove);
}
loadAudios () {
this.audios = BDFDB.loadAllData(this, "audios");
if (BDFDB.isObjectEmpty(this.audios)) this.audios = this.defaults;
BDFDB.saveAllData(this.audios, this, "audios");
}
saveAudio (settingspanel) {
var valid = true;
var inputs = settingspanel.querySelectorAll(".songInput");
inputs.forEach((input) => {
if (!input.value || input.value.length == 0 || input.value.trim().length == 0) valid = false;
});
if (valid) {
var successSavedAudio;
var category = settingspanel.querySelector("#input-category").value;
var song = settingspanel.querySelector("#input-song").value;
var url = settingspanel.querySelector("#input-url").value;
if (url.indexOf("http") == 0) {
require("request")(url, (error, response, result) => {
if (response) {
var type = response.headers["content-type"];
if (type && (type.indexOf("octet-stream") > -1 || type.indexOf("audio") > -1 || type.indexOf("video") > -1)) {
successSavedAudio();
return;
}
}
BDFDB.showToast("Use a valid direct link to a video or audio source. They usually end on something like .mp3, .mp4 or .wav.", {type:"danger"});
});
}
else {
require("fs").readFile(url, (error, response) => {
if (error) {
BDFDB.showToast("Could not fetch file. Please make sure the file exists.", {type:"danger"});
}
else {
url = `data:audio/mpeg;base64,${response.toString("base64")}`;
successSavedAudio();
}
});
}
successSavedAudio = () => {
BDFDB.showToast(`Song ${song} was added to category ${category}.`, {type:"success"});
if (!this.audios[category]) this.audios[category] = {};
this.audios[category][song] = url;
BDFDB.saveAllData(this.audios, this, "audios");
inputs.forEach((input) => {
input.value = "";
});
};
}
else {
BDFDB.showToast("Fill out all fields to add a new song.", {type:"danger"});
}
}
loadChoices () {
for (var type in this.types) {
var choice = BDFDB.loadData(type, this, "choices");
choice = choice ? choice : {};
var songFound = false;
for (var category in this.audios) {
if (choice.category == category) {
for (var song in this.audios[category]) {
if (choice.song == song) {
songFound = true;
break;
}
}
}
}
if (!songFound) choice = {category:"---",song:"---",volume:100,src:this.types[type].src,mute:this.types[type].mute};
if (typeof choice.mute == "undefined") choice.mute = this.types[type].mute;
this.saveChoice(type, choice, false);
}
}
saveChoice (type, choice, play) {
BDFDB.saveData(type, choice, this, "choices");
this.choices[type] = choice;
if (play) this.playAudio(type, this.settingsaudio);
}
playAudio (type, audio) {
if (!audio) {
if (this.dontPlayAudio(type)) return;
audio = new Audio()
}
else audio.pause();
audio.src = this.choices[type].src;
audio.volume = this.choices[type].volume/100;
audio.play();
}
dontPlayAudio (type) {
let status = BDFDB.getUserStatus();
return this.choices[type].mute && (status == "dnd" || status == "streaming");
}
fireEvent (type) {
this.firedEvents[type] = true;
setTimeout(() => {this.firedEvents[type] = false;},3000);
}
patchCallingSound (instance, instancetype, type) {
let audio = new Audio();
let play = () => {
if (!audio.paused || this.dontPlayAudio(type)) return;
audio.loop = true;
audio.src = this.choices[type].src;
audio.volume = this.choices[type].volume/100;
audio.play();
};
let stop = () => {audio.pause();}
instance.stopRinging();
BDFDB.WebModules.patch(instance, "startRinging", this, {instead: play});
BDFDB.WebModules.patch(instance, "stopRinging", this, {instead: stop});
BDFDB.WebModules.patch(instance._reactInternalFiber.type.prototype, "startRinging", this, {instead: play});
BDFDB.WebModules.patch(instance._reactInternalFiber.type.prototype, "stopRinging", this, {instead: stop});
BDFDB.WebModules.unpatch(instance._reactInternalFiber.type.prototype, this.patchModules[instancetype], this);
}
processIncomingCalls (instance, wrapper) {
this.patchCallingSound(instance, "IncomingCalls", "call_ringing");
}
processPrivateChannelCall (instance, wrapper) {
console.log(wrapper);
this.patchCallingSound(instance, "PrivateChannelCall", "call_calling");
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var fields = ["category","song"];
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
settingshtml += `<div class="add-new-song-settings"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">Add New Song:</h3></div>`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">`;
settingshtml += `<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 50%;"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin + BDFDB.disCN.marginbottom4}">Categoryname:</h5><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" placeholder="Category" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} songInput" id="input-category"></div></div>`;
settingshtml += `<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 50%;"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin + BDFDB.disCN.marginbottom4}">Songname:</h5><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" placeholder="Name" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} songInput" id="input-song"></div></div>`;
settingshtml += `</div>`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">`;
settingshtml += `<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin + BDFDB.disCN.marginbottom4}">File:</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" placeholder="Url or Filepath" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} songInput" id="input-url"></div><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} file-navigator" id="input-file" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}"></div><input type="file" accept="audio/*,video/*" style="display:none!important;"></button><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} btn-add btn-addsong" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}"></div></button></div></div>`;
settingshtml += `</div>`;
settingshtml += `</div>`;
for (var type in this.types) {
var choice = BDFDB.loadData(type, this, "choices");
settingshtml += `<div class="${type}-song-settings${this.types[type].implemented ? '"' : ' unimplemented" style="display: none !important;"'}><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.types[type].name}:</h3><h5 class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin}" style="flex: 0 0 auto;">Mute in DnD:</h5><div type="${type}" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} mute-checkbox"${choice.mute ? " checked" : ""}></div></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">`;
for (var key of fields) {
settingshtml += `<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 33%;"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin + BDFDB.disCN.marginbottom4}">${key}:</h5><div class="${BDFDB.disCN.selectwrap}"><div type="${type}" option="${key}" value="${choice[key]}" class="${BDFDB.disCNS.select + BDFDB.disCNS.selectsingle + BDFDB.disCN.selecthasvalue}"><div class="${BDFDB.disCN.selectcontrol}"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectvalue}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}" style="padding:0;">${choice[key]}</div></div><span class="${BDFDB.disCN.selectarrowzone}"><span class="${BDFDB.disCN.selectarrow}"></span></span></div></div></div></div>`;
}
settingshtml += `<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 33%;"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin + BDFDB.disCN.marginbottom4}">volume:</h5><div type="${type}" class="${BDFDB.disCN.slider}"><input type="number" class="${type}-volume ${BDFDB.disCN.sliderinput} volumeInput" value="${choice.volume}" readonly=""><div class="${BDFDB.disCN.sliderbar}"><div class="${BDFDB.disCN.sliderbarfill}" style="width: ${choice.volume}%;"></div></div><div class="${BDFDB.disCN.slidertrack}"><div class="${BDFDB.disCN.slidergrabber} marginTop" style="left: ${choice.volume}%;"></div></div></div></div>`;
settingshtml += `</div></div>`;
}
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Show unimplemented Sounds</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner}" id="input-unimplemented"></div></div>`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Remove all added songs.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} reset-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {this.openDropdownMenu(settingspanel, e);});
BDFDB.addEventListener(this, settingspanel, "click", ".btn-addsong", e => {this.saveAudio(settingspanel);});
BDFDB.addEventListener(this, settingspanel, "keyup", ".songInput", e => {if (e.which == 13) this.saveAudio(settingspanel);});
BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to delete all added songs?", () => {
BDFDB.removeAllData(this, "choices");
BDFDB.removeAllData(this, "audios");
this.loadAudios();
this.loadChoices();
settingspanel.querySelectorAll(BDFDB.dotCN.select).forEach(wrap => {
wrap.setAttribute("value", "---");
wrap.querySelector(BDFDB.dotCN.title).innerText = "---";
});
settingspanel.querySelectorAll(BDFDB.dotCN.slidergrabber).forEach(grabber => {
grabber.style.left = "100%";
});
settingspanel.querySelectorAll(BDFDB.dotCN.sliderbarfill).forEach(bar => {
bar.style.width = "100%";
});
settingspanel.querySelectorAll(".volumeInput").forEach(input => {
input.value = 100;
});
});
});
BDFDB.addEventListener(this, settingspanel, "click", ".mute-checkbox", e => {
var type = e.currentTarget.parentElement.getAttribute("type");
var choice = BDFDB.loadData(type, this, "choices");
choice.mute = e.currentTarget.checked;
this.saveChoice(type, choice, false);
});
BDFDB.addEventListener(this, settingspanel, "click", "#input-unimplemented", e => {
BDFDB.toggleEles(settingspanel.querySelectorAll(".unimplemented"), e.currentTarget.checked);
});
BDFDB.addEventListener(this, settingspanel, "mousedown", BDFDB.dotCN.slidergrabber, e => {this.dragSlider(settingspanel,e);});
return settingspanel;
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Old Title Bar - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/OldTitleBar/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/OldTitleBar/config.json)
Reverts the title bar back to its former self.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "OldTitleBar",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Reverts the title bar back to its former self. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,269 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"HeaderBar":["componentDidMount","componentDidUpdate"],
"StandardSidebarView":["componentDidMount","componentWillUnmount"],
"AuthWrapper":["componentDidMount","componentWillUnmount"]
};
this.patched = false;
this.css = `
body.hidden-by-OTB .bd-settings-button,
body.hidden-by-OTB .bd-settings {
top: 0 !important;
}
.hidden-by-OTB ${BDFDB.dotCN.titlebar},
.hidden-by-OTB ${BDFDB.dotCN.titlebar} + ${BDFDB.dotCNS.app + BDFDB.dotCN.splashbackground}:before {
display: none !important;
}
body:not(.settingsTitlebarOTB-added) ${BDFDB.dotCN.channelheaderheaderbardrag} {
-webkit-app-region: drag !important;
}
${BDFDB.dotCN.channelheaderheaderbardrag} *,
${BDFDB.dotCN.contextmenu} * {
-webkit-app-region: no-drag !important;
}
.settingsTitlebarOTB {
position: relative;
z-index: 1000;
text-align: right;
padding: 10px;
-webkit-app-region: drag;
}`;
this.dividerMarkup = `<div class="buttonOTB dividerOTB ${BDFDB.disCN.channelheaderdivider}"></div>`;
this.reloadButtonMarkup =
`<span class="${BDFDB.disCN.channelheadericonmargin} buttonOTB reloadButtonOTB">
<svg class="${BDFDB.disCNS.channelheadericoninactive + BDFDB.disCN.channelheadericon}" xmlns="http://www.w3.org/2000/svg">
<g fill="none" class="${BDFDB.disCN.channelheadericonforeground}" fill-rule="evenodd">
<path fill="currentColor" transform="translate(4,4)" d="M17.061,7.467V0l-2.507,2.507C13.013,0.96,10.885,0,8.528,0C3.813,0,0.005,3.819,0.005,8.533s3.808,8.533,8.523,8.533c3.973,0,7.301-2.72,8.245-6.4h-2.219c-0.88,2.485-3.237,4.267-6.027,4.267c-3.536,0-6.4-2.864-6.4-6.4s2.864-6.4,6.4-6.4c1.765,0,3.349,0.736,4.507,1.893l-3.44,3.44H17.061z"/>
</g>
</svg>
</span>`;
this.minButtonMarkup =
`<span class="${BDFDB.disCN.channelheadericonmargin} buttonOTB minButtonOTB">
<svg class="${BDFDB.disCNS.channelheadericoninactive + BDFDB.disCN.channelheadericon}" xmlns="http://www.w3.org/2000/svg" width="26" height="26">
<g fill="none" class="${BDFDB.disCN.channelheadericonforeground}" fill-rule="evenodd">
<path stroke-width="2" stroke="currentColor" d="M6 18 l13 0"/>
</g>
</svg>
</span>`;
this.maxButtonMarkup =
`<span class="${BDFDB.disCN.channelheadericonmargin} buttonOTB maxButtonOTB">
<svg class="${BDFDB.disCNS.channelheadericoninactive + BDFDB.disCN.channelheadericon}" xmlns="http://www.w3.org/2000/svg" width="26" height="26">
<g fill="none" class="${BDFDB.disCN.channelheadericonforeground}" fill-rule="evenodd"></g>
</svg>
</span>`;
this.maxButtonInnerMin = `<path stroke-width="2" stroke="currentColor" d="M6 6 l13 0 l0 13 l-13 0 l0 -13"/>`;
this.maxButtonInnerMax = `<path stroke-width="2" stroke="currentColor" d="M6 9 l10 0 l0 10 l-10 0 l0 -10 m3 -3 l10 0 l0 10"/>`;
this.closeButtonMarkup =
`<span class="${BDFDB.disCN.channelheadericonmargin} buttonOTB closeButtonOTB">
<svg class="${BDFDB.disCNS.channelheadericoninactive + BDFDB.disCN.channelheadericon}" xmlns="http://www.w3.org/2000/svg" width="26" height="26">
<g fill="none" class="${BDFDB.disCN.channelheadericonforeground}" fill-rule="evenodd">
<path stroke-width="2" stroke="currentColor" d="M6 6 l13 13 m0 -13 l-13 13"/>
</g>
</svg>
</span>`;
this.defaults = {
settings: {
displayNative: {value:!!document.querySelector(".platform-linux"), description:"Displays the native Title Bar."},
addOldBar: {value:true, description:"Displays the Title Bar in the old fashion."},
addToSettings: {value:true, description:"Adds a Title Bar to Settings Windows."},
reloadButton: {value:false, description:"Adds a Reload Button to the Title Bar."}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
BDFDB.addEventListener(this, window, "resize", e => {this.changeMaximizeButtons();});
this.window = require("electron").remote.getCurrentWindow();
this.patchMainScreen(BDFDB.getData("displayNative", this, "settings"));
BDFDB.addClass([document.body,document.querySelector(BDFDB.dotCN.titlebar)], "hidden-by-OTB");
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".headerbarOTB", ".settingsTitlebarOTB");
BDFDB.removeClasses("hidden-by-OTB", "settingsTitlebarOTB-added");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
processHeaderBar (instance, wrapper) {
this.addTitleBar();
}
processStandardSidebarView (instance, wrapper, methodnames) {
this.processAuthWrapper(instance, wrapper, methodnames);
}
processAuthWrapper (instance, wrapper, methodnames) {
if (methodnames.includes("componentDidMount")) {
this.addSettingsTitleBar(wrapper);
}
else if (methodnames.includes("componentWillUnmount")) {
BDFDB.removeEles(".settingsTitlebarOTB");
BDFDB.removeClass(document.body, "settingsTitlebarOTB-added");
this.addTitleBar();
}
}
addTitleBar () {
BDFDB.removeEles(".headerbarOTB");
var settings = BDFDB.getAllData(this, "settings");
if (BDFDB.getData("addOldBar", this, "settings")) {
var headerbar = BDFDB.htmlToElement(`<span class="headerbarOTB ${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}"></span>`);
this.createButtons(headerbar);
let headerbaricon = document.querySelector(BDFDB.dotCNS.channelheaderheaderbardrag + BDFDB.dotCN.flex + " > " + BDFDB.dotCN.channelheadericonmargin);
if (headerbaricon) headerbaricon.parentElement.appendChild(headerbar);
this.changeMaximizeButtons();
}
}
addSettingsTitleBar (settingspane) {
BDFDB.removeEles(".settingsTitlebarOTB");
if (BDFDB.getData("addToSettings", this, "settings")) {
BDFDB.addClass(document.body, "settingsTitlebarOTB-added");
var settingsbar = BDFDB.htmlToElement(`<div class="settingsTitlebarOTB"></div>`);
this.createButtons(settingsbar);
settingspane.parentElement.appendChild(settingsbar);
this.changeMaximizeButtons();
}
}
createButtons (bar) {
var settings = BDFDB.containsClass(bar, "settingsTitlebarOTB");
if (BDFDB.getData("reloadButton", this, "settings")) {
if (!settings) bar.appendChild(BDFDB.htmlToElement(this.dividerMarkup));
var reloadbutton = BDFDB.htmlToElement(this.reloadButtonMarkup);
bar.appendChild(reloadbutton);
var reloadbuttonicon = reloadbutton.querySelector(BDFDB.dotCN.channelheadericon);
reloadbuttonicon.addEventListener("click", () => {this.window.reload();});
reloadbuttonicon.addEventListener("mouseenter", e => {
BDFDB.createTooltip("Reload", reloadbuttonicon, {type:"bottom",selector:"reload-button-tooltip"});
});
}
if (!settings) bar.appendChild(BDFDB.htmlToElement(this.dividerMarkup));
var minbutton = BDFDB.htmlToElement(this.minButtonMarkup);
bar.appendChild(minbutton);
minbutton.querySelector(BDFDB.dotCN.channelheadericon).addEventListener("click", () => {this.window.minimize();});
var maxbutton = BDFDB.htmlToElement(this.maxButtonMarkup);
bar.appendChild(maxbutton);
maxbutton.querySelector(BDFDB.dotCN.channelheadericon).addEventListener("click", () => {
if (this.window.isMaximized()) this.window.unmaximize();
else this.window.maximize();
this.changeMaximizeButtons();
});
var closebutton = BDFDB.htmlToElement(this.closeButtonMarkup);
bar.appendChild(closebutton);
closebutton.querySelector(BDFDB.dotCN.channelheadericon).addEventListener("click", () => {this.window.close();});
}
changeMaximizeButtons () {
var innerHTML = this.window.isMaximized() ? this.maxButtonInnerMax : this.maxButtonInnerMin;
document.querySelectorAll(".maxButtonOTB g").forEach(g => {g.innerHTML = innerHTML;});
}
patchMainScreen (enable) {
if (BdApi.getWindowPreference("frame") != enable) {
BdApi.setWindowPreference("frame", enable);
return true;
}
return false;
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch${key == "displayNative" ? " nativetitlebar-switch" : ""}"${settings[key] ? " checked" : ""}></div></div>`;
}
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "click", ".nativetitlebar-switch", e => {
if (this.patchMainScreen(e.currentTarget.checked)) {
this.patched = !this.patched;
let notifybar = document.querySelector("#OldTitleBarNotifyBar");
if (notifybar) notifybar.querySelector(BDFDB.dotCN.noticedismiss).click();
if (this.patched) {
notifybar = BDFDB.createNotificationsBar("Changed nativebar settings, relaunch to see changes:", {type:"danger",btn:"Relaunch",id:"OldTitleBarNotifyBar"});
notifybar.querySelector(BDFDB.dotCN.noticebutton).addEventListener("click", () => {
let app = require("electron").remote.app;
app.relaunch();
app.quit();
});
}
}
});
return settingspanel;
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
this.addTitleBar();
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Personal Pins - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/PersonalPins/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/PersonalPins/config.json)
Allows you to pin messages in your own personal note books. Similar to pins you can check the notes of the current channel via the controlbar on the top.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "PersonalPins",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Similar to normal pins. Lets you save messages as notes for yourself. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,925 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.labels = {};
this.patchModules = {
"HeaderBar":["componentDidMount","componentDidUpdate"],
"Message":"componentDidMount",
"MessageOptionPopout":"componentDidMount"
};
this.notesButtonMarkup =
`<span class="${BDFDB.disCN.channelheadericonmargin} notes-button">
<svg class="${BDFDB.disCNS.channelheadericoninactive + BDFDB.disCN.channelheadericon}" name="Note" width="16" height="16" viewBox="0 0 26 26">
<g fill="none" fill-rule="evenodd" transform="translate(3,2)">
<path class="${BDFDB.disCN.channelheadericonforeground}" fill="currentColor" d="M 4.618, 0 c -0.316, 0 -0.573, 0.256 -0.573, 0.573 v 1.145 c 0, 0.316, 0.256, 0.573, 0.573, 0.573 s 0.573 -0.256, 0.573 -0.573 V 0.573 C 5.191, 0.256, 4.935, 0, 4.618, 0 z"/>
<path class="${BDFDB.disCN.channelheadericonforeground}" fill="currentColor" d="M 8.053, 0 c -0.316, 0 -0.573, 0.256 -0.573, 0.573 v 1.145 c 0, 0.316, 0.256, 0.573, 0.573, 0.573 s 0.573 -0.256, 0.573 -0.573 V 0.573 C 8.626, 0.256, 8.37, 0, 8.053, 0 z"/>
<path class="${BDFDB.disCN.channelheadericonforeground}" fill="currentColor" d="M 11.489, 0 c -0.316, 0 -0.573, 0.256 -0.573, 0.573 v 1.145 c 0, 0.316, 0.256, 0.573, 0.573, 0.573 c 0.316, 0, 0.573 -0.256, 0.573 -0.573 V 0.573 C 12.061, 0.256, 11.805, 0, 11.489, 0 z "/>
<path class="${BDFDB.disCN.channelheadericonforeground}" fill="currentColor" d="M 14.924, 0 c -0.316, 0 -0.573, 0.256 -0.573, 0.573 v 1.145 c 0, 0.316, 0.256, 0.573, 0.573, 0.573 c 0.316, 0, 0.573 -0.256, 0.573 -0.573 V 0.573 C 15.496, 0.256, 15.24, 0, 14.924, 0 z"/>
<path class="${BDFDB.disCN.channelheadericonforeground}" fill="currentColor" d="M 16.641, 1.25 V 1.718 c 0, 0.947 -0.77, 1.718 -1.718, 1.718 c -0.947, 0 -1.718 -0.77 -1.718 -1.718 c 0, 0.947 -0.77, 1.718 -1.718, 1.718 c -0.947, 0 -1.718 -0.77 -1.718 -1.718 c 0, 0.947 -0.77, 1.718 -1.718, 1.718 c -0.947, 0 -1.718 -0.77 -1.718 -1.718 c 0, 0.947 -0.77, 1.718 -1.718, 1.718 c -0.947, 0 -1.718 -0.77 -1.718 -1.718 V 1.25 C 2.236, 1.488, 1.756, 2.117, 1.756, 2.863 v 14.962 c 0, 0.947, 0.77, 1.718, 1.718, 1.718 h 12.595 c 0.947, 0, 1.718 -0.77, 1.718 -1.718 V 2.863 C 17.786, 2.117, 17.306, 1.488, 16.641, 1.25 z M 14.924, 16.679 H 4.618 c -0.316, 0 -0.573 -0.256 -0.573 -0.573 c 0 -0.316, 0.256 -0.573, 0.573 -0.573 h 10.305 c 0.316, 0, 0.573, 0.256, 0.573, 0.573 C 15.496, 16.423, 15.24, 16.679, 14.924, 16.679 z M 14.924, 13.244 H 4.618 c -0.316, 0 -0.573 -0.256 -0.573 -0.573 c 0 -0.316, 0.256 -0.573, 0.573 -0.573 h 10.305 c 0.316, 0, 0.573, 0.256, 0.573, 0.573 C 15.496, 12.988, 15.24, 13.244, 14.924, 13.244 z M 14.924, 9.733 H 4.618 c -0.316, 0 -0.573 -0.256 -0.573 -0.573 s 0.256 -0.573, 0.573 -0.573 h 10.305 c 0.316, 0, 0.573, 0.256, 0.573, 0.573 S 15.24, 9.733, 14.924, 9.733 z M 14.924, 6.298 H 4.618 c -0.316, 0 -0.573 -0.256 -0.573 -0.573 s 0.256 -0.573, 0.573 -0.573 h 10.305 c 0.316, 0, 0.573, 0.256, 0.573, 0.573 S 15.24, 6.298, 14.924, 6.298 z"/>
</g>
</svg>
</span>`;
this.notesPopoutMarkup =
`<div class="${BDFDB.disCNS.popout + BDFDB.disCNS.popoutbottomright + BDFDB.disCNS.popoutnoarrow + BDFDB.disCN.popoutnoshadow} popout-personalpins-notes DevilBro-modal" style="z-index: 1000; visibility: visible; left: 544.844px; top: 35.9896px; transform: translateX(-100%) translateY(0%) translateZ(0px);">
<div class="${BDFDB.disCNS.messagespopoutwrap + BDFDB.disCNS.recentmentionspopout + BDFDB.disCN.popoutthemedpopout}" style="max-height: 740px; width: 500px;">
<div class="${BDFDB.disCNS.recentmentionsheader + BDFDB.disCNS.popoutheader + BDFDB.disCN.messagespopoutheader}" style="padding-bottom: 0;">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.margintop8}" style="flex: 0 0 auto;">
<div class="${BDFDB.disCNS.popouttitle + BDFDB.disCN.messagespopouttitle}">REPLACE_popout_note_text</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.searchbar + BDFDB.disCN.size14}" style="flex: 1 1 auto;">
<input class="${BDFDB.disCN.searchbarinput}" value="" placeholder="Search for ..." style="flex: 1 1 auto;">
<div class="${BDFDB.disCN.searchbariconwrap}">
<i class="${BDFDB.disCNS.searchbaricon + BDFDB.disCNS.searchbareyeglass + BDFDB.disCN.searchbarvisible}"></i>
<i class="${BDFDB.disCNS.searchbaricon + BDFDB.disCN.searchbarclear}"></i>
</div>
</div>
</div>
<div class="${BDFDB.disCN.tabbarheadercontainer}" style="flex: 0 0 auto;">
<div class="${BDFDB.disCNS.tabbarheader + BDFDB.disCN.tabbartop}">
<div tab="channel" class="${BDFDB.disCNS.settingsitemdefault + BDFDB.disCNS.settingsitem + BDFDB.disCNS.settingsnotselected + BDFDB.disCN.tabbarheaderitem}">REPLACE_popout_channel_text</div>
<div tab="server" class="${BDFDB.disCNS.settingsitemdefault + BDFDB.disCNS.settingsitem + BDFDB.disCNS.settingsnotselected + BDFDB.disCN.tabbarheaderitem}">REPLACE_popout_server_text</div>
<div tab="allservers" class="${BDFDB.disCNS.settingsitemdefault + BDFDB.disCNS.settingsitem + BDFDB.disCNS.settingsnotselected + BDFDB.disCN.tabbarheaderitem}">REPLACE_popout_allservers_text</div>
</div>
<div class="${BDFDB.disCN.recentmentionsmentionfilter}" style="padding-right: 15px;">
<div class="${BDFDB.disCN.recentmentionsmentionfilterlabel}">REPLACE_popout_sort_text:</div>
<div option="timestamp" class="${BDFDB.disCN.recentmentionsmentionfiltervalue}" style="text-transform: none;">REPLACE_popout_messagesort_text</div>
</div>
</div>
</div>
<div class="${BDFDB.disCN.scrollerwrap}">
<div class="${BDFDB.disCNS.messagespopout + BDFDB.disCN.scroller}">
<div class="${BDFDB.disCN.messagespopoutemptyplaceholder}">
<div class="${BDFDB.disCN.messagespopoutimage}"></div>
<div class="${BDFDB.disCN.messagespopoutbody}"></div>
</div>
</div>
</div>
</div>
</div>`;
this.sortPopoutMarkup =
`<div class="${BDFDB.disCNS.popout + BDFDB.disCNS.popoutbottomright + BDFDB.disCN.popoutnoshadow} personalpins-sort-popout" style="z-index: 1100; visibility: visible; transform: translateX(-100%) translateY(0%) translateZ(0px);">
<div>
<div class="${BDFDB.disCN.contextmenu} quickSelectPopout">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div option="timestamp" class="${BDFDB.disCN.contextmenuitem}">REPLACE_popout_messagesort_text</div>
<div option="addedat" class="${BDFDB.disCN.contextmenuitem}">REPLACE_popout_datesort_text</div>
</div>
</div>
</div>
</div>`;
this.messagePinContextEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} personalpins-item personalpins-pin-item">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_pinoption_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>`;
this.messageUnpinContextEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} personalpins-item personalpins-unpin-item">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_unpinoption_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>`;
this.popoutPinEntryMarkup =
`<button role="menuitem" type="button" class="${BDFDB.disCNS.optionpopoutitem + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow} personalpins-itembtn personalpins-pin-itembtn">
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_popout_pinoption_text</div>
</button>`;
this.popoutUnpinEntryMarkup =
`<button role="menuitem" type="button" class="${BDFDB.disCNS.optionpopoutitem + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow} personalpins-itembtn personalpins-unpin-itembtn">
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_popout_unpinoption_text</div>
</button>`;
this.messageDividerMarkup =
`<div class="${BDFDB.disCN.messagespopoutchannelseparator}">
<span tabindex="0" class="${BDFDB.disCN.messagespopoutchannelname}" role="button"></span>
<span class=${BDFDB.disCN.messagespopoutguildname}></span>
</div>`;
this.messageMarkup =
`<div class="${BDFDB.disCN.messagespopoutmessagegroupwrapper}">
<div class="${BDFDB.disCN.messagespopoutmessagegroupwrapperoffsetcorrection}">
<div class="${BDFDB.disCNS.messagespopoutcontainercozybounded + BDFDB.disCNS.messagegroup + BDFDB.disCN.messagegroupcozy}">
<div class="${BDFDB.disCNS.messagespopoutmessagegroupcozy + BDFDB.disCNS.messagecozy + BDFDB.disCN.message}" aria-disabled="true">
<div class="${BDFDB.disCN.messageheadercozy}">
<div tabindex="-1" aria-hidden="true" class="${BDFDB.disCNS.avatarwrapper + BDFDB.disCNS.avatarlarge + BDFDB.disCN.avatar}" role="button">
<div class="${BDFDB.disCNS.avatarimage + BDFDB.disCN.avatarlarge}"></div>
</div>
<h2 class="${BDFDB.disCN.messageheadercozymeta}">
<span class="">
<strong tabindex="0" class="${BDFDB.disCN.messageusername}" role="button"></strong>
</span>
<time class="${BDFDB.disCN.messagetimestampcozy}"></time>
</h2>
</div>
<div class="${BDFDB.disCNS.messagecontentcozy + BDFDB.disCN.messagecontent}">
<div class="${BDFDB.disCNS.messagebodycozy + BDFDB.disCN.messagebody}">
<div class="${BDFDB.disCN.messagemarkup}"></div>
</div>
<div class="${BDFDB.disCNS.messagespopoutaccessories + BDFDB.disCNS.messageaccessorycozy + BDFDB.disCN.messageaccessory}"></div>
</div>
</div>
<div class="${BDFDB.disCNS.sinkinteractions + BDFDB.disCN.clickable}"></div>
<div class="${BDFDB.disCN.messagespopoutactionbuttons}">
<div tabindex="0" class="${BDFDB.disCN.messagespopoutjumpbutton} jump" role="button">
<div class="${BDFDB.disCN.messagespopouttext}">REPLACE_popout_jump_text</div>
</div>
<div tabindex="0" class="${BDFDB.disCN.messagespopoutjumpbutton} copy" aria-label="Jump" role="button">
<div class="${BDFDB.disCN.messagespopouttext}">REPLACE_popout_copy_text</div>
</div>
<button type="button" class="${BDFDB.disCNS.button + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonlookblank + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">
<div class="${BDFDB.disCN.messagespopoutclosebutton}"></div>
</div>
</button>
</div>
<hr aria-hidden="true" class="${BDFDB.disCNS.messagedividerenabled + BDFDB.disCN.messagedivider}">
</div>
</div>
</div>`;
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.SelectChannelUtils = BDFDB.WebModules.findByProperties("selectGuild","selectChannel");
this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers","getUser");
this.MemberUtils = BDFDB.WebModules.findByProperties("getMembers","getMember");
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
this.HistoryUtils = BDFDB.WebModules.findByProperties("transitionTo", "replaceWith", "getHistory");
this.MainDiscord = BDFDB.WebModules.findByProperties("ActionTypes");
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".popout-personalpins-notes", ".personalpins-sort-popout", ".notes-button");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
changeLanguageStrings () {
this.messagePinContextEntryMarkup = this.messagePinContextEntryMarkup.replace("REPLACE_context_pinoption_text", this.labels.context_pinoption_text);
this.messageUnpinContextEntryMarkup = this.messageUnpinContextEntryMarkup.replace("REPLACE_context_unpinoption_text", this.labels.context_unpinoption_text);
this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_note_text", this.labels.popout_note_text);
this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_channel_text", this.labels.popout_channel_text);
this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_server_text", this.labels.popout_server_text);
this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_allservers_text", this.labels.popout_allservers_text);
this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_sort_text", this.labels.popout_sort_text);
this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_messagesort_text", this.labels.popout_messagesort_text);
this.messageMarkup = this.messageMarkup.replace("REPLACE_popout_jump_text", this.labels.popout_jump_text);
this.messageMarkup = this.messageMarkup.replace("REPLACE_popout_copy_text", this.labels.popout_copy_text);
this.sortPopoutMarkup = this.sortPopoutMarkup.replace("REPLACE_popout_messagesort_text", this.labels.popout_messagesort_text);
this.sortPopoutMarkup = this.sortPopoutMarkup.replace("REPLACE_popout_datesort_text", this.labels.popout_datesort_text);
this.popoutPinEntryMarkup = this.popoutPinEntryMarkup.replace("REPLACE_popout_pinoption_text", this.labels.popout_pinoption_text);
this.popoutUnpinEntryMarkup = this.popoutUnpinEntryMarkup.replace("REPLACE_popout_unpinoption_text", this.labels.context_unpinoption_text);
}
onMessageContextMenu (instance, menu) {
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".personalpins-item")) {
let pinentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,name:"MessagePinItem"}));
let messagePinContextEntry = BDFDB.htmlToElement(this.getNoteData(instance.props.message, instance.props.target, instance.props.channel) ? this.messageUnpinContextEntryMarkup : this.messagePinContextEntryMarkup);
if (pinentry) pinentry.parentElement.insertBefore(messagePinContextEntry, pinentry.nextElementSibling);
else menu.insertBefore(messagePinContextEntry, menu.firstElementChild);
let pinitem = messagePinContextEntry.querySelector(".personalpins-item");
pinitem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
this.addMessageToNotes(instance.props.message, instance.props.target, instance.props.channel);
});
if (BDFDB.isPluginEnabled("MessageUtilities")) {
BDFDB.setContextHint(pinitem, BDFDB.Plugins["messageutilities"].getActiveShortcutString("__Note_Message"));
}
}
}
processHeaderBar (instance, wrapper) {
BDFDB.removeEles(".notes-button");
let search = wrapper.querySelector(BDFDB.dotCN.channelheadersearch);
if (!search) return;
let notesbutton = BDFDB.htmlToElement(this.notesButtonMarkup);
search.parentElement.insertBefore(notesbutton, search);
let icon = notesbutton.querySelector(BDFDB.dotCN.channelheadericon);
icon.addEventListener("click", () => {
this.openNotesPopout(icon);
});
icon.addEventListener("mouseenter", () => {
BDFDB.createTooltip(this.labels.popout_note_text, icon, {type:"bottom",selector:"note-button-tooltip"});
});
}
processMessage (instance, wrapper) {
if (instance.props && typeof instance.props.renderButtons == "function" && !wrapper.querySelector(BDFDB.dotCN.optionpopoutbutton)) {
let buttonwrap = wrapper.querySelector(BDFDB.dotCN.messagebuttoncontainer);
if (buttonwrap) {
let optionPopoutButton = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.optionpopoutbutton}"></div>`);
optionPopoutButton.addEventListener("click", () => {BDFDB.createMessageOptionPopout(optionPopoutButton);});
buttonwrap.appendChild(optionPopoutButton);
}
}
}
processMessageOptionPopout (instance, wrapper) {
if (instance.props.message && instance.props.channel && instance._reactInternalFiber.memoizedProps.target && !wrapper.querySelector(".personalpins-itembtn")) {
let {messagediv, pos} = this.getMessageAndPos(instance._reactInternalFiber.memoizedProps.target);
if (!messagediv || pos == -1) return;
let popoutUnpinEntry = BDFDB.htmlToElement(this.getNoteData(instance.props.message, instance._reactInternalFiber.memoizedProps.target, instance.props.channel) ? this.popoutUnpinEntryMarkup : this.popoutPinEntryMarkup);
wrapper.appendChild(popoutUnpinEntry);
popoutUnpinEntry.addEventListener("click", () => {
this.addMessageToNotes(instance.props.message, instance._reactInternalFiber.memoizedProps.target, instance.props.channel);
instance.props.onClose();
});
}
}
openNotesPopout (button) {
let container = document.querySelector(BDFDB.dotCN.popouts);
if (!container || BDFDB.containsClass(button, "popout-open")) return;
BDFDB.addClass(button, "popout-open");
let notespopout = BDFDB.htmlToElement(this.notesPopoutMarkup);
container.appendChild(notespopout);
BDFDB.initElements(notespopout, this);
let buttonrects = BDFDB.getRects(button);
notespopout.style.setProperty("left", buttonrects.left + buttonrects.width/2 + "px");
notespopout.style.setProperty("top", buttonrects.top + buttonrects.height + "px")
notespopout.querySelectorAll(BDFDB.dotCN.tabbarheaderitem).forEach(tab => {tab.addEventListener("click", () => {
this.addNotes(notespopout);
});});
notespopout.querySelector(BDFDB.dotCN.searchbarinput).addEventListener("keyup", () => {
clearTimeout(notespopout.searchTimeout);
notespopout.searchTimeout = setTimeout(() => {this.addNotes(notespopout);},1000);
});
notespopout.querySelector(BDFDB.dotCN.searchbarclear).addEventListener("click", e => {
clearTimeout(notespopout.searchTimeout);
notespopout.searchTimeout = setTimeout(() => {this.addNotes(notespopout);},1000);
});
notespopout.querySelector(BDFDB.dotCN.recentmentionsmentionfilter).addEventListener("click", e => {
BDFDB.createSortPopout(e.currentTarget, this.sortPopoutMarkup, () => {this.addNotes(notespopout);});
});
var removePopout = e => {
if (!notespopout.contains(e.target) && !BDFDB.getParentEle(".personalpins-sort-popout", e.target)) {
document.removeEventListener("mousedown", removePopout);
notespopout.remove();
setTimeout(() => {BDFDB.removeClass(button, "popout-open");},300);
}
};
document.addEventListener("mousedown", removePopout);
this.addNotes(notespopout);
}
addNotes (notespopout) {
BDFDB.removeEles(notespopout.querySelectorAll(BDFDB.dotCNC.messagegroupwrapper + BDFDB.dotCN.messagespopoutchannelseparator));
let channel = BDFDB.getSelectedChannel();
if (channel) {
let guild_id = channel.guild_id ? channel.guild_id : "@me";
let pins = BDFDB.loadAllData(this, "pins");
if (!BDFDB.isObjectEmpty(pins)) {
let container = notespopout.querySelector(BDFDB.dotCN.messagespopout);
let placeholder = notespopout.querySelector(BDFDB.dotCN.messagespopoutemptyplaceholder);
if (!container || !placeholder) return;
placeholder.querySelector(BDFDB.dotCN.messagespopoutimage).style.setProperty("background-image", `url(${BDFDB.getDiscordTheme() == BDFDB.disCN.themelight ? "/assets/03c7541028afafafd1a9f6a81cb7f149.svg" : "/assets/6793e022dc1b065b21f12d6df02f91bd.svg"})`);
let notes = {};
switch (notespopout.querySelector(BDFDB.dotCN.tabbarheaderitem + BDFDB.dotCN.settingsitemselected).getAttribute("tab")) {
case "channel":
notes = pins[guild_id] && pins[guild_id][channel.id] ? pins[guild_id][channel.id] : {};
break;
case "server":
if (pins[guild_id]) for (let channel in pins[guild_id]) notes = Object.assign(notes, pins[guild_id][channel]);
break;
case "allservers":
for (let server in pins) if (pins[server]) for (let channel in pins[server]) notes = Object.assign(notes, pins[server][channel]);
break;
}
let noteArray = [];
for (let id in notes) {noteArray.push(notes[id]);}
BDFDB.sortArrayByKey(noteArray, notespopout.querySelector(BDFDB.dotCN.recentmentionsmentionfiltervalue).getAttribute("option"));
for (let noteData of noteArray) this.appendNote(container, noteData, placeholder);
let searchstring = notespopout.querySelector(BDFDB.dotCN.searchbarinput).value.replace(/[<|>]/g, "");
if (searchstring) for (let note of notespopout.querySelectorAll(BDFDB.dotCN.messagegroupwrapper)) {
note.innerHTML = BDFDB.highlightText(note.innerHTML, searchstring);
if (!note.querySelector(BDFDB.dotCN.highlight)) {
note.previousSibling.remove();
note.remove();
}
}
BDFDB.toggleEles(placeholder, container.firstElementChild == placeholder);
}
}
}
appendNote (container, noteData, placeholder) {
if (!container || !noteData) return;
let server = this.GuildUtils.getGuild(noteData.guild_id) || {};
let channel = this.ChannelUtils.getChannel(noteData.channel_id) || {};
let user = this.UserUtils.getUser(noteData.author_id) || {};
let member = this.MemberUtils.getMember(noteData.guild_id, noteData.author_id) || {};
let date = new Date(noteData.timestamp);
let message = BDFDB.htmlToElement(this.messageMarkup);
let messagedivider = BDFDB.htmlToElement(this.messageDividerMarkup);
container.insertBefore(message, container.firstChild);
container.insertBefore(messagedivider, container.firstChild);
let channelname = messagedivider.querySelector(BDFDB.dotCN.messagespopoutchannelname);
channelname.innerText = (noteData.guild_id == "@me" ? " @" : " #") + (channel.name || noteData.channel_name);
if (noteData.guild_id != "@me" && BDFDB.isPluginEnabled("EditChannels")) {
BDFDB.Plugins["editchannels"].changeChannel2({id:noteData.channel_id,name:noteData.channel_name}, channelname);
}
else if (noteData.guild_id == "@me" && BDFDB.isPluginEnabled("EditUsers")) {
let dmuser_id = channel && channel.type == 1 ? channel.recipients[0] : noteData.dmuser_id;
if (dmuser_id) {
BDFDB.Plugins["editusers"].changeName2({id:dmuser_id,username:noteData.channel_name}, channelname);
if (channelname.innerText.indexOf("@") != 0) channelname.innerText = "@" + channelname.innerText;
}
}
let guildname = messagedivider.querySelector(BDFDB.dotCN.messagespopoutguildname);
guildname.innerText = server.name || noteData.guild_name;
let avatar = message.querySelector(BDFDB.dotCN.avatarimage);
avatar.style.setProperty("background-image", `url(${user.id ? BDFDB.getUserAvatar(user.id) : noteData.avatar})`);
let username = message.querySelector(BDFDB.dotCN.messageusername);
username.innerText = user.username || noteData.author_name;
username.style.setProperty("color", member.colorString || noteData.color);
if (BDFDB.isPluginEnabled("EditUsers")) {
BDFDB.Plugins["editusers"].changeName({id:noteData.author_id,username:noteData.author_name}, username, noteData.guild_id);
if (user.id) BDFDB.Plugins["editusers"].changeAvatar({id:noteData.author_id,username:noteData.author_name}, avatar);
BDFDB.Plugins["editusers"].addTag({id:noteData.author_id,username:noteData.author_name}, username.parentElement, " " + BDFDB.disCN.bottagnametag);
}
let timestamp = message.querySelector(BDFDB.dotCN.messagetimestampcozy);
timestamp.innerText = date.toLocaleString(BDFDB.getDiscordLanguage().id);
timestamp.setAttribute("datetime", date);
if (BDFDB.isPluginEnabled("CompleteTimestamps") && BDFDB.loadData("showInChat", "CompleteTimestamps", "settings")) {
BDFDB.Plugins["completetimestamps"].changeTimestamp(timestamp);
}
message.querySelector(BDFDB.dotCN.messagemarkup).innerHTML = noteData.markup.replace(`<span class="edited">`,`<span class="${BDFDB.disCN.messageedited}">`);
message.querySelector(BDFDB.dotCN.messageaccessory).innerHTML = noteData.accessory;
if (noteData.accessory) {
BDFDB.addChildEventListener(message, "click", BDFDB.dotCN.iconplay, e => {this.startYoutubeVideo(e.currentTarget);});
let ytvideo = message.querySelector(BDFDB.dotCN.embed + " iframe[src*='https://www.youtube.com']");
if (ytvideo) {
let ytlink = ytvideo.parentElement.parentElement.querySelector(BDFDB.dotCN.embedtitle).href;
let wrapper = ytvideo.parentElement;
ytvideo.remove();
require("request")(ytlink, (error, response, result) => {
if (result) {
wrapper.innerHTML = `<div class="${BDFDB.disCNS.imagewrapper + BDFDB.disCNS.imageclickable + BDFDB.disCN.embedvideoimagecomponent}" style="width: 400px; height: 225px;"><img alt="" src="${result.split('<link itemprop="thumbnailUrl" href="')[1].split('"')[0]}" style="width: 400px; height: 225px;"></div><div class="${BDFDB.disCN.embedvideoactions}"><div class="${BDFDB.disCN.embedcentercontent}"><div class="${BDFDB.disCN.iconactionswrapper}"><div tabindex="0" class="${BDFDB.disCNS.iconwrapper + BDFDB.disCN.iconwrapperactive}" role="button"><svg name="Play" class="${BDFDB.disCNS.iconplay + BDFDB.disCN.icon}" width="16" height="16" viewBox="0 0 24 24"><polygon fill="currentColor" points="0 0 0 14 11 7" transform="translate(7 5)"></polygon></svg></div><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.anchorunderlineonhover + BDFDB.disCNS.iconwrapper + BDFDB.disCN.iconwrapperactive}" href="${ytlink}" rel="noreferrer noopener" target="_blank"><svg name="OpenExternal" class="${BDFDB.disCNS.iconexternalmargins + BDFDB.disCN.icon}" width="16" height="16" viewBox="0 0 24 24"><path fill="currentColor" transform="translate(3.000000, 4.000000)" d="M16 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h4v-2H2V4h14v10h-4v2h4c1.1 0 2-.9 2-2V2a2 2 0 0 0-2-2zM9 6l-4 4h3v6h2v-6h3L9 6z"></path></svg></a></div></div></div>`;
wrapper.querySelector(BDFDB.dotCN.iconplay).addEventListener("click", e => {this.startYoutubeVideo(e.currentTarget);});
}
});
}
}
messagedivider.querySelector(BDFDB.dotCN.messagespopoutchannelname).addEventListener("click", e => {
if (!BDFDB.isObjectEmpty(channel)) {
notespopout.remove();
this.SelectChannelUtils.selectChannel(server.id, channel.id);
}
else BDFDB.shake();
});
message.querySelector(BDFDB.dotCN.messagespopoutclosebutton).addEventListener("click", e => {
BDFDB.removeEles(messagedivider, message);
this.removeNoteData(noteData);
BDFDB.toggleEles(placeholder, container.firstElementChild == placeholder);
});
message.querySelector(BDFDB.dotCN.messagespopoutjumpbutton + ".jump").addEventListener("click", e => {
this.HistoryUtils.transitionTo(this.MainDiscord.Routes.MESSAGE(noteData.guild_id, noteData.channel_id, noteData.id));
});
message.querySelector(BDFDB.dotCN.messagespopoutjumpbutton + ".copy").addEventListener("click", e => {
let clipboard = require("electron").clipboard;
if (noteData.content) clipboard.write({text: noteData.content});
else {
let image = message.querySelector(BDFDB.dotCNS.imagewrapper + "img");
if (image) {
// stolen from Image2Clipboard
require("request")({url: image.src, encoding: null}, (error, response, buffer) => {
if (buffer) {
let platform = require("process").platform;
if (platform === "win32" || platform === "darwin") {
clipboard.write({image: require("electron").nativeImage.createFromBuffer(buffer)});
}
else {
let file = require("path").join(require("process").env["HOME"], "personalpinstemp.png");
require("fs").writeFileSync(file, buffer, {encoding: null});
clipboard.write({image: file});
require("fs").unlinkSync(file);
}
}
});
}
}
});
}
startYoutubeVideo (button) {
let embedwrapper = BDFDB.getParentEle(BDFDB.dotCN.embedvideo, button);
let ytlink = embedwrapper.parentElement.querySelector(BDFDB.dotCN.embedtitle).href;
require("request")(ytlink, (error, response, result) => {
if (result && response.headers && typeof response.headers.server == "string" && response.headers.server.toUpperCase() == "YOUTUBE FRONTEND PROXY") {
while (embedwrapper.firstChild) embedwrapper.firstChild.remove();
let width = 400;
let height = Math.round(width*(result.split('<meta itemprop="height" content="')[1].split('"')[0]/result.split('<meta itemprop="width" content="')[1].split('"')[0]));
embedwrapper.appendChild(BDFDB.htmlToElement(`<iframe src="${result.split('<link itemprop="embedURL" href="')[1].split('"')[0]}?start=0&amp;autoplay=1&amp;auto_play=1" width="${width}" height="${height}" frameborder="0" allowfullscreen=""></iframe>`));
}
});
}
addMessageToNotes (message, target, channel) {
if (!message || !target) return;
let {messagediv, pos} = this.getMessageAndPos(target);
if (!messagediv || pos == -1) return;
let pins = BDFDB.loadAllData(this, "pins");
let guild = this.GuildUtils.getGuild(channel.guild_id) || {};
let guild_id = guild.id ? guild.id : "@me";
channel = channel ? channel : this.ChannelUtils.getChannel(message.channel_id);
pins[guild_id] = pins[guild_id] || {}
pins[guild_id][channel.id] = pins[guild_id][channel.id] || {}
if (!pins[guild_id][channel.id][message.id + "_" + pos]) {
let channelname = channel.name;
if (!channelname && channel.recipients.length > 0) {
for (let dmuser_id of channel.recipients) {
channelname = channelname ? channelname + ", @" : channelname;
channelname = channelname + this.UserUtils.getUser(dmuser_id).username;
}
}
let markup = messagediv.querySelector(BDFDB.dotCN.messagemarkup).cloneNode(true);
markup.querySelectorAll(BDFDB.dotCN.messageheadercompact).forEach(h2 => {h2.remove();});
pins[guild_id][channel.id][message.id + "_" + pos] = BDFDB.sortObject({
"guild_id": guild_id,
"guild_name": guild.name ? guild.name : "Direct Messages",
"channel_id": channel.id,
"channel_name": channelname,
"dmuser_id": channel.type == 1 ? channel.recipients[0] : null,
"id": message.id,
"pos": pos,
"timestamp": message.timestamp._i.getTime(),
"addedat": new Date().getTime(),
"color": message.colorString,
"author_id": message.author.id,
"author_name": message.author.username,
"avatar": BDFDB.getUserAvatar(message.author.id),
"content": message.content,
"markup": markup.innerHTML,
"accessory": messagediv.querySelector(BDFDB.dotCN.messageaccessory).innerHTML
});
BDFDB.saveAllData(pins, this, "pins");
BDFDB.showToast(this.labels.toast_noteadd_text, {type:"success"});
}
else this.removeNoteData(pins[guild_id][channel.id][message.id + "_" + pos]);
}
getNoteData (message, target, channel) {
if (!message || !target) return;
let {messagediv, pos} = this.getMessageAndPos(target);
if (!messagediv || pos == -1) return;
channel = channel ? channel : this.ChannelUtils.getChannel(message.channel_id);
let pins = BDFDB.loadAllData(this, "pins");
let guildid = channel.guild_id ? channel.guild_id : "@me";
return pins[guildid] && pins[guildid][channel.id] && pins[guildid][channel.id][message.id + "_" + pos] ? pins[guildid][channel.id][message.id + "_" + pos] : null;
}
removeNoteData (noteData) {
let pins = BDFDB.loadAllData(this, "pins");
delete pins[noteData.guild_id][noteData.channel_id][noteData.id + "_" + noteData.pos];
if (BDFDB.isObjectEmpty(pins[noteData.guild_id][noteData.channel_id])) {
delete pins[noteData.guild_id][noteData.channel_id];
if (BDFDB.isObjectEmpty(pins[noteData.guild_id])) delete pins[noteData.guild_id];
}
BDFDB.saveAllData(pins, this, "pins");
BDFDB.showToast(this.labels.toast_noteremove_text, {type:"danger"});
}
getMessageAndPos (target) {
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.message, target);
let pos = messagediv ? Array.from(messagediv.parentElement.querySelectorAll(BDFDB.dotCN.message)).indexOf(messagediv) : -1;
return {messagediv, pos};
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Delete all Notes.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} reset-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
settingspanel.querySelector(".reset-button").addEventListener("click", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to delete all pinned notes?", () => {
BDFDB.removeAllData(this, "pins");
});
});
return settingspanel;
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {
popout_note_text: "Bilješke",
popout_channel_text: "Kanal",
popout_server_text: "Poslužavnik",
popout_allservers_text: "Svi poslužitelji",
popout_sort_text: "Poredaj po",
popout_messagesort_text: "Vijesti-Datum",
popout_datesort_text: "Bilješka-Datum",
popout_jump_text: "Skok",
popout_copy_text: "Kopija",
context_pinoption_text: "Napominjemo poruku",
context_unpinoption_text: "Uklonite bilješku",
popout_pinoption_text: "Bilješka",
toast_noteadd_text: "Poruka dodana u bilježnicu.",
toast_noteremove_text: "Poruka uklonjena iz bilježnice."
};
case "da": //danish
return {
popout_note_text: "Noter",
popout_channel_text: "Kanal",
popout_server_text: "Server",
popout_allservers_text: "Alle servere",
popout_sort_text: "Sorter efter",
popout_messagesort_text: "Meddelelse-Dato",
popout_datesort_text: "Note-Dato",
popout_jump_text: "Hop",
popout_copy_text: "Kopi",
context_pinoption_text: "Noter besked",
context_unpinoption_text: "Fjern notatet",
popout_pinoption_text: "Noter",
toast_noteadd_text: "Meddelelse tilføjet til notesbog.",
toast_noteremove_text: "Meddelelse fjernet fra notesbog."
};
case "de": //german
return {
popout_note_text: "Notizen",
popout_channel_text: "Kanal",
popout_server_text: "Server",
popout_allservers_text: "Alle Server",
popout_sort_text: "Sortieren nach",
popout_messagesort_text: "Nachrichten-Datum",
popout_datesort_text: "Notiz-Datum",
popout_jump_text: "Springen",
popout_copy_text: "Kopieren",
context_pinoption_text: "Nachricht notieren",
context_unpinoption_text: "Notiz entfernen",
popout_pinoption_text: "Notieren",
toast_noteadd_text: "Nachricht zum Notizbuch hinzugefügt.",
toast_noteremove_text: "Nachricht aus dem Notizbuch entfernt."
};
case "es": //spanish
return {
popout_note_text: "Notas",
popout_channel_text: "Canal",
popout_server_text: "Servidor",
popout_allservers_text: "Todos los servidores",
popout_sort_text: "Ordenar por",
popout_messagesort_text: "Mensaje-Fecha",
popout_datesort_text: "Nota-Fecha",
popout_jump_text: "Ir a",
popout_copy_text: "Copiar",
context_pinoption_text: "Anotar mensaje",
context_unpinoption_text: "Quitar la nota",
popout_pinoption_text: "Anotar",
toast_noteadd_text: "Mensaje agregado al cuaderno.",
toast_noteremove_text: "Mensaje eliminado del cuaderno."
};
case "fr": //french
return {
popout_note_text: "Notes",
popout_channel_text: "Canal",
popout_server_text: "Serveur",
popout_allservers_text: "Tous les serveurs",
popout_sort_text: "Trier par",
popout_messagesort_text: "Message-Date",
popout_datesort_text: "Note-Date",
popout_jump_text: "Accéder",
popout_copy_text: "Copier",
context_pinoption_text: "Noter le message",
context_unpinoption_text: "Enlevez la note",
popout_pinoption_text: "Noter",
toast_noteadd_text: "Message ajouté au bloc-notes.",
toast_noteremove_text: "Message supprimé du bloc-notes."
};
case "it": //italian
return {
popout_note_text: "Note",
popout_channel_text: "Canale",
popout_server_text: "Server",
popout_allservers_text: "Tutti i server",
popout_sort_text: "Ordina per",
popout_messagesort_text: "Messaggio-Data",
popout_datesort_text: "Nota-Data",
popout_jump_text: "Vai",
popout_copy_text: "Copiare",
context_pinoption_text: "Annotare il messaggio",
context_unpinoption_text: "Rimuovi la nota",
popout_pinoption_text: "Annotare",
toast_noteadd_text: "Messaggio aggiunto al blocco note.",
toast_noteremove_text: "Messaggio rimosso dal blocco note."
};
case "nl": //dutch
return {
popout_note_text: "Notities",
popout_channel_text: "Kanaal",
popout_server_text: "Server",
popout_allservers_text: "Alle servers",
popout_sort_text: "Sorteer op",
popout_messagesort_text: "Bericht-Datum",
popout_datesort_text: "Notitie-Datum",
popout_jump_text: "Openen",
popout_copy_text: "Kopiëren",
context_pinoption_text: "Noteer bericht",
context_unpinoption_text: "Verwijder de notitie",
popout_pinoption_text: "Noteer",
toast_noteadd_text: "Bericht toegevoegd aan notitieblok.",
toast_noteremove_text: "Bericht verwijderd van notitieblok."
};
case "no": //norwegian
return {
popout_note_text: "Notatene",
popout_channel_text: "Kanal",
popout_server_text: "Server",
popout_allservers_text: "Alle servere",
popout_sort_text: "Sorter etter",
popout_messagesort_text: "Melding-Dato",
popout_datesort_text: "Merknad-Dato",
popout_jump_text: "Hoppe",
popout_copy_text: "Kopiere",
context_pinoption_text: "Notat ned meldingen",
context_unpinoption_text: "Fjern notatet",
popout_pinoption_text: "Notere",
toast_noteadd_text: "Melding lagt til i notisboken.",
toast_noteremove_text: "Melding fjernet fra notatboken."
};
case "pl": //polish
return {
popout_note_text: "Notatki",
popout_channel_text: "Kanał",
popout_server_text: "Serwer",
popout_allservers_text: "Wszystkie serwery",
popout_sort_text: "Sortuj według",
popout_messagesort_text: "Wiadomość-Data",
popout_datesort_text: "Notatka-Data",
popout_jump_text: "Skocz",
popout_copy_text: "Kopiować",
context_pinoption_text: "Notuj wiadomość",
context_unpinoption_text: "Usuń notatkę",
popout_pinoption_text: "Notuj",
toast_noteadd_text: "Wiadomość została dodana do notatnika.",
toast_noteremove_text: "Wiadomość została usunięta z notatnika."
};
case "pt-BR": //portuguese (brazil)
return {
popout_note_text: "Notas",
popout_channel_text: "Canal",
popout_server_text: "Servidor",
popout_allservers_text: "Todos os servidores",
popout_sort_text: "Ordenar por",
popout_messagesort_text: "Mensagem-Data",
popout_datesort_text: "Nota-Data",
popout_jump_text: "Pular",
popout_copy_text: "Copiar",
context_pinoption_text: "Anote a mensagem",
context_unpinoption_text: "Remova a nota",
popout_pinoption_text: "Anotar",
toast_noteadd_text: "Mensagem adicionada ao caderno.",
toast_noteremove_text: "Mensagem removida do caderno."
};
case "fi": //finnish
return {
popout_note_text: "Muistiinpanot",
popout_channel_text: "Kanava",
popout_server_text: "Palvelin",
popout_allservers_text: "Kaikki palvelimet",
popout_sort_text: "Järjestä",
popout_messagesort_text: "Viesti-Päivämäärä",
popout_datesort_text: "Huomaa-Päivämäärä",
popout_jump_text: "Siirry",
popout_copy_text: "Kopioida",
context_pinoption_text: "Huomaa viesti",
context_unpinoption_text: "Poista muistiinpano",
popout_pinoption_text: "Huomaa",
toast_noteadd_text: "Viesti lisätty muistikirjaan.",
toast_noteremove_text: "Viesti poistettiin muistikirjaan."
};
case "sv": //swedish
return {
popout_note_text: "Anteckningarna",
popout_channel_text: "Kanal",
popout_server_text: "Server",
popout_allservers_text: "Alla servrar",
popout_sort_text: "Sortera efter",
popout_messagesort_text: "Meddelande-Datum",
popout_datesort_text: "Anteckningen-Datum",
popout_jump_text: "Hoppa",
popout_copy_text: "Kopiera",
context_pinoption_text: "Anteckna meddelande",
context_unpinoption_text: "Ta bort noten",
popout_pinoption_text: "Anteckna",
toast_noteadd_text: "Meddelandet läggs till i anteckningsboken.",
toast_noteremove_text: "Meddelande borttaget från anteckningsboken."
};
case "tr": //turkish
return {
popout_note_text: "Notlar",
popout_channel_text: "Kanal",
popout_server_text: "Sunucu",
popout_allservers_text: "Tüm Sunucular",
popout_sort_text: "Göre sırala",
popout_messagesort_text: "Mesaj-Tarih",
popout_datesort_text: "Not-Tarih",
popout_jump_text: "Git",
popout_copy_text: "Kopyalamak",
context_pinoption_text: "Mesajı not alın",
context_unpinoption_text: "Notu kaldırmak",
popout_pinoption_text: "Not almak",
toast_noteadd_text: "Mesaj not defteri'ya eklendi.",
toast_noteremove_text: "Mesaj not defteri'dan kaldırıldı."
};
case "cs": //czech
return {
popout_note_text: "Poznámky",
popout_channel_text: "Kanál",
popout_server_text: "Server",
popout_allservers_text: "Všechny servery",
popout_sort_text: "Seřazeno podle",
popout_messagesort_text: "Zpráva-datum",
popout_datesort_text: "Poznámka-datum",
popout_jump_text: "Skok",
popout_copy_text: "Kopírovat",
context_pinoption_text: "Poznámka dolů zprávu",
context_unpinoption_text: "Odstraňte poznámku",
popout_pinoption_text: "Poznámka dolů",
toast_noteadd_text: "Zpráva byla přidána do notebooku.",
toast_noteremove_text: "Zpráva byla odebrána z notebooku."
};
case "bg": //bulgarian
return {
popout_note_text: "бележките",
popout_channel_text: "Канал",
popout_server_text: "Сървър",
popout_allservers_text: "Всички сървъри",
popout_sort_text: "Сортиране по",
popout_messagesort_text: "Съобщение-Дата",
popout_datesort_text: "Забележка-Дата",
popout_jump_text: "Направо",
popout_copy_text: "Копирам",
context_pinoption_text: "Oтбележете съобщението",
context_unpinoption_text: "Премахнете бележката",
popout_pinoption_text: "Oтбележете",
toast_noteadd_text: "Съобщението бе добавено към бележника.",
toast_noteremove_text: "Съобщението е премахнато от преносимия компютър."
};
case "ru": //russian
return {
popout_note_text: "Заметки",
popout_channel_text: "Канал",
popout_server_text: "Cервер",
popout_allservers_text: "Все серверы",
popout_sort_text: "Сортировать по",
popout_messagesort_text: "Сообщение-дата",
popout_datesort_text: "Заметки-Дата",
popout_jump_text: "Перейти",
popout_copy_text: "Копировать",
context_pinoption_text: "Записывать вниз",
context_unpinoption_text: "Удалить заметку",
popout_pinoption_text: "Записывать",
toast_noteadd_text: "Сообщение добавлено в блокнот.",
toast_noteremove_text: "Сообщение удалено из записной книжки."
};
case "uk": //ukrainian
return {
popout_note_text: "Замітки",
popout_channel_text: "Канал",
popout_server_text: "Сервер",
popout_allservers_text: "Всі сервери",
popout_sort_text: "Сортувати за",
popout_messagesort_text: "Повідомлення-дата",
popout_datesort_text: "Примітка-дата",
popout_jump_text: "Плиг",
popout_copy_text: "Копіювати",
context_pinoption_text: "Зверніть увагу на повідомлення",
context_unpinoption_text: "Видаліть нотатку",
popout_pinoption_text: "Занотуйте",
toast_noteadd_text: "Повідомлення додається до ноутбука.",
toast_noteremove_text: "Повідомлення видалено з ноутбука."
};
case "ja": //japanese
return {
popout_note_text: "ノート",
popout_channel_text: "チャネル",
popout_server_text: "サーバ",
popout_allservers_text: "すべてのサーバー",
popout_sort_text: "並び替え",
popout_messagesort_text: "メッセージ-日付",
popout_datesort_text: "注-日付",
popout_jump_text: "ジャンプ",
popout_copy_text: "写す",
context_pinoption_text: "ノートダウンメッセージ",
context_unpinoption_text: "メモを削除",
popout_pinoption_text: "書き留める",
toast_noteadd_text: "ノートブックにメッセージが追加されました.",
toast_noteremove_text: "ノートブックからメッセージが削除されました."
};
case "zh-TW": //chinese (traditional)
return {
popout_note_text: "筆記",
popout_channel_text: "渠道",
popout_server_text: "服務器",
popout_allservers_text: "所有服務器",
popout_sort_text: "排序方式",
popout_messagesort_text: "消息-日期",
popout_datesort_text: "注-日期",
popout_jump_text: "跳到",
popout_copy_text: "複製",
context_pinoption_text: "記下下來的消息",
context_unpinoption_text: "刪除備註",
popout_pinoption_text: "記下",
toast_noteadd_text: "消息添加到筆記本.",
toast_noteremove_text: "消息從筆記本中刪除."
};
case "ko": //korean
return {
popout_note_text: "노트",
popout_channel_text: "채널",
popout_server_text: "섬기는 사람",
popout_allservers_text: "모든 서버",
popout_sort_text: "정렬 기준",
popout_messagesort_text: "메시지-날짜",
popout_datesort_text: "주-날짜",
popout_jump_text: "이동",
popout_copy_text: "베끼다",
context_pinoption_text: "메모 다운 메시지",
context_unpinoption_text: "메모 삭제",
popout_pinoption_text: "메모하다",
toast_noteadd_text: "노트북에 메시지 추가됨.",
toast_noteremove_text: "노트에서 메시지 삭제됨."
};
default: //default: english
return {
popout_note_text: "Notes",
popout_channel_text: "Channel",
popout_server_text: "Server",
popout_allservers_text: "All Servers",
popout_sort_text: "Sort by",
popout_messagesort_text: "Message-Date",
popout_datesort_text: "Note-Date",
popout_jump_text: "Jump",
popout_copy_text: "Copy",
context_pinoption_text: "Note Message",
context_unpinoption_text: "Remove Note",
popout_pinoption_text: "Note",
toast_noteadd_text: "Message added to notebook.",
toast_noteremove_text: "Message removed from notebook."
};
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Pin DMs - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/PinDMs/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/PinDMs/config.json)
Allows you to pin DMs, making them appear at the top of your DM-list.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "PinDMs",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Allows you to pin DMs, making them appear at the top of your DM-list. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,736 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"Guilds":"componentDidMount",
"DirectMessage":["componentDidMount","componentDidUpdate","componentWillUnmount"],
"LazyScroller":"render"
};
this.dmContextEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} pindms-item ${BDFDB.disCN.contextmenuitemsubmenu}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_pindm_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>`;
this.dmContextSubMenuMarkup =
`<div class="${BDFDB.disCN.contextmenu} pindms-submenu">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} pindm-channel-item">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_pinchannel_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
<div class="${BDFDB.disCN.contextmenuitem} unpindm-channel-item ${BDFDB.disCN.contextmenuitemdanger}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_unpinchannel_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
<div class="${BDFDB.disCN.contextmenuitem} pindm-guild-item">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_pinguild_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
<div class="${BDFDB.disCN.contextmenuitem} unpindm-guild-item ${BDFDB.disCN.contextmenuitemdanger}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_unpinguild_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>
</div>`;
this.dmPinContextMarkup =
`<div class="${BDFDB.disCN.contextmenu} pinneddm-contextmenu">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} pindm-guild-item">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_pinguild_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>
</div>`;
this.dmUnpinContextMarkup =
`<div class="${BDFDB.disCN.contextmenu} pinneddm-contextmenu">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} unpindm-guild-item ${BDFDB.disCN.contextmenuitemdanger}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_unpinguild_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>
</div>`;
this.recentDMMarkup =
`<div class="${BDFDB.disCN.guild} pinned" style="transform: translateX(0px);">
<div class="${BDFDB.disCN.guildinner}" draggable="false" style="border-radius: 25px;">
<div class="${BDFDB.disCNS.avatarwrapper + BDFDB.disCNS.avatarsmall + BDFDB.disCNS.guildavatar + BDFDB.disCN.avatarsizesmall}">
<a draggable="false" class="${BDFDB.disCNS.guildavatarinner + BDFDB.disCNS.avatarinner + BDFDB.disCN.avatarstopanimation}"></a>
</div>
</div>
<div class="${BDFDB.disCNS.badge + BDFDB.disCN.badgewrapper}" style="display: none !important;">0</div>
</div>`;
this.css = `
${BDFDB.dotCN.guild}.pinned:after {
background-position: 50%;
background-repeat: no-repeat;
background-size: 16px;
border-radius: 12px;
content: " ";
height: 24px;
overflow: hidden;
pointer-events: none;
position: absolute;
right: -6px;
top: -6px;
width: 24px;
background-image: url('data:image/svg+xml; utf8, <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-90 -80 700 700" xml:space="preserve"><g fill="#FFF"><path d="M291.31,402.761L109.241,220.693C79.073,190.525,30.166,190.526,0,220.692l291.31,291.31C321.474,481.835,321.476,432.927,291.31,402.761z"/><polygon points="273.104,111.449 154.758,211.589 300.412,357.242 400.55,238.898"/><path d="M500.688,175.174L336.827,11.313c-15.085-15.085-39.539-15.083-54.621,0c-15.082,15.082-15.082,39.538,0,54.62 l163.861,163.861c15.083,15.085,39.539,15.085,54.621,0.001C515.773,214.712,515.773,190.257,500.688,175.174z"/><polygon points="91.032,366.346 0,512 145.655,420.967"/></g></svg>');
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.guild}.pinned:after {
background-color: #202225;
}
${BDFDB.dotCNS.themedark + BDFDB.dotCN.guild}.pinned:after {
background-color: #202225;
}`;
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers", "getUser");
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels", "getChannel");
this.PrivateChannelUtils = BDFDB.WebModules.findByProperties("ensurePrivateChannel");
this.ChannelSwitchUtils = BDFDB.WebModules.findByProperties("selectPrivateChannel");
this.UnreadUtils = BDFDB.WebModules.findByProperties("getUnreadCount");
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
this.Animations = BDFDB.WebModules.findByProperties("spring");
BDFDB.addEventListener(this, document, "click", BDFDB.dotCNS.dmchannels + BDFDB.dotCN.dmchannel, e => {
let instance = BDFDB.getReactInstance(e.currentTarget);
if (BDFDB.getReactValue(instance, "return.return.return.memoizedProps.ispin")) {
let dmsscroller = document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller);
if (dmsscroller) {
this.oldScrollerPos = dmsscroller.scrollTop;
setTimeout(() => {this.oldScrollerPos = null;},1000);
}
}
});
BDFDB.addEventListener(this, document, "click", BDFDB.dotCNS.dmchannels + BDFDB.dotCNS.dmchannel + BDFDB.dotCN.dmchannelclose, e => {
let instance = BDFDB.getReactInstance(e.currentTarget);
if (BDFDB.getReactValue(instance, "return.return.return.return.return.memoizedProps.ispin")) {
e.originalEvent.stopPropagation();
e.originalEvent.preventDefault();
this.removePinnedDM(BDFDB.getReactValue(instance, "return.return.return.return.return.memoizedProps.channel.id"));
}
});
this.forceAdding = true;
BDFDB.WebModules.forceAllUpdates(this);
delete this.forceAdding;
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
let dmsscrollerinstance = BDFDB.getReactInstance(document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller));
if (dmsscrollerinstance) {
let dms = dmsscrollerinstance.return.return.return.memoizedProps.children;
let amount = 0;
let insertpoint = null;
for (let i in dms) {
let ele = dms[i];
if (ele && ele.pinned) {
delete ele.pinned;
if (ele.props.ispin) {
if (ele.type == "header") insertpoint = i;
amount++;
}
}
}
dms.splice(insertpoint, amount);
this.forceUpdateScroller(dmsscrollerinstance.stateNode);
}
for (let info of BDFDB.readDmList()) {
this.unhideNativeDM(info.id);
if (info.div) info.div.removeEventListener("contextmenu", info.div.PinDMsContextMenuListener);
}
BDFDB.removeEles(BDFDB.dotCNS.dms + BDFDB.dotCN.guild + ".pinned");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
changeLanguageStrings () {
this.dmContextEntryMarkup = this.dmContextEntryMarkup.replace("REPLACE_context_pindm_text", this.labels.context_pindm_text);
this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_pinchannel_text", this.labels.context_pinchannel_text);
this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_unpinchannel_text", this.labels.context_unpinchannel_text);
this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_pinguild_text", this.labels.context_pinguild_text);
this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_unpinguild_text", this.labels.context_unpinguild_text);
this.dmPinContextMarkup = this.dmPinContextMarkup.replace("REPLACE_context_pinguild_text", this.labels.context_pinguild_text);
this.dmUnpinContextMarkup = this.dmUnpinContextMarkup.replace("REPLACE_context_unpinguild_text", this.labels.context_unpinguild_text);
}
onUserContextMenu (instance, menu) {
if (instance.props && instance.props.user && !menu.querySelector(".pindms-item")) {
let closeentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleClose"]}));
if (closeentry) {
let id = this.ChannelUtils.getDMFromUserId(instance.props.user.id);
if (id) this.appendItem(instance, id, closeentry);
else this.PrivateChannelUtils.ensurePrivateChannel(BDFDB.myData.id, instance.props.user.id).then(id => {this.appendItem(instance, id, closeentry);});
}
}
}
onGroupDMContextMenu (instance, menu) {
if (instance.props && instance.props.channelId && !menu.querySelector(".pindms-item")) {
let changeentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleChangeIcon"]}));
if (changeentry) {
this.appendItem(instance, instance.props.channelId, changeentry);
}
}
}
appendItem (instance, id, target) {
let dmContextEntry = BDFDB.htmlToElement(this.dmContextEntryMarkup);
target.parentElement.insertBefore(dmContextEntry, target);
let pindmsitem = dmContextEntry.querySelector(".pindms-item");
pindmsitem.addEventListener("mouseenter", () => {
let dmContextSubMenu = BDFDB.htmlToElement(this.dmContextSubMenuMarkup);
let pinchannelitem = dmContextSubMenu.querySelector(".pindm-channel-item");
let unpinchannelitem = dmContextSubMenu.querySelector(".unpindm-channel-item");
let pinguilditem = dmContextSubMenu.querySelector(".pindm-guild-item");
let unpinguilditem = dmContextSubMenu.querySelector(".unpindm-guild-item");
let pinnedDMs = BDFDB.loadAllData(this, "pinnedDMs");
if (pinnedDMs[id] == undefined) {
BDFDB.removeEles(unpinchannelitem);
pinchannelitem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
let dmsscrollerinstance = BDFDB.getReactInstance(document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller));
if (dmsscrollerinstance) {
let dms = dmsscrollerinstance.return.return.return.memoizedProps.children;
let insertpoint = this.getInsertPoint(dms);
this.addPinnedDM(id, dms, insertpoint);
this.forceUpdateScroller(dmsscrollerinstance.stateNode);
}
pinnedDMs[id] = Object.keys(pinnedDMs).length;
BDFDB.saveAllData(pinnedDMs, this, "pinnedDMs");
});
}
else {
BDFDB.removeEles(pinchannelitem);
unpinchannelitem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
this.removePinnedDM(id);
});
}
let pinnedRecents = BDFDB.loadAllData(this, "pinnedRecents");
if (pinnedRecents[id] == undefined) {
BDFDB.removeEles(unpinguilditem);
pinguilditem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
this.addPinnedRecent(id);
pinnedRecents[id] = Object.keys(pinnedRecents).length;
BDFDB.saveAllData(pinnedRecents, this, "pinnedRecents");
});
}
else {
BDFDB.removeEles(pinguilditem);
unpinguilditem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
BDFDB.removeEles(document.querySelector(`${BDFDB.dotCNS.dms + BDFDB.dotCN.guild}.pinned[channelid="${id}"]`));
this.unhideNativeDM(id);
delete pinnedRecents[id];
BDFDB.saveAllData(pinnedRecents, this, "pinnedRecents");
});
}
BDFDB.appendSubMenu(pindmsitem, dmContextSubMenu);
});
}
processGuilds (instance, wrapper) {
let dms = wrapper.querySelector(BDFDB.dotCN.dms);
if (dms) for (let id of this.sortAndUpdate("pinnedRecents")) this.addPinnedRecent(id);
}
processDirectMessage (instance, wrapper, methodnames) {
if (instance.props && instance.props.channel) {
if (methodnames.includes("componentDidMount")) {
wrapper.removeEventListener("contextmenu", wrapper.PinDMsContextMenuListener);
wrapper.PinDMsContextMenuListener = e => {
let freshPinnedRecents = BDFDB.loadAllData(this, "pinnedRecents");
if (freshPinnedRecents[instance.props.channel.id] == undefined) {
let dmContext = BDFDB.htmlToElement(this.dmPinContextMarkup);
dmContext.querySelector(".pindm-guild-item").addEventListener("click", () => {
BDFDB.removeEles(dmContext);
this.addPinnedRecent(instance.props.channel.id);
freshPinnedRecents[instance.props.channel.id] = Object.keys(freshPinnedRecents).length;
BDFDB.saveAllData(freshPinnedRecents, this, "pinnedRecents");
});
BDFDB.appendContextMenu(dmContext, e);
}
};
wrapper.addEventListener("contextmenu", wrapper.PinDMsContextMenuListener);
}
let pinnedRecents = BDFDB.loadAllData(this, "pinnedRecents");
if (pinnedRecents[instance.props.channel.id] != undefined) {
if (methodnames.includes("componentDidMount")) this.hideNativeDM(instance.props.channel.id);
this.updateUnreadCount(instance.props.channel.id);
}
}
}
processLazyScroller (instance, wrapper) {
let privateChannelIds = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.privateChannelIds");
if (privateChannelIds) {
if (this.forceAdding || !instance.props.PinDMsPatched) {
instance.props.PinDMsPatched = true;
let dms = instance.props.children;
let sortedDMs = this.sortAndUpdate("pinnedDMs");
if (sortedDMs.length > 0) {
let insertpoint = this.getInsertPoint(dms);
for (let pos in sortedDMs) this.addPinnedDM(sortedDMs[pos], dms, insertpoint);
}
this.forceUpdateScroller(instance.getScrollerNode());
}
if (this.oldScrollerPos != null) {
instance.getScrollerNode().scrollTop = this.oldScrollerPos;
}
}
}
getInsertPoint (dms) {
let insertpoint = null;
for (let i in dms) {
let ele = dms[i];
if (ele && ele.type == "header") {
insertpoint = parseInt(i);
if (!ele.pinned && !ele.props.ispin) {
ele.pinned = true;
let headerpin = Object.assign({},ele);
headerpin.key = "pin" + headerpin.key;
headerpin.props = {children:this.labels.header_pinneddms_text,ispin:true};
dms.splice(insertpoint, 0, headerpin);
}
insertpoint++;
break;
}
}
return insertpoint;
}
addPinnedDM (id, dms, insertpoint) {
for (let ele of dms) if (ele && !ele.pinned && id == ele.key) {
ele.pinned = true;
let dmpin = Object.assign({ispin:true},ele);
dmpin.key = "pin" + ele.key;
dmpin.props = {channel:ele.props.channel,selected:ele.props.selected,ispin:true};
dms.splice(insertpoint, 0, dmpin);
}
}
removePinnedDM (id) {
if (!id) return;
BDFDB.removeData(id, this, "pinnedDMs");
let dmsscrollerinstance = BDFDB.getReactInstance(document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller));
if (dmsscrollerinstance) {
let dms = dmsscrollerinstance.return.return.return.memoizedProps.children;
let existingDMs = this.sortAndUpdate("pinnedDMs");
let removepoint = null;
for (let i in dms) {
let ele = dms[i];
if (ele && ele.pinned && (id == ele.key || ("pin" + id) == ele.key)) {
delete ele.pinned;
if (ele.props.ispin) removepoint = parseInt(i);
}
}
if (removepoint) {
let offset = existingDMs.length ? 0 : 1;
if (offset) delete dms[removepoint + offset].pinned;
dms.splice(removepoint-offset,1+offset);
}
this.forceUpdateScroller(dmsscrollerinstance.stateNode);
}
}
sortAndUpdate (type) {
let pinnedDMs = BDFDB.loadAllData(this, type);
delete pinnedDMs[""];
let sortedDMs = [], existingDMs = [], sortDM = (id) => {
if (typeof sortedDMs[pinnedDMs[id]] == "undefined") sortedDMs[pinnedDMs[id]] = id;
else sortDM(sortedDMs, pinnedDMs[id]+1, id);
};
for (let id in pinnedDMs) sortDM(id);
sortedDMs = sortedDMs.filter(n => n);
for (let pos in sortedDMs) {
pinnedDMs[sortedDMs[pos]] = parseInt(pos);
if (this.ChannelUtils.getChannel(sortedDMs[pos])) existingDMs.push(sortedDMs[pos]);
}
BDFDB.saveAllData(pinnedDMs, this, type);
return existingDMs;
}
forceUpdateScroller (scroller) {
if (this.updatingScroller) return;
this.updatingScroller = true;
var stateNode = BDFDB.getReactValue(scroller, "return.return.return.stateNode");
if (stateNode) stateNode.updater.enqueueForceUpdate(stateNode);
setTimeout(() => {delete this.updatingScroller;},1000);
}
addPinnedRecent (id) {
let dms = document.querySelector(BDFDB.dotCN.dms);
if (dms && !dms.querySelector(`${BDFDB.dotCN.guild}.pinned[channelid="${id}"]`)) {
let info = this.ChannelUtils.getChannel(id);
if (info) {
let dmdiv = BDFDB.htmlToElement(this.recentDMMarkup);
let user = info.type == 1 ? this.UserUtils.getUser(info.recipients[0]) : null;
dmdiv.setAttribute("channelid", id);
dms.insertBefore(dmdiv, dms.firstElementChild);
let avatar = dmdiv.querySelector(BDFDB.dotCN.avatarinner);
let dmname = info.name;
if (!dmname && info.recipients.length > 0) {
for (let dmuser_id of info.recipients) {
dmname = dmname ? dmname + ", " : dmname;
dmname = dmname + this.UserUtils.getUser(dmuser_id).username;
}
}
let EditUsersData = user && BDFDB.isPluginEnabled("EditUsers") ? BDFDB.Plugins["editusers"].getUserData(user.id, dmdiv) : {};
if (!EditUsersData.removeIcon) avatar.style.setProperty("background-image", `url(${EditUsersData.url || BDFDB.getChannelIcon(id)})`);
avatar.setAttribute("channel", dmname);
if (user) avatar.setAttribute("user", user.username);
dmdiv.addEventListener("mouseenter", () => {
let FreshEditUsersData = user && BDFDB.isPluginEnabled("EditUsers") ? BDFDB.Plugins["editusers"].getUserData(user.id, dmdiv) : {};
BDFDB.createTooltip(FreshEditUsersData.name || dmname, dmdiv, {selector:(BDFDB.isObjectEmpty(FreshEditUsersData) ? "" : "EditUsers-tooltip"),type:"right"});
});
dmdiv.addEventListener("click", () => {
this.ChannelSwitchUtils.selectPrivateChannel(id);
});
dmdiv.addEventListener("contextmenu", e => {
let dmContext = BDFDB.htmlToElement(this.dmUnpinContextMarkup);
dmContext.querySelector(".unpindm-guild-item").addEventListener("click", () => {
BDFDB.removeEles(dmdiv, dmContext);
this.unhideNativeDM(id);
BDFDB.removeData(id, this, "pinnedRecents");
});
BDFDB.appendContextMenu(dmContext, e);
});
this.addHoverBehaviour(dmdiv);
this.updateUnreadCount(id);
this.hideNativeDM(id);
}
}
}
updateUnreadCount (id) {
let dmdiv = document.querySelector(`${BDFDB.dotCNS.dms + BDFDB.dotCN.guild}.pinned[channelid="${id}"]`);
if (Node.prototype.isPrototypeOf(dmdiv)) {
let count = this.UnreadUtils.getUnreadCount(dmdiv.getAttribute("channelid"));
let badge = dmdiv.querySelector(BDFDB.dotCN.badge);
BDFDB.toggleEles(badge, count > 0);
BDFDB.toggleClass(dmdiv, "has-new-messages", count > 0);
badge.innerText = count;
}
}
hideNativeDM (id) {
let dmdiv = BDFDB.getDmDiv(id);
if (Node.prototype.isPrototypeOf(dmdiv)) {
BDFDB.toggleEles(dmdiv, false);
BDFDB.addClass(dmdiv, "hidden-by-pin");
}
}
unhideNativeDM (id) {
let dmdiv = BDFDB.getDmDiv(id);
if (Node.prototype.isPrototypeOf(dmdiv) && BDFDB.containsClass(dmdiv, "hidden-by-pin")) {
BDFDB.toggleEles(dmdiv, true);
BDFDB.removeClass(dmdiv, "hidden-by-pin");
}
}
addHoverBehaviour (div) {
/* based on stuff from Zerebos */
let divinner = div.querySelector(BDFDB.dotCN.guildinner);
let divicon = div.querySelector(BDFDB.dotCN.guildicon);
let backgroundColor = new this.Animations.Value(0);
backgroundColor
.interpolate({
inputRange: [0, 1],
outputRange: [this.DiscordConstants.Colors.CHANNELS_GREY, this.DiscordConstants.Colors.BRAND_PURPLE]
})
.addListener((value) => {
if (BDFDB.containsClass(divicon, BDFDB.disCN.avatarnoicon)) {
let comp = BDFDB.colorCONVERT(value.value, "RGBCOMP");
if (comp) divinner.style.setProperty("background-color", `rgb(${comp[0]}, ${comp[1]}, ${comp[2]})`);
}
});
let borderRadius = new this.Animations.Value(0);
borderRadius
.interpolate({
inputRange: [0, 1],
outputRange: [25, 15]
})
.addListener((value) => {
divinner.style.setProperty("border-radius", `${value.value}px`);
});
let animate = (v) => {
this.Animations.parallel([
this.Animations.timing(backgroundColor, {toValue: v, duration: 200}),
this.Animations.spring(borderRadius, {toValue: v, friction: 3})
]).start();
};
div.addEventListener("mouseenter", () => {animate(1);})
div.addEventListener("mouseleave", () => {if (!BDFDB.containsClass(div, BDFDB.disCN.guildselected)) animate(0);});
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Unpin all DMs.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} reset-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to unpin all pinned DMs?", () => {
BDFDB.removeAllData(this, "pinnedDMs");
BDFDB.removeAllData(this, "pinnedRecents");
});
});
return settingspanel;
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {
context_pindm_text: "Prikljucite Izravnu Poruku",
context_pinchannel_text: "Priložite popisu kanala",
context_unpinchannel_text: "Ukloni s popisa kanala",
context_pinguild_text: "Priložite popisu poslužitelja",
context_unpinguild_text: "Ukloni s popisa poslužitelja",
header_pinneddms_text: "Prikvačene Izravne Poruke"
};
case "da": //danish
return {
context_pindm_text: "Fastgør PB",
context_pinchannel_text: "Vedhæft til kanalliste",
context_unpinchannel_text: "Fjern fra kanalliste",
context_pinguild_text: "Vedhæft til serverliste",
context_unpinguild_text: "Fjern fra serverliste",
header_pinneddms_text: "Pinned Privat Beskeder"
};
case "de": //german
return {
context_pindm_text: "Direktnachricht anheften",
context_pinchannel_text: "An Kanalliste anheften",
context_unpinchannel_text: "Von Kanalliste loslösen",
context_pinguild_text: "An Serverliste anheften",
context_unpinguild_text: "Von Serverliste loslösen",
header_pinneddms_text: "Gepinnte Direktnachrichten"
};
case "es": //spanish
return {
context_pindm_text: "Anclar MD",
context_pinchannel_text: "Adjuntar a la lista de canales",
context_unpinchannel_text: "Deshazte de la lista de canales",
context_pinguild_text: "Adjuntar a la lista de servidores",
context_unpinguild_text: "Deshazte de la lista de servidores",
header_pinneddms_text: "Mensajes Directos Fijados"
};
case "fr": //french
return {
context_pindm_text: "Épingler MP",
context_pinchannel_text: "Épingler à la liste des chaînes",
context_unpinchannel_text: "Détacher de la liste des chaînes",
context_pinguild_text: "Épingler à la liste de serveurs",
context_unpinguild_text: "Détacher de la liste de serveurs",
header_pinneddms_text: "Messages Prives Épinglés"
};
case "it": //italian
return {
context_pindm_text: "Fissa il messaggio diretto",
context_pinchannel_text: "Allega alla lista dei canali",
context_unpinchannel_text: "Rimuovi dalla lista dei canali",
context_pinguild_text: "Allega alla lista dei server",
context_unpinguild_text: "Rimuovi dalla lista dei server",
header_pinneddms_text: "Messaggi Diretti Aggiunti"
};
case "nl": //dutch
return {
context_pindm_text: "PB pinnen",
context_pinchannel_text: "Pin naar de kanalenlijst",
context_unpinchannel_text: "Losmaken van kanalenlijst",
context_pinguild_text: "Pin naar de serverlijst",
context_unpinguild_text: "Losmaken van serverlijst",
header_pinneddms_text: "Vastgezette Persoonluke Berichten"
};
case "no": //norwegian
return {
context_pindm_text: "Fest DM",
context_pinchannel_text: "Fest på kanalliste",
context_unpinchannel_text: "Fjern fra kanalliste",
context_pinguild_text: "Fest på serverliste",
context_unpinguild_text: "Fjern fra serverlisten",
header_pinneddms_text: "Pinned Direktemeldinger"
};
case "pl": //polish
return {
context_pindm_text: "Przypnij PW",
context_pinchannel_text: "Dołącz do listy kanałów",
context_unpinchannel_text: "Usuń z listy kanałów",
context_pinguild_text: "Dołącz do listy serwerów",
context_unpinguild_text: "Usuń z listy serwerów",
header_pinneddms_text: "Prywatne Wiadomości Bezpośrednie"
};
case "pt-BR": //portuguese (brazil)
return {
context_pindm_text: "Fixar MD",
context_pinchannel_text: "Anexar à lista de canais",
context_unpinchannel_text: "Remover da lista de canais",
context_pinguild_text: "Anexar à lista de servidores",
context_unpinguild_text: "Remover da lista de servidores",
header_pinneddms_text: "Mensagens diretas fixadas"
};
case "fi": //finnish
return {
context_pindm_text: "Kiinnitä yksityisviestit",
context_pinchannel_text: "Liitä kanavaluetteloon",
context_unpinchannel_text: "Poista kanavaluettelosta",
context_pinguild_text: "Liitä palvelinluetteloon",
context_unpinguild_text: "Poista palvelinluettelosta",
header_pinneddms_text: "Liitetyt yksityisviestit"
};
case "sv": //swedish
return {
context_pindm_text: "Fäst DM",
context_pinchannel_text: "Fäst till kanallista",
context_unpinchannel_text: "Ta bort från kanallistan",
context_pinguild_text: "Fäst till servernlista",
context_unpinguild_text: "Ta bort från servernlista",
header_pinneddms_text: "Inlagda Direktmeddelanden"
};
case "tr": //turkish
return {
context_pindm_text: "DM'yi Sabitle",
context_pinchannel_text: "Kanal listesine ekle",
context_unpinchannel_text: "Kanal listesinden kaldır",
context_pinguild_text: "Sunucu listesine ekle",
context_unpinguild_text: "Sunucu listesinden kaldır",
header_pinneddms_text: "Direkt Mesajlar Sabitleyin"
};
case "cs": //czech
return {
context_pindm_text: "Připnout PZ",
context_pinchannel_text: "Připojení k seznamu kanálů",
context_unpinchannel_text: "Odstranit ze seznamu kanálů",
context_pinguild_text: "Připojit ke seznamu serverů",
context_unpinguild_text: "Odstranit ze seznamu serverů",
header_pinneddms_text: "Připojené Přímá Zpráva"
};
case "bg": //bulgarian
return {
context_pindm_text: "Закачени ДС",
context_pinchannel_text: "Прикачете към списъка с канали",
context_unpinchannel_text: "Премахване от списъка с канали",
context_pinguild_text: "Прикачване към списъка със сървъри",
context_unpinguild_text: "Премахване от списъка със сървъри",
header_pinneddms_text: "Свързани директни съобщения"
};
case "ru": //russian
return {
context_pindm_text: "Закрепить ЛС",
context_pinchannel_text: "Прикрепить к списку каналов",
context_unpinchannel_text: "Удалить из списка каналов",
context_pinguild_text: "Присоединить к списку серверов",
context_unpinguild_text: "Удалить из списка серверов",
header_pinneddms_text: "Прикрепленные Личные Сообщения"
};
case "uk": //ukrainian
return {
context_pindm_text: "Закріпити ОП",
context_pinchannel_text: "Додайте до списку каналів",
context_unpinchannel_text: "Видалити зі списку каналів",
context_pinguild_text: "Додайте до списку серверів",
context_unpinguild_text: "Видалити зі списку серверів",
header_pinneddms_text: "Прикріплені oсобисті повідомлення"
};
case "ja": //japanese
return {
context_pindm_text: "DMピン",
context_pinchannel_text: "チャンネルリストに添付",
context_unpinchannel_text: "チャンネルリストから削除",
context_pinguild_text: "サーバーリストに添付",
context_unpinguild_text: "サーバーリストから削除",
header_pinneddms_text: "固定された直接メッセージ"
};
case "zh-TW": //chinese (traditional)
return {
context_pindm_text: "引腳直接留言",
context_pinchannel_text: "附加到頻道列表",
context_unpinchannel_text: "從頻道列表中刪除",
context_pinguild_text: "附加到服務器列表",
context_unpinguild_text: "從服務器列表中刪除",
header_pinneddms_text: "固定私人信息"
};
case "ko": //korean
return {
context_pindm_text: "비공개 메시지 고정",
context_pinchannel_text: "채널 목록에 첨부",
context_unpinchannel_text: "채널 목록에서 삭제",
context_pinguild_text: "서버 목록에 첨부",
context_unpinguild_text: "서버 목록에서 제거",
header_pinneddms_text: "고정 된 비공개 메시지"
};
default: //default: english
return {
context_pindm_text: "Pin DM",
context_pinchannel_text: "Pin to Channellist",
context_unpinchannel_text: "Unpin from Channellist",
context_pinguild_text: "Pin to Serverlist",
context_unpinguild_text: "Unpin from Serverlist",
header_pinneddms_text: "Pinned Direct Messages"
};
}
}
}
};

View File

@ -1,41 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Plugins
- [BadgesEverywhere](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/BadgesEverywhere) - Displays Badges (Nitro, Hypesquad, etc...) in the chat/memberlist/userpopout. Thanks for Zerebos' help.
- [Better Friend Count](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/BetterFriendCount) - Shows the amount of total and online friends and blocked users in the friends tab.
- [Better NSFW Tag](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/BetterNsfwTag) - Adds a more noticeable tag to NSFW channels.
- [Char Counter](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/CharCounter) - Adds a character counter to the chat.
- [Chat Aliases](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ChatAliases) - Allows the user to configure their own chat-aliases which will automatically be replaced before the message is being sent.
- [Chat Filter](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ChatFilter) - Allows the user to censor words or block complete messages based on words in the chatwindow.
- [Complete Timestamps](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/CompleteTimestamps) - Replace all timestamps with complete timestamps.
- [Creation Date](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/CreationDate) - Displays the Creation Date of an Account in the UserPopout and UserModal.
- [Display Servers As Channels](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/DisplayServersAsChannels) - Display servers in a similar way as channels.
- [Edit Channels](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/EditChannels) - Allows the user to locally change the name and color of channels.
- [Edit Servers](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/EditServers) - Allows the user to locally change the name, initials, icon and color of servers.
- [Edit Users](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/EditUsers) - Allows you to change the icon, name, tag and color of users.
- [Emoji Statistics](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/EmojiStatistics) - Displays emojiinformation when hovering over an emoji in the emojipicker and adds a button to the emojipicker to open a statistics overview.
- [Fix German Translation](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/FixGermanTranslation) - Fixes some minor translation errors in the german version of Discord.
- [Force Image Previews](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ForceImagePreviews) - Forces embedded Image Previews, if Discord doesn't do it itself.
- [Friend Notifications](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/FriendNotifications) - Notifies you when a friend either logs in or out. Click the Online Friend-Counter to display a timelog of the current session.
- [Google Search Replace](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/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/PluginsV2/GoogleTranslateOption) - Adds a Google Translate option to your context menu, which will open the selected text in Google Translate.
- [Image Gallery](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ImageGallery) - Allows the user to browse through images sent inside the same message.
- [Message Utilities](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/MessageUtilities) - Offers a number of useful message options.
- [Moveable Popups](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/MoveablePopups) - Adds the feature to move all popups and modals around like on a normal desktop. Ctrl + drag with your left mousebutton to drag element.
- [Notification Sounds](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/NotificationSounds) - Allows you to replace the native sounds of Discord with your own.
- [Old Title Bar](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/OldTitleBar) - Reverts the title bar back to its former self.
- [Personal Pins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/PersonalPins) - Similar to normal pins. Lets you save messages as notes for yourself.
- [Pin DMs](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/PinDMs) - Allows you to pin DMs, making them appear at the top of your DM-list.
- [Read All Notifications Button](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ReadAllNotificationsButton) - Adds a little button at the top of your serverlist that enables you to clear all mentions and messagesnotifications at once.
- [Remove Nicknames](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/RemoveNicknames) - Replace all nicknames with the actual accountnames.
- [Reverse Image Search](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ReverseImageSearch) - Adds the option to reverse image search images in discord via several engines.
- [Send Large Messages](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/SendLargeMessages) - Opens a popout when your message is too large, which allows you to automatically send the message in several smaller messages.
- [Server Hider](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ServerHider) - Adds two options on your server context menu to hide servers in your server list.
- [Server Folders](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ServerFolders) - Adds the option to create pseudo folders that, click the folder to hide/display all folders between two folders. Easily gets broken by moving server icons.
- [Show Hidden Channels](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ShowHiddenChannels) - Displays all hidden channels that can't be accessed due to role restrictions in a new category.
- [Show Image Details](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ShowImageDetails) - Display the name, size and dimensions of uploaded images (does not include embed images) in the chat as an header or as a tooltip.
- [Spell Check](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/SpellCheck) - Adds a spellcheck to all textareas.
- [Stalker Notifications](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/StalkerNotifications) - Lets you observe the status of people that aren't your friends.
- [Steam Profile Link](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/SteamProfileLink) - Opens a steam profile in steam instead of a browser when clicking the steamlink in a userprofile. With the help of square.
- [Top Role Everywhere](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/TopRoleEverywhere) - Adds the highest role of a user as a tag.
- [Write UpperCase](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/WriteUpperCase) - Changes the input in the textarea to uppercase.

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Read All Notifications Button - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ReadAllNotificationsButton/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ReadAllNotificationsButton/config.json)
Adds a little button at the top of your serverlist that enables you to clear all mentions and messagesnotifications at once.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "ReadAllNotifications",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Adds a button to clear all notifications. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,176 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"Guilds":"componentDidMount",
"RecentMentions":"componentDidMount"
};
this.RANcontextMenuMarkup =
`<div class="${BDFDB.disCN.contextmenu} RANbutton-contextmenu">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} readguilds-item">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_guilds_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
<div class="${BDFDB.disCN.contextmenuitem} readmutedguilds-item">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_mutedguilds_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
<div class="${BDFDB.disCN.contextmenuitem} readdms-item">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_dms_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>
</div>`;
this.RANbuttonMarkup =
`<div class="${BDFDB.disCN.guild} RANbutton-frame" id="bd-pub-li" style="height: 20px; margin-bottom: 10px;">
<div class="${BDFDB.disCN.guildinner}" style="height: 20px; border-radius: 4px;">
<a>
<div class="RANbutton" id="bd-pub-button" style="line-height: 20px; font-size: 12px;">read all</div>
</a>
</div>
</div>`;
this.RAMbuttonMarkup =
`<button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemin + BDFDB.disCN.buttongrow} RAMbutton" style="flex: 0 0 auto; margin-left: 25px; height: 25px;">
<div class="${BDFDB.disCN.buttoncontents}">Clear Mentions</div>
</button>`;
this.defaults = {
settings: {
includeGuilds: {value:true, description:"unread Servers"},
includeMuted: {value:false, description:"muted unread Servers"},
includeDMs: {value:false, description:"unread DMs"}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".RANbutton-frame", ".RAMbutton");
BDFDB.removeClasses("RAN-added", "RAM-added");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
processGuilds (instance, wrapper) {
BDFDB.removeEles(".RANbutton-frame");
let guildseparator = wrapper.querySelector(BDFDB.dotCN.guildseparator);
if (guildseparator) {
let ranbutton = BDFDB.htmlToElement(this.RANbuttonMarkup);
guildseparator.parentElement.insertBefore(ranbutton, guildseparator);
ranbutton.addEventListener("click", () => {
let settings = BDFDB.getAllData(this, "settings");
if (settings.includeGuilds) BDFDB.markGuildAsRead(settings.includeMuted ? BDFDB.readServerList() : BDFDB.readUnreadServerList());
if (settings.includeDMs) BDFDB.markChannelAsRead(BDFDB.readDmList());
});
ranbutton.addEventListener("contextmenu", e => {
let RANcontextMenu = BDFDB.htmlToElement(this.RANcontextMenuMarkup);
RANcontextMenu.querySelector(".readguilds-item").addEventListener("click", () => {
BDFDB.removeEles(RANcontextMenu);
BDFDB.markGuildAsRead(BDFDB.readUnreadServerList());
});
RANcontextMenu.querySelector(".readmutedguilds-item").addEventListener("click", () => {
BDFDB.removeEles(RANcontextMenu);
BDFDB.markGuildAsRead(BDFDB.readServerList());
});
RANcontextMenu.querySelector(".readdms-item").addEventListener("click", () => {
BDFDB.removeEles(RANcontextMenu);
BDFDB.markChannelAsRead(BDFDB.readDmList());
});
BDFDB.appendContextMenu(RANcontextMenu, e);
});
BDFDB.addClass(wrapper, "RAN-added");
}
}
processRecentMentions (instance, wrapper) {
BDFDB.removeEles(".RAMbutton");
if (instance.props && instance.props.popoutName == "RECENT_MENTIONS_POPOUT") {
let recentmentionstitle = wrapper.querySelector(BDFDB.dotCN.recentmentionstitle);
if (recentmentionstitle) {
let ranbutton = BDFDB.htmlToElement(this.RAMbuttonMarkup);
recentmentionstitle.appendChild(ranbutton);
ranbutton.addEventListener("click", () => {this.clearMentions(instance, wrapper);});
BDFDB.addClass(wrapper, "RAM-added");
}
}
}
clearMentions (instance, wrapper) {
let closebuttons = wrapper.querySelectorAll(BDFDB.dotCN.messagespopoutclosebutton);
for (let btn of wrapper.querySelectorAll(BDFDB.dotCN.messagespopoutclosebutton)) btn.click();
if (closebuttons.length) {
instance.loadMore();
setTimeout(() => {this.clearMentions(instance, wrapper);},3000);
}
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">When left clicking the button mark following elements as unread:</h3></div><div class="DevilBro-settings-inner-list">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
settingshtml += `</div>`;
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
let mutedinput = settingspanel.querySelector(".settings-switch[value='settings includeMuted']").parentElement.parentElement;
BDFDB.toggleEles(mutedinput, settings.includeGuilds);
BDFDB.addEventListener(this, settingspanel, "click", ".settings-switch[value='settings includeGuilds']", e => {
BDFDB.toggleEles(mutedinput, e.currentTarget.checked);
});
return settingspanel;
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Remove Nicknames - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/RemoveNicknames/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/RemoveNicknames/config.json)
Replace all nicknames with the actual accountnames.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "RemoveNicknames",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "CReplace all nicknames with the actual accountnames. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,160 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"NameTag":"componentDidMount",
"TypingUsers":"componentDidUpdate",
"MessageUsername":"componentDidMount",
"Clickable":"componentDidMount"
};
this.defaults = {
settings: {
replaceOwn: {value:false, description:"Replace your own name:"},
addNickname: {value:false, description:"Add nickname as parentheses:"},
swapPositions: {value:false, description:"Swap the position of username and nickname:"}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.reseting = false;
this.UserStore = BDFDB.WebModules.findByProperties("getUsers", "getUser");
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
this.MemberStore = BDFDB.WebModules.findByProperties("getNicknames", "getNick");
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.reseting = true;
BDFDB.WebModules.forceAllUpdates(this);
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
getNewName (info) {
if (!info) return null;
let EditUsersData = BDFDB.isPluginEnabled("EditUsers") ? BDFDB.loadData(info.id, "EditUsers", "users") : null;
if (EditUsersData && EditUsersData.name) return EditUsersData.name;
let settings = BDFDB.getAllData(this, "settings");
let member = this.MemberStore.getMember(this.LastGuildStore.getGuildId(), info.id);
if (!member || !member.nick || info.id == BDFDB.myData.id && !settings.replaceOwn) return info.username;
if (this.reseting) return member.nick || info.username;
return settings.addNickname ? (settings.swapPositions ? (member.nick + " (" + info.username + ")") : (info.username + " (" + member.nick + ")")) : info.username;
}
processNameTag (instance, wrapper) {
let username = wrapper.parentElement.querySelector("." + (BDFDB.containsClass(wrapper, BDFDB.disCN.userpopoutheadertagwithnickname) ? BDFDB.disCN.userpopoutheadernickname : instance.props.usernameClass).replace(/ /g, "."));
if (username) BDFDB.setInnerText(username, this.getNewName(instance.props.user));
}
processMessageUsername (instance, wrapper) {
let message = BDFDB.getReactValue(instance, "props.message");
if (message) {
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
if (username) BDFDB.setInnerText(username, this.getNewName(message.author));
}
}
processTypingUsers (instance, wrapper) {
let users = !instance.state.typingUsers ? [] : Object.keys(instance.state.typingUsers).filter(id => id != BDFDB.myData.id).filter(id => !this.RelationshipUtils.isBlocked(id)).map(id => this.UserUtils.getUser(id)).filter(id => id != null);
wrapper.querySelectorAll("strong").forEach((username, i) => {
if (users[i] && username) BDFDB.setInnerText(username, this.getNewName(users[i]));
});
}
processClickable (instance, wrapper) {
if (!wrapper || !instance.props || !instance.props.className) return;
if (instance.props.tag == "a" && instance.props.className.indexOf(BDFDB.disCN.anchorunderlineonhover) > -1) {
if (BDFDB.containsClass(wrapper.parentElement, BDFDB.disCN.messagesystemcontent)) {
let message = BDFDB.getKeyInformation({node:wrapper.parentElement, key:"message", up:true});
if (message) BDFDB.setInnerText(wrapper, this.getNewName(message.author));
}
}
else if (instance.props.tag == "span" && instance.props.className.indexOf(BDFDB.disCN.mention) > -1) {
let render = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.stateNode.props.render");
if (typeof render == "function") BDFDB.setInnerText(wrapper, "@" + this.getNewName(render().props.user));
}
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.voiceuser) > -1) {
let user = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.user");
if (user) {
let username = wrapper.querySelector(BDFDB.dotCN.voicename);
if (username) BDFDB.setInnerText(username, this.getNewName(user));
}
}
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.autocompleterow) > -1) {
let user = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.user");
if (user) {
let username = wrapper.querySelector(BDFDB.dotCN.marginleft8);
if (username) BDFDB.setInnerText(username, this.getNewName(user));
}
}
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
;
return settingspanel;
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
BDFDB.WebModules.forceAllUpdates(this);
}
}
}
};

View File

@ -1,9 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Reverse Image Search - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ReverseImageSearch/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ReverseImageSearch/config.json)
Adds the option to right click an image and use an engine to reverse image search it.
Enable/Disable them in the settings.
Current engines: Baidu, Bing, Google, Karma Decay (Reddit), Sogou, TinEye, Yandex
If you want to add new search engines, simply add a new entry in the searchEngines array in the constructor. Make sure to get the right search url for the engine.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "ReverseImageSearch",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Adds a reverse image search option to the context menu. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,233 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.imgUrlReplaceString = "DEVILBRO_BD_REVERSEIMAGESEARCH_REPLACE_IMAGEURL";
this.defaults = {
engines: {
_all: {value:true, name:BDFDB.getLibraryStrings().btn_all_text, url:null},
Baidu: {value:true, name:"Baidu", url:"http://image.baidu.com/pcdutu?queryImageUrl=" + this.imgUrlReplaceString},
Bing: {value:true, name:"Bing", url:"https://www.bing.com/images/search?q=imgurl:" + this.imgUrlReplaceString + "&view=detailv2&iss=sbi&FORM=IRSBIQ"},
Google: {value:true, name:"Google", url:"https://images.google.com/searchbyimage?image_url=" + this.imgUrlReplaceString},
IQDB: {value:true, name:"IQDB", url:"https://iqdb.org/?url=" + this.imgUrlReplaceString},
Reddit: {value:true, name:"Reddit", url:"http://karmadecay.com/search?q=" + this.imgUrlReplaceString},
SauceNAO: {value:true, name:"SauceNAO", url:"https://saucenao.com/search.php?db=999&url=" + this.imgUrlReplaceString},
Sogou: {value:true, name:"Sogou", url:"http://pic.sogou.com/ris?flag=1&drag=0&query=" + this.imgUrlReplaceString + "&flag=1"},
TinEye: {value:true, name:"TinEye", url:"https://tineye.com/search?url=" + this.imgUrlReplaceString},
WhatAnime: {value:true, name:"WhatAnime", url:"https://trace.moe/?url=" + this.imgUrlReplaceString},
Yandex: {value:true, name:"Yandex", url:"https://yandex.com/images/search?url=" + this.imgUrlReplaceString + "&rpt=imageview"}
}
};
this.messageContextEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} reverseimagesearch-item ${BDFDB.disCN.contextmenuitemsubmenu}">
<span>Reverse Image Search</span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>`;
this.messageContextSubMenuMarkup =
`<div class="${BDFDB.disCN.contextmenu} reverseimagesearch-submenu">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} alldisabled-item ${BDFDB.disCN.contextmenuitemdisabled}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_submenu_disabled_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
${Object.keys(this.defaults.engines).map((key, i) => `<div engine="${key}" class="${BDFDB.disCN.contextmenuitem} RIS-item"><span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">${this.defaults.engines[key].name}</div></span><div class="${BDFDB.disCN.contextmenuhint}"></div></div>`).join("")}
</div>
</div>`;
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
changeLanguageStrings () {
this.messageContextSubMenuMarkup = this.messageContextSubMenuMarkup.replace("REPLACE_submenu_disabled_text", this.labels.submenu_disabled_text);
}
onNativeContextMenu (instance, menu) {
if (instance.props && instance.props.type == "NATIVE_IMAGE" && instance.props.href && !menu.querySelector(".reverseimagesearch-item")) {
this.appendItem(instance, menu, instance.props.href);
}
}
onMessageContextMenu (instance, menu) {
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".reverseimagesearch-item")) {
if (instance.props.attachment) {
this.appendItem(instance, menu, instance.props.attachment.url);
}
if (instance.props.target.tagName == "A") {
BDFDB.toggleEles(menu, false);
require("request")(instance.props.target.href, (error, response, result) => {
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
this.appendItem(instance, menu, instance.props.target.href);
}
BDFDB.toggleEles(menu, true);
BDFDB.updateContextPosition(menu);
});
}
}
}
appendItem (instance, menu, url) {
if (instance && menu && url) {
if (url.indexOf("discordapp.com/assets/") == -1) {
if (url.indexOf("https://images-ext-1.discordapp.net/external/") > -1) {
if (url.split("/https/").length != 1) url = "https://" + url.split("/https/")[url.split("/https/").length-1];
else if (url.split("/http/").length != 1) url = "http://" + url.split("/http/")[url.split("/http/").length-1];
}
let messageContextEntry = BDFDB.htmlToElement(this.messageContextEntryMarkup);
menu.appendChild(messageContextEntry);
let searchitem = messageContextEntry.querySelector(".reverseimagesearch-item");
searchitem.addEventListener("mouseenter", () => {
let messageContextSubMenu = BDFDB.htmlToElement(this.messageContextSubMenuMarkup);
let engines = BDFDB.getAllData(this, "engines");
for (let key in engines) if (!engines[key]) BDFDB.removeEles(messageContextSubMenu.querySelector("[engine='" + key + "']"));
if (messageContextSubMenu.querySelector(".RIS-item")) BDFDB.removeEles(messageContextSubMenu.querySelector(".alldisabled-item"));
BDFDB.addChildEventListener(messageContextSubMenu, "click", ".RIS-item", e => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
let engine = e.currentTarget.getAttribute("engine");
if (engine == "_all") {
for (let key in engines) if (key != "_all" && engines[key]) window.open(this.defaults.engines[key].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), "_blank");
}
else window.open(this.defaults.engines[engine].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), "_blank");
});
BDFDB.appendSubMenu(searchitem, messageContextSubMenu);
});
}
}
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {
submenu_disabled_text: "Svi su onemogućeni"
};
case "da": //danish
return {
submenu_disabled_text: "Alle deaktiveret"
};
case "de": //german
return {
submenu_disabled_text: "Alle deaktiviert"
};
case "es": //spanish
return {
submenu_disabled_text: "Todo desactivado"
};
case "fr": //french
return {
submenu_disabled_text: "Tous désactivés"
};
case "it": //italian
return {
submenu_disabled_text: "Tutto disattivato"
};
case "nl": //dutch
return {
submenu_disabled_text: "Alles gedeactiveerd"
};
case "no": //norwegian
return {
submenu_disabled_text: "Alle deaktivert"
};
case "pl": //polish
return {
submenu_disabled_text: "Wszystkie wyłączone"
};
case "pt-BR": //portuguese (brazil)
return {
submenu_disabled_text: "Todos desativados"
};
case "fi": //finnish
return {
submenu_disabled_text: "Kaikki on poistettu käytöstä"
};
case "sv": //swedish
return {
submenu_disabled_text: "Alla avaktiverade"
};
case "tr": //turkish
return {
submenu_disabled_text: "Hepsi deaktive"
};
case "cs": //czech
return {
submenu_disabled_text: "Všechny deaktivované"
};
case "bg": //bulgarian
return {
submenu_disabled_text: "Всички са деактивирани"
};
case "ru": //russian
return {
submenu_disabled_text: "Все деактивированные"
};
case "uk": //ukrainian
return {
submenu_disabled_text: "Всі вимкнені"
};
case "ja": //japanese
return {
submenu_disabled_text: "すべて非アクティブ化"
};
case "zh-TW": //chinese (traditional)
return {
submenu_disabled_text: "全部停用"
};
case "ko": //korean
return {
submenu_disabled_text: "모두 비활성화 됨"
};
default: //default: english
return {
submenu_disabled_text: "All disabled"
};
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Send Large Messages - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/SendLargeMessages/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/SendLargeMessages/config.json)
Opens a popout when your message is too large, which allows you to automatically send the message in several smaller messages.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "SendLargeMessages",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Opens a popout when your message is too large, which allows you to automatically send the message in several smaller messages. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,446 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.labels = {};
this.patchModules = {
"ChannelTextArea":"componentDidMount"
};
this.messageDelay = 1000; //changing at own risk, might result in bans or mutes
this.css = `
.${this.name}-modal textarea {
rows: 0;
cols: 0;
height: 100vw;
resize: none;
}
.${this.name}-modal #warning-message {
color: red;
}
.${this.name}-modal #character-counter {
float: right;
color: white;
opacity: .5;
}`;
this.sendMessageModalMarkup =
`<span class="${this.name}-modal DevilBro-modal">
<div class="${BDFDB.disCN.backdrop}"></div>
<div class="${BDFDB.disCN.modal}">
<div class="${BDFDB.disCN.modalinner}">
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizelarge}">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">REPLACE_modal_header_text</h4>
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCN.primary}"></div>
</div>
<button type="button" class="${BDFDB.disCNS.modalclose + BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">
<svg name="Close" width="18" height="18" viewBox="0 0 12 12" style="flex: 0 1 auto;">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h12v12H0"></path>
<path class="fill" fill="currentColor" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path>
</g>
</svg>
</div>
</button>
</div>
<div class="${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.modalcontent + BDFDB.disCNS.scrollerthemed + BDFDB.disCNS.themeghosthairline + BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.flexchild + BDFDB.disCN.modalsubinner}" style="flex: 1 1 auto;">
<textarea class="${BDFDB.disCNS.scroller + BDFDB.disCNS.inputdefault + BDFDB.disCN.input}" id="modal-inputtext"></textarea>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCNS.nowrap + BDFDB.disCNS.modalsubinner + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;">
<h5 id="warning-message" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.h5 + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightbold + BDFDB.disCNS.h5defaultmargin}" style="flex: 1 1 auto;"></h5>
<h5 id="character-counter" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.h5 + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightmedium + BDFDB.disCNS.h5defaultmargin}" style="flex: 0 0 auto;"></h5>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
<button type="button" class="btn-send ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_send_text</div>
</button>
</div>
</div>
</div>
</div>
</span>`;
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.clipboard = require("electron").clipboard;
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
changeLanguageStrings () {
this.sendMessageModalMarkup = this.sendMessageModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
this.sendMessageModalMarkup = this.sendMessageModalMarkup.replace("REPLACE_btn_cancel_text", this.labels.btn_cancel_text);
this.sendMessageModalMarkup = this.sendMessageModalMarkup.replace("REPLACE_btn_send_text", this.labels.btn_send_text);
}
processChannelTextArea (instance, wrapper) {
if (instance.props && instance.props.type && instance.props.type == "normal") {
var textarea = wrapper.querySelector("textarea");
if (!textarea) return;
let modaltext, checkTextarea = () => {
if (BDFDB.getParsedLength(textarea.value) > 1950) {
textarea.selectionStart = 0;
textarea.selectionEnd = textarea.value.length;
document.execCommand("insertText", false, "");
this.showSendModal(modaltext);
}
};
BDFDB.addEventListener(this, textarea, "keyup", e => {
clearTimeout(textarea.sendlargemessagestimeout);
textarea.sendlargemessagestimeout = setTimeout(() => {
modaltext = textarea.value;
checkTextarea();
},100);
});
BDFDB.addEventListener(this, textarea, "paste", e => {
modaltext = textarea.value.slice(0, textarea.selectionStart) + this.clipboard.readText() + textarea.value.slice(textarea.selectionEnd);
setImmediate(() => {checkTextarea(textarea);});
});
}
}
showSendModal (text) {
let sendMessageModal = BDFDB.htmlToElement(this.sendMessageModalMarkup);
let textinput = sendMessageModal.querySelector("#modal-inputtext");
let warning = sendMessageModal.querySelector("#warning-message");
let counter = sendMessageModal.querySelector("#character-counter");
let updateCounter = () => {
let parsedlength = BDFDB.getParsedLength(textinput.value);
let messageAmount = Math.ceil(parsedlength/1900);
warning.innerText = messageAmount > 15 ? this.labels.modal_messages_warning : "";
counter.innerText = parsedlength + " (" + (textinput.selectionEnd - textinput.selectionStart) + ") => " + this.labels.modal_messages_translation + ": " + messageAmount;
};
BDFDB.appendModal(sendMessageModal);
BDFDB.addChildEventListener(sendMessageModal, "click", ".btn-send", e => {
e.preventDefault();
let messages = this.formatText(textinput.value || "");
messages.forEach((message,i) => {
setTimeout(() => {
this.sendMessage(message);
if (i >= messages.length-1) BDFDB.showToast(this.labels.toast_allsent_text, {type:"success"});
},this.messageDelay * i);
});
});
textinput.value = text || "";
textinput.addEventListener("keyup", () => {setTimeout(() => {updateCounter();},10);});
textinput.addEventListener("click", () => {updateCounter();});
textinput.addEventListener("mousedown", () => {
var mouseup = () => {
document.removeEventListener("mouseup", mouseup);
document.removeEventListener("mousemove", mousemove);
};
var mousemove = () => {
setTimeout(() => {updateCounter();},10);
};
document.addEventListener("mouseup", mouseup);
document.addEventListener("mousemove", mousemove);
});
updateCounter();
textinput.focus();
}
formatText (text) {
text = text.replace(new RegExp("\t", 'g'), " ");
let longwords = text.match(/[\S]{1800,}/gm);
for (let i in longwords) {
let longword = longwords[i];
let count1 = 0;
let shortwords = [];
longword.split("").forEach((char) => {
if (shortwords[count1] && BDFDB.getParsedLength(shortwords[count1]) >= 1800) count1++;
shortwords[count1] = shortwords[count1] ? shortwords[count1] + char : char;
});
text = text.replace(longword, shortwords.join(" "));
}
let messages = [];
let count2 = 0;
text.split(" ").forEach((word) => {
if (messages[count2] && BDFDB.getParsedLength(messages[count2] + "" + word) > 1900) count2++;
messages[count2] = messages[count2] ? messages[count2] + " " + word : word;
});
let insertCodeBlock = null, insertCodeLine = null;
for (let j = 0; j < messages.length; j++) {
if (insertCodeBlock) {
messages[j] = insertCodeBlock + messages[j];
insertCodeBlock = null;
}
else if (insertCodeLine) {
messages[j] = insertCodeLine + messages[j];
insertCodeLine = null;
}
let codeBlocks = messages[j].match(/`{3,}[\S]*\n|`{3,}/gm);
let codeLines = messages[j].match(/[^`]{0,1}`{1,2}[^`]|[^`]`{1,2}[^`]{0,1}/gm);
if (codeBlocks && codeBlocks.length % 2 == 1) {
messages[j] = messages[j] + "```";
insertCodeBlock = codeBlocks[codeBlocks.length-1] + "\n";
}
else if (codeLines && codeLines.length % 2 == 1) {
insertCodeLine = codeLines[codeLines.length-1].replace(/[^`]/g, "");
messages[j] = messages[j] + insertCodeLine;
}
}
return messages;
}
sendMessage (text) {
let textarea = document.querySelector(BDFDB.dotCNS.textareawrapchat + "textarea");
if (textarea) {
let instance = BDFDB.getOwnerInstance({"node":textarea.parentElement, "name":"ChannelTextAreaForm", "up":true});
if (instance) {
instance.setState({textValue:text});
BDFDB.triggerSend(textarea);
}
}
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {
toast_allsent_text: "Sve veliku poslane.",
modal_messages_translation: "Vijesti",
modal_messages_warning: "Nemojte slati previše veliku!",
modal_header_text: "Pošalji veliku poruku:",
btn_cancel_text: "Prekid",
btn_send_text: "Poslati"
};
case "da": //danish
return {
toast_allsent_text: "Alle beskeder sendes.",
modal_messages_translation: "Beskeder",
modal_messages_warning: "Send ikke for mange beskeder!",
modal_header_text: "Send stor besked:",
btn_cancel_text: "Afbryde",
btn_send_text: "Sende"
};
case "de": //german
return {
toast_allsent_text: "Alle Nachrichten versendet.",
modal_messages_translation: "Nachrichten",
modal_messages_warning: "Schicke nicht zu viele Nachrichten!",
modal_header_text: "Große Nachricht senden:",
btn_cancel_text: "Abbrechen",
btn_send_text: "Senden"
};
case "es": //spanish
return {
toast_allsent_text: "Todos los mensajes enviados.",
modal_messages_translation: "Mensajes",
modal_messages_warning: "¡No envíe demasiados mensajes!",
modal_header_text: "Enviar mensaje grande:",
btn_cancel_text: "Cancelar",
btn_send_text: "Enviar"
};
case "fr": //french
return {
toast_allsent_text: "Tous les messages envoyés",
modal_messages_translation: "Messages",
modal_messages_warning: "N'envoyez pas trop de messages!",
modal_header_text: "Envoyer un gros message:",
btn_cancel_text: "Abandonner",
btn_send_text: "Envoyer"
};
case "it": //italian
return {
toast_allsent_text: "Tutti i messaggi inviati.",
modal_messages_translation: "Messaggi",
modal_messages_warning: "Non inviare troppi messaggi!",
modal_header_text: "Invia grande messaggio:",
btn_cancel_text: "Cancellare",
btn_send_text: "Inviare"
};
case "nl": //dutch
return {
toast_allsent_text: "Alle berichten verzonden.",
modal_messages_translation: "Berichten",
modal_messages_warning: "Stuur niet te veel berichten!",
modal_header_text: "Stuur een groot bericht:",
btn_cancel_text: "Afbreken",
btn_send_text: "Sturen"
};
case "no": //norwegian
return {
toast_allsent_text: "Alle meldinger sendt.",
modal_messages_translation: "Meldinger",
modal_messages_warning: "Ikke send for mange meldinger!",
modal_header_text: "Send stor melding:",
btn_cancel_text: "Avbryte",
btn_send_text: "Sende"
};
case "pl": //polish
return {
toast_allsent_text: "Wszystkie wiadomości zostały wysłane.",
modal_messages_translation: "Wiadomości",
modal_messages_warning: "Nie wysyłaj zbyt wielu wiadomości!",
modal_header_text: "Wyślij dużą wiadomość:",
btn_cancel_text: "Anuluj",
btn_send_text: "Wyślij"
};
case "pt-BR": //portuguese (brazil)
return {
toast_allsent_text: "Todas as mensagens enviadas.",
modal_messages_translation: "Mensagens",
modal_messages_warning: "Não envie muitas mensagens!",
modal_header_text: "Enviar mensagem grande:",
btn_cancel_text: "Cancelar",
btn_send_text: "Enviar"
};
case "fi": //finnish
return {
toast_allsent_text: "Kaikki lähetetyt viestit.",
modal_messages_translation: "Viestien",
modal_messages_warning: "Älä lähetä liian monta viestiä!",
modal_header_text: "Lähetä suuri viesti:",
btn_cancel_text: "Peruuttaa",
btn_send_text: "Lähettää"
};
case "sv": //swedish
return {
toast_allsent_text: "Alla meddelanden skickade.",
modal_messages_translation: "Meddelanden",
modal_messages_warning: "Skicka inte för många meddelanden!",
modal_header_text: "Skicka stort meddelande:",
btn_cancel_text: "Avbryta",
btn_send_text: "Skicka"
};
case "tr": //turkish
return {
toast_allsent_text: "Tüm mesajlar gönderildi.",
modal_messages_translation: "Mesajları",
modal_messages_warning: "Çok fazla mesaj göndermeyin!",
modal_header_text: "Büyük mesaj gönder:",
btn_cancel_text: "Iptal",
btn_send_text: "Göndermek"
};
case "cs": //czech
return {
toast_allsent_text: "Všechny zprávy byly odeslány.",
modal_messages_translation: "Zpráv",
modal_messages_warning: "Neposílejte příliš mnoho zpráv!",
modal_header_text: "Odeslat velkou zprávu:",
btn_cancel_text: "Zrušení",
btn_send_text: "Poslat"
};
case "bg": //bulgarian
return {
toast_allsent_text: "Всички изпратени съобщения.",
modal_messages_translation: "Съобщения",
modal_messages_warning: "Не изпращайте твърде много съобщения!",
modal_header_text: "Изпратете голямо съобщение:",
btn_cancel_text: "Зъбести",
btn_send_text: "изпращам"
};
case "ru": //russian
return {
toast_allsent_text: "Все отправленные сообщения.",
modal_messages_translation: "Сообщения",
modal_messages_warning: "Не отправляйте слишком много сообщений!",
modal_header_text: "Отправить сообщение:",
btn_cancel_text: "Отмена",
btn_send_text: "Послать"
};
case "uk": //ukrainian
return {
toast_allsent_text: "Всі повідомлення надіслано.",
modal_messages_translation: "Повідомлення",
modal_messages_warning: "Не надсилайте надто багато повідомлень!",
modal_header_text: "Надіслати велике повідомлення:",
btn_cancel_text: "Скасувати",
btn_send_text: "Відправити"
};
case "ja": //japanese
return {
toast_allsent_text: "すべてのメッセージが送信されました。",
modal_messages_translation: "メッセージ",
modal_messages_warning: "あまりにも多くのメッセージを送信しないでください!",
modal_header_text: "大きなメッセージを送信する:",
btn_cancel_text: "キャンセル",
btn_send_text: "送信"
};
case "zh-TW": //chinese (traditional)
return {
toast_allsent_text: "發送的所有消息。",
modal_messages_translation: "消息",
modal_messages_warning: "不要發送太多信息!",
modal_header_text: "發送大信息:",
btn_cancel_text: "取消",
btn_send_text: "發送"
};
case "ko": //korean
return {
toast_allsent_text: "모든 메시지가 전송되었습니다.",
modal_messages_translation: "메시지",
modal_messages_warning: "너무 많은 메시지를 보내지 마십시오!",
modal_header_text: "큰 메시지 보내기:",
btn_cancel_text: "취소",
btn_send_text: "보내다"
};
default: //default: english
return {
toast_allsent_text: "All messages sent.",
modal_messages_translation: "Messages",
modal_messages_warning: "Do not send too many messages!",
modal_header_text: "Send large message:",
btn_cancel_text: "Cancel",
btn_send_text: "Send"
};
}
}
}
};

View File

@ -1,14 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Server Folders - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ServerFolders/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ServerFolders/config.json)
Adds the feature to create folders to organize your servers.
- Right click a server > 'Serverfolders' > 'Create Folder' to create a folder.
- To add servers to a folder hold 'Ctrl' and drag the server onto the folder, this will add the server to the folderlist and hide it in the serverlist.
- To open a folder click the folder. A folder can only be opened when it has at least one server in it.
- To remove a server from a folder, open the folder and either right click the server > 'Serverfolders' > 'Remove Server from Folder' or hold 'Del' and click the server in the folderlist.
- Right clicking a folder gives you the option to
- Clear all notifications of the servers within the folder (greyed out if no notifications are present).
- Open the settingspopout for the folder to change the icon, the name and/or the color of the folder.
- Delete the folder.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "ServerFolders",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Adds the feature to create folders to organize your servers. Right click a server > 'Serverfolders' > 'Create Server' to create a server. To add servers to a folder hold 'Ctrl' and drag the server onto the folder, this will add the server to the folderlist and hide it in the serverlist. To open a folder click the folder. A folder can only be opened when it has at least one server in it. To remove a server from a folder, open the folder and either right click the server > 'Serverfolders' > 'Remove Server from Folder' or hold 'Del' and click the server in the folderlist. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Server Hider - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ServerHider/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ServerHider/config.json)
Adds two options on your server context menu.
- You can hide the selected server.
- You can open a popout, where you can swiftly hide servers and display them again.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "ServerHider",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Hide Servers in your Serverlist. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,463 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.labels = {};
this.patchModules = {
"Guild":"componentDidMount"
};
this.serverHiderModalMarkup =
`<span class="${this.name}-modal DevilBro-modal">
<div class="${BDFDB.disCN.backdrop}"></div>
<div class="${BDFDB.disCN.modal}">
<div class="${BDFDB.disCN.modalinner}">
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">REPLACE_modal_header_text</h4>
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCN.primary}"></div>
</div>
<button type="button" class="${BDFDB.disCNS.modalclose + BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">
<svg name="Close" width="18" height="18" viewBox="0 0 12 12" style="flex: 0 1 auto;">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h12v12H0"></path>
<path class="fill" fill="currentColor" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path>
</g>
</svg>
</div>
</button>
</div>
<div class="${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.modalcontent + BDFDB.disCNS.scrollerthemed + BDFDB.disCN.themeghosthairline}">
<div class="${BDFDB.disCNS.scroller + BDFDB.disCN.modalsubinner} entries"></div>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
<button type="button" class="btn-ok ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_ok_text</div>
</button>
<button type="button" class="btn-all ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlooklink + BDFDB.disCNS.buttoncolortransparent + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_all_text</div>
</button>
</div>
</div>
</div>
</div>
</span>`;
this.serverEntryMarkup =
`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCN.marginbottom4} entry" style="flex: 1 1 auto;">
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCNS.flexchild + BDFDB.disCNS.overflowellipsis} serverhiderName" style="flex: 1 1 auto;"></h3>
<div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;">
<input type="checkbox" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} serverhiderCheckbox">
</div>
</div>`;
this.serverContextEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} serverhider-item ${BDFDB.disCN.contextmenuitemsubmenu}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_context_serverhider_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>`;
this.serverContextSubMenuMarkup =
`<div class="${BDFDB.disCN.contextmenu} serverhider-submenu">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} hideserver-item ${BDFDB.disCN.contextmenuitemdisabled}">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_submenu_hideserver_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
<div class="${BDFDB.disCN.contextmenuitem} openhidemenu-item">
<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">REPLACE_submenu_openhidemenu_text</div></span>
<div class="${BDFDB.disCN.contextmenuhint}"></div>
</div>
</div>
</div>`;
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
if (BDFDB.isPluginEnabled("HideUtils") && !BDFDB.loadData("hideutils", this, "warnings")) BDFDB.openConfirmModal(this, this.name + " is not compartible with the plugin HideUtils by Arashiryuu. You might expierence bugs like Servers that should be hidden by " + this.name + " still being visible in the Guildlist. To avoid this disable the Plugin HideUtils. Press the " + BDFDB.getLibraryStrings().btn_ok_text + "-Button to not show this Message again.", "Warning", () => {BDFDB.saveData("hideutils", true, this, "warnings")});
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.readServerList().forEach(info => {if (!info.div.getAttribute("folder")) BDFDB.toggleEles(info.div, true);});
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
changeLanguageStrings () {
this.serverContextEntryMarkup = this.serverContextEntryMarkup.replace("REPLACE_context_serverhider_text", this.labels.context_serverhider_text);
this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_hideserver_text", this.labels.submenu_hideserver_text);
this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_openhidemenu_text", this.labels.submenu_openhidemenu_text);
this.serverHiderModalMarkup = this.serverHiderModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
this.serverHiderModalMarkup = this.serverHiderModalMarkup.replace("REPLACE_btn_ok_text", this.labels.btn_ok_text);
this.serverHiderModalMarkup = this.serverHiderModalMarkup.replace("REPLACE_btn_all_text", this.labels.btn_all_text);
this.serverEntryMarkup = this.serverEntryMarkup.replace("REPLACE_btn_visible_text", this.labels.btn_visible_text);
}
onGuildContextMenu (instance, menu) {
if (document.querySelector(".DevilBro-modal")) return;
if (instance.props && instance.props.target && instance.props.type.indexOf("GUILD_ICON_") == 0 && !menu.querySelector(".serverhider-item")) {
let serverContextEntry = BDFDB.htmlToElement(this.serverContextEntryMarkup);
menu.appendChild(serverContextEntry);
let hideritem = serverContextEntry.querySelector(".serverhider-item");
hideritem.addEventListener("mouseenter", () => {
let serverContextSubMenu = BDFDB.htmlToElement(this.serverContextSubMenuMarkup);
let openitem = serverContextSubMenu.querySelector(".openhidemenu-item");
openitem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
this.showServerModal();
});
if (instance.props.guild && !instance.props.target.getAttribute("folder")) {
let hideitem = serverContextSubMenu.querySelector(".hideserver-item");
BDFDB.removeClass(hideitem, BDFDB.disCN.contextmenuitemdisabled);
hideitem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
this.toggleServer(instance.props.guild, instance.props.target, false);
});
}
BDFDB.appendSubMenu(hideritem, serverContextSubMenu);
});
}
}
processGuild (instance, wrapper) {
if (instance.props && instance.props.guild) {
let hiddenservers = BDFDB.loadData("hiddenservers", this, "hiddenservers") || [];
this.toggleServer(instance.props.guild, wrapper, !hiddenservers.includes(instance.props.guild.id));
}
}
showServerModal () {
let serverHiderModal = BDFDB.htmlToElement(this.serverHiderModalMarkup);
let container = serverHiderModal.querySelector(".entries");
if (!container) return;
BDFDB.addChildEventListener(serverHiderModal, "click", ".btn-all", () => {
let firstcheckbox = serverHiderModal.querySelector(".serverhiderCheckbox");
firstcheckbox.click();
serverHiderModal.querySelectorAll(".serverhiderCheckbox").forEach(checkbox => {
if (checkbox != firstcheckbox && checkbox.checked != firstcheckbox.checked) checkbox.click();
});
});
for (let info of BDFDB.readServerList()) {
if (!info.div.getAttribute("folder")) {
if (container.firstElementChild) container.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCN.modaldivider}"></div>`));
let entry = BDFDB.htmlToElement(this.serverEntryMarkup);
container.appendChild(entry);
let name = entry.querySelector(".serverhiderName");
name.innerText = info.name || "";
name.parentElement.insertBefore(this.createCopyOfServer(info), name);
let hidecheckbox = entry.querySelector(".serverhiderCheckbox");
hidecheckbox.checked = !BDFDB.isEleHidden(info.div);
hidecheckbox.addEventListener("click", e => {
this.toggleServer(info, info.div, e.currentTarget.checked);
});
}
}
BDFDB.appendModal(serverHiderModal);
}
createCopyOfServer (info) {
let serverCopy = info.div.cloneNode(true);
BDFDB.toggleEles(serverCopy, true);
BDFDB.removeClass(serverCopy, BDFDB.disCN.guildunread, BDFDB.disCN.guildselected);
serverCopy.addEventListener("click", e => {
e.preventDefault();
info.div.querySelector("a").click();
});
serverCopy.addEventListener("contextmenu", e => {BDFDB.openGuildContextMenu(info.div, e);});
return serverCopy;
}
toggleServer (info, target, visible) {
if (!info || !target) return;
let guilddiv = BDFDB.getParentEle(BDFDB.dotCN.guild, target);
if (!guilddiv || guilddiv.getAttribute("folder")) return;
BDFDB.toggleEles(guilddiv, visible);
let hiddenservers = BDFDB.loadData("hiddenservers", this, "hiddenservers") || [];
BDFDB.removeFromArray(hiddenservers, info.id);
if (!visible) hiddenservers.push(info.id);
BDFDB.saveData("hiddenservers", hiddenservers, this, "hiddenservers");
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Reset all Servers.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} reset-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to reset all servers?", () => {
BDFDB.removeAllData(this, "servers");
BDFDB.readServerList().forEach(info => {if (!info.div.getAttribute("folder")) BDFDB.toggleEles(info.div, false);});
});
});
return settingspanel;
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {
modal_header_text: "Upravljanje popisom poslužitelja",
modal_folderhide_text: "Nemoj prikazivati poslužitelje skrivene po narudžbi",
btn_ok_text: "OK",
btn_all_text: "Sve",
context_serverhider_text: "Vidljivost poslužitelj",
submenu_hideserver_text: "Sakrij poslužitelj",
submenu_openhidemenu_text: "Upravljanje popisom poslužitelja"
};
case "da": //danish
return {
modal_header_text: "Styring af Serverliste",
modal_folderhide_text: "Vis ingen servere, som er gemt af mapper",
btn_ok_text: "OK",
btn_all_text: "Alle",
context_serverhider_text: "Server synlighed",
submenu_hideserver_text: "Skjul Server",
submenu_openhidemenu_text: "Styre Serverliste"
};
case "de": //german
return {
modal_header_text: "Verwaltung der Serverliste",
modal_folderhide_text: "Zeige keine Server, die durch Order versteckt wurden",
btn_ok_text: "OK",
btn_all_text: "Alle",
context_serverhider_text: "Serversichtbarkeit",
submenu_hideserver_text: "Server verstecken",
submenu_openhidemenu_text: "Serverliste verwalten"
};
case "es": //spanish
return {
modal_header_text: "Administración de lista de servidores",
modal_folderhide_text: "No mostrar servidores, que están ocultos por las carpetas",
btn_ok_text: "OK",
btn_all_text: "Todo",
context_serverhider_text: "Visibilidad del servidor",
submenu_hideserver_text: "Ocultar servidor",
submenu_openhidemenu_text: "Administrar lista de servidores"
};
case "fr": //french
return {
modal_header_text: "Gestion de la liste des serveurs",
modal_folderhide_text: "Afficher aucun serveur, qui sont cachés par des dossiers",
btn_ok_text: "OK",
btn_all_text: "Tout",
context_serverhider_text: "Visibilité du serveur",
submenu_hideserver_text: "Cacher le serveur",
submenu_openhidemenu_text: "Gérer la liste des serveurs"
};
case "it": //italian
return {
modal_header_text: "Gestione dell'elenco dei server",
modal_folderhide_text: "Mostra nessun server nascosto nelle cartelle",
btn_ok_text: "OK",
btn_all_text: "Tutto",
context_serverhider_text: "Visibilità del server",
submenu_hideserver_text: "Nascondi il server",
submenu_openhidemenu_text: "Gestione elenco dei server"
};
case "nl": //dutch
return {
modal_header_text: "Beheer van de Serverlijst",
modal_folderhide_text: "Toon geen servers, die zijn verborgen door mappen",
btn_ok_text: "OK",
btn_all_text: "Alle",
context_serverhider_text: "Server zichtbaarheid",
submenu_hideserver_text: "Verberg server",
submenu_openhidemenu_text: "Beheer serverlijst"
};
case "no": //norwegian
return {
modal_header_text: "Administrasjon av serverlisten",
modal_folderhide_text: "Vis ingen servere, som er skjult av mapper",
btn_ok_text: "OK",
btn_all_text: "Alle",
context_serverhider_text: "Server synlighet",
submenu_hideserver_text: "Skjul server",
submenu_openhidemenu_text: "Administrer serverliste"
};
case "pl": //polish
return {
modal_header_text: "Zarządzanie listą serwerów",
modal_folderhide_text: "Nie pokazuj żadnych serwerów, które są ukryte w folderach",
btn_ok_text: "OK",
btn_all_text: "Wszystkie",
context_serverhider_text: "Widoczność serwera",
submenu_hideserver_text: "Ukryj serwer",
submenu_openhidemenu_text: "Zarządzaj listą serwerów"
};
case "pt-BR": //portuguese (brazil)
return {
modal_header_text: "Gerenciamento da lista de servidores",
modal_folderhide_text: "Não exiba servidores, que estão ocultos por pastas",
btn_ok_text: "OK",
btn_all_text: "Todo",
context_serverhider_text: "Visibilidade do servidor",
submenu_hideserver_text: "Ocultar servidor",
submenu_openhidemenu_text: "Gerenciar lista de servidores"
};
case "fi": //finnish
return {
modal_header_text: "Palvelinluettelon hallinta",
modal_folderhide_text: "Näytä mitään palvelimia, jotka ovat kansioiden piilossa",
btn_ok_text: "OK",
btn_all_text: "Kaikki",
context_serverhider_text: "Palvelimen näkyvyys",
submenu_hideserver_text: "Piilota palvelin",
submenu_openhidemenu_text: "Hallinnoi palvelinluetteloa"
};
case "sv": //swedish
return {
modal_header_text: "Hantering av serverlistan",
modal_folderhide_text: "Visa inga servrar, vilka är dolda av mappar",
btn_ok_text: "OK",
btn_all_text: "All",
context_serverhider_text: "Server sikt",
submenu_hideserver_text: "Dölj server",
submenu_openhidemenu_text: "Hantera serverlistan"
};
case "tr": //turkish
return {
modal_header_text: "Sunucu Listesinin Yönetimi",
modal_folderhide_text: "Klasörler tarafından gizlenen hiçbir sunucu gösterme",
btn_ok_text: "Okey",
btn_all_text: "Her",
context_serverhider_text: "Sunucu görünürlüğü",
submenu_hideserver_text: "Sunucuyu Gizle",
submenu_openhidemenu_text: "Sunucu Listesini Yönet"
};
case "cs": //czech
return {
modal_header_text: "Správa seznamu serverů",
modal_folderhide_text: "Zobrazit žádné servery, které jsou skryty podle složek",
btn_ok_text: "OK",
btn_all_text: "Vše",
context_serverhider_text: "Viditelnost serveru",
submenu_hideserver_text: "Skrýt server",
submenu_openhidemenu_text: "Správa seznamu serverů"
};
case "bg": //bulgarian
return {
modal_header_text: "Управление на списъка със сървъри",
modal_folderhide_text: "Показване на сървъри, които са скрити от папки",
btn_ok_text: "Добре",
btn_all_text: "Bсичко",
context_serverhider_text: "Видимост на сървъра",
submenu_hideserver_text: "Скриване на сървър",
submenu_openhidemenu_text: "Управление на списъка със сървъри"
};
case "ru": //russian
return {
modal_header_text: "Управление списком серверов",
modal_folderhide_text: "Показывать никакие серверы, скрытые папками",
btn_ok_text: "ОК",
btn_all_text: "Все",
context_serverhider_text: "Видимость сервера",
submenu_hideserver_text: "Скрыть сервер",
submenu_openhidemenu_text: "Управление списком серверов"
};
case "uk": //ukrainian
return {
modal_header_text: "Управління списком серверів",
modal_folderhide_text: "Не показувати жодних серверів, які приховуються папками",
btn_ok_text: "Добре",
btn_all_text: "Все",
context_serverhider_text: "Видимість сервера",
submenu_hideserver_text: "Сховати сервер",
submenu_openhidemenu_text: "Управління списком серверів"
};
case "ja": //japanese
return {
modal_header_text: "サーバリストの管理",
modal_folderhide_text: "フォルダに隠されているサーバーは表示しない",
btn_ok_text: "はい",
btn_all_text: "すべて",
context_serverhider_text: "サーバーの可視性",
submenu_hideserver_text: "サーバーを隠す",
submenu_openhidemenu_text: "サーバーリストを管理する"
};
case "zh-TW": //chinese (traditional)
return {
modal_header_text: "管理服务器列表",
modal_folderhide_text: "不顯示被文件夾隱藏的服務器",
btn_ok_text: "好",
btn_all_text: "所有",
context_serverhider_text: "服務器可見性",
submenu_hideserver_text: "隐藏服务器",
submenu_openhidemenu_text: "管理服务器列表"
};
case "ko": //korean
return {
modal_header_text: "서버 목록 관리",
modal_folderhide_text: "폴더별로 숨겨진 서버 표시 안 함",
btn_ok_text: "승인",
btn_all_text: "모든",
context_serverhider_text: "서버 가시성",
submenu_hideserver_text: "서버 숨기기",
submenu_openhidemenu_text: "서버 목록 관리"
};
default: //default: english
return {
modal_header_text: "Managing Serverlist",
modal_folderhide_text: "Show no servers, which are hidden by folders",
btn_ok_text: "OK",
btn_all_text: "All",
context_serverhider_text: "Server Visibility",
submenu_hideserver_text: "Hide Server",
submenu_openhidemenu_text: "Manage Serverlist"
};
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Show Hidden Channels - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ShowHiddenChannels/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ShowHiddenChannels/config.json)
Displays all hidden channels that can't be accessed due to role restrictions in a new category.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "ShowHiddenChannels",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Displays channels that are hidden from you by role restrictions. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,482 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"Channels":["componentDidMount","componentDidUpdate"],
"ChannelItem":"componentDidMount",
"ChannelCategoryItem":"componentDidMount"
};
this.categoryMarkup =
`<div class="container-hidden">
<div class="${BDFDB.disCN.categorycontainerdefault} hidden-channel">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCNS.nowrap + BDFDB.disCNS.categorywrapperdefault + BDFDB.disCN.cursorpointer}" style="flex: 1 1 auto;">
<svg class="${BDFDB.disCNS.categoryicondefault + BDFDB.disCN.categoryicontransition}" width="12" height="12" viewBox="0 0 24 24">
<path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 10L12 15 17 10"></path>
</svg>
<div class="${BDFDB.disCNS.categorynamedefault + BDFDB.disCNS.categorycolortransition + BDFDB.disCN.categoryoverflowellipsis}" style="flex: 1 1 auto;">hidden</div>
</div>
</div>
</div>`;
this.channelTextMarkup =
`<div class="${BDFDB.disCN.channelcontainerdefault} hidden-channel">
<div class="${BDFDB.disCNS.channelwrapperdefaulttext + BDFDB.disCN.channelwrapper}">
<div class="${BDFDB.disCNS.channelcontentdefaulttext + BDFDB.disCN.channelcontent}">
<div class="${BDFDB.disCN.marginreset}" style="flex: 0 0 auto;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" class="${BDFDB.disCNS.channelcolordefaulttext + BDFDB.disCN.channelicon}">
<path class="${BDFDB.disCN.channelbackground}" fill="currentColor" d="M7.92,4.66666667 L6.50666667,4.66666667 L6.98,2 L5.64666667,2 L5.17333333,4.66666667 L2.50666667,4.66666667 L2.27333333,6 L4.94,6 L4.23333333,10 L1.56666667,10 L1.33333333,11.3333333 L4,11.3333333 L3.52666667,14 L4.86,14 L5.33333333,11.3333333 L9.33333333,11.3333333 L8.86,14 L10.1933333,14 L10.6666667,11.3333333 L13.3333333,11.3333333 L13.5666667,10 L12.2333333,10 L8.74333333,10 L5.56666667,10 L6.27333333,6 L7.92,6 L7.92,4.66666667 Z"></path>
<path class="${BDFDB.disCN.channelforeground}" fill="currentColor" fill-rule="nonzero" d="M15.1,3.2 L15.1,2 C15.1,0.88 14.05,0 13,0 C11.95,0 10.9,0.88 10.9,2 L10.9,3.2 C10.45,3.2 10,3.68 10,4.16 L10,6.96 C10,7.52 10.45,8 10.9,8 L15.025,8 C15.55,8 16,7.52 16,7.04 L16,4.24 C16,3.68 15.55,3.2 15.1,3.2 Z M14,3 L12,3 L12,1.92857143 C12,1.35714286 12.4666667,1 13,1 C13.5333333,1 14,1.35714286 14,1.92857143 L14,3 Z"></path>
</svg>
</div>
<div class="${BDFDB.disCNS.channelnamedefaulttext + BDFDB.disCNS.channelname + BDFDB.disCN.channeloverflowellipsis}" style="flex: 1 1 auto;"></div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginreset}" style="flex: 0 1 auto;"></div>
</div>
</div>
</div>`;
this.channelVoiceMarkup =
`<div class="${BDFDB.disCN.channelcontainerdefault} hidden-channel">
<div class="${BDFDB.disCNS.channelwrapperdefaultvoice + BDFDB.disCN.channelwrapper}">
<div class="${BDFDB.disCNS.channelcontentdefaultvoice + BDFDB.disCN.channelcontent}">
<div class="${BDFDB.disCN.marginreset}" style="flex: 0 0 auto;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" class="${BDFDB.disCNS.channelcolordefaultvoice + BDFDB.disCN.channelicon}">
<path class="${BDFDB.disCN.channelbackground}" fill="currentColor" d="M13.6005009,10 C12.8887426,11.8438372 11.2906136,13.2480521 9.33333333,13.6933333 L9.33333333,12.3133333 C10.5512947,11.950895 11.5614504,11.1062412 12.1398042,10 L13.6005009,10 Z M10.7736513,8.99497564 C10.4978663,9.6613459 9.98676114,10.2040442 9.33333333,10.5133333 L9.33333333,8.99497564 L10.7736513,8.99497564 Z M2,5.84666667 L4.66666667,5.84666667 L8,2.51333333 L8,13.18 L4.66666667,9.84666667 L2,9.84666667 L2,5.84666667 Z"></path>
<path class="${BDFDB.disCN.channelforeground}" fill="currentColor" fill-rule="nonzero" d="M15.1,3.2 L15.1,2 C15.1,0.88 14.05,0 13,0 C11.95,0 10.9,0.88 10.9,2 L10.9,3.2 C10.45,3.2 10,3.68 10,4.16 L10,6.96 C10,7.52 10.45,8 10.9,8 L15.025,8 C15.55,8 16,7.52 16,7.04 L16,4.24 C16,3.68 15.55,3.2 15.1,3.2 Z M14,3 L12,3 L12,1.92857143 C12,1.35714286 12.4666667,1 13,1 C13.5333333,1 14,1.35714286 14,1.92857143 L14,3 Z"></path>
</svg>
</div>
<div class="${BDFDB.disCNS.channelnamedefaultvoice + BDFDB.disCNS.channelname + BDFDB.disCN.channeloverflowellipsis}" style="flex: 1 1 auto;"></div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginreset}" style="flex: 0 1 auto;"></div>
</div>
</div>
</div>`;
this.channelCategoryMarkup =
`<div class="${BDFDB.disCN.channelcontainerdefault} hidden-channel">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.cursorpointer + BDFDB.disCNS.categorywrappercollapsed + BDFDB.disCN.channelcontent}" style="flex: 1 1 auto;">
<svg class="${BDFDB.disCNS.categoryicontransition + BDFDB.disCNS.directionright + BDFDB.disCN.categoryiconcollapsed}" width="12" height="12" viewBox="0 0 24 24">
<path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 10L12 15 17 10"></path>
</svg>
<div class="${BDFDB.disCNS.categorycolortransition + BDFDB.disCNS.categoryoverflowellipsis + BDFDB.disCN.categorynamecollapsed}" style="flex: 1 1 auto;"></div>
</div>
</div>`;
this.css = `
.container-hidden .containerDefault-1ZnADq .iconTransition-2pOJ7l {
position: static;
}`;
this.defaults = {
settings: {
showText: {value:true, description:"Show hidden Textchannels:"},
showVoice: {value:true, description:"Show hidden Voicechannels:"},
showCategory: {value:false, description:"Show hidden Categories:"},
showAllowedRoles: {value:true, description:"Show allowed Roles on hover:"},
showAllowedUsers: {value:true, description:"Show specifically allowed Users on hover:"},
showOverWrittenRoles: {value:true, description:"Include overwritten Roles in allowed Roles:"},
showDeniedRoles: {value:true, description:"Show denied Roles on hover:"},
showDeniedUsers: {value:true, description:"Show denied Users on hover:"},
showForNormal: {value:false, description:"Also show Roles/Users for allowed channels:"},
showTopic: {value:false, description:"Show the topic of hidden channels:"}
},
amounts: {
hoverDelay: {value:0, description:"Tooltip delay in millisec:"}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return true;
BDFDB.loadMessage(this);
this.React = BDFDB.WebModules.findByProperties("createElement", "cloneElement");
this.ChannelTypes = BDFDB.WebModules.findByProperties("ChannelTypes").ChannelTypes;
this.UserStore = BDFDB.WebModules.findByProperties("getUsers", "getUser");
this.MemberStore = BDFDB.WebModules.findByProperties("getMember", "getMembers");
this.GuildStore = BDFDB.WebModules.findByProperties("getGuilds", "getGuild");
this.ChannelStore = BDFDB.WebModules.findByProperties("getChannels", "getDMFromUserId");
this.GuildChannels = BDFDB.WebModules.findByProperties("getChannels", "getDefaultChannel");
this.Permissions = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes").Permissions;
BDFDB.WebModules.forceAllUpdates(this, "Channels");
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".container-hidden");
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
processChannels (instance, wrapper, methodnames) {
if (instance.props && instance.props.guild) {
if (methodnames.includes("componentDidMount")) this.appendHiddenContainer(instance.props.guild);
if (methodnames.includes("componentDidUpdate")) this.reappendHiddenContainer(instance.props.guild);
}
}
processChannelItem (instance, wrapper) {
if (instance.props && instance.props.channel) this.reappendHiddenContainer(this.GuildStore.getGuild(instance.props.channel.guild_id));
}
processChannelCategoryItem (instance, wrapper) {
if (instance.props && instance.props.channel) this.reappendHiddenContainer(this.GuildStore.getGuild(instance.props.channel.guild_id));
}
appendHiddenContainer (guild) {
BDFDB.removeEles(".container-hidden");
if (!guild) return;
this.currentGuild = guild.id;
var allChannels = this.ChannelStore.getChannels();
var shownChannels = this.GuildChannels.getChannels(guild.id);
var hiddenChannels = {};
for (let type in this.ChannelTypes) hiddenChannels[this.ChannelTypes[type]] = [];
for (let channel_id in allChannels) {
var channel = allChannels[channel_id];
if (channel.guild_id == guild.id) {
var isHidden = true;
if (channel.type == this.ChannelTypes.GUILD_CATEGORY) {
for (let type in this.ChannelTypes) if (shownChannels[this.ChannelTypes[type]]) for (let shownChannel of shownChannels[this.ChannelTypes[type]]) {
if (!channel.id || shownChannel.channel.parent_id == channel.id) {
isHidden = false;
break;
}
}
}
else {
for (let shownChannel of shownChannels[channel.type]) if (shownChannel.channel.id == channel.id) {
isHidden = false;
break;
}
}
if (isHidden) hiddenChannels[channel.type].push(channel);
}
}
var settings = BDFDB.getAllData(this, "settings");
var count = 0;
for (let type in this.ChannelTypes) {
if (!settings.showText && type == "GUILD_TEXT" || !settings.showVoice && type == "GUILD_VOICE" || !settings.showCategory && type == "GUILD_CATEGORY") {
hiddenChannels[this.ChannelTypes[type]] = [];
}
BDFDB.sortArrayByKey(hiddenChannels[this.ChannelTypes[type]], "name");
count += hiddenChannels[this.ChannelTypes[type]].length;
}
hiddenChannels.count = count;
if (count > 0) {
var category = BDFDB.htmlToElement(this.categoryMarkup);
var wrapper = category.querySelector(BDFDB.dotCN.cursorpointer);
var svg = category.querySelector(BDFDB.dotCN.categoryicontransition);
var name = category.querySelector(BDFDB.dotCN.categorycolortransition);
var inner = category.querySelector(BDFDB.dotCN.categorycontainerdefault + " > " + BDFDB.dotCN.flex);
category.setAttribute("guild", guild.id);
inner.addEventListener("click", () => {
BDFDB.toggleClass(wrapper, BDFDB.disCN.categorywrapperhovered, BDFDB.disCN.categorywrapperhoveredcollapsed);
BDFDB.toggleClass(svg, BDFDB.disCN.categoryiconhovered, BDFDB.disCN.categoryiconhoveredcollapsed, BDFDB.disCN.directionright);
BDFDB.toggleClass(name, BDFDB.disCN.categorynamehovered, BDFDB.disCN.categorynamehoveredcollapsed);
var visible = BDFDB.containsClass(svg, BDFDB.disCN.directionright);
BDFDB.toggleEles(category.querySelectorAll(BDFDB.dotCN.channelcontainerdefault), !visible);
BDFDB.saveData(guild.id, !visible, this, "categorystatus");
});
var togglecontainer = () => {
if (!BDFDB.containsClass(svg, BDFDB.disCN.directionright)) {
BDFDB.toggleClass(wrapper, BDFDB.disCN.categorywrapperdefault, BDFDB.disCN.categorywrapperhovered);
BDFDB.toggleClass(svg, BDFDB.disCN.categoryicondefault, BDFDB.disCN.categoryiconhovered);
BDFDB.toggleClass(name, BDFDB.disCN.categorynamedefault,BDFDB.disCN.categorynamehovered);
}
else {
BDFDB.toggleClass(wrapper, BDFDB.disCN.categorywrappercollapsed, BDFDB.disCN.categorywrapperhoveredcollapsed)
BDFDB.toggleClass(svg, BDFDB.disCN.categoryiconcollapsed, BDFDB.disCN.categoryiconhoveredcollapsed);
BDFDB.toggleClass(name, BDFDB.disCN.categorynamecollapsed, BDFDB.disCN.categorynamehoveredcollapsed)
}
};
inner.addEventListener("mouseenter", togglecontainer);
inner.addEventListener("mouseleave", togglecontainer);
for (let hiddenChannel of hiddenChannels[0]) {
let channel = BDFDB.htmlToElement(this.channelTextMarkup);
let channelwrapper = channel.querySelector(BDFDB.dotCN.channelwrapper);
let channelicon = channel.querySelector(BDFDB.dotCN.channelcontent);
let channelsvg = channel.querySelector(BDFDB.dotCN.channelicon);
let channelname = channel.querySelector(BDFDB.dotCN.channelname);
this.setReactInstanceOfChannel(hiddenChannel, channel);
channelname.innerText = hiddenChannel.name;
BDFDB.addChildEventListener(channel, "mouseenter mouseleave", BDFDB.dotCN.channelwrapper, e => {
BDFDB.toggleClass(channelwrapper, BDFDB.disCN.channelwrapperdefaulttext, BDFDB.disCN.channelwrapperhoveredtext);
BDFDB.toggleClass(channelicon, BDFDB.disCN.channelcontentdefaulttext, BDFDB.disCN.channelcontenthoveredtext);
BDFDB.toggleClass(channelsvg, BDFDB.disCN.channelcolordefaulttext, BDFDB.disCN.channelcolorhoveredtext);
BDFDB.toggleClass(channelname, BDFDB.disCN.channelnamedefaulttext, BDFDB.disCN.channelnamehoveredtext);
this.showAccessRoles(guild, hiddenChannel, e, false);
});
channel.addEventListener("click", () => {
BDFDB.showToast(`You can not enter the hidden textchannel ${hiddenChannel.name}.`, {type:"error"});
});
channel.addEventListener("contextmenu", e => {
this.createHiddenObjContextMenu(guild, hiddenChannel, "TEXT", e);
});
category.appendChild(channel);
}
for (let hiddenChannel of hiddenChannels[2]) {
let channel = BDFDB.htmlToElement(this.channelVoiceMarkup);
let channelwrapper = channel.querySelector(BDFDB.dotCN.channelwrapper);
let channelicon = channel.querySelector(BDFDB.dotCN.channelcontent);
let channelsvg = channel.querySelector(BDFDB.dotCN.channelicon);
let channelname = channel.querySelector(BDFDB.dotCN.channelname);
this.setReactInstanceOfChannel(hiddenChannel, channel);
channelname.innerText = hiddenChannel.name;
BDFDB.addChildEventListener(channel, "mouseenter mouseleave", BDFDB.dotCN.channelwrapper, e => {
BDFDB.toggleClass(channelwrapper, BDFDB.disCN.channelwrapperdefaultvoice, BDFDB.disCN.channelwrapperhoveredvoice);
BDFDB.toggleClass(channelicon, BDFDB.disCN.channelcontentdefaultvoice, BDFDB.disCN.channelcontenthoveredvoice);
BDFDB.toggleClass(channelsvg, BDFDB.disCN.channelcolordefaultvoice, BDFDB.disCN.channelcolorhoveredvoice);
BDFDB.toggleClass(channelname, BDFDB.disCN.channelnamedefaultvoice, BDFDB.disCN.channelnamehoveredvoice);
this.showAccessRoles(guild, hiddenChannel, e, false);
});
channel.addEventListener("click", () => {
BDFDB.showToast(`You can not enter the hidden voicechannel ${hiddenChannel.name}.`, {type:"error"});
});
channel.addEventListener("contextmenu", e => {
this.createHiddenObjContextMenu(guild, hiddenChannel, "VOICE", e);
});
category.appendChild(channel);
}
for (let hiddenChannel of hiddenChannels[4]) {
let channel = BDFDB.htmlToElement(this.channelCategoryMarkup);
let channelwrapper = channel.querySelector(BDFDB.dotCN.categorywrappercollapsed);
let channelsvg = channel.querySelector(BDFDB.dotCN.categoryiconcollapsed);
let channelname = channel.querySelector(BDFDB.dotCN.categorynamecollapsed);
this.setReactInstanceOfChannel(hiddenChannel, channel);
channelname.innerText = hiddenChannel.name;
BDFDB.addChildEventListener(channel, "mouseenter mouseleave", BDFDB.dotCN.flex, e => {
BDFDB.toggleClass(channelwrapper, BDFDB.disCN.categorywrappercollapsed, BDFDB.disCN.categorywrapperhoveredcollapsed);
BDFDB.toggleClass(channelsvg, BDFDB.disCN.categoryiconcollapsed, BDFDB.disCN.categoryiconhoveredcollapsed);
BDFDB.toggleClass(channelname, BDFDB.disCN.categorynamecollapsed, BDFDB.disCN.categorynamehoveredcollapsed);
this.showAccessRoles(guild, hiddenChannel, e, false);
});
channel.addEventListener("click", () => {
BDFDB.showToast(`You can not open the hidden category ${hiddenChannel.name}.`, {type:"error"});
});
channel.addEventListener("contextmenu", e => {
this.createHiddenObjContextMenu(guild, hiddenChannel, "CATEGORY", e);
});
category.appendChild(channel);
}
if (BDFDB.loadData(guild.id, this, "categorystatus") === false) {
BDFDB.toggleClass(wrapper, BDFDB.disCN.categorywrapperdefault, BDFDB.disCN.categorywrappercollapsed);
BDFDB.toggleClass(svg, BDFDB.disCN.categoryicondefault, BDFDB.disCN.categoryiconcollapsed, BDFDB.disCN.directionright);
BDFDB.toggleClass(name, BDFDB.disCN.categorynamedefault, BDFDB.disCN.categorynamecollapsed);
BDFDB.toggleEles(category.querySelectorAll(BDFDB.dotCN.channelcontainerdefault), false);
}
this.reappendHiddenContainer(guild, category);
}
let channellist = document.querySelector(BDFDB.dotCNS.channels + BDFDB.dotCN.scroller);
if (channellist) {
BDFDB.removeEventListener(this, channellist, "mouseenter", BDFDB.dotCNC.channelcontainerdefault + BDFDB.dotCN.categorycontainerdefault);
if (settings.showForNormal) BDFDB.addEventListener(this, channellist, "mouseenter", BDFDB.dotCNC.channelcontainerdefault + BDFDB.dotCN.categorycontainerdefault, e => {
if (!BDFDB.containsClass(e.currentTarget, "hidden-channel")) {
var channel = BDFDB.getKeyInformation({"node":e.currentTarget,"key":"channel"});
if (channel) this.showAccessRoles(guild, channel, e, false);
}
});
}
}
reappendHiddenContainer (guild, category = document.querySelector(BDFDB.dotCNS.channels + BDFDB.dotCNS.scroller + ".container-hidden")) {
if (!guild) return;
if (guild.id != this.currentGuild) this.appendHiddenContainer(guild);
else if (category) {
var scroller = document.querySelector(BDFDB.dotCNS.channels + BDFDB.dotCN.scroller);
if (!scroller || scroller.lastChild.previousSibling == category) return;
category.remove();
let count = parseInt(scroller.lastChild.previousSibling.className.split("-")[1])+1;
category.className = "container-" + count + " container-hidden";
scroller.insertBefore(category, scroller.lastChild);
}
}
setReactInstanceOfChannel (guild, div) {
var reactInstance = BDFDB.React.createElement(div);
reactInstance.memoizedProps = {channel:guild};
div.__reactInternalInstance = reactInstance;
}
createHiddenObjContextMenu (guild, channel, type, e) {
e.preventDefault();
e.stopPropagation();
var contextMenu = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.contextmenu} showhiddenchannels-contextmenu">${BDFDB.isPluginEnabled("PermissionsViewer") ? '<div class="' + BDFDB.disCN.contextmenuitemgroup + '"><div class="' + BDFDB.disCN.contextmenuitem + '" style="display: none !important;"></div></div>' : ''}<div class="${BDFDB.disCN.contextmenuitemgroup}"><div class="${BDFDB.disCN.contextmenuitem} copyid-item"><span>${BDFDB.LanguageStrings.COPY_ID}</span><div class="${BDFDB.disCN.contextmenuhint}"></div></div></div></div>`);
var reactInstance = BDFDB.React.createElement(contextMenu);
reactInstance.memoizedProps = {displayName:"ChannelDeleteGroup",guild,channel};
reactInstance.return = {memoizedProps:{type:("CHANNEL_LIST_" + type),guild,channel}};
contextMenu.__reactInternalInstance = reactInstance;
BDFDB.addChildEventListener(contextMenu, "click", ".copyid-item", e2 => {
contextMenu.remove();
require("electron").clipboard.write({text: channel.id});
});
BDFDB.appendContextMenu(contextMenu, e);
}
showAccessRoles (guild, channel, e, allowed) {
if ((e.type != "mouseenter" && e.type != "mouseover") || !guild || !channel) return;
var settings = BDFDB.getAllData(this, "settings");
var myMember = this.MemberStore.getMember(guild.id, BDFDB.myData.id);
var allowedRoles = [], allowedUsers = [], overwrittenRoles = [], deniedRoles = [], deniedUsers = [];
var everyoneDenied = false;
for (let id in channel.permissionOverwrites) {
if (settings.showAllowedRoles &&
channel.permissionOverwrites[id].type == "role" &&
(guild.roles[id].name != "@everyone") &&
(channel.permissionOverwrites[id].allow | this.Permissions.VIEW_CHANNEL) == channel.permissionOverwrites[id].allow) {
if (myMember.roles.includes(id) && !allowed) {
if (settings.showOverWrittenRoles) overwrittenRoles.push(guild.roles[id]);
}
else {
allowedRoles.push(guild.roles[id]);
}
}
else if (settings.showAllowedUsers &&
channel.permissionOverwrites[id].type == "member" &&
(channel.permissionOverwrites[id].allow | this.Permissions.VIEW_CHANNEL) == channel.permissionOverwrites[id].allow) {
let user = this.UserStore.getUser(id);
let member = this.MemberStore.getMember(guild.id,id);
if (user && member) allowedUsers.push(Object.assign({name:user.username},member));
}
if (settings.showDeniedRoles &&
channel.permissionOverwrites[id].type == "role" &&
(channel.permissionOverwrites[id].deny | this.Permissions.VIEW_CHANNEL) == channel.permissionOverwrites[id].deny) {
deniedRoles.push(guild.roles[id]);
if (guild.roles[id].name == "@everyone") everyoneDenied = true;
}
else if (settings.showDeniedUsers &&
channel.permissionOverwrites[id].type == "member" &&
(channel.permissionOverwrites[id].deny | this.Permissions.VIEW_CHANNEL) == channel.permissionOverwrites[id].deny) {
let user = this.UserStore.getUser(id);
let member = this.MemberStore.getMember(guild.id,id);
if (user && member) deniedUsers.push(Object.assign({name:user.username},member));
}
}
if (settings.showAllowedRoles && allowed && !everyoneDenied) {
allowedRoles.push({"name":"@everyone"});
}
var htmlString = ``;
if (settings.showTopic && !allowed && channel.topic && channel.topic.replace(/[\t\n\r\s]/g, "")) {
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Topic:</div><div class="${BDFDB.disCNS.flex + BDFDB.disCN.wrap}"><div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex + BDFDB.disCNS.aligncenter + BDFDB.disCN.wrap + BDFDB.disCNS.size12 + BDFDB.disCN.weightmedium} SHC-topic" style="border-color: rgba(255, 255, 255, 0.6); height: unset !important; padding-top: 5px; padding-bottom: 5px; max-width: ${window.outerWidth/3}px">${BDFDB.encodeToHTML(channel.topic)}</div></div>`;
}
if (allowedRoles.length > 0 || overwrittenRoles.length > 0) {
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Allowed Roles:</div><div class="${BDFDB.disCNS.flex + BDFDB.disCN.wrap}">`;
for (let role of allowedRoles) {
let color = role.colorString ? BDFDB.colorCONVERT(role.colorString, "RGBCOMP") : [255,255,255];
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex + BDFDB.disCNS.aligncenter + BDFDB.disCN.wrap + BDFDB.disCNS.size12 + BDFDB.disCN.weightmedium} SHC-allowedrole" style="border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCNS.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.encodeToHTML(role.name)}</div></div>`;
}
for (let role of overwrittenRoles) {
let color = role.colorString ? BDFDB.colorCONVERT(role.colorString, "RGBCOMP") : [255,255,255];
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex + BDFDB.disCNS.aligncenter + BDFDB.disCN.wrap + BDFDB.disCNS.size12 + BDFDB.disCN.weightmedium} SHC-overwrittenrole" style="border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCNS.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}" style="text-decoration: line-through !important;">${BDFDB.encodeToHTML(role.name)}</div></div>`;
}
htmlString += `</div>`;
}
if (allowedUsers.length > 0) {
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Allowed Users:</div><div class="${BDFDB.disCNS.flex + BDFDB.disCN.wrap}">`;
for (let user of allowedUsers) {
let color = user.colorString ? BDFDB.colorCONVERT(user.colorString, "RGBCOMP") : [255,255,255];
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex + BDFDB.disCNS.aligncenter + BDFDB.disCN.wrap + BDFDB.disCNS.size12 + BDFDB.disCN.weightmedium} SHC-denieduser" style="border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCNS.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.encodeToHTML(user.nick ? user.nick : user.name)}</div></div>`;
}
htmlString += `</div>`;
}
if (deniedRoles.length > 0) {
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Denied Roles:</div><div class="${BDFDB.disCNS.flex + BDFDB.disCN.wrap}">`;
for (let role of deniedRoles) {
let color = role.colorString ? BDFDB.colorCONVERT(role.colorString, "RGBCOMP") : [255,255,255];
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex + BDFDB.disCNS.aligncenter + BDFDB.disCN.wrap + BDFDB.disCNS.size12 + BDFDB.disCN.weightmedium} SHC-deniedrole" style="border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCNS.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.encodeToHTML(role.name)}</div></div>`;
}
htmlString += `</div>`;
}
if (deniedUsers.length > 0) {
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Denied Users:</div><div class="${BDFDB.disCNS.flex + BDFDB.disCN.wrap}">`;
for (let user of deniedUsers) {
let color = user.colorString ? BDFDB.colorCONVERT(user.colorString, "RGBCOMP") : [255,255,255];
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex + BDFDB.disCNS.aligncenter + BDFDB.disCN.wrap + BDFDB.disCNS.size12 + BDFDB.disCN.weightmedium} SHC-denieduser" style="border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCNS.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.encodeToHTML(user.nick ? user.nick : user.name)}</div></div>`;
}
htmlString += `</div>`;
}
if (htmlString) {
var width = window.outerWidth/2;
var tooltip = BDFDB.createTooltip(htmlString, e.currentTarget, {type:"right", selector:"showhiddenchannels-tooltip", html:true, style:`max-width: ${width < 200 ? 400 : width}px !important;`, delay:BDFDB.getData("hoverDelay", this, "amounts")});
var style = getComputedStyle(e.currentTarget);
tooltip.style.setProperty("top", BDFDB.getRects(tooltip).top - style.paddingBottom.replace("px","")/2 + style.paddingTop.replace("px","")/2 + "px");
}
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var amounts = BDFDB.getAllData(this, "amounts");
var settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
for (let key in amounts) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCN.flexchild}" style="flex: 0 0 50%;">${this.defaults.amounts[key].description}</h3><div class="${BDFDB.disCN.inputwrapper} inputNumberWrapper ${BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn}" style="flex: 1 1 auto;"><span class="numberinput-buttons-zone"><span class="numberinput-button-up"></span><span class="numberinput-button-down"></span></span><input type="number" min="0" option="${key}" value="${amounts[key]}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} amountInput"></div></div>`;
}
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "input", ".amountInput", e => {
var input = parseInt(e.currentTarget.value);
if (!isNaN(input) && input > -1) BDFDB.saveData(e.currentTarget.getAttribute("option"), input, this, "amounts");
});
return settingspanel;
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
BDFDB.WebModules.forceAllUpdates(this, "Channels");
}
}
}
};

View File

@ -1,5 +0,0 @@
# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
## Show Image Details - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ShowImageDetails/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ShowImageDetails/config.json)
Display the name, size and dimensions of uploaded images (does not include embed images) in the chat as an header or as a tooltip.

View File

@ -1,15 +0,0 @@
{
"info": {
"name": "ShowImageDetails",
"authors": [
{
"name": "DevilBro",
"url": "https://www.paypal.me/MircoWittrien",
"discord_id": "278543574059057154",
"github_username": "mwittrien"
}
],
"version": 1.0,
"description": "Display the name, size and dimensions of uploaded images (does not include embed images) in the chat as an header or as a tooltip. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
}
}

View File

@ -1,142 +0,0 @@
module.exports = (Plugin, Api, Vendor) => {
if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
return class extends Plugin {
initConstructor () {
this.patchModules = {
"LazyImageZoomable":"componentDidMount"
};
this.css = `
.image-details .image-details-size {
margin: 0 10px;
}
.image-details-tooltip {
max-width: 500px;
}
.image-details-tooltip .image-details-tooltip-size {
margin: 10px 0;
}
`;
this.defaults = {
settings: {
showOnHover: {value:false, description:"Show the details as Tooltip instead:"}
},
amounts: {
hoverDelay: {value:0, description:"Tooltip delay in millisec:"}
}
};
}
onStart () {
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return return;
BDFDB.loadMessage(this);
BDFDB.WebModules.forceAllUpdates(this);
return true;
}
else {
console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
return false;
}
}
onStop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
document.querySelectorAll(".image-details-added").forEach(image => {this.resetImage(image);});
BDFDB.unloadMessage(this);
return true;
}
else {
return false;
}
}
// begin of own functions
resetImage (image) {
BDFDB.removeClass(image, "image-details-added");
image.removeEventListener("mouseenter", image.mouseenterShowImageDetails);
let wrapper = image.parentElement;
if (BDFDB.containsClass(wrapper, "image-details-wrapper")) {
wrapper.parentElement.insertBefore(image, wrapper);
wrapper.remove();
}
}
processLazyImageZoomable (instance, image) {
let attachment = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.memoizedProps.attachment");
if (attachment && !attachment.filename.endsWith(".bdemote.png") && !attachment.filename.endsWith(".bdemote.gif")) {
BDFDB.addClass(image, "image-details-added");
image.removeEventListener("mouseenter", image.mouseenterShowImageDetails);
if (BDFDB.getData("showOnHover", this, "settings")) {
image.mouseenterShowImageDetails = () => {
BDFDB.createTooltip(`<div class="image-details-tooltip-name">${attachment.filename}</div><div class="image-details-tooltip-size">${BDFDB.formatBytes(attachment.size)}</div><div class="image-details-tooltip-dimensions">${attachment.width}x${attachment.height}px</div>`, image, {type:"right", html:true, selector:"image-details-tooltip", delay:BDFDB.getData("hoverDelay", this, "amounts")});
};
image.addEventListener("mouseenter", image.mouseenterShowImageDetails);
}
else {
let imagedetailswrapper = BDFDB.htmlToElement(`<div class="image-details-wrapper"><div class="image-details"><a class="${BDFDB.disCNS.anchor + BDFDB.disCN.anchorunderlineonhover} image-details-link" title="${attachment.url}" href="${attachment.url}" target="_blank" rel="noreferrer noopener">${attachment.filename}</a><label class="image-details-size ${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">${BDFDB.formatBytes(attachment.size)}</label><label class="image-details-dimensions ${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">${attachment.width}x${attachment.height}px</label></div></div>`);
image.parentElement.insertBefore(imagedetailswrapper, image);
imagedetailswrapper.appendChild(image);
let scroller = BDFDB.getParentEle(BDFDB.dotCN.messages, image);
if (scroller) scroller.scrollTop += BDFDB.getRects(imagedetailswrapper).height - BDFDB.getRects(image).height;
}
}
}
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let amounts = BDFDB.getAllData(this, "amounts");
let settingshtml = `<div class="${this.name}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="DevilBro-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
}
for (let key in amounts) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCN.flexchild}" style="flex: 0 0 50%;">${this.defaults.amounts[key].description}</h3><div class="${BDFDB.disCN.inputwrapper} inputNumberWrapper ${BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn}" style="flex: 1 1 auto;"><span class="numberinput-buttons-zone"><span class="numberinput-button-up"></span><span class="numberinput-button-down"></span></span><input type="number" min="0" option="${key}" value="${amounts[key]}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} amountInput"></div></div>`;
}
settingshtml += `</div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this);
BDFDB.addEventListener(this, settingspanel, "input", ".amountInput", e => {
let input = parseInt(e.currentTarget.value);
if (!isNaN(input) && input > -1) BDFDB.saveData(e.currentTarget.getAttribute("option"), input, this, "amounts");
});
return settingspanel;
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
document.querySelectorAll(".image-details-added").forEach(image => {this.resetImage(image);});
BDFDB.WebModules.forceAllUpdates(this);
}
}
}
};

Some files were not shown because too many files have changed in this diff Show More