all stuff

This commit is contained in:
Mirco Wittrien 2019-09-04 12:34:02 +02:00
parent 3c55796f6a
commit 97bf34de7d
54 changed files with 541 additions and 519 deletions

File diff suppressed because one or more lines are too long

View File

@ -9,18 +9,20 @@ class BadgesEverywhere {
getDescription () {return "Displays Badges (Nitro, HypeSquad, etc...) in the chat/memberlist/userpopout. Thanks for Zerebos' help.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["DM Groups","Now works properly in DM Groups"]]
};
this.patchModules = {
"MemberListItem":"componentDidMount",
"MessageUsername":"componentDidMount",
"UserPopout":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.css = `
${BDFDB.dotCN.userpopoutcustomstatus}:not(:last-child) {
margin-top: 4px;
@ -70,12 +72,12 @@ class BadgesEverywhere {
.BE-badge:not(.BE-badge-chat):not(.BE-badge-list).BE-size-21 {width:21px !important; min-width:21px !important;}
.BE-badge:not(.BE-badge-chat):not(.BE-badge-list).BE-size-22 {width:22px !important; min-width:22px !important;}
.BE-badge:not(.BE-badge-chat):not(.BE-badge-list).BE-size-24 {width:24px !important; min-width:24px !important;}
.BE-badge.BE-badge-CurrentGuildBoost {height:14px !important; width:14px !important; min-width:14px !important;}
.BE-badge.BE-badge-settings {width:30px !important;min-width:30px !important;}
${BDFDB.dotCNS.member + BDFDB.dotCN.memberpremiumicon}:not(.BE-badge-CurrentGuildBoost-inner) {display: none;}`;
${BDFDB.dotCNS.member + BDFDB.dotCN.memberpremiumicon}:not(.BE-badge-CurrentGuildBoost-inner) {display: none;}`;
this.requestedusers = {};
@ -107,7 +109,7 @@ class BadgesEverywhere {
"CURRENT_GUILD_BOOST": {value:true, name:"Current Nitro Guild Boost", markup:`<div class="BE-badge BE-badge-CurrentGuildBoost"><svg aria-label="Nitro boosting since May 31, 2019" name="PremiumGuildSubscriberBadge" class="BE-badge-CurrentGuildBoost-inner ${BDFDB.disCNS.memberpremiumicon + BDFDB.disCN.membericon}" aria-hidden="false" width="24" height="24" viewBox="0 0 8 12" style="margin: 0;"><path d="M4 0L0 4V8L4 12L8 8V4L4 0ZM7 7.59L4 10.59L1 7.59V4.41L4 1.41L7 4.41V7.59Z" fill="currentColor"></path><path d="M2 4.83V7.17L4 9.17L6 7.17V4.83L4 2.83L2 4.83Z" fill="currentColor"></path></svg></div>`},
}
};
var UserFlags = BDFDB.WebModules.findByProperties("UserFlags").UserFlags;
for (let flagname in UserFlags) if (this.defaults.badges[flagname]) {
if (BDFDB.LanguageStringsCheck[this.defaults.badges[flagname].name]) this.defaults.badges[flagname].name = BDFDB.LanguageStrings[this.defaults.badges[flagname].name];
@ -149,7 +151,7 @@ class BadgesEverywhere {
settingshtml += `</div></div></div>`;
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.addClass(settingspanel.querySelectorAll(".BE-badge"), "BE-badge-settings");
BDFDB.initElements(settingspanel, this);
@ -232,7 +234,7 @@ class BadgesEverywhere {
if (username && BDFDB.getData("showInChat", this, "settings")) this.addBadges(message.author, wrapper, "chat");
}
}
processUserPopout (instance, wrapper) {
if (instance.props && BDFDB.getData("showInPopout", this, "settings")) this.addBadges(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), "popout");
}

View File

@ -9,16 +9,18 @@ class BetterFriendCount {
getDescription () {return "Shows the amount of total and online friends and blocked users in the friends tab.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["New Structure","Fixed issues that will occur once the avatar/name changes from canary will hit stable/ptb"]]
};
this.patchModules = {
"TabBar":"componentDidMount",
"FriendRow":["componentWillMount","componentWillUnmount"]
};
}
initConstructor () {
this.css = `
${BDFDB.dotCNS.friends + BDFDB.dotCNS.settingstabbar + BDFDB.dotCN.settingstabbarbadge}:not(.betterfriendcount-badge) {
display: none !important;
@ -126,7 +128,7 @@ class BetterFriendCount {
break;
}
}
createBadge (amount, type) {
return BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.settingstabbarbadge + BDFDB.disCN.guildbadgenumberbadge} betterfriendcount-badge ${type}" style="background-color: rgb(240, 71, 71); width: ${amount > 99 ? 30 : (amount > 9 ? 22 : 16)}px; padding-right: ${amount > 99 ? 0 : (amount > 9 ? 0 : 1)}px;">${amount}</div>`)
}

View File

@ -9,7 +9,7 @@ class BetterNsfwTag {
getDescription () {return "Adds a more noticeable tag to NSFW channels.";}
initConstructor () {
constructor () {
this.patchModules = {
"ChannelItem":"componentDidMount"
};

View File

@ -9,16 +9,18 @@ class BetterSearchPage {
getDescription () {return "Adds some extra controls to the search results page.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Canary/PTB","Fixed the plugin for canary and ptb"]]
};
this.patchModules = {
"SearchResults":["componentDidMount","componentDidUpdate"],
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.css = `
.BSP-pagination-button {
background: url('data:image/svg+xml; base64, PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMCIgaGVpZ2h0PSIyNSI+PGcgZmlsbD0iIzczN2Y4ZCIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgZD0iTTE3LjMzOCAxMi40ODVjLTQuMTU2IDQuMTU2LTguMzEyIDguMzEyLTEyLjQ2OCAxMi40NjctMS40MDItMS40MDItMi44MDUtMi44MDQtNC4yMDctNC4yMDYgMi43NTYtMi43NTcgNS41MTMtNS41MTQgOC4yNy04LjI3QzYuMTc2IDkuNzIgMy40MTkgNi45NjMuNjYzIDQuMjA3TDQuODcgMGMtLjA1OC0uMDU5IDEyLjU1NSAxMi41NjIgMTIuNDY4IDEyLjQ4NXoiLz48cGF0aCB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGQ9Ik0xNy4zMzggMTIuNDg1Yy00LjE1NiA0LjE1Ni04LjMxMiA4LjMxMi0xMi40NjggMTIuNDY3LTEuNDAyLTEuNDAyLTIuODA1LTIuODA0LTQuMjA3LTQuMjA2IDIuNzU2LTIuNzU3IDUuNTEzLTUuNTE0IDguMjctOC4yN0M2LjE3NiA5LjcyIDMuNDE5IDYuOTYzLjY2MyA0LjIwN0w0Ljg3IDBjLS4wNTgtLjA1OSAxMi41NTUgMTIuNTYyIDEyLjQ2OCAxMi40ODV6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiAwKSIvPjwvZz48L3N2Zz4=') 50%/9px 12px no-repeat;
@ -67,7 +69,7 @@ class BetterSearchPage {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-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>`;
@ -118,7 +120,7 @@ class BetterSearchPage {
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.loadMessage(this);
BDFDB.loadMessage(this);
this.SearchNavigation = BDFDB.WebModules.findByProperties("searchNextPage","searchPreviousPage");

View File

@ -9,17 +9,19 @@ class CharCounter {
getDescription () {return "Adds a charcounter in the chat.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Nickname Modal","Fixed for the nickname modal"]]
};
this.patchModules = {
"ChannelTextArea":"componentDidMount",
"Note":"componentDidMount",
"ChangeNickname":"componentDidMount"
};
}
initConstructor () {
this.maxLenghts = {
normal: 2000,
edit: 2000,
@ -31,7 +33,7 @@ class CharCounter {
this.css = `
${BDFDB.dotCN.themelight} #charcounter {
color: #747f8d;
color: #747f8d;
opacity: .7;
}
${BDFDB.dotCN.themedark} #charcounter {
@ -47,7 +49,7 @@ class CharCounter {
#charcounter {
display: block;
position: absolute;
z-index: 1000;
z-index: 1000;
pointer-events: none;
font-size: 15px;
}

View File

@ -9,16 +9,18 @@ class ChatAliases {
getDescription () {return "Allows the user to configure their own chat-aliases which will automatically be replaced before the message is being sent.";}
initConstructor () {
constructor () {
this.changelog = {
"improved":[["Min Length","Plugin now allows you to set a minimum character length required for the Autocomplete-Menu to show up to avoid the Autocomplete-Menu from opening on words like 'i' and 'a' in case an aliases starts with these letters, which could have prevented you from sending the message via enter before"]]
};
this.patchModules = {
"ChannelTextArea":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.defaults = {
configs: {
case: {value:false, description:"Handle the wordvalue case sensitive"},
@ -199,7 +201,7 @@ class ChatAliases {
stop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
BDFDB.unloadMessage(this);
}
}
@ -249,7 +251,7 @@ class ChatAliases {
});
}
}
saveWord (wordvalue, replacevalue, fileselection, configs = BDFDB.getAllData(this, "configs")) {
if (!wordvalue || !replacevalue || !fileselection) return;
var filedata = null;
@ -369,7 +371,7 @@ class ChatAliases {
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
if (BDFDB.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteAliasesRow")) {
BDFDB.stopEvent(e);
this.swapWordWithAlias(textarea);
this.swapWordWithAlias(textarea);
}
}
else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
@ -468,7 +470,7 @@ class ChatAliases {
}
else {
let items = menu.querySelectorAll(BDFDB.dotCN.autocompleteselectable);
next = forward ? items[0] : items[items.length-1];
next = forward ? items[0] : items[items.length-1];
}
return next ? next : this.getNextSelection(menu, sibling, forward);
}
@ -478,7 +480,7 @@ class ChatAliases {
let lastword = textarea.parentElement.querySelector(".autocompleteAliasesRow .lastword").innerText;
if (aliasword && lastword) {
BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
textarea.focus();
textarea.focus();
textarea.selectionStart = textarea.value.length - lastword.length;
textarea.selectionEnd = textarea.value.length;
document.execCommand("insertText", false, aliasword);
@ -532,17 +534,17 @@ class ChatAliases {
}
return string;
}
openAddModal (wordvalue) {
let chataliasesAddModal = BDFDB.htmlToElement(this.chataliasesAddModalMarkup);
let wordvalueinput = chataliasesAddModal.querySelector("#input-wordvalue");
let replacevalueinput = chataliasesAddModal.querySelector("#input-replacevalue");
let addbutton = chataliasesAddModal.querySelector(".btn-add");
wordvalueinput.value = wordvalue || "";
BDFDB.appendModal(chataliasesAddModal);
let checkInputs = () => {
let validinputs = [wordvalueinput, replacevalueinput];
let invalidinputs = [];
@ -574,7 +576,7 @@ class ChatAliases {
};
wordvalueinput.addEventListener("input", checkInputs);
replacevalueinput.addEventListener("input", checkInputs);
BDFDB.addChildEventListener(chataliasesAddModal, "click", BDFDB.dotCNC.backdrop + BDFDB.dotCNC.modalclose + ".btn-add", () => {
BDFDB.removeEles(".chataliases-disabled-tooltip");
});
@ -589,7 +591,7 @@ class ChatAliases {
BDFDB.saveAllData(this.aliases, this, "words");
});
wordvalueinput.focus();
setTimeout(checkInputs, 500);
}
}

View File

@ -9,16 +9,18 @@ class ChatFilter {
getDescription () {return "Allows the user to censor words or block complete messages based on words in the chatwindow.";}
initConstructor () {
constructor () {
this.changelog = {
"added":[["ContextMenu","Added an contextmenu entry when right clicking a highlighted/selected word to allow you to faster add new aliases"]]
};
this.patchModules = {
"Message":["componentDidMount","componentDidUpdate"],
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.css = `
${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messageaccessory}.blocked:not(.revealed),
${BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messagemarkup}.blocked:not(.revealed) {
@ -261,7 +263,7 @@ class ChatFilter {
});
}
}
saveWord (wordvalue, replacevalue, rtype, configs = BDFDB.getAllData(this, "configs")) {
if (!wordvalue || !replacevalue) return;
wordvalue = wordvalue.trim();
@ -350,7 +352,7 @@ class ChatFilter {
if (chara == "<") {
if (strings[count]) count++;
}
strings[count] = strings[count] ? strings[count] + chara : chara;
strings[count] = strings[count] ? strings[count] + chara : chara;
if (chara == ">") {
count++;
}
@ -478,17 +480,17 @@ class ChatFilter {
message.addEventListener("click", message.clickChatFilterListener);
}
}
openAddModal (wordvalue) {
let chatfilterAddModal = BDFDB.htmlToElement(this.chatfilterAddModalMarkup);
let wordvalueinput = chatfilterAddModal.querySelector("#input-wordvalue");
let replacevalueinput = chatfilterAddModal.querySelector("#input-replacevalue");
let addbutton = chatfilterAddModal.querySelector(".btn-add");
wordvalueinput.value = wordvalue || "";
BDFDB.appendModal(chatfilterAddModal);
wordvalueinput.addEventListener("input", () => {
if (!wordvalueinput.value.trim()) {
addbutton.disabled = true;
@ -503,7 +505,7 @@ class ChatFilter {
BDFDB.removeEles(".chatfilter-disabled-tooltip");
}
});
BDFDB.addChildEventListener(chatfilterAddModal, "click", BDFDB.dotCNC.backdrop + BDFDB.dotCNC.modalclose + ".btn-add", () => {
BDFDB.removeEles(".chatfilter-disabled-tooltip");
});

View File

@ -9,19 +9,19 @@ class CompleteTimestamps {
getDescription () {return "Replace all timestamps with complete timestamps.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["New Select Classes","The Dropdown-Select element got new classes on canary, this update will prevent stable from breaking once the class change is pushed to stable"]]
};
this.patchModules = {
"MessageGroup":["componentDidMount","componentDidUpdate"],
"Embed":["componentDidMount","componentDidUpdate"],
"StandardSidebarView":"componentWillUnmount"
};
}
this.languages;
initConstructor () {
this.defaults = {
settings: {
showInChat: {value:true, description:"Replace Chat Timestamp with Complete Timestamp:"},
@ -185,7 +185,7 @@ class CompleteTimestamps {
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(".languageName").innerText = this.languages[choice].name;
@ -193,7 +193,7 @@ class CompleteTimestamps {
BDFDB.saveData(type, choice, this, "choices");
}
}
createSelectChoice (choice) {
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
}

View File

@ -9,7 +9,7 @@ class CopyRawMessage {
getDescription () {return "Adds a entry in the contextmenu when you right click a message that allows you to copy the raw contents of a message.";}
initConstructor () {
constructor () {
this.changelog = {
"added":[["Message 3-dot entry","Added the copy entry to the message 3-dot menu"]]
};
@ -18,7 +18,9 @@ class CopyRawMessage {
"Message":"componentDidMount",
"MessageOptionPopout":"componentDidMount"
};
}
initConstructor () {
this.messageCopyRawEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} copyrawmessage-item">
@ -84,9 +86,9 @@ class CopyRawMessage {
}
}
// begin of own functions
onMessageContextMenu (instance, menu) {
if (instance.props && instance.props.message && instance.props.message.content && instance.props.target && !menu.querySelector(".copyrawmessage-item")) {
let messageCopyRawEntry = BDFDB.htmlToElement(this.messageCopyRawEntryMarkup);

View File

@ -9,20 +9,20 @@ class CreationDate {
getDescription () {return "Displays the Creation Date of an Account in the UserPopout and UserModal.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Showing at top","Fixed issue where dates would be listed at the top in the profile the first time a profile was opened or when a custom status is set"]]
};
this.labels = {};
this.patchModules = {
"UserPopout":"componentDidMount",
"UserProfile":"componentDidMount"
};
}
this.languages;
initConstructor () {
this.css = `
${BDFDB.dotCNS.userpopout + BDFDB.dotCN.nametag} {
margin-bottom: 4px;
@ -31,14 +31,14 @@ class CreationDate {
margin-right: 20px;
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.userpopoutheadernormal} .creationDate {
color: #b9bbbe;
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);
color: hsla(216,4%,74%,.6);
}
${BDFDB.dotCN.themelight} [class*='topSection']${BDFDB.notCN.userprofiletopsectionnormal} .creationDate,
${BDFDB.dotCN.themedark} [class*='topSection'] .creationDate {
@ -138,7 +138,7 @@ class CreationDate {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.loadMessage(this);
this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}},BDFDB.languages);
BDFDB.WebModules.forceAllUpdates(this);
@ -180,7 +180,7 @@ class CreationDate {
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(".languageName").innerText = this.languages[choice].name;
@ -188,7 +188,7 @@ class CreationDate {
BDFDB.saveData(type, choice, this, "choices");
}
}
createSelectChoice (choice) {
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
}

View File

@ -9,16 +9,18 @@ class DisplayServersAsChannels {
getDescription () {return "Display servers in a similar way as channels.";}
initConstructor () {
constructor () {
this.changelog = {
"added":[["Width settings","Added the option to change the width of the changed server list"]]
};
this.patchModules = {
"Guilds":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
};
}
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">
@ -91,13 +93,13 @@ class DisplayServersAsChannels {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.loadMessage(this);
BDFDB.addClass(document.body, "DSAC-styled");
this.addCSS();
BDFDB.WebModules.forceAllUpdates(this);
BDFDB.addEventListener(this, document, "mouseenter", BDFDB.dotCN.guildouter, e => {
if (e.currentTarget.querySelector(BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill + "+ *")) BDFDB.appendLocalStyle("HideAllToolTips" + this.name, `${BDFDB.dotCN.tooltip} {display: none !important;}`);
});
@ -114,11 +116,11 @@ class DisplayServersAsChannels {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeClasses("DSAC-styled");
BDFDB.removeEles(".DSAC-verification-badge, .DSAC-name, .DSAC-icon");
BDFDB.removeLocalStyle("HideAllToolTips" + this.name);
BDFDB.removeLocalStyle("DSACStyle" + this.name);
for (let changedSVG of document.querySelectorAll(BDFDB.dotCN.guildsvg + "[DSAC-oldViewBox")) {
changedSVG.setAttribute("viewBox", changedSVG.getAttribute("DSAC-oldViewBox"));
changedSVG.removeAttribute("DSAC-oldViewBox");
@ -130,7 +132,7 @@ class DisplayServersAsChannels {
// begin of own functions
processGuilds (instance, wrapper) {
var observer = new MutationObserver((changes, _) => {changes.forEach((change, i) => {if (change.addedNodes) {change.addedNodes.forEach((node) => {
if (node && BDFDB.containsClass(node, BDFDB.disCN.guildouter) && !node.querySelector(BDFDB.dotCN.guildserror)) {
@ -182,7 +184,7 @@ class DisplayServersAsChannels {
}
this.changeSVG(div);
}
changeButton (div) {
if (!div) return;
var guildbuttoninner = div.querySelector(BDFDB.dotCN.guildbuttoninner);
@ -192,7 +194,7 @@ class DisplayServersAsChannels {
}
this.changeSVG(div);
}
changeSVG (div) {
var guildsvg = div.querySelector(BDFDB.dotCN.guildsvg);
if (guildsvg && !guildsvg.getAttribute("DSAC-oldViewBox")) {
@ -200,7 +202,7 @@ class DisplayServersAsChannels {
guildsvg.removeAttribute("viewBox");
}
}
changeError (div) {
if (!div) return;
BDFDB.removeEles(div.querySelectorAll(".DSAC-name, .DSAC-icon"));
@ -212,7 +214,7 @@ class DisplayServersAsChannels {
var data = BDFDB.loadData(folderdiv.id, "ServerFolders", "folders");
return data ? Object.assign({div:folderdiv}, data) : null;
}
addCSS () {
var listwidth = BDFDB.getData("serverListWidth", this, "amounts");
BDFDB.appendLocalStyle("DSACStyle" + this.name, `

View File

@ -9,11 +9,11 @@ class EditChannels {
getDescription () {return "Allows you to rename and recolor channelnames.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["EditUsers bug","Fixed a bug that occured when EditUsers is enabled"]]
};
this.labels = {};
this.patchModules = {
@ -27,7 +27,9 @@ class EditChannels {
"Clickable":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.channelContextEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} localchannelsettings-item ${BDFDB.disCN.contextmenuitemsubmenu}">
@ -132,7 +134,7 @@ class EditChannels {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-settings-inner">`;
for (let key in settings) {
if (!this.defaults.settings[key].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: 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>`;
@ -204,7 +206,7 @@ class EditChannels {
this.GuildChannels = BDFDB.WebModules.findByProperties("getChannels","getDefaultChannel");
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
var observer = new MutationObserver(() => {this.changeAppTitle();});
BDFDB.addObserver(this, document.head.querySelector("title"), {name:"appTitleObserver",instance:observer}, {childList:true});
this.changeAppTitle();
@ -326,7 +328,7 @@ class EditChannels {
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
if (BDFDB.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteEditChannelsRow")) {
BDFDB.stopEvent(e);
this.swapWordWithMention(textarea);
this.swapWordWithMention(textarea);
}
}
else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
@ -385,7 +387,7 @@ class EditChannels {
this.changeChannel(instance.props.channel, wrapper.querySelector(BDFDB.dotCN.channelname), true);
}
}
processHeaderBarContainer (instance, wrapper) {
this.processHeaderBar(instance, wrapper);
}
@ -461,7 +463,7 @@ class EditChannels {
BDFDB.WebModules.forceAllUpdates(this);
}
}
changeAppTitle () {
let channel = this.ChannelUtils.getChannel(this.LastChannelStore.getChannelId());
let title = document.head.querySelector("title");
@ -580,12 +582,12 @@ class EditChannels {
mention.removeEventListener("mouseout", mention.mouseoutListenerEditChannels);
let data = this.getChannelData(info.id, info.parent_id, mention);
let name = "#" + (data.name || info.name);
let isgradient = data.color && BDFDB.isObject(data.color);
let color = isgradient ? BDFDB.colorGRADIENT(data.color) : BDFDB.colorCONVERT(data.color, "RGB");
let color0_1 = isgradient ? BDFDB.colorGRADIENT(BDFDB.colorSETALPHA(data.color, 0.1, "RGB")) : BDFDB.colorSETALPHA(data.color, 0.1, "RGB");
let color0_7 = isgradient ? BDFDB.colorGRADIENT(BDFDB.colorSETALPHA(data.color, 0.7, "RGB")) : BDFDB.colorSETALPHA(data.color, 0.7, "RGB");
if (mention.EditChannelsHovered) colorHover();
else colorDefault();
mention.mouseoverListenerEditChannels = () => {
@ -634,7 +636,7 @@ class EditChannels {
}
return null;
}
getChannelData (id, categoryid, wrapper) {
let data = BDFDB.loadData(id, this, "channels");
let categorydata = categoryid ? BDFDB.loadData(categoryid, this, "channels") : null;
@ -673,7 +675,7 @@ class EditChannels {
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]));
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) {
@ -718,7 +720,7 @@ class EditChannels {
}
else {
let items = menu.querySelectorAll(BDFDB.dotCN.autocompleteselectable);
next = forward ? items[0] : items[items.length-1];
next = forward ? items[0] : items[items.length-1];
}
return next ? next : this.getNextSelection(menu, sibling, forward);
}
@ -730,7 +732,7 @@ class EditChannels {
let lastword = words[words.length-1].trim();
if (channelid && lastword) {
BDFDB.removeEles(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
textarea.focus();
textarea.focus();
textarea.selectionStart = textarea.value.length - lastword.length;
textarea.selectionEnd = textarea.value.length;
document.execCommand("insertText", false, `<#${channelid}> `);

View File

@ -9,11 +9,11 @@ class EditServers {
getDescription () {return "Allows you to change the icon, name and color of servers.";}
initConstructor () {
constructor () {
this.changelog = {
"improved":[["<span style='-webkit-background-clip: text; color: transparent; background-image: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)'>Color Gradients</span>","You can now use color gradients to edit servers"]]
};
};
this.labels = {};
this.patchModules = {
@ -22,7 +22,9 @@ class EditServers {
"GuildHeader":["componentDidMount","componentDidUpdate"],
"Clickable":"componentDidMount"
};
}
initConstructor () {
this.serverContextEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} localserversettings-item ${BDFDB.disCN.contextmenuitemsubmenu}">
@ -228,7 +230,7 @@ class EditServers {
this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
this.CurrentGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
BDFDB.WebModules.patch(BDFDB.WebModules.findByProperties('getGuildBannerURL'), 'getGuildBannerURL', this, {instead:e => {
let guild = this.GuildUtils.getGuild(e.methodArguments[0].id);
if (guild) {
@ -257,7 +259,7 @@ class EditServers {
this.updateGuildSidebar();
} catch (err) {}
BDFDB.saveAllData(data, this, "servers");
for (let guildobj of BDFDB.readServerList()) if (guildobj.instance) {
delete guildobj.instance.props.guild.EditServersCachedBanner;
}
@ -328,7 +330,7 @@ class EditServers {
});
}
}
processGuild (instance, wrapper) {
if (instance.props && instance.props.guild) {
let icon = wrapper.querySelector(BDFDB.dotCN.guildicon + ":not(.fake-guildicon), " + BDFDB.dotCN.guildiconacronym + ":not(.fake-guildacronym)");
@ -337,7 +339,7 @@ class EditServers {
this.changeTooltip(instance.props.guild, wrapper.querySelector(BDFDB.dotCN.guildcontainer), "right");
}
}
processGuildIconWrapper (instance, wrapper) {
if (instance.props && instance.props.guild) {
let icon = wrapper.classList && BDFDB.containsClass(wrapper, BDFDB.disCN.avataricon) ? wrapper : wrapper.querySelector(BDFDB.dotCN.avataricon);
@ -430,7 +432,7 @@ class EditServers {
serverbannerinput = null;
removebannerinput = null;
}
BDFDB.addChildEventListener(serverSettingsModal, "click", ".btn-save", e => {
name = servernameinput.value.trim();
name = name ? name : null;
@ -653,7 +655,7 @@ class EditServers {
return !key || settings[key] ? data : {};
}
setBanner (id, data) {
data = data || {};
let guild = this.GuildUtils.getGuild(id);
@ -661,7 +663,7 @@ class EditServers {
if (guild.EditServersCachedBanner === undefined) guild.EditServersCachedBanner = guild.banner;
guild.banner = data.removeBanner ? null : (data.banner || guild.EditServersCachedBanner);
}
updateGuildSidebar() {
if (document.querySelector(BDFDB.dotCN.guildheader)) {
var ins = BDFDB.getOwnerInstance({node: document.querySelector(BDFDB.dotCN.app), name: ["GuildSidebar", "GuildHeader"], all: true, noCopies: true, depth: 99999999, time: 99999999});

View File

@ -9,12 +9,12 @@ class EditUsers {
getDescription () {return "Allows you to change the icon, name, tag and color of users.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["EditChannels bug","Fixed a bug that occured when EditChannels is enabled"]]
};
this.labels = {};
this.labels = {};
this.patchModules = {
"ChannelTextArea":"componentDidMount",
@ -42,7 +42,9 @@ class EditUsers {
"MessageContent":["componentDidMount","componentDidUpdate"],
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.avatarselector = BDFDB.dotCNC.guildicon + BDFDB.dotCNC.avatar + BDFDB.dotCNC.callavatarwrapper + BDFDB.dotCN.voiceavatarcontainer;
this.css = `
@ -216,7 +218,7 @@ class EditUsers {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-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;">Change User in:</h3></div><div class="BDFDB-settings-inner-list">`;
for (let key in settings) {
@ -286,11 +288,11 @@ class EditUsers {
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
var observer = new MutationObserver(() => {this.changeAppTitle();});
BDFDB.addObserver(this, document.head.querySelector("title"), {name:"appTitleObserver",instance:observer}, {childList:true});
this.changeAppTitle();
BDFDB.WebModules.forceAllUpdates(this);
}
else {
@ -500,7 +502,7 @@ class EditUsers {
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
if (BDFDB.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteEditUsersRow")) {
BDFDB.stopEvent(e);
this.swapWordWithMention(textarea);
this.swapWordWithMention(textarea);
}
}
else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
@ -531,7 +533,7 @@ class EditUsers {
}
}
}
processMemberListItem (instance, wrapper) {
let username = wrapper.querySelector(BDFDB.dotCN.memberusername);
if (username) {
@ -566,7 +568,7 @@ class EditUsers {
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
}
}
processVoiceUser (instance, wrapper) {
let user = instance.props.user;
if (user && wrapper.className) {
@ -611,7 +613,7 @@ class EditUsers {
if (instance.props && instance.props.user && instance.props.guild) {
let username = wrapper.querySelector(BDFDB.dotCN.guildsettingsbannedusername);
if (username) {
this.changeName3(instance.props.user, username);
this.changeName3(instance.props.user, username);
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
}
}
@ -707,7 +709,7 @@ class EditUsers {
processHeaderBarContainer (instance, wrapper) {
this.processHeaderBar(instance, wrapper);
}
processHeaderBar (instance, wrapper) {
let channel_id = BDFDB.getReactValue(instance, "props.channelId") || BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.channelId");
if (channel_id) {
@ -792,7 +794,7 @@ class EditUsers {
BDFDB.WebModules.forceAllUpdates(this);
}
}
changeAppTitle () {
let channel = this.ChannelUtils.getChannel(this.LastChannelStore.getChannelId());
let title = document.head.querySelector("title");
@ -815,7 +817,7 @@ class EditUsers {
let isBRCenabled = BDFDB.isPluginEnabled("BetterRoleColors");
let usenick = !BDFDB.containsClass(username, BDFDB.disCN.userprofileusername) && !BDFDB.containsClass(username.parentElement, BDFDB.disCN.userprofilelistname, BDFDB.disCN.accountinfodetails, false) && member.nick;
let usemembercolor = !BDFDB.containsClass(username.parentElement, BDFDB.disCN.userprofilelistname) && (BDFDB.containsClass(username, BDFDB.disCN.memberusername, BDFDB.disCN.messageusername, false) || isBRCenabled);
if (BDFDB.isObject(data.color1)) {
username.style.removeProperty("color");
BDFDB.setInnerText(username, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.colorGRADIENT(data.color1)} !important;">${BDFDB.encodeToHTML(data.name || (usenick ? member.nick : info.username))}</span>`));
@ -824,9 +826,9 @@ class EditUsers {
username.style.setProperty("color", BDFDB.colorCONVERT(data.color1 || (usemembercolor ? member.colorString : null), "RGB"), "important");
BDFDB.setInnerText(username, data.name || (usenick ? member.nick : info.username));
}
username.style.setProperty("background", BDFDB.isObject(data.color2) ? BDFDB.colorGRADIENT(data.color2) : BDFDB.colorCONVERT(data.color2, "RGB"), "important");
if (data.name || data.color1 || data.color2) {
username.setAttribute("changed-by-editusers", true);
username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
@ -895,7 +897,7 @@ class EditUsers {
else username.removeAttribute("changed-by-editusers");
}
}
changeBotTags (data, username, member) {
for (let tag of username.parentElement.parentElement.querySelectorAll(BDFDB.dotCN.bottag)) if (!BDFDB.containsClass(tag, "TRE-tag")) {
let isBRCenabled = BDFDB.isPluginEnabled("BetterRoleColors");
@ -1032,13 +1034,13 @@ class EditUsers {
let data = this.getUserData(info.id, mention);
let member = this.MemberUtils.getMember(this.LastGuildStore.getGuildId(), info.id) || {};
let name = "@" + (data.name ? data.name : (BDFDB.isPluginEnabled("RemoveNicknames") ? window.bdplugins.RemoveNicknames.plugin.getNewName(info) : member.nick || info.username));
let isgradient = data.color1 && BDFDB.isObject(data.color1);
let datacolor = data.color1 || (BDFDB.isPluginEnabled("BetterRoleColors") ? member.colorString : null);
let color = isgradient ? BDFDB.colorGRADIENT(data.color1) : BDFDB.colorCONVERT(datacolor, "RGB");
let color0_1 = isgradient ? BDFDB.colorGRADIENT(BDFDB.colorSETALPHA(data.color1, 0.1, "RGB")) : BDFDB.colorSETALPHA(datacolor, 0.1, "RGB");
let color0_7 = isgradient ? BDFDB.colorGRADIENT(BDFDB.colorSETALPHA(data.color1, 0.7, "RGB")) : BDFDB.colorSETALPHA(datacolor, 0.7, "RGB");
if (mention.EditUsersHovered) colorHover();
else colorDefault();
mention.mouseoverListenerEditUsers = () => {
@ -1144,14 +1146,14 @@ class EditUsers {
else if (wrapper.EditUsersCachedDataState) {
return data;
}
let allenabled = true, settings = BDFDB.getAllData(this, "settings");
for (let i in settings) if (!settings[i]) {
allenabled = false;
break;
}
if (allenabled) return data;
let key = null;
if (!BDFDB.containsClass(wrapper, BDFDB.disCN.mention) && BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper)) key = "changeInChatWindow";
else if (BDFDB.containsClass(wrapper, BDFDB.disCN.mention)) key = "changeInMentions";
@ -1174,7 +1176,7 @@ class EditUsers {
else if (BDFDB.getParentEle(BDFDB.dotCN.searchpopout, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.searchpopoutdmaddpopout, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.quickswitcher, wrapper)) key = "changeInSearchPopout";
else if (BDFDB.getParentEle(BDFDB.dotCN.accountinfo, wrapper)) key = "changeInUserAccount";
else if (wrapper.parentElement == document.head) key = "changeInAppTitle";
if (!key || settings[key]) {
wrapper.EditUsersCachedDataState = true;
return data;
@ -1240,7 +1242,7 @@ class EditUsers {
}
else {
let items = menu.querySelectorAll(BDFDB.dotCN.autocompleteselectable);
next = forward ? items[0] : items[items.length-1];
next = forward ? items[0] : items[items.length-1];
}
return next ? next : this.getNextSelection(menu, sibling, forward);
}
@ -1254,7 +1256,7 @@ class EditUsers {
let discriminator = selected.querySelector(BDFDB.dotCN.autocompletedescriptiondiscriminator).textContent;
let userid = selected.getAttribute("userid");
BDFDB.removeEles(".autocompleteEditUsers", ".autocompleteEditUsersRow");
textarea.focus();
textarea.focus();
textarea.selectionStart = textarea.value.length - lastword.length;
textarea.selectionEnd = textarea.value.length;
document.execCommand("insertText", false, (username && discriminator ? ("@" + username + discriminator) : `<@!${userid}>`) + " ");

View File

@ -9,17 +9,19 @@ class EmojiStatistics {
getDescription () {return "Adds some helpful options to show you more information about emojis and emojiservers.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Context Menu & Tooltips","fixed"]]
};
this.labels = {};
this.patchModules = {
"EmojiPicker":"componentDidMount"
};
}
initConstructor () {
this.css = `
.emojistatistics-tooltip,
.emoji-tooltip {
@ -305,9 +307,9 @@ class EmojiStatistics {
var entries = [], index = 0, totalGlobal = 0, totalLocal = 0, totalCopies = 0;
BDFDB.addChildEventListener(titleEntry, "click", ".modal-sorttitle-label ", e => {
var oldTitle = e.currentTarget.innerText;
this.resetTitles(titleEntry, totalGlobal, totalLocal, totalCopies);
var reverse = oldTitle.indexOf("▼") < 0 ? false : true, sortKey = "index";
if (oldTitle.indexOf("▲") < 0) {
sortKey = e.currentTarget.getAttribute("sortkey");
@ -343,14 +345,14 @@ class EmojiStatistics {
totalLocal += amountLocal;
totalCopies += amountCopies;
}
this.resetTitles(titleEntry, totalGlobal, totalLocal, totalCopies);
BDFDB.appendModal(emojiInformationModal);
this.updateAllEntries(entriescontainer, entries);
}
resetTitles (titleEntry, totalGlobal, totalLocal, totalCopies) {
titleEntry.querySelector(".modal-titlesname-label").innerText = this.labels.modal_titlesname_text;
titleEntry.querySelector(".modal-titlestotal-label").innerText = `${this.labels.modal_titlestotal_text} (${totalGlobal + totalLocal})`;

View File

@ -9,11 +9,11 @@ class ForceImagePreviews {
getDescription () {return "Forces embedded Image Previews, if Discord doesn't do it itself. Caution: Externals Images can contain malicious code and reveal your IP!";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["GIFs","Fixed the issue where gifs would be forced as a preview even tho the native preview was rendered"]]
};
this.patchModules = {
"Message":"componentDidMount"
};
@ -98,7 +98,7 @@ class ForceImagePreviews {
addItemToAccessory (previmage, links, accessory) {
let item = links.shift();
if (!item) return;
else if (item.embedded) this.addItemToAccessory(item, links, accessory);
else if (item.embedded) this.addItemToAccessory(item, links, accessory);
else {
let itemsrc = this.parseSrc(item.src);
require("request")(itemsrc, (error, response, result) => {

View File

@ -9,17 +9,19 @@ class FriendNotifications {
getDescription () {return "Notifies you when a Friend or a User your choose to observe changing his online status, can be configured individually in the settings.";}
initConstructor () {
constructor () {
this.changelog = {
"improved":[["Notification Message","You can now customize the message depending on the status"]],
"fixed":[["Mute Sound Bug","Fixed the bug where desktop notifications could not be muted"],["Settings Bug","Fixed the bug where disabling/changing settings for users would not work, unless the plugin was restarted"],["Log Bug","Fixed the bug where the time log would display weirdly"]]
};
this.patchModules = {
"FriendsOnline":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.userStatusStore = {};
this.checkInterval = null;
@ -152,16 +154,16 @@ class FriendNotifications {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let notificationstrings = BDFDB.getAllData(this, "notificationstrings");
let notificationsounds = BDFDB.getAllData(this, "notificationsounds");
let amounts = BDFDB.getAllData(this, "amounts");
let friendIDs = this.FriendUtils.getFriendIDs();
let friends = BDFDB.loadAllData(this, "friends");
let nonfriends = BDFDB.loadAllData(this, "nonfriends");
let settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-settings-inner">`;
settingshtml += `<div class="${BDFDB.disCNS.h2 + BDFDB.disCNS.cursorpointer + BDFDB.disCNS.margintop4 + BDFDB.disCN.marginbottom4} BDFDB-containertext"><span class="BDFDB-containerarrow closed"></span>General Settings</div><div class="BDFDB-collapsecontainer">`;
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>`;
@ -213,7 +215,7 @@ class FriendNotifications {
for (let config in notificationsounds) if (config.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;">${config} 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" config="${config}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} mute-checkbox"${notificationsounds[config].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" config="${config}" value="${notificationsounds[config].url ? notificationsounds[config].url : ""}" placeholder="Url or Filepath" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16}"></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" 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>`;
settingshtml += `</div></div>`;
BDFDB.saveAllData(friends, this, "friends");
let settingspanel = BDFDB.htmlToElement(settingshtml);
@ -335,7 +337,7 @@ class FriendNotifications {
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers", "getUsers");
this.APIUtils = BDFDB.WebModules.findByProperties("getAPIBaseURL");
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
/* REMOVE AFTER SOME TIME - 22.08.2019 */
let oldFriendDataDesktop = BDFDB.loadAllData("FriendNotifications", "desktop");
let oldFriendDataDisabled = BDFDB.loadAllData("FriendNotifications", "disabled");
@ -373,7 +375,7 @@ class FriendNotifications {
// begin of own functions
createHoverCard (user, data, group) {
let EUdata = BDFDB.loadData(user.id, "EditUsers", "users") || {};
var hovercardhtml = `<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}"><div class="settings-avatar${data.desktop ? " desktop" : ""}${data.disabled ? " disabled" : ""}" group="${group}" user-id="${user.id}" style="flex: 0 0 auto; background-image: url(${EUdata.removeIcon ? "" : (EUdata.url ? EUdata.url : BDFDB.getUserAvatar(user.id))});"></div><div class="BDFDB-textscrollwrapper" style="flex: 1 1 auto;"><div class="BDFDB-textscroll">${BDFDB.encodeToHTML(EUdata.name || user.username)}</div></div>`;
@ -382,7 +384,7 @@ class FriendNotifications {
}
return hovercardhtml + `</div>${group == "nonfriends" ? `<div class="${BDFDB.disCN.hovercardbutton} remove-user" group="${group}" user-id="${user.id}"></div>` : ''}</div>`
}
changeNotificationType (avatar, desktopon, disableon) {
let id = avatar.getAttribute("user-id");
let group = avatar.getAttribute("group");
@ -396,7 +398,7 @@ class FriendNotifications {
this.SettingsUpdated = true;
}
}
changeAllNotificationTypes (settingspanel, tableheader, enable) {
let config = tableheader.getAttribute("config");
let group = tableheader.getAttribute("group");
@ -413,7 +415,7 @@ class FriendNotifications {
this.SettingsUpdated = true;
}
}
changeNotificationConfig (checkbox) {
let id = checkbox.getAttribute("user-id");
let config = checkbox.getAttribute("config");
@ -425,7 +427,7 @@ class FriendNotifications {
this.SettingsUpdated = true;
}
}
changeAllNotificationConfigs (settingspanel, tableheader, enable) {
let config = tableheader.getAttribute("config");
let group = tableheader.getAttribute("group");
@ -440,11 +442,11 @@ class FriendNotifications {
this.SettingsUpdated = true;
}
}
createDefaultConfig () {
return Object.assign({desktop: false, disabled: false}, BDFDB.mapObject(this.defaults.notificationstrings, "init"));
}
saveNotificationString (input) {
let config = input.getAttribute("config");
if (config) {
@ -502,7 +504,7 @@ class FriendNotifications {
this.startInterval();
}
}
getStatusWithMobile (id) {
let status = BDFDB.getUserStatus(id);
return status == "online" && this.MobileUtils.isMobileOnline(id) ? "mobile" : status;

View File

@ -9,9 +9,11 @@ class GoogleSearchReplace {
getDescription () {return "Replaces the default Google Text Search with a selection menu of several search engines.";}
initConstructor () {
constructor () {
this.labels = {};
}
initConstructor () {
this.textUrlReplaceString = "DEVILBRO_BD_GOOGLESEARCHREPLACE_REPLACE_TEXTURL";
this.defaults = {
@ -133,7 +135,7 @@ class GoogleSearchReplace {
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);
if (searchentry) this.appendItem(searchentry, instance.props.value);
}
}
@ -142,12 +144,12 @@ class GoogleSearchReplace {
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);
if (searchentry) this.appendItem(searchentry, text);
}
}
}
appendItem (instance, target, text) {
appendItem (target, text) {
let messageContextEntry = BDFDB.htmlToElement(this.messageContextEntryMarkup);
target.parentElement.insertBefore(messageContextEntry, target.nextElementSibling);
messageContextEntry.addEventListener("mouseenter", () => {
@ -156,7 +158,7 @@ class GoogleSearchReplace {
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();
BDFDB.closeContextMenu(target);
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");

View File

@ -9,11 +9,11 @@ class GoogleTranslateOption {
getDescription () {return "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.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Embeds","Fixed the bug where some parts of an embed would vanish if the message above is translated"],["Translating/Untranslating Bug","Translating/Untranslating no longer breaks the features of native discord elements (clicking the username, spoilers, etc.)"]]
};
this.labels = {};
this.patchModules = {
@ -22,16 +22,18 @@ class GoogleTranslateOption {
"MessageOptionPopout":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.languages = {};
this.doTranslate = false;
this.translating = false;
this.brailleConverter = {
"0":"⠴", "1":"⠂", "2":"⠆", "3":"⠒", "4":"⠲", "5":"⠢", "6":"⠖", "7":"⠶", "8":"⠦", "9":"⠔", "!":"⠮", "\"":"⠐", "#":"⠼", "$":"⠫", "%":"⠩", "&":"⠯", "'":"⠄", "(":"⠷", ")":"⠾", "*":"⠡", "+":"⠬", ",":"⠠", "-":"⠤", ".":"⠨", "/":"⠌", ":":"⠱", ";":"⠰", "<":"⠣", "=":"⠿", ">":"⠜", "?":"⠹", "@":"⠈", "a":"⠁", "b":"⠃", "c":"⠉", "d":"⠙", "e":"⠑", "f":"⠋", "g":"⠛", "h":"⠓", "i":"⠊", "j":"⠚", "k":"⠅", "l":"⠇", "m":"⠍", "n":"⠝", "o":"⠕", "p":"⠏", "q":"⠟", "r":"⠗", "s":"⠎", "t":"⠞", "u":"⠥", "v":"⠧", "w":"⠺", "x":"⠭", "y":"⠽", "z":"⠵", "[":"⠪", "\\":"⠳", "]":"⠻", "^":"⠘", "⠁":"a", "⠂":"1", "⠃":"b", "⠄":"'", "⠅":"k", "⠆":"2", "⠇":"l", "⠈":"@", "⠉":"c", "⠊":"i", "⠋":"f", "⠌":"/", "⠍":"m", "⠎":"s", "⠏":"p", "⠐":"\"", "⠑":"e", "⠒":"3", "⠓":"h", "⠔":"9", "⠕":"o", "⠖":"6", "⠗":"r", "⠘":"^", "⠙":"d", "⠚":"j", "⠛":"g", "⠜":">", "⠝":"n", "⠞":"t", "⠟":"q", "⠠":", ", "⠡":"*", "⠢":"5", "⠣":"<", "⠤":"-", "⠥":"u", "⠦":"8", "⠧":"v", "⠨":".", "⠩":"%", "⠪":"[", "⠫":"$", "⠬":"+", "⠭":"x", "⠮":"!", "⠯":"&", "⠰":";", "⠱":":", "⠲":"4", "⠳":"\\", "⠴":"0", "⠵":"z", "⠶":"7", "⠷":"(", "⠸":"_", "⠹":"?", "⠺":"w", "⠻":"]", "⠼":"#", "⠽":"y", "⠾":")", "⠿":"=", "_":"⠸"
};
this.morseConverter = {
"0":"", "1":"·−−−−", "2":"··−−−", "3":"···−−", "4":"····−", "5":"·····", "6":"−····", "7":"−−···", "8":"−−−··", "9":"−−−−·", "!":"−·−·−−", "\"":"·−··−·", "$":"···−··−", "&":"·−···", "'":"·−−−−·", "(":"−·−−·", ")":"−·−−·−", "+":"·−·−·", ",":"−−··−−", "-":"−····−", ".":"·−·−·−", "/":"−··−·", ":":"−−−···", ";":"−·−·−·", "=":"−···−", "?":"··−−··", "@":"·−−·−·", "a":"·−", "b":"−···", "c":"−·−·", "d":"−··", "e":"·", "f":"··−·", "g":"−−·", "h":"····", "i":"··", "j":"·−−−", "k":"−·−", "l":"·−··", "m":"", "n":"−·", "o":"", "p":"·−−·", "q":"−−·−", "r":"·−·", "s":"···", "t":"", "u":"··−", "v":"···−", "w":"·−−", "x":"−··−", "y":"−·−−", "z":"−−··", "·":"e", "··":"i", "···":"s", "····":"h", "·····":"5", "····−":"4", "···−":"v", "···−··−":"$", "···−−":"3", "··−":"u", "··−·":"f", "··−−··":"?", "··−−·−":"_", "··−−−":"2", "·−":"a", "·−·":"r", "·−··":"l", "·−···":"&", "·−··−·":"\"", "·−·−·":"+", "·−·−·−":".", "·−−":"w", "·−−·":"p", "·−−·−·":"@", "·−−−":"j", "·−−−−":"1", "·−−−−·":"'", "":"t", "−·":"n", "−··":"d", "−···":"b", "−····":"6", "−····−":"-", "−···−":"=", "−··−":"x", "−··−·":"/", "−·−":"k", "−·−·":"c", "−·−·−·":";", "−·−·−−":"!", "−·−−":"y", "−·−−·":"(", "−·−−·−":")", "":"m", "−−·":"g", "−−··":"z", "−−···":"7", "−−··−−":",", "−−·−":"q", "":"o", "−−−··":"8", "−−−···":":", "−−−−·":"9", "":"0", "_":"··−−·−"
};
@ -178,8 +180,8 @@ class GoogleTranslateOption {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var choices = BDFDB.getAllData(this, "choices");
var settings = BDFDB.getAllData(this, "settings");
var choices = BDFDB.getAllData(this, "choices");
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-settings-inner">`;
for (let key in choices) {
let choice = this.getLanguageChoice(key);
@ -519,7 +521,7 @@ class GoogleTranslateOption {
finishTranslation(translation, exceptions, input, output, toast);
}
}
checkForSpecialCase (text, input) {
if (input.id == "binary" || input.id == "braille" || input.id == "morse") return input;
else if (input.id == "auto") {
@ -533,7 +535,7 @@ class GoogleTranslateOption {
return {id: "morse", name: "Morse"};
}
}
return null;
return null;
}
string2binary (string) {
@ -603,7 +605,7 @@ class GoogleTranslateOption {
let text = [], i = 0;
string.split("").forEach(chara => {
if (chara == "<" && text[i]) i++;
text[i] = text[i] ? text[i] + chara : chara;
text[i] = text[i] ? text[i] + chara : chara;
if (chara == ">") i++;
});
for (let j in text) {
@ -634,7 +636,7 @@ class GoogleTranslateOption {
BDFDB.addClass(button, "popout-open");
let translatepopout = BDFDB.htmlToElement(this.translatePopoutMarkup);
container.appendChild(translatepopout);
let buttonrects = BDFDB.getRects(button);
let buttonrects = BDFDB.getRects(button);
translatepopout.style.setProperty("left", buttonrects.left + buttonrects.width + "px");
translatepopout.style.setProperty("top", buttonrects.top - buttonrects.height/2 + "px")
@ -682,14 +684,14 @@ class GoogleTranslateOption {
BDFDB.initElements(translatepopout, this);
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(BDFDB.dotCN.title).innerText = this.languages[choice].name;
BDFDB.saveData(type, choice, this, "choices");
}
}
createSelectChoice (key) {
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="flex: 1 1 auto;">${this.languages[key].name}</div>`;
}

View File

@ -9,14 +9,17 @@ class ImageGallery {
getDescription () {return "Allows the user to browse through images sent inside the same message.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Prev/Next Image","Fixed bug where the previou/next image would sometimes be doubled with the current image on the first/last image"]]
};
this.patchModules = {
"ImageModal":["componentDidMount","componentWillUnmount"]
}
};
}
initConstructor () {
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>`;
@ -76,7 +79,7 @@ class ImageGallery {
if (this.started) return;
BDFDB.loadMessage(this);
BDFDB.WebModules.forceAllUpdates(this);
BDFDB.WebModules.forceAllUpdates(this);
}
else {
console.error(`%c[${this.getName()}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');

View File

@ -9,16 +9,18 @@ class ImageZoom {
getDescription () {return "Allows you to zoom in opened Images by holding left clicking on them in the Image Modal.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Lense","Fixed the issue where the lesen wouldn't properly clip the zoomed image"]]
};
this.patchModules = {
"ImageModal":["componentDidMount","componentWillUnmount"],
"Icon":["componentDidMount","componentWillUnmount"],
}
};
}
initConstructor () {
this.zoomSettingsContextMarkup =
`<div class="${BDFDB.disCN.contextmenu} imagezoom-contextmenu">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
@ -112,7 +114,7 @@ class ImageZoom {
if (this.started) return;
BDFDB.loadMessage(this);
BDFDB.WebModules.forceAllUpdates(this);
BDFDB.WebModules.forceAllUpdates(this);
}
else {
console.error(`%c[${this.getName()}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
@ -126,9 +128,9 @@ class ImageZoom {
delete img.ImageZoomMouseDownListener;
img.removeAttribute("draggable");
}
BDFDB.removeEles(".imagezoom-contextmenu", ".imagezoom-separator", ".imagezoom-settings", ".imagezoom-lense", ".imagezoom-backdrop");
BDFDB.unloadMessage(this);
}
}
@ -175,16 +177,16 @@ class ImageZoom {
img.ImageZoomMouseDownListener = e => {
BDFDB.stopEvent(e);
BDFDB.appendLocalStyle("ImageZoomCrossHair", "* {cursor: crosshair !important;}");
let imgrects = BDFDB.getRects(img);
let settings = BDFDB.getAllData(this, "settings");
let lense = BDFDB.htmlToElement(`<div class="imagezoom-lense" style="clip-path: circle(${(settings.lensesize/2) + 2}px at center) !important; border-radius: 50% !important; pointer-events: none !important; z-index: 10000 !important; width: ${settings.lensesize}px !important; height: ${settings.lensesize}px !important; position: fixed !important;"><div class="imagezoom-lense-inner" style="position: absolute !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; clip-path: circle(${settings.lensesize/2}px at center) !important;"><${img.tagName} class="imagezoom-pane" src="${img.src}" style="width: ${imgrects.width * settings.zoomlevel}px; height: ${imgrects.height * settings.zoomlevel}px; position: fixed !important;"${img.tagName == "VIDEO" ? " loop autoplay" : ""}></${img.tagName}></div></div>`);
let pane = lense.querySelector(".imagezoom-pane");
let backdrop = BDFDB.htmlToElement(`<div class="imagezoom-backdrop" style="background: rgba(0,0,0,0.2) !important;"></div>`);
document.querySelector(BDFDB.dotCN.appmount).appendChild(lense);
document.querySelector(BDFDB.dotCN.appmount).appendChild(backdrop);
let lenserects = BDFDB.getRects(lense), panerects = BDFDB.getRects(pane);
let halfW = lenserects.width / 2, halfH = lenserects.height / 2;
let minX = imgrects.left, maxX = minX + imgrects.width;
@ -193,7 +195,7 @@ class ImageZoom {
lense.style.setProperty("top", e.clientY - halfH + "px", "important");
pane.style.setProperty("left", imgrects.left + ((settings.zoomlevel - 1) * (imgrects.left - e.clientX)) + "px", "important");
pane.style.setProperty("top", imgrects.top + ((settings.zoomlevel - 1) * (imgrects.top - e.clientY)) + "px", "important");
let dragging = e2 => {
let x = e2.clientX > maxX ? maxX - halfW : e2.clientX < minX ? minX - halfW : e2.clientX - halfW;
let y = e2.clientY > maxY ? maxY - halfH : e2.clientY < minY ? minY - halfH : e2.clientY - halfH;
@ -259,7 +261,7 @@ class ImageZoom {
document.addEventListener("mouseup", mouseup);
document.addEventListener("mousemove", mousemove);
}
updateSlider () {
var sY = 0;
var sHalfW = BDFDB.getRects(grabber).width/2;

View File

@ -9,20 +9,20 @@ class JoinedAtDate {
getDescription () {return "Displays the Joined At Date of the current Server for a Member in the UserPopout and UserModal.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Showing at top","Fixed issue where dates would be listed at the top in the profile the first time a profile was opened or when a custom status is set"]]
};
this.labels = {};
this.patchModules = {
"UserPopout":"componentDidMount",
"UserProfile":"componentDidMount"
};
}
this.languages;
initConstructor () {
this.loadedusers = {};
this.css = `
@ -33,14 +33,14 @@ class JoinedAtDate {
margin-right: 20px;
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.userpopoutheadernormal} .joinedAtDate {
color: #b9bbbe;
color: #b9bbbe;
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.userpopoutheader + BDFDB.notCN.userpopoutheadernormal} .joinedAtDate,
${BDFDB.dotCNS.themedark + BDFDB.dotCN.userpopoutheader} .joinedAtDate {
color: hsla(0,0%,100%,.6);
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.userprofiletopsectionnormal} .joinedAtDate {
color: hsla(216,4%,74%,.6);
color: hsla(216,4%,74%,.6);
}
${BDFDB.dotCN.themelight} [class*='topSection']${BDFDB.notCN.userprofiletopsectionnormal} .joinedAtDate,
${BDFDB.dotCN.themedark} [class*='topSection'] .joinedAtDate {
@ -186,7 +186,7 @@ class JoinedAtDate {
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(".languageName").innerText = this.languages[choice].name;
@ -194,7 +194,7 @@ class JoinedAtDate {
BDFDB.saveData(type, choice, this, "choices");
}
}
createSelectChoice (choice) {
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
}

View File

@ -9,20 +9,20 @@ class LastMessageDate {
getDescription () {return "Displays the Date of the last sent Message of a Member for the current Server/DM in the UserPopout and UserModal.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Showing at top","Fixed issue where dates would be listed at the top in the profile the first time a profile was opened or when a custom status is set"]]
};
this.labels = {};
this.patchModules = {
"UserPopout":"componentDidMount",
"UserProfile":"componentDidMount"
};
}
this.languages;
initConstructor () {
this.loadedusers = {};
this.css = `
@ -33,14 +33,14 @@ class LastMessageDate {
margin-right: 20px;
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.userpopoutheadernormal} .lastMessageDate {
color: #b9bbbe;
color: #b9bbbe;
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.userpopoutheader + BDFDB.notCN.userpopoutheadernormal} .lastMessageDate,
${BDFDB.dotCNS.themedark + BDFDB.dotCN.userpopoutheader} .lastMessageDate {
color: hsla(0,0%,100%,.6);
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.userprofiletopsectionnormal} .lastMessageDate {
color: hsla(216,4%,74%,.6);
color: hsla(216,4%,74%,.6);
}
${BDFDB.dotCN.themelight} [class*='topSection']${BDFDB.notCN.userprofiletopsectionnormal} .lastMessageDate,
${BDFDB.dotCN.themedark} [class*='topSection'] .lastMessageDate {
@ -147,7 +147,7 @@ class LastMessageDate {
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}},BDFDB.languages);
BDFDB.WebModules.patch(BDFDB.WebModules.findByProperties("receiveMessage"), "receiveMessage", this, {after: e => {
let message = e.methodArguments[1];
let guildid = message.guild_id || message.channel_id;
@ -193,7 +193,7 @@ class LastMessageDate {
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(".languageName").innerText = this.languages[choice].name;
@ -201,7 +201,7 @@ class LastMessageDate {
BDFDB.saveData(type, choice, this, "choices");
}
}
createSelectChoice (choice) {
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
}

View File

@ -9,11 +9,13 @@ class MessageUtilities {
getDescription () {return "Offers a number of useful message options. Remap the keybindings in the settings.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["New Select Classes","The Dropdown-Select element got new classes on canary, this update will prevent stable from breaking once the class change is pushed to stable"]]
};
}
initConstructor () {
this.bindings = {};
this.firedEvents = [];
@ -176,7 +178,7 @@ class MessageUtilities {
});
});
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(BDFDB.dotCN.title).innerText = this.clickMap[choice];
@ -186,7 +188,7 @@ class MessageUtilities {
BDFDB.saveData(type[0], binding, this, "bindings");
}
}
createSelectChoice (key) {
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="padding: 0;">${this.clickMap[key]}</div>`;
}

View File

@ -9,7 +9,7 @@ class MoveablePopups {
getDescription () {return "Adds the feature to move all popups and modals around like on a normal desktop. Ctrl + drag with your left mousebutton to drag element.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Moved Modal Container","Fixed selector for new modal container"]]
};

View File

@ -9,15 +9,18 @@ class NotificationSounds {
getDescription () {return "Allows you to replace the native sounds of Discord with your own";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Go Live","Maybe fix the Go Live Bug, maybe not"]]
};
this.patchModules = {
"IncomingCalls":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
/* NEVER CHANGE THE SRC LINKS IN THE PLUGIN FILE, TO ADD NEW SONGS ADD THEM IN THE SETTINGS GUI IN THE PLUGINS PAGE */
this.types = {
@ -96,7 +99,7 @@ class NotificationSounds {
"Voicechat Reconnect": "/assets/471cfd0005b112ff857705e894bf41a6.mp3"
}
};
this.orderTypes = {"category":true, "song":true};
this.settingsaudio = new Audio();
@ -356,7 +359,7 @@ class NotificationSounds {
menuhtml += `</div></div>`;
return BDFDB.htmlToElement(menuhtml);
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(BDFDB.dotCN.title).innerText = choice;
@ -366,14 +369,14 @@ class NotificationSounds {
this.choices[type[0]].song = Object.keys(this.audios[choice])[0];
var settingspanel = BDFDB.getParentEle(".BDFDB-settings", selectWrap), songSelect = settingspanel ? settingspanel.querySelector(`${BDFDB.dotCN.select}[type="${type[0]} song"]`) : null;
if (songSelect) songSelect.outerHTML = BDFDB.createSelectMenu(this.createSelectChoice(this.choices[type[0]].song), this.choices[type[0]].song, type[0] + " song");
}
this.choices[type[0]].src = this.audios[this.choices[type[0]].category][this.choices[type[0]].song];
this.choices[type[0]].src = this.choices[type[0]].src ? this.choices[type[0]].src : this.types[type[0]].src;
this.saveChoice(type[0], true);
}
}
createSelectChoice (key) {
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="padding: 0;">${key}</div>`;
}

View File

@ -9,18 +9,20 @@ class OldTitleBar {
getDescription () {return "Reverts the title bar back to its former self.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Mac OSX","Fixed the plugin for Mac OSX"]]
};
this.patchModules = {
"HeaderBar":["componentDidMount","componentDidUpdate"],
"HeaderBarContainer":["componentDidMount","componentDidUpdate"],
"StandardSidebarView":["componentDidMount","componentWillUnmount"],
"AuthWrapper":["componentDidMount","componentWillUnmount"]
};
}
initConstructor () {
this.patched = false;
this.css = `
@ -28,11 +30,11 @@ class OldTitleBar {
.hidden-by-OTB ${BDFDB.dotCN.titlebar} + ${BDFDB.dotCNS.app + BDFDB.dotCN.splashbackground}:before {
display: none !important;
}
.hidden-by-OTB .platform-osx ${BDFDB.dotCN.guildswrapper} {
margin-top: 0;
}
.hidden-by-OTB .platform-osx ${BDFDB.dotCN.guilds} {
padding-top: 10px;
}
@ -95,7 +97,7 @@ class OldTitleBar {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-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>`;
@ -273,7 +275,7 @@ class OldTitleBar {
var innerHTML = this.isMaximized() ? this.maxButtonInnerMax : this.maxButtonInnerMin;
document.querySelectorAll(".maxButtonOTB g").forEach(g => {g.innerHTML = innerHTML;});
}
isMaximized () {
return window.screen.availWidth == window.outerWidth && window.screen.availHeight == window.outerHeight && window.screenX == 0 && window.screenY == 0;
}

View File

@ -9,11 +9,11 @@ class OwnerTag {
getDescription () {return "Adds a Tag like Bottags to the Serverowner.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["DM Groups","Now works properly in DM Groups"]]
};
this.patchModules = {
"MemberListItem":["componentDidMount","componentDidUpdate"],
"MessageUsername":["componentDidMount","componentDidUpdate"],
@ -21,7 +21,9 @@ class OwnerTag {
"UserProfile":["componentDidMount","componentDidUpdate"],
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.defaults = {
settings: {
addInChatWindow: {value:true, inner:true, description:"Messages"},
@ -44,7 +46,7 @@ class OwnerTag {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var inputs = BDFDB.getAllData(this, "inputs");
var inputs = BDFDB.getAllData(this, "inputs");
var settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-settings-inner">`;
for (let key in inputs) {
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.inputs[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="${inputs[key]}" placeholder="${this.defaults.inputs[key].value}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16}"></div></div>`;
@ -114,7 +116,7 @@ class OwnerTag {
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
BDFDB.WebModules.forceAllUpdates(this);
this.addHideCSS();
}
else {
@ -125,9 +127,9 @@ class OwnerTag {
stop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".owner-tag, .owner-tag-crown");
BDFDB.removeLocalStyle(this.name + "HideCrown");
BDFDB.unloadMessage(this);
}
}
@ -147,11 +149,11 @@ class OwnerTag {
processMemberListItem (instance, wrapper) {
if (instance.props && BDFDB.getData("addInMemberList", this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "list", BDFDB.disCN.bottagnametag, null);
}
processUserPopout (instance, wrapper) {
if (instance.props && BDFDB.getData("addInUserPopout", this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "popout", BDFDB.disCN.bottagnametag, wrapper);
}
processUserProfile (instance, wrapper) {
if (instance.props && BDFDB.getData("addInUserProfil", this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "profile", BDFDB.disCNS.bottagnametag + BDFDB.disCN.userprofilebottag, wrapper);
}
@ -206,7 +208,7 @@ class OwnerTag {
wrapper.insertBefore(crown, wrapper.querySelector(".TRE-tag,svg[name=MobileDevice]"));
}
}
addHideCSS () {
var settings = BDFDB.getAllData(this, "settings");
if (settings.hideNativeCrown || settings.useCrown) BDFDB.appendLocalStyle(this.name + "HideCrown", `${BDFDB.dotCNS.member + BDFDB.dotCN.memberownericon}:not(.owner-tag-crown) {display: none;}`);

View File

@ -9,11 +9,11 @@ class PersonalPins {
getAuthor () {return "DevilBro";}
initConstructor () {
constructor () {
this.changelog = {
"added":[["Update Option","Rightclicking/Using the 3-dot menu, will show an option to update a note in the notebook in case the original message changed"]]
};
this.labels = {};
this.patchModules = {
@ -22,7 +22,9 @@ class PersonalPins {
"Message":"componentDidMount",
"MessageOptionPopout":"componentDidMount"
};
}
initConstructor () {
this.notesButtonMarkup =
`<div class="${BDFDB.disCNS.channelheadericonwrapper + BDFDB.disCN.channelheadericonclickable} notes-button">
<svg class="${BDFDB.disCN.channelheadericon}" name="Note" width="24" height="24" viewBox="-1 -1 23 23">
@ -226,7 +228,7 @@ class PersonalPins {
initialize () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.loadMessage(this);
BDFDB.loadMessage(this);
this.SelectChannelUtils = BDFDB.WebModules.findByProperties("selectPrivateChannel","selectChannel");
this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
@ -310,7 +312,7 @@ class PersonalPins {
}
}
}
processHeaderBarContainer (instance, wrapper) {
this.processHeaderBar(instance, wrapper);
}
@ -422,10 +424,10 @@ class PersonalPins {
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]);
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]);
for (let server in pins) if (pins[server]) for (let channel in pins[server]) notes = Object.assign(notes, pins[server][channel]);
break;
}
let noteArray = [];
@ -600,7 +602,7 @@ class PersonalPins {
}
else this.removeNoteData(pins[guild_id][channel.id][message.id + "_" + pos]);
}
updateNoteData (note, markup, accessory) {
let pins = BDFDB.loadAllData(this, "pins");
pins[note.guild_id][note.channel_id][note.id + "_" + note.pos].markup = markup;
@ -609,7 +611,7 @@ class PersonalPins {
BDFDB.saveAllData(pins, this, "pins");
BDFDB.showToast(this.labels.toast_noteupdate_text, {type:"info"});
}
getMarkup (messagediv) {
let markup = messagediv.querySelector(BDFDB.dotCN.messagemarkup).cloneNode(true);
markup.querySelectorAll(BDFDB.dotCN.messageheadercompact).forEach(h2 => {h2.remove();});

View File

@ -9,11 +9,11 @@ class PinDMs {
getDescription () {return "Allows you to pin DMs, making them appear at the top of your DMs/Guild-list.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Pinned DMs","Changed to new DM classes"]]
};
this.patchModules = {
"Guilds":"componentDidMount",
"PrivateChannel":"componentDidMount",
@ -21,7 +21,9 @@ class PinDMs {
"LazyScroller":"render",
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.dmContextEntryMarkup =
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
<div class="${BDFDB.disCN.contextmenuitem} pindms-item ${BDFDB.disCN.contextmenuitemsubmenu}">
@ -267,7 +269,7 @@ class PinDMs {
BDFDB.unloadMessage(this);
}
}
onSwitch () {
for (let pin of document.querySelectorAll(".pinned-dm")) this.updatePinnedRecent(pin.getAttribute("channelid"));
}
@ -327,7 +329,7 @@ class PinDMs {
if (dmsscrollerinstance) {
let dms = dmsscrollerinstance.return.return.return.memoizedProps.children;
let insertpoint = this.getInsertPoint(dms);
this.addPinnedDM(id, dms, insertpoint);
this.addPinnedDM(id, dms, insertpoint);
this.forceUpdateScroller(dmsscrollerinstance.stateNode);
}
this.updatePinnedPositions("pinnedDMs");
@ -553,7 +555,7 @@ class PinDMs {
for (let id in pinnedDMs) sortDM(id, pinnedDMs[id]);
sortedDMs = sortedDMs.filter(n => n);
for (let pos in sortedDMs) if (this.ChannelUtils.getChannel(sortedDMs[pos])) existingDMs.push(sortedDMs[pos]);
this.updatePinnedPositions(type);
this.updatePinnedPositions(type);
return existingDMs;
}
@ -696,26 +698,26 @@ class PinDMs {
if (Node.prototype.isPrototypeOf(pinneddmdiv)) {
let count = this.UnreadUtils.getUnreadCount(id);
let showpin = BDFDB.getData("showPinIcon", this, "settings");
let dmdiv = BDFDB.getDmDiv(id);
let pinneddmiconwrapper = pinneddmdiv.querySelector(BDFDB.dotCN.guildiconwrapper);
let pinneddmdivpill = pinneddmdiv.querySelector(BDFDB.dotCN.guildpillitem);
let iconbadge = pinneddmdiv.querySelector(BDFDB.dotCN.guildupperbadge);
let notificationbadge = pinneddmdiv.querySelector(BDFDB.dotCN.guildlowerbadge);
BDFDB.toggleClass(pinneddmdiv, "has-new-messages", count > 0);
let selected = this.CurrentChannelStore.getChannelId() == id;
pinneddmiconwrapper.style.setProperty("border-radius", selected ? "30%" : "50%");
pinneddmdivpill.style.setProperty("opacity", selected ? 1 : (count ? 0.7 : 0));
pinneddmdivpill.style.setProperty("height", selected ? "40px" : "8px");
pinneddmdivpill.style.setProperty("transform", "translate3d(0px, 0px, 0px)");
BDFDB.toggleEles(iconbadge, showpin);
notificationbadge.firstElementChild.innerText = count;
notificationbadge.firstElementChild.style.setProperty("width", `${count > 99 ? 30 : (count > 9 ? 22 : 16)}px`);
notificationbadge.firstElementChild.style.setProperty("padding-right", `${count > 99 ? 0 : (count > 9 ? 0 : 1)}px`);
BDFDB.toggleEles(notificationbadge, count > 0);
let masks = pinneddmdiv.querySelectorAll("mask rect");
masks[0].setAttribute("transform", showpin ? "translate(0 0)" : "translate(20 -20)");
masks[1].setAttribute("transform", count > 0 ? "translate(0 0)" : "translate(20 20)");
@ -744,7 +746,7 @@ class PinDMs {
let divinner = div.querySelector(BDFDB.dotCN.guildinnerwrapper);
let diviconwrapper = div.querySelector(BDFDB.dotCN.guildiconwrapper);
let divpillitem = div.querySelector(BDFDB.dotCN.guildpillitem);
let pillvisible = divpillitem.style.getPropertyValue("opacity") != 0;
let borderRadius = new this.Animations.Value(0);
@ -776,14 +778,14 @@ class PinDMs {
.addListener((value) => {
divpillitem.style.setProperty("opacity", `${this.CurrentChannelStore.getChannelId() == id ? 1 : value.value}`);
});
let animate = (v) => {
this.Animations.parallel([
this.Animations.timing(borderRadius, {toValue: v, duration: 200}),
this.Animations.spring(pillHeight, {toValue: v, friction: 5})
]).start();
};
let animate2 = (v) => {
this.Animations.parallel([
this.Animations.timing(pillOpacity, {toValue: v, duration: 200}),

View File

@ -9,15 +9,17 @@ class PluginRepo {
getDescription () {return "Allows you to look at all plugins from the plugin repo and download them on the fly. Repo button is in the plugins settings.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Refetch","Fixed refetching occuring every x hours"]]
};
this.patchModules = {
"V2C_List":"componentDidMount"
};
}
initConstructor () {
this.sortings = {
sort: {
name: "Name",
@ -337,7 +339,7 @@ class PluginRepo {
clearTimeout(this.loading.timeout);
BDFDB.removeEles(".pluginrepo-notice",".bd-pluginrepobutton",".pluginrepo-loadingicon",BDFDB.dotCN.app + " > .repo-loadingwrapper:empty");
var frame = document.querySelector("iframe.discordSandbox");
if (frame) {
window.removeEventListener("message", frame.messageReceived);
@ -437,7 +439,7 @@ class PluginRepo {
pluginRepoModal.querySelector("#input-hidedownloadable").checked = hiddenSettings.downloadable || options.showOnlyOutdated;
if (!BDFDB.isRestartNoMoreEnabled()) pluginRepoModal.querySelector("#RNMoption").remove();
else pluginRepoModal.querySelector("#input-rnmstart").checked = BDFDB.loadData("RNMstart", this, "RNMstart");
if (options.forcedSort && this.sortings.sort[options.forcedSort]) {
var sortinput = pluginRepoModal.querySelector(".sort-filter " + BDFDB.dotCN.quickselectvalue);
orderinput.innerText = this.sortings.sort[options.forcedSort];
@ -603,7 +605,7 @@ class PluginRepo {
let pos = entrypositions.indexOf(li.getAttribute("data-url"));
if (pos > -1) {
li.querySelectorAll(BDFDB.dotCNC._reponame + BDFDB.dotCNC._repoversion + BDFDB.dotCNC._repoauthor + BDFDB.dotCN._repodescription).forEach(ele => {
if (searchstring && searchstring.length > 2 || ele.querySelector(BDFDB.dotCN.highlight)) ele.innerHTML = BDFDB.highlightText(ele.innerText, searchstring);
if (searchstring && searchstring.length > 2 || ele.querySelector(BDFDB.dotCN.highlight)) ele.innerHTML = BDFDB.highlightText(ele.innerText, searchstring);
});
li.style.setProperty("order", pos, "important");
}
@ -794,7 +796,7 @@ class PluginRepo {
}
};
window.addEventListener("message", frame.messageReceived);
document.body.appendChild(frame);
});
}
@ -849,11 +851,11 @@ class PluginRepo {
}
}
}
getLoadingTooltipText () {
return `Loading PluginRepo - [${Object.keys(this.loadedPlugins).length}/${Object.keys(this.grabbedPlugins).length}]`;
}
getString (obj) {
var string = "";
if (typeof obj == "string") string = obj;

View File

@ -9,17 +9,19 @@ class ReadAllNotificationsButton {
getDescription () {return "Adds a button to clear all notifications.";}
initConstructor () {
constructor () {
this.changelog = {
"added":[["Muted Servers","Added an extra contextmenu option to only read muted servers and also relabeled the other options"]]
};
this.patchModules = {
"Guilds":["componentDidMount","componentDidUpdate"],
"RecentMentions":"componentDidMount",
"DirectMessage":"componentDidMount"
};
}
initConstructor () {
this.RANcontextMenuMarkup =
`<div class="${BDFDB.disCN.contextmenu} RANbutton-contextmenu">
<div class="${BDFDB.disCN.contextmenuitemgroup}">
@ -51,7 +53,7 @@ class ReadAllNotificationsButton {
`<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.css = `
.RANbutton-frame {
margin-bottom: 10px;
@ -77,7 +79,7 @@ class ReadAllNotificationsButton {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-settings-inner">`;
for (let key in settings) {
if (!this.defaults.settings[key].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: 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>`;
@ -92,7 +94,7 @@ class ReadAllNotificationsButton {
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 => {
@ -231,7 +233,7 @@ class ReadAllNotificationsButton {
setTimeout(() => {this.clearMentions(instance, wrapper);},3000);
}
}
getInsertNode () {
let homebutton = BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCN.homebuttonicon));
if (!homebutton) return null;
@ -242,7 +244,7 @@ class ReadAllNotificationsButton {
}
return insertnode;
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian

View File

@ -9,11 +9,11 @@ class RemoveNicknames {
getDescription () {return "Replace all nicknames with the actual accountnames.";}
initConstructor () {
constructor () {
this.changelog = {
"added":[["Bot Nicknames","Added an option that allows you to keep the nicknames of bots"]]
};
this.patchModules = {
"MemberListItem":"componentDidMount",
"MessageUsername":"componentDidMount",
@ -21,7 +21,9 @@ class RemoveNicknames {
"Clickable":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.defaults = {
settings: {
replaceOwn: {value:false, description:"Replace your own name:"},
@ -34,7 +36,7 @@ class RemoveNicknames {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-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>`;

View File

@ -9,17 +9,19 @@ class RepoControls {
getDescription () {return "Lets you sort and filter your list of downloaded Themes and Plugins.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Canary/PTB","Fixed the plugin for canary and ptb"]]
};
this.patchModules = {
"V2C_List":"componentDidMount",
"V2C_PluginCard": ["componentDidMount","componentDidUpdate"],
"V2C_ThemeCard": ["componentDidMount","componentDidUpdate"]
};
}
initConstructor () {
this.sortings = {
sort: {
name: "Name",
@ -398,7 +400,7 @@ class RepoControls {
if (searchstring && searchstring.length > 2) ele.innerHTML = BDFDB.highlightText(string, searchstring);
else ele.innerHTML = string;
}
else if (searchstring && searchstring.length > 2 || ele.querySelector(BDFDB.dotCN.highlight)) ele.innerHTML = BDFDB.highlightText(string, searchstring);
else if (searchstring && searchstring.length > 2 || ele.querySelector(BDFDB.dotCN.highlight)) ele.innerHTML = BDFDB.highlightText(string, searchstring);
}
}

View File

@ -71,7 +71,7 @@ class RevealAllSpoilersOption {
}
}
// begin of own functions
onMessageContextMenu (instance, menu) {
@ -92,7 +92,7 @@ class RevealAllSpoilersOption {
}
}
}
revealAllSpoilers (target) {
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.message, target);
if (!messagediv) return;

View File

@ -9,11 +9,13 @@ class ReverseImageSearch {
getDescription () {return "Adds a reverse image search option to the context menu.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Image Modal","Option is now also added to a contextmenu when you right click the image in the image modal"]]
};
}
initConstructor () {
this.imgUrlReplaceString = "DEVILBRO_BD_REVERSEIMAGESEARCH_REPLACE_IMAGEURL";
this.defaults = {

View File

@ -9,16 +9,19 @@ class SendLargeMessages {
getDescription () {return "Opens a popout when your message is too large, which allows you to automatically send the message in several smaller messages.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Sending","Fixed the issue where Messages are not being sent"]]
};
this.labels = {};
this.patchModules = {
"ChannelTextArea":"componentDidMount"
};
}
initConstructor () {
this.messageDelay = 1000; //changing at own risk, might result in bans or mutes
this.css = `

View File

@ -9,11 +9,11 @@ class ServerFolders {
getDescription () {return "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.";}
initConstructor () {
constructor () {
this.changelog = {
"improved":[["<span style='-webkit-background-clip: text; color: transparent; background-image: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)'>Color Gradients</span>","You can now use color gradients to create folders"]]
};
this.labels = {};
this.patchModules = {
@ -21,7 +21,9 @@ class ServerFolders {
"Guild":["componentDidMount","componentDidUpdate","render","componentWillUnmount"],
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.cachedGuildState = {};
this.css = `
@ -379,7 +381,7 @@ class ServerFolders {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.getAllData(this, "settings");
let settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-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>`;
@ -667,7 +669,7 @@ class ServerFolders {
this.foldercontent.querySelectorAll(BDFDB.dotCN.guildouter + ".folder").forEach(folderdiv => {this.updateFolderNotifications(folderdiv);});
}
}
getGuildState (instance) {
let state = {};
for (let key in instance.props) if (typeof instance.props[key] != "object" && typeof instance.props[key] != "function") state[key] = instance.props[key];
@ -721,7 +723,7 @@ class ServerFolders {
color2 = BDFDB.getSwatchColor(folderSettingsModal, 2);
color3 = BDFDB.getSwatchColor(folderSettingsModal, 3);
color4 = BDFDB.getSwatchColor(folderSettingsModal, 4);
if (folderName) folderdiv.setAttribute("foldername", folderName);
else folderdiv.removeAttribute("foldername");
folderdiv.querySelector(BDFDB.dotCN.guildiconwrapper).setAttribute("aria-label", folderName || "");
@ -738,7 +740,7 @@ class ServerFolders {
});
foldernameinput.focus();
}
createBase64SVG (paths, color1 = "#000000", color2 = "#FFFFFF") {
if (paths.indexOf("<path ") != 0) return paths;
let isgradient1 = color1 && BDFDB.isObject(color1);
@ -865,7 +867,7 @@ class ServerFolders {
iconpreviewswitchinginner.style.setProperty("background-image", iconpreviewopenimage);
let switching = true;
iconpreviewswitching.switchInterval = setInterval(() => {
switching = !switching;
switching = !switching;
iconpreviewswitchinginner.style.setProperty("background-image", switching ? iconpreviewopenimage : iconpreviewclosedimage);
},1000);
}
@ -1044,12 +1046,12 @@ class ServerFolders {
BDFDB.saveData(data.folderID, data, this, "folders");
this.updateFolderNotifications(folderdiv);
if (data.isOpen) folderdiv.click();
return folderdiv;
}
insertFolderDiv (data, folderdiv) {
folderdiv.remove();
let serversandfolders = this.getAllServersAndFolders();
@ -1101,7 +1103,7 @@ class ServerFolders {
folderdiv.remove();
this.updateFolderPositions();
}
getAllServersAndFolders () {
let separator = document.querySelector(`${BDFDB.dotCN.guildseparator}:not(.folderseparator)`).parentElement;
let nextsibling = separator.nextElementSibling, serversandfolders = [];
@ -1155,7 +1157,7 @@ class ServerFolders {
this.toggleFolderContent(true);
let settings = BDFDB.getAllData(this, "settings");
let open = () => {
if (this.foldercontent) {
if (settings.addSeparators && this.foldercontent.querySelectorAll(BDFDB.dotCN.guildcontainer).length) this.foldercontentguilds.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.guildouter + BDFDB.disCN._bdguildseparator} folderseparatorouter" folder="${folderdiv.id}"><div class="${BDFDB.disCN.guildseparator} folderseparator"></div></div>`));
@ -1169,7 +1171,7 @@ class ServerFolders {
else this.closeFolderContent(folderdiv);
folderdiv.querySelector(BDFDB.dotCN.guildicon).setAttribute("src", `${isClosed ? data.icons.openicon : data.icons.closedicon}`);
data.isOpen = isClosed;
BDFDB.saveData(folderdiv.id, data, this, "folders");
}
@ -1321,7 +1323,7 @@ class ServerFolders {
return guildcopy;
}
isAutoPlayGif () {
return BDFDB.isPluginEnabled("AutoPlayGifs") && window.bdplugins && window.bdplugins.AutoPlayGifs && window.bdplugins.AutoPlayGifs.plugin && window.bdplugins.AutoPlayGifs.plugin.settings && window.bdplugins.AutoPlayGifs.plugin.settings.guildList;
}
@ -1383,7 +1385,7 @@ class ServerFolders {
let folderpillitem = folderdiv.querySelector(BDFDB.dotCN.guildpillitem);
let folderdivbadges = folderdiv.querySelector(BDFDB.dotCN.guildbadgewrapper);
let masks = folderdiv.querySelectorAll("mask rect");
let mentions = 0, unread = false, selected = false, audioenabled = false, videoenabled = false;
includedServers.forEach(div => {
@ -1394,14 +1396,14 @@ class ServerFolders {
if (props.audio) audioenabled = true;
if (props.video) videoenabled = true;
});
BDFDB.toggleClass(folderdiv, BDFDB.disCN._bdguildunread, unread);
BDFDB.toggleClass(folderdiv, BDFDB.disCN._bdguildaudio, audioenabled);
BDFDB.toggleClass(folderdiv, BDFDB.disCN._bdguildvideo, videoenabled);
BDFDB.toggleClass(folderpill, BDFDB.disCN._bdpillunread, unread);
folderpillitem.style.setProperty("opacity", unread ? 0.7 : 0);
let showcount = BDFDB.getData("showCountBadge", this, "settings");
let notificationbadge = folderdiv.querySelector(BDFDB.dotCN.guildlowerbadge + ".notifications");
let countbadge = folderdiv.querySelector(BDFDB.dotCN.guildupperbadge + ".count");
@ -1413,7 +1415,7 @@ class ServerFolders {
notificationbadge.firstElementChild.style.setProperty("width", `${mentions > 99 ? 30 : (mentions > 9 ? 22 : 16)}px`);
notificationbadge.firstElementChild.style.setProperty("padding-right", `${mentions > 99 ? 0 : (mentions > 9 ? 0 : 1)}px`);
BDFDB.toggleEles(notificationbadge, mentions > 0);
masks[0].setAttribute("transform", audioenabled || videoenabled ? "translate(0 0)" : "translate(20 -20)");
masks[1].setAttribute("transform", mentions > 0 ? "translate(0 0)" : "translate(20 20)");
masks[1].setAttribute("x", `${mentions > 99 ? 14 : (mentions > 9 ? 22 : 28)}`);
@ -1421,13 +1423,13 @@ class ServerFolders {
masks[2].setAttribute("transform", showcount ? "translate(0 0)" : "translate(-20 -20)");
masks[2].setAttribute("x", -4);
masks[2].setAttribute("width", `${includedServers.length > 99 ? 38 : (includedServers.length > 9 ? 30 : 24)}`);
if (audioenabled) folderdivbadges.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCN.guildupperbadge} audio-badge" style="opacity: 1; transform: translate(0px, 0px);"><div class="${BDFDB.disCNS.guildbadgeiconbadge + BDFDB.disCN.guildbadgeiconbadge2}"><svg name="Nova_Speaker" class="${BDFDB.disCN.guildbadgeicon}" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M11.383 3.07904C11.009 2.92504 10.579 3.01004 10.293 3.29604L6 8.00204H3C2.45 8.00204 2 8.45304 2 9.00204V15.002C2 15.552 2.45 16.002 3 16.002H6L10.293 20.71C10.579 20.996 11.009 21.082 11.383 20.927C11.757 20.772 12 20.407 12 20.002V4.00204C12 3.59904 11.757 3.23204 11.383 3.07904ZM14 5.00195V7.00195C16.757 7.00195 19 9.24595 19 12.002C19 14.759 16.757 17.002 14 17.002V19.002C17.86 19.002 21 15.863 21 12.002C21 8.14295 17.86 5.00195 14 5.00195ZM14 9.00195C15.654 9.00195 17 10.349 17 12.002C17 13.657 15.654 15.002 14 15.002V13.002C14.551 13.002 15 12.553 15 12.002C15 11.451 14.551 11.002 14 11.002V9.00195Z"></path></svg></div></div>`));
else BDFDB.removeEles(folderdivbadges.querySelectorAll(".audio-badge"));
if (videoenabled) folderdivbadges.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCN.guildupperbadge} video-badge" style="opacity: 1; transform: translate(0px, 0px);"><div class="${BDFDB.disCNS.guildbadgeiconbadge + BDFDB.disCN.guildbadgeiconbadge2}"><svg name="Nova_Camera" class="${BDFDB.disCN.guildbadgeicon}" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M20.526 8.149C20.231 7.966 19.862 7.951 19.553 8.105L17 9.382V8C17 6.897 16.103 6 15 6H6C4.897 6 4 6.897 4 8V16C4 17.104 4.897 18 6 18H15C16.103 18 17 17.104 17 16V14.618L19.553 15.894C19.694 15.965 19.847 16 20 16C20.183 16 20.365 15.949 20.526 15.851C20.82 15.668 21 15.347 21 15V9C21 8.653 20.82 8.332 20.526 8.149Z"></path></svg></div></div>`));
else BDFDB.removeEles(folderdivbadges.querySelectorAll(".video-badge"));
if (document.contains(folderdiv) && BDFDB.containsClass(folderdiv, "open") && !this.foldercontent.querySelector(`[folder="${folderdiv.id}"]`)) this.openCloseFolder(folderdiv);
}
}
@ -1446,9 +1448,9 @@ class ServerFolders {
let divinner = div.querySelector(BDFDB.dotCN.guildcontainer);
let diviconwrapper = div.querySelector(BDFDB.dotCN.guildiconwrapper);
let divpillitem = div.querySelector(BDFDB.dotCN.guildpillitem);
let pillvisible = divpillitem.style.getPropertyValue("opacity") != 0;
let guild = div.getAttribute("guild");
let borderRadius = new this.Animations.Value(0);
@ -1480,14 +1482,14 @@ class ServerFolders {
.addListener((value) => {
divpillitem.style.setProperty("opacity", `${value.value}`);
});
let animate = (v) => {
this.Animations.parallel([
this.Animations.timing(borderRadius, {toValue: v, duration: 200}),
this.Animations.spring(pillHeight, {toValue: v, friction: 5})
]).start();
};
let animate2 = (v) => {
this.Animations.parallel([
this.Animations.timing(pillOpacity, {toValue: v, duration: 200}),

View File

@ -9,17 +9,19 @@ class ServerHider {
getDescription () {return "Hide Servers in your Serverlist";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Server Object","Changes in the Server Object broke the plugin"]]
};
this.labels = {};
this.patchModules = {
"Guild":["componentDidMount","componentDidUpdate"]
};
}
initConstructor () {
this.serverHiderModalMarkup =
`<span class="${this.name}-modal BDFDB-modal">
<div class="${BDFDB.disCN.backdrop}"></div>
@ -97,7 +99,7 @@ class ServerHider {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.getAllData(this, "settings");
let settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-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>`;
@ -273,11 +275,11 @@ class ServerHider {
}
BDFDB.saveData("hiddenservers", hiddenservers, this, "hiddenservers");
}
unreadServer (id) {
if (BDFDB.getData("clearNotifications", this, "settings") && !this.isInFolder(id)) BDFDB.markGuildAsRead(id);
}
isInFolder (id) {
if (!BDFDB.isPluginEnabled("ServerFolders")) return false;
let folders = BDFDB.loadAllData("ServerFolders", "folders");

View File

@ -9,17 +9,20 @@ class ShowHiddenChannels {
getDescription () {return "Displays channels that are hidden from you by role restrictions.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["New Structure","Fixed issues that will occur once the avatar/name changes from canary will hit stable/ptb"]]
};
this.patchModules = {
"Channels":["componentDidMount","componentDidUpdate"],
"ChannelItem":"componentDidMount",
"ChannelCategoryItem":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.categoryMarkup =
`<div class="container-hidden">
@ -51,7 +54,7 @@ class ShowHiddenChannels {
</div>
</div>
</div>`;
this.channelMessage = {
GUILD_TEXT: `enter the hidden text channel`,
GUILD_VOICE: `enter the hidden voice channel`,
@ -60,7 +63,7 @@ class ShowHiddenChannels {
GUILD_CATEGORY: `open the hidden category`,
DEFAULT: `open the channel`,
}
this.channelIcons = {
GUILD_TEXT: `M5.88657 21C5.57547 21 5.3399 20.7189 5.39427 20.4126L6.00001 17H2.59511C2.28449 17 2.04905 16.7198 2.10259 16.4138L2.27759 15.4138C2.31946 15.1746 2.52722 15 2.77011 15H6.35001L7.41001 9H4.00511C3.69449 9 3.45905 8.71977 3.51259 8.41381L3.68759 7.41381C3.72946 7.17456 3.93722 7 4.18011 7H7.76001L8.39677 3.41262C8.43914 3.17391 8.64664 3 8.88907 3H9.87344C10.1845 3 10.4201 3.28107 10.3657 3.58738L9.76001 7H15.76L16.3968 3.41262C16.4391 3.17391 16.6466 3 16.8891 3H17.8734C18.1845 3 18.4201 3.28107 18.3657 3.58738L17.76 7H21.1649C21.4755 7 21.711 7.28023 21.6574 7.58619L21.4824 8.58619C21.4406 8.82544 21.2328 9 20.9899 9H17.41L16.35 15H19.7549C20.0655 15 20.301 15.2802 20.2474 15.5862L20.0724 16.5862C20.0306 16.8254 19.8228 17 19.5799 17H16L15.3632 20.5874C15.3209 20.8261 15.1134 21 14.8709 21H13.8866C13.5755 21 13.3399 20.7189 13.3943 20.4126L14 17H8.00001L7.36325 20.5874C7.32088 20.8261 7.11337 21 6.87094 21H5.88657ZM9.41045 9L8.35045 15H14.3504L15.4104 9H9.41045Z`,
GUILD_VOICE: `M11.383 3.07904C11.009 2.92504 10.579 3.01004 10.293 3.29604L6 8.00204H3C2.45 8.00204 2 8.45304 2 9.00204V15.002C2 15.552 2.45 16.002 3 16.002H6L10.293 20.71C10.579 20.996 11.009 21.082 11.383 20.927C11.757 20.772 12 20.407 12 20.002V4.00204C12 3.59904 11.757 3.23204 11.383 3.07904ZM14 5.00195V7.00195C16.757 7.00195 19 9.24595 19 12.002C19 14.759 16.757 17.002 14 17.002V19.002C17.86 19.002 21 15.863 21 12.002C21 8.14295 17.86 5.00195 14 5.00195ZM14 9.00195C15.654 9.00195 17 10.349 17 12.002C17 13.657 15.654 15.002 14 15.002V13.002C14.551 13.002 15 12.553 15 12.002C15 11.451 14.551 11.002 14 11.002V9.00195Z`,
@ -69,7 +72,7 @@ class ShowHiddenChannels {
GUILD_CATEGORY: `M9.6 1.6 L9.6 6.4 L3.2 6.4 L3.2 1.6 L9.6 1.6 Z M16 16 L22.4 16 L22.4 20.8 L16 20.8 L16 16.533333328 L16 16 Z M14.4 12.8 L8 12.8 L8 17.6 L14.4 17.6 L14.4 20.8 L8 20.8 L4.8 20.8 L4.8 8 L8 8 L8 9.6 L14.4 9.6 L14.4 12.8 Z`,
DEFAULT: `M 11.44 0 c 4.07 0 8.07 1.87 8.07 6.35 c 0 4.13 -4.74 5.72 -5.75 7.21 c -0.76 1.11 -0.51 2.67 -2.61 2.67 c -1.37 0 -2.03 -1.11 -2.03 -2.13 c 0 -3.78 5.56 -4.64 5.56 -7.76 c 0 -1.72 -1.14 -2.73 -3.05 -2.73 c -4.07 0 -2.48 4.19 -5.56 4.19 c -1.11 0 -2.07 -0.67 -2.07 -1.94 C 4 2.76 7.56 0 11.44 0 z M 11.28 18.3 c 1.43 0 2.61 1.17 2.61 2.61 c 0 1.43 -1.18 2.61 -2.61 2.61 c -1.43 0 -2.61 -1.17 -2.61 -2.61 C 8.68 19.48 9.85 18.3 11.28 18.3 z`
};
this.settingsMap = {
GUILD_TEXT: "showText",
GUILD_VOICE: "showVoice",
@ -244,7 +247,7 @@ class ShowHiddenChannels {
}
}
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.getAllData(this, "settings");
var count = 0;
for (let type in this.ChannelTypes) {
if (this.settingsMap[type] && !settings[this.settingsMap[type]]) hiddenChannels[this.ChannelTypes[type]] = [];
@ -266,7 +269,7 @@ class ShowHiddenChannels {
});
for (let type in this.ChannelTypes) for (let hiddenChannel of hiddenChannels[this.ChannelTypes[type]]) this.createChannel(guild, category, hiddenChannel, type);
var isvisibile = BDFDB.loadData(guild.id, this, "categorystatus") === true;
BDFDB.toggleClass(wrapper, BDFDB.disCN.categorycollapsed, !isvisibile);
BDFDB.toggleEles(category.querySelectorAll(BDFDB.dotCN.channelcontainerdefault), isvisibile);
@ -284,7 +287,7 @@ class ShowHiddenChannels {
});
}
}
createChannel (guild, category, info, type) {
let channel = BDFDB.htmlToElement(this.channelMarkup);
channel.querySelector(BDFDB.dotCN.channelname).innerText = info.name;

View File

@ -9,16 +9,18 @@ class ShowImageDetails {
getDescription () {return "Display the name, size and dimensions of uploaded images (does not include embed images) in the chat as an header or as a tooltip.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Spoilers","Properly works with images that are marked as spoilers now"],["Spoiler Crash","Fixed crash occuring when trying to reveal an inline spoiler"]]
};
this.patchModules = {
"LazyImageZoomable":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.css = `
.image-details .image-details-size {
margin: 0 10px;

View File

@ -9,15 +9,17 @@ class SpellCheck {
getDescription () {return "Adds a spellcheck to all textareas. Select a word and rightclick it to add it to your dictionary.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["New Select Classes","The Dropdown-Select element got new classes on canary, this update will prevent stable from breaking once the class change is pushed to stable"]]
};
this.patchModules = {
"ChannelTextArea":"componentDidMount"
};
}
initConstructor () {
this.languages = {};
this.langDictionary = [];
this.dictionary = [];
@ -307,7 +309,7 @@ class SpellCheck {
BDFDB.saveData(lang, ownDictionary, this, "owndics");
this.dictionary = this.langDictionary.concat(ownDictionary);
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(BDFDB.dotCN.title).innerText = this.languages[choice].name;
@ -325,7 +327,7 @@ class SpellCheck {
}
}
}
createSelectChoice (choice) {
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="padding:0;">${this.languages[choice].name}</div>`;
}

View File

@ -9,7 +9,7 @@ class StalkerNotifications {
getDescription () {return "DISCONTINUED.";}
initConstructor () {
constructor () {
this.changelog = {
"improved":[["Merged FriendNotifications and StalkerNotifications","Since both of these plugins now work the same, I decided to merge them. FriendNotifications will be continued and StalkerNotifications will be disconntinued. You can find the old StalkerNotifications settings in the FriendNotifications settings. <i style='color:rgb(200, 100, 100); font-weight: 800;'>All old configurations of FriendNotifications and StalkerNotifications should have been merged</i>"]]
};
@ -54,63 +54,7 @@ class StalkerNotifications {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.loadMessage(this);
//META{"name":"StalkerNotifications","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/StalkerNotifications","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/StalkerNotifications/StalkerNotifications.plugin.js"}*//
class StalkerNotifications {
getName () {return "StalkerNotifications";}
getVersion () {return "9.9.9";}
getAuthor () {return "DevilBro";}
getDescription () {return "DISCONTINUED.";}
initConstructor () {
this.changelog = {
"improved":[["Merged FriendNotifications and StalkerNotifications","Since both of these plugins now work the same, I decided to merge them. FriendNotifications will be continued and StalkerNotifications will be disconntinued. You can find the old StalkerNotifications settings in the FriendNotifications settings. <i style='color:rgb(200, 100, 100); font-weight: 800;'>All old configurations of FriendNotifications and StalkerNotifications should have been merged</i>"]]
};
}
//legacy
load () {}
start () {
if (!global.BDFDB) global.BDFDB = {myPlugins:{}};
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.getName()] = this;
var libraryScript = document.querySelector('head script#BDFDBLibraryScript');
if (!libraryScript || (performance.now() - libraryScript.getAttribute("date")) > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("id", "BDFDBLibraryScript");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {this.initialize();});
document.head.appendChild(libraryScript);
this.libLoadTimeout = setTimeout(() => {
libraryScript.remove();
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
if (body) {
libraryScript = document.createElement("script");
libraryScript.setAttribute("id", "BDFDBLibraryScript");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("date", performance.now());
libraryScript.innerText = body;
document.head.appendChild(libraryScript);
}
this.initialize();
});
}, 15000);
}
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;
BDFDB.loadMessage(this);
BDFDB.openConfirmModal(this, "StalkerNotifications has been discontinued and was merged with FriendNotifications. To download FriendNotifications click the 'OK' button bellow. This will delete StalkerNotifications and download FriendNotifications.", "Update Notification", () => {
require("request")("https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/FriendNotifications/FriendNotifications.plugin.js", (error, response, body) => {
if (error) BDFDB.showToast(`Unable to download FriendNotifications.plugin.js.`, {type:"error"});

View File

@ -9,7 +9,7 @@ class SteamProfileLink {
getDescription () {return "Opens any Steam links in Steam instead of your internet browser.";}
initConstructor () {
constructor () {
this.changelog = {
"improved":[["Activity + Store Links","Plugin now covers any links in the Discord Activity and Store"]]
};
@ -71,11 +71,11 @@ class SteamProfileLink {
stop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
BDFDB.removeEles(".urlCheckFrame");
BDFDB.unloadMessage(this);
}
}
openInSteam (e, url) {
BDFDB.stopEvent(e);
require("request")(url, (error, response, body) => {

View File

@ -9,15 +9,17 @@ class ThemeRepo {
getDescription () {return "Allows you to preview all themes from the theme repo and download them on the fly. Repo button is in the theme settings.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["Refetch","Fixed refetching occuring every x hours"]]
};
this.patchModules = {
"V2C_List":"componentDidMount"
};
}
initConstructor () {
this.sortings = {
sort: {
name: "Name",
@ -39,7 +41,7 @@ class ThemeRepo {
this.cachedThemes = [];
this.grabbedThemes = [];
this.foundThemes = [];
this.loadedThemes = {};
this.loadedThemes = {};
this.updateInterval;
@ -512,7 +514,7 @@ class ThemeRepo {
document.addEventListener("keyup", keyPressed);
window.addEventListener("message", messageReceived);
var frame = BDFDB.htmlToElement(this.frameMarkup);
var themeRepoModal = BDFDB.htmlToElement(this.themeRepoModalMarkup);
var tabbar = themeRepoModal.querySelector(BDFDB.dotCN.tabbar);
@ -531,7 +533,7 @@ class ThemeRepo {
themeRepoModal.querySelector("#input-hidedownloadable").checked = hiddenSettings.downloadable || options.showOnlyOutdated;
if (!BDFDB.isRestartNoMoreEnabled()) themeRepoModal.querySelector("#RNMoption").remove();
else themeRepoModal.querySelector("#input-rnmstart").checked = BDFDB.loadData("RNMstart", this, "RNMstart");
if (options.forcedSort && this.sortings.sort[options.forcedSort]) {
var sortinput = themeRepoModal.querySelector(".sort-filter " + BDFDB.dotCN.quickselectvalue);
sortinput.innerText = this.sortings.sort[options.forcedSort];
@ -763,7 +765,7 @@ class ThemeRepo {
NFLDreplace = NFLDreplace && NFLDreplace.length > 1 ? NFLDreplace[1] : null;
}
this.foundThemes = this.grabbedThemes.concat(ownlist);
this.loading = {is:true, timeout:setTimeout(() => {
clearTimeout(this.loading.timeout);
if (this.started) {
@ -884,7 +886,7 @@ class ThemeRepo {
});
}
}
getLoadingTooltipText () {
return `Loading ThemeRepo - [${Object.keys(this.loadedThemes).length}/${Object.keys(this.grabbedThemes).length}]`;
}

View File

@ -9,7 +9,7 @@ class ThemeSettings {
getDescription () {return "Allows you to change Theme Variables within BetterDiscord. Adds a Settings button (similar to Plugins) to customizable Themes in your Themes Page.";}
initConstructor () {
constructor () {
this.patchModules = {
"V2C_ThemeCard":"componentDidMount"
};

View File

@ -9,16 +9,18 @@ class TimedLightDarkMode {
getDescription () {return "Allows you to automatically change light/dark mode depending on the time of day. Slider is added to the 'Appearance' settings.";}
initConstructor () {
constructor () {
this.changelog = {
"added":[["Current Time","Added a little indicator to show the current time on the slider"]],
"improved":[["Start up","Now properly checks the current time on start up and not only after the first check interval"]]
};
this.patchModules = {
"RadioGroup":"componentDidMount"
};
}
initConstructor () {
this.defaults = {
settings: {
running: {value: true}
@ -69,11 +71,11 @@ class TimedLightDarkMode {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.loadMessage(this);
this.SettingsUtils = BDFDB.WebModules.findByProperties("updateRemoteSettings","updateLocalSettings");
BDFDB.WebModules.forceAllUpdates(this);
this.startInterval();
}
else {
@ -84,16 +86,16 @@ class TimedLightDarkMode {
stop () {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
clearInterval(this.checkInterval);
BDFDB.removeEles(".TLDM-settingsbox");
BDFDB.unloadMessage(this);
}
}
// begin of own functions
processRadioGroup (instance, wrapper) {
if (instance.props && Array.isArray(instance.props.options) && instance.props.options[0] && instance.props.options[0].value == "light" && instance.props.options[1] && instance.props.options[1].value == "dark" && wrapper.parentElement.firstElementChild.innerText && wrapper.parentElement.firstElementChild.innerText.toUpperCase() == BDFDB.LanguageStrings.THEME.toUpperCase()) {
var settings = BDFDB.getAllData(this, "settings");
@ -101,7 +103,7 @@ class TimedLightDarkMode {
var settingsbox = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.margintop8} TLDM-settingsbox"><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;"><h5 class="${BDFDB.disCN.h5}">${BDFDB.LanguageStrings.THEME} Timer</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" value="settings running" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings.running ? " checked" : ""}></div></div><div class="${BDFDB.disCNS.slider + BDFDB.disCN.margintop20}${!settings.running ? (" " + BDFDB.disCN.sliderdisabled): ""}"><input type="number" key="timer1" class="${BDFDB.disCN.sliderinput}" value="${values.timer1}" readonly=""><input type="number" key="timer2" class="${BDFDB.disCN.sliderinput}" value="${values.timer2}" readonly=""><div class="${BDFDB.disCN.slidertrack}"><div class="${BDFDB.disCN.slidermark}" style="left: 0%;"><div class="${BDFDB.disCN.slidermarkvalue}">00:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 12.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">03:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 25%;"><div class="${BDFDB.disCN.slidermarkvalue}">06:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 37.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">09:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 50%;"><div class="${BDFDB.disCN.slidermarkvalue}">12:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 62.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">15:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 75%;"><div class="${BDFDB.disCN.slidermarkvalue}">18:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 87.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">21:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 100%;"><div class="${BDFDB.disCN.slidermarkvalue}">24:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div></div><div class="${BDFDB.disCN.sliderbar}"><div class="${BDFDB.disCN.sliderbarfill}"></div></div><div class="${BDFDB.disCN.slidertrack}"><div class="${BDFDB.disCN.slidergrabber} timer-grabber" key="timer1" style="left: ${values.timer1}%;"></div><div class="${BDFDB.disCN.slidergrabber} timer-grabber" key="timer2" style="left: ${values.timer2}%;"></div><div class="${BDFDB.disCN.slidergrabber} date-grabber" key="current" style="left: ${this.getPercent(new Date())}%; cursor: help !important; height: 12px; margin-top: -7px;"></div></div></div></div>`);
wrapper.parentElement.appendChild(settingsbox);
var slider = settingsbox.querySelector(BDFDB.dotCN.slider);
BDFDB.initElements(settingsbox, this);
this.updateSlider(slider, values);
BDFDB.addChildEventListener(settingsbox, "mousedown", BDFDB.dotCN.slidergrabber + ".timer-grabber", e => {this.dragSlider(e.currentTarget);});
@ -112,7 +114,7 @@ class TimedLightDarkMode {
});
}
}
startInterval () {
clearInterval(this.checkInterval);
if (BDFDB.getData("running", this, "settings")) {
@ -131,17 +133,17 @@ class TimedLightDarkMode {
this.checkInterval = setInterval(check, 60000);
}
}
checkTime (timerLOW, timerHIGH, time) {
return timerHIGH[0] > time[0] || timerHIGH[0] == time[0] && timerHIGH[1] >= time[1] || time[0] > timerLOW[0] || time[0] == timerLOW[0] && time[1] >= timerLOW[1];
}
changeTheme (dark) {
var theme = BDFDB.getDiscordTheme();
if (dark && theme == BDFDB.disCN.themelight) this.SettingsUtils.updateRemoteSettings({theme:"dark"});
else if (!dark && theme == BDFDB.disCN.themedark) this.SettingsUtils.updateRemoteSettings({theme:"light"});
}
showCurrentTime (grabber) {
var currenttime = new Date();
var currenthours = currenttime.getHours();
@ -155,7 +157,7 @@ class TimedLightDarkMode {
};
grabber.addEventListener("mouseleave", mouseleave);
}
dragSlider (grabber) {
var track = grabber.parentNode;
if (BDFDB.containsClass(track.parentNode, BDFDB.disCN.sliderdisabled)) return;
@ -193,7 +195,7 @@ class TimedLightDarkMode {
document.addEventListener("mouseup", mouseup);
document.addEventListener("mousemove", mousemove);
}
updateSlider (slider, values) {
var bar = slider.querySelector(BDFDB.dotCN.sliderbar);
var fill = slider.querySelector(BDFDB.dotCN.sliderbarfill);
@ -203,21 +205,21 @@ class TimedLightDarkMode {
fill.style.setProperty("background-color", inverted ? "#66757F" : "#E0C460", "important");
bar.style.setProperty("background-color", inverted ? "#E0C460" : "#66757F", "important");
}
getTime (percent, stringify) {
var time = BDFDB.mapRange([0, 100], [0, 1440], percent)/60;
var hours = Math.floor(time);
var minutes = Math.floor((time - hours) * 60);
return stringify ? (hours > 9 ? hours : ("0" + hours)) + ":" + (minutes > 9 ? minutes : ("0" + minutes)) : [hours,minutes];
}
getPercent (time) {
if (!time) return 0;
var hours = Array.isArray(time) ? time[0] : (typeof time == "object" && typeof time.getHours == "function" ? time.getHours() : 0);
var minutes = Array.isArray(time) ? time[1] : (typeof time == "object" && typeof time.getMinutes == "function" ? time.getMinutes() : 0);
return BDFDB.mapRange([0, 1440], [0, 100], (hours * 60) + minutes);
}
getHighTime (timer) {
var hours = timer[0];
var minutes = timer[1] - 1;

View File

@ -9,17 +9,19 @@ class TopRoleEverywhere {
getDescription () {return "Adds the highest role of a user as a tag.";}
initConstructor () {
constructor () {
this.changelog = {
"fixed":[["DM Groups","Now works properly in DM Groups"]]
};
this.patchModules = {
"MemberListItem":"componentDidMount",
"MessageUsername":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
};
}
initConstructor () {
this.css = `
.TRE-tag {
white-space: nowrap;
@ -49,7 +51,7 @@ class TopRoleEverywhere {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.getAllData(this, "settings");
let settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-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>`;
@ -220,7 +222,7 @@ class TopRoleEverywhere {
idtag.style.setProperty("order", 12, "important");
let idinner = idtag.querySelector(".role-inner");
idinner.style.setProperty("color", idTextColor, "important");
idinner.style.setProperty("background-image", idBgInner, "important");
idinner.style.setProperty("background-image", idBgInner, "important");
idinner.style.setProperty("-webkit-background-clip", "text", "important");
idinner.textContent = info.id;
}

View File

@ -67,7 +67,7 @@ class UserNotes {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.getAllData(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-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="BDFDB-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;">Remove all User Notes.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} remove-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Remove</div></button></div>`;
settingshtml += `</div></div>`;

View File

@ -9,7 +9,7 @@ class WriteUpperCase {
getDescription () {return "Change input to uppercase.";}
initConstructor () {
constructor () {
this.patchModules = {
"ChannelTextArea":"componentDidMount",
};

View File

@ -1773,7 +1773,7 @@ img[src="/assets/bfffd518c76d3f6bc5e96eb52e4ae2cf.svg"],
border-color: rgba(16,126,16,var(--vtransparencyalpha)) !important;
}
.root-SR8cQa .userInfoSection-2acyCx {
border-color: rgba(var(--vtransparencycolor),calc(var(--vtransparencyalpha) * 2)) !important;
border-color: rgba(var(--vtransparencycolor),calc(var(--vtransparencyalpha) * 2)) !important;
}
.root-SR8cQa .body-3ND3kc {
border-radius: 0 0 5px 5px !important;
@ -1789,7 +1789,7 @@ img[src="/assets/bfffd518c76d3f6bc5e96eb52e4ae2cf.svg"],
background: linear-gradient(90deg,rgba(var(--vtransparencycolor),0.3) 90%,rgba(var(--vtransparencycolor),0)) !important;
}
.root-SR8cQa .connectedAccount-36nQx7 {
border: none !important;
border: none !important;
background: rgba(var(--vtransparencycolor),calc(var(--vtransparencyalpha) * 3)) !important;
}
.root-SR8cQa .connectedAccountOpenIcon-2cNbq5:hover {
@ -2479,7 +2479,7 @@ html, span:not(.spinner-item) {
display: block;
width: 100%;
height: calc(100% - 15px);
position: absolute;
position: absolute;
z-index: 200;
pointer-events: none;
left: 0px;
@ -2590,7 +2590,7 @@ html, span:not(.spinner-item) {
.replyer-icon:hover,
.replyer[style*="cursor:pointer;color:rgba(255,255,255,.4) !important;position:relative;top:-1px;"]:hover {
border-radius: 3px;
opacity: 1 !important;
opacity: 1 !important;
background-color: rgba(var(--vtransparencycolor),calc(var(--vtransparencyalpha) * 2)) !important
}
.citar-btn:active,
@ -2725,9 +2725,9 @@ html:only-child > head + body > div#app-mount.appMount-3lHmkl > div.app-19_DXt >
}
html:only-child > head + body > div#app-mount.appMount-3lHmkl > div.app-19_DXt > div.app-2rEoOp.vertical-V37hAW.flex-1O1GKY.directionColumn-35P_nr > div.layers-3iHuyZ.vertical-V37hAW.flex-1O1GKY.directionColumn-35P_nr.spacer-1fA9zc > div.layer-3QrUeG + div.layer-3QrUeG > div > div.standardSidebarView-3F1I7i > div.sidebarRegion-VFTUkN > div.scrollerWrap-2lJEkd.scrollerThemed-2oenus.themeGhostHairline-DBD-2d.scrollerFade-1Ijw5y > div.scroller-2FKFPG.sidebarRegionScroller-3MXcoP > div.sidebar-CFHs9e > div.side-8zPYf6 > span#bd-settings-sidebar:before {
content: "DevilBro" !important;
font-size: 12px !important;
font-weight: 600 !important;
color: rgb(var(--vaccentcolor)) !important;
font-size: 12px !important;
font-weight: 600 !important;
color: rgb(var(--vaccentcolor)) !important;
display: inline !important;
opacity: 1 !important;
padding: 0 !important;

File diff suppressed because one or more lines are too long

View File

@ -1086,7 +1086,7 @@ img[src*="/assets/0f4d1ff76624bb45a3fee4189279ee92.svg"] + * + *:before {
}
.channelNotice-1-XFjC.premiumGuildSubscription-3oKecP,
.channelNotice-1-XFjC.invite-OjTXrW.new-1_t60t {
background-image: none !important;
background-image: none !important;
}
.channelNotice-1-XFjC.premiumGuildSubscription-3oKecP:after,
.channelNotice-1-XFjC.premiumGuildSubscription-3oKecP:before,