This commit is contained in:
Mirco Wittrien 2019-10-22 20:16:05 +02:00
parent 8a6b2a9ea5
commit 59e61334a5
35 changed files with 204 additions and 204 deletions

View File

@ -213,19 +213,19 @@ class BadgesEverywhere {
// begin of own functions
processMemberListItem (instance, wrapper, returnvalue) {
if (instance.props && BDFDB.getData("showInMemberList", this, "settings")) this.addBadges(instance.props.user, wrapper.querySelector(BDFDB.dotCN.namecontainernamewrapper), "list");
if (instance.props && BDFDB.DataUtils.get(this, "settings")) this.addBadges(instance.props.user, wrapper.querySelector(BDFDB.dotCN.namecontainernamewrapper), "list", "showInMemberList");
}
processMessageUsername (instance, wrapper, returnvalue) {
let message = BDFDB.ReactUtils.getValue(instance, "props.message");
if (message) {
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
if (username && BDFDB.getData("showInChat", this, "settings")) this.addBadges(message.author, wrapper, "chat");
if (username && BDFDB.DataUtils.get(this, "settings")) this.addBadges(message.author, wrapper, "chat", "showInChat");
}
}
processUserPopout (instance, wrapper, returnvalue) {
if (instance.props && BDFDB.getData("showInPopout", this, "settings")) this.addBadges(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), "popout");
if (instance.props && BDFDB.DataUtils.get(this, "settings")) this.addBadges(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), "popout", "showInPopout");
}
processStandardSidebarView (instance, wrapper, returnvalue) {

View File

@ -119,7 +119,7 @@ class ChatAliases {
}
settingshtml += `</div>`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Remove all added words.</h3><button action="removeall" type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} remove-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
var infoHidden = BDFDB.loadData("hideInfo", this, "hideInfo");
var infoHidden = BDFDB.DataUtils.load(this, "hideInfo", "hideInfo");
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.cursorpointer} toggle-info" style="flex: 1 1 auto;"><svg class="toggle-infoarrow${infoHidden ? (" " + BDFDB.disCN.directionright) : ""}" width="12" height="12" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 10L12 15 17 10"></path></svg><div class="toggle-infotext" style="flex: 1 1 auto;">Information</div></div>`;
settingshtml += `<div class="BDFDB-settings-inner-list info-container" ${infoHidden ? "style='display:none;'" : ""}><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Case: Will replace words while comparing lowercase/uppercase. apple => apple, not APPLE or AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Case: Will replace words while ignoring lowercase/uppercase. apple => apple, APPLE and AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Exact: Will replace words that are exactly the replaceword. apple to pear => applepie stays applepie</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Exact: Will replace words anywhere they appear. apple to pear => applepieapple to pearpiepear</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Autoc: Will appear in the Autocomplete Menu (if enabled).</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Regex: Will treat the entered wordvalue as a regular expression. <a class="${BDFDB.disCNS.anchor + BDFDB.disCN.anchorunderlineonhover}" target="_blank" href="https://regexr.com/">Help</a></div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">File: If the replacevalue is a filepath it will try to upload the file located at the filepath.</div></div>`;
settingshtml += `</div>`;
@ -285,19 +285,19 @@ class ChatAliases {
toggleInfo (ele) {
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
}
onNativeContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.value && instance.props.value.trim() && !menu.querySelector(`${this.name}-contextMenuItem`)) {
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, returnvalue, instance.props.value.trim());
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.DataUtils.get(this, "settings")) this.appendItem(menu, returnvalue, instance.props.value.trim(), "addContextMenu");
}
}
onMessageContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(`${this.name}-contextMenuItem`)) {
let text = document.getSelection().toString().trim();
if (text && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, returnvalue, text);
if (text && BDFDB.DataUtils.get(this, "settings")) this.appendItem(menu, returnvalue, text, "addContextMenu");
}
}
@ -400,7 +400,7 @@ class ChatAliases {
lastword = lastword.charAt(0).toUpperCase() + lastword.slice(1);
}
}
if (lastword && BDFDB.getData("minAliasLength", this, "amounts") <= lastword.length) {
if (lastword && BDFDB.DataUtils.get(this, "amounts", "minAliasLength") <= lastword.length) {
let matchedaliases = {};
for (let word in this.aliases) {
let aliasdata = this.aliases[word];

View File

@ -134,7 +134,7 @@ class ChatFilter {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Remove all added words.</h3><button rtype="${rtype}" action="removeall" type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} remove-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
settingshtml += `<div class="${BDFDB.disCNS.divider + BDFDB.disCNS.dividerdefault + BDFDB.disCN.marginbottom40}"></div>`;
}
var infoHidden = BDFDB.loadData("hideInfo", this, "hideInfo");
var infoHidden = BDFDB.DataUtils.load(this, "hideInfo", "hideInfo");
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.cursorpointer} toggle-info" style="flex: 1 1 auto;"><svg class="toggle-infoarrow${infoHidden ? (" " + BDFDB.disCN.directionright) : ""}" width="12" height="12" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 10L12 15 17 10"></path></svg><div class="toggle-infotext" style="flex: 1 1 auto;">Information</div></div>`;
settingshtml += `<div class="BDFDB-settings-inner-list info-container" ${infoHidden ? "style='display:none;'" : ""}><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Case: Will block/censor words while comparing lowercase/uppercase. apple => apple, not APPLE or AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Case: Will block/censor words while ignoring lowercase/uppercase. apple => apple, APPLE and AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Exact: Will block/censor words that are exactly the selected word. apple => apple, not applepie or pineapple</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Exact: Will block/censor all words containing the selected word. apple => apple, applepie and pineapple</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Empty: Ignores the default and set replace word and removes the word/message instead.</div></div>`;
settingshtml += `</div>`;
@ -259,8 +259,8 @@ class ChatFilter {
var rtype = input.getAttribute("rtype");
var wordvalue = input.value;
if (rtype) {
var replaces = BDFDB.getData(rtype, this, "replaces");
BDFDB.saveData(rtype, wordvalue.trim(), this, "replaces");
var replaces = BDFDB.DataUtils.get(this, "replaces", rtype);
BDFDB.DataUtils.save(wordvalue.trim(), this, "replaces", rtype);
}
}
@ -277,19 +277,19 @@ class ChatFilter {
toggleInfo (ele) {
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
}
onNativeContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.value && instance.props.value.trim() && !menu.querySelector(`${this.name}-contextMenuItem`)) {
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, returnvalue, instance.props.value.trim());
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.DataUtils.get(this, "settings")) this.appendItem(menu, returnvalue, instance.props.value.trim(), "addContextMenu");
}
}
onMessageContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(`${this.name}-contextMenuItem`)) {
let text = document.getSelection().toString().trim();
if (text && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, returnvalue, text);
if (text && BDFDB.DataUtils.get(this, "settings")) this.appendItem(menu, returnvalue, text, "addContextMenu");
}
}

View File

@ -60,7 +60,7 @@ class CompleteTimestamps {
for (let key in formats) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCN.flexchild}" style="flex: 0 0 30%;">${this.defaults.formats[key].description}</h3><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.directioncolumn}" style="flex: 1 1 auto;"><input type="text" option="${key}" value="${formats[key]}" placeholder="${this.defaults.formats[key].value}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}"></div></div>`;
}
let infoHidden = BDFDB.loadData("hideInfo", this, "hideInfo");
let infoHidden = BDFDB.DataUtils.load(this, "hideInfo", "hideInfo");
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.cursorpointer} toggle-info" style="flex: 1 1 auto;"><svg class="toggle-infoarrow${infoHidden ? (" " + BDFDB.disCN.directionright) : ""}" width="12" height="12" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 10L12 15 17 10"></path></svg><div class="toggle-infotext" style="flex: 1 1 auto;">Information</div></div>`;
settingshtml += `<div class="BDFDB-settings-inner-list info-container" ${infoHidden ? "style='display:none;'" : ""}>`;
settingshtml += `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$hour will be replaced with the current hour</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$minute will be replaced with the current minutes</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$second will be replaced with the current seconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$msecond will be replaced with the current milliseconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$timemode will change $hour to a 12h format and will be replaced with AM/PM</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$year will be replaced with the current year</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$month will be replaced with the current month</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$day will be replaced with the current day</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameL will be replaced with the monthname in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameS will be replaced with the monthname in short format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayL will be replaced with the weekday in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayS will be replaced with the weekday in short format based on the Discord Language</div>`;
@ -109,22 +109,22 @@ class CompleteTimestamps {
this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}}, BDFDB.LanguageUtils.languages);
BDFDB.ListenerUtils.add(this, document, "mouseenter", BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messagecontent, e => {
if (BDFDB.getData("showOnHover", this, "settings")) {
if (BDFDB.DataUtils.get(this, "settings", "showOnHover")) {
let message = e.currentTarget;
let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, message);
if (!messagegroup || !messagegroup.tagName) return;
let info = this.getMessageData(message, messagegroup);
if (!info || !info.timestamp || !info.timestamp._i) return;
let choice = BDFDB.getData("creationDateLang", this, "choices");
let choice = BDFDB.DataUtils.get(this, "choices", "creationDateLang");
BDFDB.TooltipUtils.create(message, this.getTimestamp(this.languages[choice].id, info.timestamp._i), {type:"left", selector:"completetimestamp-tooltip"});
}
});
BDFDB.ListenerUtils.add(this, document, "mouseenter", BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messageedited, e => {
if (BDFDB.getData("changeForEdit", this, "settings")) {
if (BDFDB.DataUtils.get(this, "settings", "changeForEdit")) {
let marker = e.currentTarget;
let time = marker.getAttribute("datetime");
if (!time) return;
let choice = BDFDB.getData("creationDateLang", this, "choices");
let choice = BDFDB.DataUtils.get(this, "choices", "creationDateLang");
BDFDB.TooltipUtils.create(marker, this.getTimestamp(this.languages[choice].id, time), {type:"top", selector:"completetimestampedit-tooltip"});
}
});
@ -171,14 +171,14 @@ class CompleteTimestamps {
toggleInfo (ele) {
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(".languageName").innerText = this.languages[choice].name;
selectWrap.querySelector(".languageTimestamp").innerText = this.getTimestamp(this.languages[choice].id);
BDFDB.saveData(type, choice, this, "choices");
BDFDB.DataUtils.save(choice, this, "choices", type);
}
}
@ -187,14 +187,14 @@ class CompleteTimestamps {
}
processMessageGroup (instance, wrapper, returnvalue) {
if (BDFDB.getData("showInChat", this, "settings")) for (let stamp of wrapper.querySelectorAll("time[datetime]")) this.changeTimestamp(stamp);
if (BDFDB.DataUtils.get(this, "settings")) for (let stamp of wrapper.querySelectorAll("time[datetime]")) this.changeTimestamp(stamp, "showInChat");
}
processEmbed (instance, wrapper, returnvalue) {
let embed = BDFDB.ReactUtils.getValue(instance, "props.embed");
let footer = wrapper.querySelector(BDFDB.dotCN.embedfootertext);
if (footer && embed && embed.timestamp && BDFDB.getData("showInEmbed", this, "settings")) {
footer.lastChild.textContent = this.getTimestamp(this.languages[BDFDB.getData("creationDateLang", this, "choices")].id, embed.timestamp._i);
if (footer && embed && embed.timestamp && BDFDB.DataUtils.get(this, "settings", "showInEmbed")) {
footer.lastChild.textContent = this.getTimestamp(this.languages[BDFDB.DataUtils.get(this, "choices")].id, embed.timestamp._i, "creationDateLang");
}
}
@ -212,7 +212,7 @@ class CompleteTimestamps {
this.setMaxWidth();
BDFDB.addClass(stamp, "complete-timestamp");
stamp.parentElement.insertBefore(BDFDB.htmlToElement(`<span class="complete-timestamp-divider arabic-fix" style="display: inline !important; height: 0 !important; width: 0 !important; font-size: 0 !important; user-select: none !important;">ARABIC FIX</span>`), stamp);
BDFDB.setInnerText(stamp, this.getTimestamp(this.languages[BDFDB.getData("creationDateLang", this, "choices")].id, time));
BDFDB.setInnerText(stamp, this.getTimestamp(this.languages[BDFDB.DataUtils.get(this, "choices")].id, time), "creationDateLang");
}
}
@ -239,7 +239,7 @@ class CompleteTimestamps {
if (timestring && settings.forceZeros) timestring = this.addLeadingZeros(timestring);
}
else {
let ownformat = BDFDB.getData("ownFormat", this, "formats");
let ownformat = BDFDB.DataUtils.get(this, "formats", "ownFormat");
languageid = BDFDB.getDiscordLanguage().id;
let hour = timeobj.getHours(), minute = timeobj.getMinutes(), second = timeobj.getSeconds(), msecond = timeobj.getMilliseconds(), day = timeobj.getDate(), month = timeobj.getMonth()+1, timemode = "";
if (ownformat.indexOf("$timemode") > -1) {
@ -283,7 +283,7 @@ class CompleteTimestamps {
this.currentMode = BDFDB.DiscordUtils.getMode();
let timestamp = document.querySelector(BDFDB.dotCN.messagetimestampcompact);
if (timestamp) {
let choice = BDFDB.getData("creationDateLang", this, "choices");
let choice = BDFDB.DataUtils.get(this, "choices", "creationDateLang");
let testtimestamp = BDFDB.htmlToElement(`<time class="${timestamp.className}" style="width: auto !important;">${this.getTimestamp(this.languages[choice].id, new Date(253402124399995))}</time>`);
document.body.appendChild(testtimestamp);
let width = BDFDB.getRects(testtimestamp).width + 5;

View File

@ -80,7 +80,7 @@ class CreationDate {
for (let key in formats) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCN.flexchild}" style="flex: 0 0 30%;">${this.defaults.formats[key].description}</h3><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.directioncolumn}" style="flex: 1 1 auto;"><input type="text" option="${key}" value="${formats[key]}" placeholder="${this.defaults.formats[key].value}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}"></div></div>`;
}
let infoHidden = BDFDB.loadData("hideInfo", this, "hideInfo");
let infoHidden = BDFDB.DataUtils.load(this, "hideInfo", "hideInfo");
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.cursorpointer} toggle-info" style="flex: 1 1 auto;"><svg class="toggle-infoarrow${infoHidden ? (" " + BDFDB.disCN.directionright) : ""}" width="12" height="12" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 10L12 15 17 10"></path></svg><div class="toggle-infotext" style="flex: 1 1 auto;">Information</div></div>`;
settingshtml += `<div class="BDFDB-settings-inner-list info-container" ${infoHidden ? "style='display:none;'" : ""}>`;
settingshtml += `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$hour will be replaced with the current hour</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$minute will be replaced with the current minutes</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$second will be replaced with the current seconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$msecond will be replaced with the current milliseconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$timemode will change $hour to a 12h format and will be replaced with AM/PM</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$year will be replaced with the current year</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$month will be replaced with the current month</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$day will be replaced with the current day</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameL will be replaced with the monthname in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameS will be replaced with the monthname in short format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayL will be replaced with the weekday in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayS will be replaced with the weekday in short format based on the Discord Language</div>`;
@ -164,14 +164,14 @@ class CreationDate {
toggleInfo (ele) {
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(".languageName").innerText = this.languages[choice].name;
selectWrap.querySelector(".languageTimestamp").innerText = this.getTimestamp(this.languages[choice].id);
BDFDB.saveData(type, choice, this, "choices");
BDFDB.DataUtils.save(choice, this, "choices", type);
}
}
@ -180,13 +180,13 @@ class CreationDate {
}
processUserPopout (instance, wrapper, returnvalue) {
if (instance.props && instance.props.user && BDFDB.getData("addInUserPopout", this, "settings")) {
if (instance.props && instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserPopout")) {
this.addCreationDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), wrapper.parentElement);
}
}
processUserProfile (instance, wrapper, returnvalue) {
if (instance.props && instance.props.user && BDFDB.getData("addInUserProfil", this, "settings")) {
if (instance.props && instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserProfil")) {
this.addCreationDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userprofileheaderinfo), null);
}
}
@ -197,7 +197,7 @@ class CreationDate {
if (document.contains(container)) {
BDFDB.removeEles(container.querySelectorAll(".creationDate"));
if (BDFDB.ObjectUtils.is(container.CreationDateObserver)) container.CreationDateObserver.disconnect();
let choice = BDFDB.getData("creationDateLang", this, "choices");
let choice = BDFDB.DataUtils.get(this, "choices", "creationDateLang");
let nametag = container.querySelector(BDFDB.dotCN.nametag);
container.insertBefore(BDFDB.htmlToElement(`<div class="creationDate BDFDB-textscrollwrapper ${BDFDB.disCN.textrow}" style="max-width: ${BDFDB.getRects(BDFDB.getParentEle(popout ? BDFDB.dotCN.userpopoutheader : BDFDB.dotCN.userprofileheaderinfo, container)).width - 20}px !important; order: 8 !important;"><div class="BDFDB-textscroll">${this.labels.createdat_text.replace("{{time}}", this.getTimestamp(this.languages[choice].id, timestamp))}</div></div>`), nametag ? nametag.nextSibling : null);
BDFDB.initElements(container, this);
@ -229,7 +229,7 @@ class CreationDate {
if (timestring && settings.forceZeros) timestring = this.addLeadingZeros(timestring);
}
else {
let ownformat = BDFDB.getData("ownFormat", this, "formats");
let ownformat = BDFDB.DataUtils.get(this, "formats", "ownFormat");
languageid = BDFDB.getDiscordLanguage().id;
let hour = timeobj.getHours(), minute = timeobj.getMinutes(), second = timeobj.getSeconds(), msecond = timeobj.getMilliseconds(), day = timeobj.getDate(), month = timeobj.getMonth()+1, timemode = "";
if (ownformat.indexOf("$timemode") > -1) {

View File

@ -215,7 +215,7 @@ class DisplayServersAsChannels {
}
addCSS () {
var listwidth = BDFDB.getData("serverListWidth", this, "amounts");
var listwidth = BDFDB.DataUtils.get(this, "amounts", "serverListWidth");
BDFDB.appendLocalStyle("DSACStyle" + this.name, `
.DSAC-styled ${BDFDB.dotCN.guildswrapper},
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildsscrollerwrap},

View File

@ -161,10 +161,10 @@ class EditChannels {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
label: this.labels.submenu_resetsettings_text,
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-resetsettings-ContextMenuItem`,
disabled: !BDFDB.loadData(instance.props.channel.id, this, "channels"),
disabled: !BDFDB.DataUtils.load(this, "channels", instance.props.channel.id),
action: e => {
BDFDB.closeContextMenu(menu);
BDFDB.removeData(instance.props.channel.id, this, "channels");
BDFDB.DataUtils.remove(this, "channels", instance.props.channel.id);
this.forceUpdateAll();
}
})
@ -184,7 +184,7 @@ class EditChannels {
}
showChannelSettings (info) {
var data = BDFDB.loadData(info.id, this, "channels") || {};
var data = BDFDB.DataUtils.load(this, "channels", info.id) || {};
BDFDB.openModal(this, {
size: "MEDIUM",
@ -245,8 +245,8 @@ class EditChannels {
data.inheritColor = inheritcolorinput.checked;
let changed = false;
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.removeData(info.id, this, "channels");
else if (!BDFDB.equals(olddata, data) && (changed = true)) BDFDB.saveData(info.id, data, this, "channels");
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.DataUtils.remove(this, "channels", info.id);
else if (!BDFDB.equals(olddata, data) && (changed = true)) BDFDB.DataUtils.save(data, this, "channels", info.id);
if (changed) this.forceUpdateAll();
}
}]
@ -263,7 +263,7 @@ class EditChannels {
wrapper.querySelector("textarea").setAttribute("placeholder", BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", "#" + (data.name || channel.name)));
}
BDFDB.ListenerUtils.remove(this, textarea);
if (BDFDB.getData("changeInAutoComplete", this, "settings")) {
if (BDFDB.DataUtils.get(this, "settings", "changeInAutoComplete")) {
BDFDB.ListenerUtils.add(this, textarea, "keydown", e => {
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
@ -578,8 +578,8 @@ class EditChannels {
}
getChannelData (id, categoryid, wrapper) {
let data = BDFDB.loadData(id, this, "channels");
let categorydata = categoryid ? BDFDB.loadData(categoryid, this, "channels") : null;
let data = BDFDB.DataUtils.load(this, "channels", id);
let categorydata = categoryid ? BDFDB.DataUtils.load(this, "channels", categoryid) : null;
if (!data && (!categorydata || (categorydata && !categorydata.color && !categorydata.inheritColor))) return {};
if (!data) data = {};
data.color = data.color ? data.color : (categorydata && categorydata.color && categorydata.inheritColor ? categorydata.color : null);

View File

@ -99,7 +99,7 @@ class EditServers {
let guild = BDFDB.LibraryModules.GuildStore.getGuild(e.methodArguments[0].id);
if (guild) {
if (e.methodArguments[0].id == "410787888507256842") return guild.banner;
let data = BDFDB.loadData(guild.id, this, "servers");
let data = BDFDB.DataUtils.load(this, "servers", guild.id);
if (data && data.banner && !data.removeBanner) return data.banner;
}
return e.callOriginalMethod();
@ -152,10 +152,10 @@ class EditServers {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
label: this.labels.submenu_resetsettings_text,
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-resetsettings-ContextMenuItem`,
disabled: !BDFDB.loadData(instance.props.guild.id, this, "servers"),
disabled: !BDFDB.DataUtils.load(this, "servers", instance.props.guild.id),
action: e => {
BDFDB.closeContextMenu(menu);
BDFDB.removeData(instance.props.guild.id, this, "servers");
BDFDB.DataUtils.remove(this, "servers", instance.props.guild.id);
this.forceUpdateAll(instance.props.guild.id);
}
})
@ -224,7 +224,7 @@ class EditServers {
}
showServerSettings (info) {
var data = BDFDB.loadData(info.id, this, "servers") || {};
var data = BDFDB.DataUtils.load(this, "servers", info.id) || {};
BDFDB.openModal(this, {
size: "MEDIUM",
@ -402,8 +402,8 @@ class EditServers {
data.color4 = BDFDB.getSwatchColor(modal, 4);
let changed = false;
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.removeData(info.id, this, "servers");
else if (!BDFDB.equals(olddata, data) && (changed = true)) BDFDB.saveData(info.id, data, this, "servers");
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.DataUtils.remove(this, "servers", info.id);
else if (!BDFDB.equals(olddata, data) && (changed = true)) BDFDB.DataUtils.save(data, this, "servers", info.id);
if (changed) this.forceUpdateAll(info.id);
}
}]
@ -456,7 +456,7 @@ class EditServers {
guildname.style.setProperty("color", BDFDB.colorCONVERT(data.color2, "RGBA"), "important");
BDFDB.setInnerText(guildname, data.name || info.name);
}
if (data.name && BDFDB.containsClass(guildname, BDFDB.disCN.guildheadername) && BDFDB.getData("addOriginalTooltip", this, "settings")) {
if (data.name && BDFDB.containsClass(guildname, BDFDB.disCN.guildheadername) && BDFDB.DataUtils.get(this, "settings", "addOriginalTooltip")) {
guildname.mouseenterListenerEditChannels = () => {
BDFDB.TooltipUtils.create(guildname.parentElement, info.name, {type:"right", selector:"EditServers-tooltip", hide:true});
};
@ -548,7 +548,7 @@ class EditServers {
if (data.name || data.color3 || data.color4) {
let ServerFolders = BDFDB.BdUtils.getPlugin("ServerFolders", true);
let folder = ServerFolders ? ServerFolders.getFolderOfGuildId(info.id) : null;
let folderData = folder ? BDFDB.loadData(folder.folderId, "ServerFolders", "folders") : null;
let folderData = folder ? BDFDB.DataUtils.load("ServerFolders", "folders", folder.folderId) : null;
let color3 = data.color3 || (folderData && folderData.copyTooltipColor ? folderData.color3 : null);
let color4 = data.color4 || (folderData && folderData.copyTooltipColor ? folderData.color4 : null);
var isgradient3 = color3 && BDFDB.ObjectUtils.is(color3);
@ -590,7 +590,7 @@ class EditServers {
}
getGuildData (id, wrapper) {
let data = BDFDB.loadData(id, this, "servers");
let data = BDFDB.DataUtils.load(this, "servers", id);
this.setBanner(id, data);
if (!data) return {};
let allenabled = true, settings = BDFDB.DataUtils.get(this, "settings");

View File

@ -208,10 +208,10 @@ class EditUsers {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
label: this.labels.submenu_resetsettings_text,
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-resetsettings-ContextMenuItem`,
disabled: !BDFDB.loadData(instance.props.user.id, this, "users"),
disabled: !BDFDB.DataUtils.load(this, "users", instance.props.user.id),
action: e => {
BDFDB.closeContextMenu(menu);
BDFDB.removeData(instance.props.user.id, this, "users");
BDFDB.DataUtils.remove(this, "users", instance.props.user.id);
this.forceUpdateAll();
}
})
@ -231,7 +231,7 @@ class EditUsers {
}
showUserSettings (info) {
let data = BDFDB.loadData(info.id, this, "users") || {};
let data = BDFDB.DataUtils.load(this, "users", info.id) || {};
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id) || {};
BDFDB.openModal(this, {
@ -387,8 +387,8 @@ class EditUsers {
data.color4 = BDFDB.getSwatchColor(modal, 4);
let changed = false;
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.removeData(info.id, this, "users");
else if (!BDFDB.equals(olddata, data) && (changed = true)) BDFDB.saveData(info.id, data, this, "users");
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.DataUtils.remove(this, "users", info.id);
else if (!BDFDB.equals(olddata, data) && (changed = true)) BDFDB.DataUtils.save(data, this, "users", info.id);
if (changed) this.forceUpdateAll();
}
}]
@ -408,7 +408,7 @@ class EditUsers {
}
}
BDFDB.ListenerUtils.remove(this, textarea);
if (BDFDB.getData("changeInAutoComplete", this, "settings")) {
if (BDFDB.DataUtils.get(this, "settings", "changeInAutoComplete")) {
BDFDB.ListenerUtils.add(this, textarea, "keydown", e => {
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
@ -1083,7 +1083,7 @@ class EditUsers {
}
getUserData (id, wrapper) {
let data = BDFDB.loadData(id, this, "users");
let data = BDFDB.DataUtils.load(this, "users", id);
if (!data) {
delete wrapper.EditUsersCachedDataState;
return {};

View File

@ -231,7 +231,7 @@ class EmojiStatistics {
if (settings.enableEmojiHovering) {
BDFDB.ListenerUtils.add(this, wrapper, "mouseenter", BDFDB.dotCN.emojipickeremojiitem, e => {
let data = this.emojiToServerList[e.target.style.getPropertyValue("background-image").replace('url("',"").replace('")',"")];
if (data) BDFDB.TooltipUtils.create(e.target, `${BDFDB.encodeToHTML(data.emoji)}\n${BDFDB.encodeToHTML(data.server)}`, {type:"right",selector:"emoji-tooltip",delay:BDFDB.getData("hoverDelay", this, "amounts")});
if (data) BDFDB.TooltipUtils.create(e.target, `${BDFDB.encodeToHTML(data.emoji)}\n${BDFDB.encodeToHTML(data.server)}`, {type:"right",selector:"emoji-tooltip",delay:BDFDB.DataUtils.get(this, "amounts")}, "hoverDelay");
});
}
}

View File

@ -230,9 +230,9 @@ class FriendNotifications {
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".mute-checkbox", e => {
let config = e.currentTarget.getAttribute("config");
if (config) {
let notificationsound = BDFDB.getData(config, this, "notificationsounds");
let notificationsound = BDFDB.DataUtils.get(this, "notificationsounds", config);
notificationsound.mute = e.currentTarget.checked;
BDFDB.saveData(config, notificationsound, this, "notificationsounds");
BDFDB.DataUtils.save(notificationsound, this, "notificationsounds", config);
}
});
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".settings-avatar", e => {
@ -262,7 +262,7 @@ class FriendNotifications {
let id = e.currentTarget.getAttribute("user-id");
let group = e.currentTarget.getAttribute("group");
if (id && group) {
BDFDB.removeData(id, this, group);
BDFDB.DataUtils.remove(this, group, id);
BDFDB.removeEles(BDFDB.getParentEle(BDFDB.dotCN.hovercard, e.currentTarget));
this.SettingsUpdated = true;
}
@ -272,12 +272,12 @@ class FriendNotifications {
let id = idinput.value;
idinput.value = "";
if (friendIDs.includes(id)) BDFDB.NotificationUtils.toast("User is already a friend of yours. Please use the 'Friends' area to configure him/her.", {type:"error"});
else if (BDFDB.loadData(id, this, "nonfriends")) BDFDB.NotificationUtils.toast("User is already being observed as a 'Non-Friend'.", {type:"error"});
else if (BDFDB.DataUtils.load(this, "nonfriends")) BDFDB.NotificationUtils.toast("User is already being observed as a 'Non-Friend'.", {type:"error"}, id);
else {
let user = BDFDB.LibraryModules.UserStore.getUser(id);
if (user) {
let data = this.createDefaultConfig();
BDFDB.saveData(user.id, data, this, "nonfriends");
BDFDB.DataUtils.save(data, this, "nonfriends", user.id);
let hovercard = BDFDB.htmlToElement(this.createHoverCard(user, data, "nonfriends"));
settingspanel.querySelector(".nonfriend-list").appendChild(hovercard);
BDFDB.initElements(hovercard);
@ -338,7 +338,7 @@ class FriendNotifications {
// begin of own functions
createHoverCard (user, data, group) {
let EUdata = BDFDB.loadData(user.id, "EditUsers", "users") || {};
let EUdata = BDFDB.DataUtils.load("EditUsers", "users", user.id) || {};
var hovercardhtml = `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + 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.UserUtils.getAvatar(user.id))});"></div><div class="BDFDB-textscrollwrapper" style="flex: 1 1 auto;"><div class="BDFDB-textscroll">${BDFDB.encodeToHTML(EUdata.name || user.username)}</div></div>`;
for (let config in this.defaults.notificationstrings) {
hovercardhtml += `<div class="${BDFDB.disCNS.checkboxcontainer + BDFDB.disCN.marginreset} BDFDB-tablecheckbox" table-id="${group}" style="flex: 0 0 auto;"><label class="${BDFDB.disCN.checkboxwrapper}"><input user-id="${user.id}" group="${group}" config="${config}" type="checkbox" class="${BDFDB.disCN.checkboxinputdefault}"${data[config] ? " checked" : ""}><div class="${BDFDB.disCNS.checkbox + BDFDB.disCNS.flexcenter + BDFDB.disCNS.flex2 + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.checkboxround}"><svg name="Checkmark" width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><polyline stroke="transparent" stroke-width="2" points="3.5 9.5 7 13 15 5"></polyline></g></svg></div></label></div>`;
@ -350,12 +350,12 @@ class FriendNotifications {
let id = avatar.getAttribute("user-id");
let group = avatar.getAttribute("group");
if (id && group) {
let data = BDFDB.loadData(id, this, group) || this.createDefaultConfig();
let data = BDFDB.DataUtils.load(this, group) || this.createDefaultConfig(, id);
data.desktop = desktopon;
data.disabled = disableon;
BDFDB.toggleClass(avatar, "desktop", desktopon);
BDFDB.toggleClass(avatar, "disabled", disableon);
BDFDB.saveData(id, data, this, group);
BDFDB.DataUtils.save(data, this, group, id);
this.SettingsUpdated = true;
}
}
@ -382,9 +382,9 @@ class FriendNotifications {
let config = checkbox.getAttribute("config");
let group = checkbox.getAttribute("group");
if (id && config && group) {
let data = BDFDB.loadData(id, this, group) || this.createDefaultConfig();
let data = BDFDB.DataUtils.load(this, group) || this.createDefaultConfig(, id);
data[config] = checkbox.checked;
BDFDB.saveData(id, data, this, group);
BDFDB.DataUtils.save(data, this, group, id);
this.SettingsUpdated = true;
}
}
@ -405,13 +405,13 @@ class FriendNotifications {
}
createDefaultConfig () {
return Object.assign({desktop: false, disabled: BDFDB.getData("disableForNew", this, "settings")}, BDFDB.ObjectUtils.map(this.defaults.notificationstrings, "init"));
return Object.assign({desktop: false, disabled: BDFDB.DataUtils.get(this, "settings")}, BDFDB.ObjectUtils.map(this.defaults.notificationstrings, "init"), "disableForNew");
}
saveNotificationString (input) {
let config = input.getAttribute("config");
if (config) {
BDFDB.saveData(config, input.value, this, "notificationstrings");
BDFDB.DataUtils.save(input.value, this, "notificationstrings", config);
this.SettingsUpdated = true;
}
}
@ -421,10 +421,10 @@ class FriendNotifications {
if (config) {
let successSavedAudio = (parsedurl, parseddata) => {
if (parsedurl && parseddata) BDFDB.NotificationUtils.toast(`Sound was saved successfully.`, {type:"success"});
let notificationsound = BDFDB.getData(config, this, "notificationsounds");
let notificationsound = BDFDB.DataUtils.get(this, "notificationsounds", config);
notificationsound.url = parsedurl;
notificationsound.song = parseddata;
BDFDB.saveData(config, notificationsound, this, "notificationsounds");
BDFDB.DataUtils.save(notificationsound, this, "notificationsounds", config);
this.SettingsUpdated = true;
};
@ -491,7 +491,7 @@ class FriendNotifications {
let user = BDFDB.LibraryModules.UserStore.getUser(id);
let status = this.getStatusWithMobileAndActivity(id, users[id]);
if (user && this.userStatusStore[id] != status.statusname && users[id][status.statusname]) {
let EUdata = BDFDB.loadData(user.id, "EditUsers", "users") || {};
let EUdata = BDFDB.DataUtils.load("EditUsers", "users", user.id) || {};
let libstring = (this.defaults.notificationstrings[status.statusname].libstring ? BDFDB.LanguageUtils.LanguageStrings[this.defaults.notificationstrings[status.statusname].libstring] : (this.defaults.notificationstrings[status.statusname].statusname || "")).toLowerCase();
let string = notificationstrings[status.statusname] || "$user changed status to $status";
let toaststring = BDFDB.encodeToHTML(string).replace(/'{0,1}\$user'{0,1}/g, `<strong>${BDFDB.encodeToHTML(EUdata.name || user.username)}</strong>`).replace(/'{0,1}\$status'{0,1}/g, `<strong>${libstring}</strong>`);

View File

@ -300,7 +300,7 @@ class GoogleTranslateOption {
getLanguageChoice (direction, place) {
this.setLanguages();
var type = typeof place === "undefined" ? direction : direction.toLowerCase() + place.charAt(0).toUpperCase() + place.slice(1).toLowerCase();
var choice = BDFDB.getData(type, this, "choices");
var choice = BDFDB.DataUtils.get(this, "choices", type);
choice = this.languages[choice] ? choice : Object.keys(this.languages)[0];
choice = type.indexOf("output") > -1 && choice == "auto" ? "en" : choice;
return choice;
@ -316,7 +316,7 @@ class GoogleTranslateOption {
}
processChannelTextArea (instance, wrapper, returnvalue) {
if (instance.props && instance.props.type && instance.props.type == "normal" && !instance.props.disabled && !wrapper.querySelector(".translate-button") && BDFDB.getData("addTranslateButton", this, "settings")) {
if (instance.props && instance.props.type && instance.props.type == "normal" && !instance.props.disabled && !wrapper.querySelector(".translate-button") && BDFDB.DataUtils.get(this, "settings", "addTranslateButton")) {
let textarea = wrapper.querySelector("textarea");
if (textarea) {
var buttoncontainer = wrapper.querySelector(BDFDB.dotCN.textareapickerbuttons);
@ -342,7 +342,7 @@ class GoogleTranslateOption {
textarea.selectionEnd = text.length;
document.execCommand("insertText", false, "");
this.translateText(text, "message", (translation, input, output) => {
translation = !translation ? text : (BDFDB.getData("sendOriginalMessage", this, "settings") ? text + "\n\n" + translation : translation);
translation = !translation ? text : (BDFDB.DataUtils.get(this, "settings") ? text + "\n\n" + translation : translation, "sendOriginalMessage");
textarea.focus();
document.execCommand("insertText", false, translation + " ");
BDFDB.triggerSend(textarea);
@ -614,9 +614,9 @@ class GoogleTranslateOption {
BDFDB.ListenerUtils.addToChildren(menu, "click", BDFDB.dotCN.giffavoritebutton, e => {
let choice = e.currentTarget.parentElement.getAttribute("value");
if (choice) {
let favorize = !BDFDB.loadData(choice, this, "favorites");
if (favorize) BDFDB.saveData(choice, true, this, "favorites");
else BDFDB.removeData(choice, this, "favorites");
let favorize = !BDFDB.DataUtils.load(this, "favorites", choice);
if (favorize) BDFDB.DataUtils.save(true, this, "favorites", choice);
else BDFDB.DataUtils.remove(this, "favorites", choice);
this.setLanguages();
}
});
@ -632,8 +632,8 @@ class GoogleTranslateOption {
inputselect.querySelector(BDFDB.dotCN.title).innerText = this.languages[input].name;
outputselect.setAttribute("value", output);
outputselect.querySelector(BDFDB.dotCN.title).innerText = this.languages[output].name;
BDFDB.saveData("input" + place, input, this, "choices");
BDFDB.saveData("output" + place, output, this, "choices");
BDFDB.DataUtils.save(input, this, "choices", "input" + place);
BDFDB.DataUtils.save(output, this, "choices", "output" + place);
});
translatepopout.querySelectorAll(BDFDB.dotCN.select).forEach(selectWrap => {
@ -664,7 +664,7 @@ class GoogleTranslateOption {
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(BDFDB.dotCN.title).innerText = this.languages[choice].name;
BDFDB.saveData(type, choice, this, "choices");
BDFDB.DataUtils.save(choice, this, "choices", type);
}
}

View File

@ -116,7 +116,7 @@ class ImageZoom {
type,
defaultValue: BDFDB.mapRange([this.defaults.settings[type].min, this.defaults.settings[type].max], [0, 100], settings[type]),
onValueChange: value => {
BDFDB.saveData(type, Math.round(BDFDB.mapRange([0, 100], [this.defaults.settings[type].min, this.defaults.settings[type].max], value)), this, "settings");
BDFDB.DataUtils.save(Math.round(BDFDB.mapRange([0, 100], [this.defaults.settings[type].min, this.defaults.settings[type].max], value)), this, "settings", type);
},
onValueRender: value => {
setImmediate(() => {for (let slider of document.querySelectorAll(BDFDB.dotCN.contextmenuitemslider)) if (BDFDB.ReactUtils.getValue(slider, "return.memoizedProps.type") == type) {

View File

@ -81,7 +81,7 @@ class JoinedAtDate {
for (let key in formats) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCN.flexchild}" style="flex: 0 0 30%;">${this.defaults.formats[key].description}</h3><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.directioncolumn}" style="flex: 1 1 auto;"><input type="text" option="${key}" value="${formats[key]}" placeholder="${this.defaults.formats[key].value}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}"></div></div>`;
}
let infoHidden = BDFDB.loadData("hideInfo", this, "hideInfo");
let infoHidden = BDFDB.DataUtils.load(this, "hideInfo", "hideInfo");
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.cursorpointer} toggle-info" style="flex: 1 1 auto;"><svg class="toggle-infoarrow${infoHidden ? (" " + BDFDB.disCN.directionright) : ""}" width="12" height="12" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 10L12 15 17 10"></path></svg><div class="toggle-infotext" style="flex: 1 1 auto;">Information</div></div>`;
settingshtml += `<div class="BDFDB-settings-inner-list info-container" ${infoHidden ? "style='display:none;'" : ""}>`;
settingshtml += `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$hour will be replaced with the current hour</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$minute will be replaced with the current minutes</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$second will be replaced with the current seconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$msecond will be replaced with the current milliseconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$timemode will change $hour to a 12h format and will be replaced with AM/PM</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$year will be replaced with the current year</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$month will be replaced with the current month</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$day will be replaced with the current day</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameL will be replaced with the monthname in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameS will be replaced with the monthname in short format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayL will be replaced with the weekday in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayS will be replaced with the weekday in short format based on the Discord Language</div>`;
@ -165,14 +165,14 @@ class JoinedAtDate {
toggleInfo (ele) {
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(".languageName").innerText = this.languages[choice].name;
selectWrap.querySelector(".languageTimestamp").innerText = this.getTimestamp(this.languages[choice].id);
BDFDB.saveData(type, choice, this, "choices");
BDFDB.DataUtils.save(choice, this, "choices", type);
}
}
@ -181,13 +181,13 @@ class JoinedAtDate {
}
processUserPopout (instance, wrapper, returnvalue) {
if (instance.props && instance.props.user && BDFDB.getData("addInUserPopout", this, "settings")) {
if (instance.props && instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserPopout")) {
this.addJoinedAtDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), wrapper.parentElement);
}
}
processUserProfile (instance, wrapper, returnvalue) {
if (instance.props && instance.props.user && BDFDB.getData("addInUserProfil", this, "settings")) {
if (instance.props && instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserProfil")) {
this.addJoinedAtDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userprofileheaderinfo), null);
}
}
@ -201,7 +201,7 @@ class JoinedAtDate {
if (document.contains(container)) {
BDFDB.removeEles(container.querySelectorAll(".joinedAtDate"));
if (BDFDB.ObjectUtils.is(container.JoinedAtDateObserver)) container.JoinedAtDateObserver.disconnect();
let choice = BDFDB.getData("joinedAtDateLang", this, "choices");
let choice = BDFDB.DataUtils.get(this, "choices", "joinedAtDateLang");
let nametag = container.querySelector(BDFDB.dotCN.nametag);
container.insertBefore(BDFDB.htmlToElement(`<div class="joinedAtDate BDFDB-textscrollwrapper ${BDFDB.disCN.textrow}" style="max-width: ${BDFDB.getRects(BDFDB.getParentEle(popout ? BDFDB.dotCN.userpopoutheader : BDFDB.dotCN.userprofileheaderinfo, container)).width - 20}px !important; order: 7 !important;"><div class="BDFDB-textscroll">${this.labels.joinedat_text.replace("{{time}}", this.getTimestamp(this.languages[choice].id, timestamp))}</div></div>`), nametag ? nametag.nextSibling : null);
BDFDB.initElements(container, this);
@ -241,7 +241,7 @@ class JoinedAtDate {
if (timestring && settings.forceZeros) timestring = this.addLeadingZeros(timestring);
}
else {
let ownformat = BDFDB.getData("ownFormat", this, "formats");
let ownformat = BDFDB.DataUtils.get(this, "formats", "ownFormat");
languageid = BDFDB.getDiscordLanguage().id;
let hour = timeobj.getHours(), minute = timeobj.getMinutes(), second = timeobj.getSeconds(), msecond = timeobj.getMilliseconds(), day = timeobj.getDate(), month = timeobj.getMonth()+1, timemode = "";
if (ownformat.indexOf("$timemode") > -1) {

View File

@ -82,7 +82,7 @@ class LastMessageDate {
for (let key in formats) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCN.flexchild}" style="flex: 0 0 30%;">${this.defaults.formats[key].description}</h3><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.directioncolumn}" style="flex: 1 1 auto;"><input type="text" option="${key}" value="${formats[key]}" placeholder="${this.defaults.formats[key].value}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}"></div></div>`;
}
let infoHidden = BDFDB.loadData("hideInfo", this, "hideInfo");
let infoHidden = BDFDB.DataUtils.load(this, "hideInfo", "hideInfo");
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.cursorpointer} toggle-info" style="flex: 1 1 auto;"><svg class="toggle-infoarrow${infoHidden ? (" " + BDFDB.disCN.directionright) : ""}" width="12" height="12" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 10L12 15 17 10"></path></svg><div class="toggle-infotext" style="flex: 1 1 auto;">Information</div></div>`;
settingshtml += `<div class="BDFDB-settings-inner-list info-container" ${infoHidden ? "style='display:none;'" : ""}>`;
settingshtml += `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$hour will be replaced with the current hour</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$minute will be replaced with the current minutes</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$second will be replaced with the current seconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$msecond will be replaced with the current milliseconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$timemode will change $hour to a 12h format and will be replaced with AM/PM</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$year will be replaced with the current year</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$month will be replaced with the current month</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$day will be replaced with the current day</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameL will be replaced with the monthname in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameS will be replaced with the monthname in short format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayL will be replaced with the weekday in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayS will be replaced with the weekday in short format based on the Discord Language</div>`;
@ -172,14 +172,14 @@ class LastMessageDate {
toggleInfo (ele) {
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
BDFDB.toggleEles(ele.nextElementSibling);
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
}
saveSelectChoice (selectWrap, type, choice) {
if (type && choice) {
selectWrap.querySelector(".languageName").innerText = this.languages[choice].name;
selectWrap.querySelector(".languageTimestamp").innerText = this.getTimestamp(this.languages[choice].id);
BDFDB.saveData(type, choice, this, "choices");
BDFDB.DataUtils.save(choice, this, "choices", type);
}
}
@ -188,13 +188,13 @@ class LastMessageDate {
}
processUserPopout (instance, wrapper, returnvalue) {
if (instance.props && instance.props.user && BDFDB.getData("addInUserPopout", this, "settings")) {
if (instance.props && instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserPopout")) {
this.addLastMessageDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), wrapper.parentElement);
}
}
processUserProfile (instance, wrapper, returnvalue) {
if (instance.props && instance.props.user && BDFDB.getData("addInUserProfil", this, "settings")) {
if (instance.props && instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserProfil")) {
this.addLastMessageDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userprofileheaderinfo), null);
}
}
@ -210,7 +210,7 @@ class LastMessageDate {
if (document.contains(container)) {
BDFDB.removeEles(container.querySelectorAll(".lastMessageDate"));
if (BDFDB.ObjectUtils.is(container.LastMessageDateObserver)) container.LastMessageDateObserver.disconnect();
let choice = BDFDB.getData("lastMessageDateLang", this, "choices");
let choice = BDFDB.DataUtils.get(this, "choices", "lastMessageDateLang");
let nametag = container.querySelector(BDFDB.dotCN.nametag);
container.insertBefore(BDFDB.htmlToElement(`<div class="lastMessageDate BDFDB-textscrollwrapper ${BDFDB.disCN.textrow}" style="max-width: ${BDFDB.getRects(BDFDB.getParentEle(popout ? BDFDB.dotCN.userpopoutheader : BDFDB.dotCN.userprofileheaderinfo, container)).width - 20}px !important; order: 6 !important;"><div class="BDFDB-textscroll">${this.labels.lastmessage_text.replace("{{time}}", timestamp == "never" ? "---" : this.getTimestamp(this.languages[choice].id, timestamp))}</div></div>`), nametag ? nametag.nextSibling : null);
BDFDB.initElements(container, this);
@ -257,7 +257,7 @@ class LastMessageDate {
if (timestring && settings.forceZeros) timestring = this.addLeadingZeros(timestring);
}
else {
let ownformat = BDFDB.getData("ownFormat", this, "formats");
let ownformat = BDFDB.DataUtils.get(this, "formats", "ownFormat");
languageid = BDFDB.getDiscordLanguage().id;
let hour = timeobj.getHours(), minute = timeobj.getMinutes(), second = timeobj.getSeconds(), msecond = timeobj.getMilliseconds(), day = timeobj.getDate(), month = timeobj.getMonth()+1, timemode = "";
if (ownformat.indexOf("$timemode") > -1) {

View File

@ -200,9 +200,9 @@ class MessageUtilities {
if (type && choice) {
selectWrap.querySelector(BDFDB.dotCN.title).innerText = this.clickMap[choice];
type = type.split(" ");
let binding = BDFDB.getData(type[0], this, "bindings");
let binding = BDFDB.DataUtils.get(this, "bindings", type[0]);
binding[type[1]] = parseInt(choice);
BDFDB.saveData(type[0], binding, this, "bindings");
BDFDB.DataUtils.save(binding, this, "bindings", type[0]);
}
}
@ -232,9 +232,9 @@ class MessageUtilities {
var stopRecording = e => {
document.removeEventListener("mousedown", stopRecording);
document.removeEventListener("keydown", saveRecording);
let binding = BDFDB.getData(action, this, "bindings");
let binding = BDFDB.DataUtils.get(this, "bindings", action);
binding[option] = parseInt(recorderWrap.getAttribute("value"));
BDFDB.saveData(action, binding, this, "bindings");
BDFDB.DataUtils.save(binding, this, "bindings", action);
setTimeout(() => {
BDFDB.removeClass(recorderWrap, BDFDB.disCN.hotkeyrecording);
BDFDB.addClass(recorderWrap, BDFDB.disCN.hotkeyhasvalue);
@ -254,9 +254,9 @@ class MessageUtilities {
let option = recorderWrap.getAttribute("option");
recorderWrap.setAttribute("value", 0);
recorderInput.setAttribute("value", this.keyboardMap[0]);
let binding = BDFDB.getData(action, this, "bindings");
let binding = BDFDB.DataUtils.get(this, "bindings", action);
binding[option] = parseInt(recorderWrap.getAttribute("value"));
BDFDB.saveData(action, binding, this, "bindings");
BDFDB.DataUtils.save(binding, this, "bindings", action);
}
onClick (e, click, name) {
@ -313,7 +313,7 @@ class MessageUtilities {
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
if ((channel && BDFDB.UserUtils.can("MANAGE_MESSAGES")) || message.author.id == BDFDB.UserUtils.me.id && message.type != 1 && message.type != 2 && message.type != 3) {
BDFDB.LibraryModules.MessageUtils.deleteMessage(message.channel_id, message.id, message.state != "SENT");
if (BDFDB.getData(action, this, "toasts")) BDFDB.NotificationUtils.toast("Message has been deleted.", {type:"success"});
if (BDFDB.DataUtils.get(this, "toasts")) BDFDB.NotificationUtils.toast("Message has been deleted.", {type:"success"}, action);
}
}
}
@ -321,7 +321,7 @@ class MessageUtilities {
doEdit ({messagediv, pos, message}, action) {
if (message.author.id == BDFDB.UserUtils.me.id && !messagediv.querySelector("textarea")) {
BDFDB.LibraryModules.MessageUtils.startEditMessage(message.channel_id, message.id, message.content);
if (BDFDB.getData(action, this, "toasts")) BDFDB.NotificationUtils.toast("Started editing.", {type:"success"});
if (BDFDB.DataUtils.get(this, "toasts")) BDFDB.NotificationUtils.toast("Started editing.", {type:"success"}, action);
}
}
@ -329,7 +329,7 @@ class MessageUtilities {
let reactButton = messagediv.querySelector(BDFDB.dotCN.emojipickerbutton);
if (reactButton) {
reactButton.click();
if (BDFDB.getData(action, this, "toasts")) BDFDB.NotificationUtils.toast("Reaction popout has been opened.", {type:"success"});
if (BDFDB.DataUtils.get(this, "toasts")) BDFDB.NotificationUtils.toast("Reaction popout has been opened.", {type:"success"}, action);
}
}
@ -339,11 +339,11 @@ class MessageUtilities {
if (channel && (channel.type == 1 || channel.type == 3 || BDFDB.UserUtils.can("MANAGE_MESSAGES")) && message.type == 0) {
if (message.pinned) {
BDFDB.LibraryModules.MessagePinUtils.unpinMessage(channel, message.id);
if (BDFDB.getData(action, this, "toasts")) BDFDB.NotificationUtils.toast("Message has been unpinned.", {type:"error"});
if (BDFDB.DataUtils.get(this, "toasts")) BDFDB.NotificationUtils.toast("Message has been unpinned.", {type:"error"}, action);
}
else {
BDFDB.LibraryModules.MessagePinUtils.pinMessage(channel, message.id);
if (BDFDB.getData(action, this, "toasts")) BDFDB.NotificationUtils.toast("Message has been pinned.", {type:"success"});
if (BDFDB.DataUtils.get(this, "toasts")) BDFDB.NotificationUtils.toast("Message has been pinned.", {type:"success"}, action);
}
}
}
@ -352,7 +352,7 @@ class MessageUtilities {
doCopyRaw ({messagediv, pos, message}, action) {
if (message.content) {
BDFDB.LibraryRequires.electron.clipboard.write({text:message.content});
if (BDFDB.getData(action, this, "toasts")) BDFDB.NotificationUtils.toast("Raw message content has been copied.", {type:"success"});
if (BDFDB.DataUtils.get(this, "toasts")) BDFDB.NotificationUtils.toast("Raw message content has been copied.", {type:"success"}, action);
}
}
@ -360,7 +360,7 @@ class MessageUtilities {
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
if (channel) {
BDFDB.LibraryRequires.electron.clipboard.write({text:`https://discordapp.com/channels/${channel.guild_id}/${channel.id}/${message.id}`});
if (BDFDB.getData(action, this, "toasts")) BDFDB.NotificationUtils.toast("Messagelink has been copied.", {type:"success"});
if (BDFDB.DataUtils.get(this, "toasts")) BDFDB.NotificationUtils.toast("Messagelink has been copied.", {type:"success"}, action);
}
}
@ -401,7 +401,7 @@ class MessageUtilities {
onKeyDown (e, key, name) {
if (!this.isEventFired(name)) {
this.fireEvent(name);
if (key == 27 && BDFDB.getData("clearOnEscape", this, "settings")) {
if (key == 27 && BDFDB.DataUtils.get(this, "settings", "clearOnEscape")) {
let instance = BDFDB.ReactUtils.findOwner(BDFDB.getParentEle(BDFDB.dotCNS.chat + "form", e.currentTarget), {name:"ChannelTextAreaForm", up:true});
if (instance) instance.setState({textValue:""});
}
@ -413,7 +413,7 @@ class MessageUtilities {
if (!action) return null;
let str = "", settings = BDFDB.DataUtils.get(this, "settings");
if (settings.addHints && settings[action]) {
let binding = BDFDB.getData(action, this, "bindings");
let binding = BDFDB.DataUtils.get(this, "bindings", action);
if (binding) for (let type in binding) {
let typename = type == "click" ? this.clickMap[binding[type]] : this.keyboardMap[binding[type]];
if (typename && typename != "NONE") str += typename + "+";

View File

@ -456,7 +456,7 @@ class NotificationSounds {
loadChoices () {
for (var type in this.types) {
var choice = BDFDB.loadData(type, this, "choices") || {}, songFound = false;
var choice = BDFDB.DataUtils.load(this, "choices", type) || {}, songFound = false;
for (var category in this.audios) if (choice.category == category) for (var song in this.audios[category]) if (choice.song == song) {
songFound = true;
break;
@ -470,7 +470,7 @@ class NotificationSounds {
saveChoice (type, play) {
if (!this.choices[type]) return;
BDFDB.saveData(type, this.choices[type], this, "choices");
BDFDB.DataUtils.save(this.choices[type], this, "choices", type);
if (play) {
this.SettingsUpdated = true;
this.playAudio(type, this.settingsaudio);

View File

@ -158,7 +158,7 @@ class OldTitleBar {
this.window = BDFDB.LibraryRequires.electron.remote.getCurrentWindow();
this.patchMainScreen(BDFDB.getData("displayNative", this, "settings"));
this.patchMainScreen(BDFDB.DataUtils.get(this, "settings"), "displayNative");
BDFDB.addClass([document.body,document.querySelector(BDFDB.dotCN.titlebar)], "hidden-by-OTB");
@ -209,7 +209,7 @@ class OldTitleBar {
addTitleBar () {
BDFDB.removeEles(".headerbarOTB");
var settings = BDFDB.DataUtils.get(this, "settings");
if (BDFDB.getData("addOldBar", this, "settings")) {
if (BDFDB.DataUtils.get(this, "settings", "addOldBar")) {
var headerbar = BDFDB.htmlToElement(`<span class="headerbarOTB ${BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}"></span>`);
this.createButtons(headerbar);
let headerbaricon = document.querySelector(BDFDB.dotCN.channelheaderchildren);
@ -220,7 +220,7 @@ class OldTitleBar {
addSettingsTitleBar (settingspane) {
BDFDB.removeEles(".settingsTitlebarOTB");
if (BDFDB.getData("addToSettings", this, "settings")) {
if (BDFDB.DataUtils.get(this, "settings", "addToSettings")) {
BDFDB.addClass(document.body, "settingsTitlebarOTB-added");
var settingsbar = BDFDB.htmlToElement(`<div class="settingsTitlebarOTB ${BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifyend + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}"></div>`);
this.createButtons(settingsbar);
@ -230,7 +230,7 @@ class OldTitleBar {
}
createButtons (bar) {
if (BDFDB.getData("reloadButton", this, "settings")) {
if (BDFDB.DataUtils.get(this, "settings", "reloadButton")) {
bar.appendChild(BDFDB.htmlToElement(this.dividerMarkup));
var reloadbutton = BDFDB.htmlToElement(this.reloadButtonMarkup);
bar.appendChild(reloadbutton);

View File

@ -128,20 +128,20 @@ class OwnerTag {
}
processMemberListItem (instance, wrapper, returnvalue) {
if (instance.props && BDFDB.getData("addInMemberList", this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.namecontainernamewrapper), "list", BDFDB.disCN.bottagmember, null);
if (instance.props && BDFDB.DataUtils.get(this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.namecontainernamewrapper), "list", BDFDB.disCN.bottagmember, null, "addInMemberList");
}
processUserPopout (instance, wrapper, returnvalue) {
if (instance.props && BDFDB.getData("addInUserPopout", this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "popout", BDFDB.disCN.bottagnametag, wrapper);
if (instance.props && BDFDB.DataUtils.get(this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "popout", BDFDB.disCN.bottagnametag, wrapper, "addInUserPopout");
}
processUserProfile (instance, wrapper, returnvalue) {
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);
if (instance.props && BDFDB.DataUtils.get(this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "profile", BDFDB.disCNS.bottagnametag + BDFDB.disCN.userprofilebottag, wrapper, "addInUserProfil");
}
processMessageUsername (instance, wrapper, returnvalue, methodnames) {
let message = BDFDB.ReactUtils.getValue(instance, "props.message");
if (message && BDFDB.getData("addInChatWindow", this, "settings")) {
if (message && BDFDB.DataUtils.get(this, "settings", "addInChatWindow")) {
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
if (username) {
let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper);
@ -170,7 +170,7 @@ class OwnerTag {
if (!(isowner || (settings.addForAdmins && BDFDB.UserUtils.can("ADMINISTRATOR", info.id)))) return;
let member = settings.useRoleColor ? (BDFDB.LibraryModules.MemberStore.getMember(channel.guild_id, info.id) || {}) : {};
if (!settings.useCrown) {
let tag = BDFDB.htmlToElement(`<span class="owner-tag ${isowner ? "owner-tag-owner" : "owner-tag-admin"} owner-${type}-tag ${(settings.useRoleColor ? "owner-tag-rolecolor " : "") + BDFDB.disCN.bottag + (selector ? (" " + selector) : "")}" style="order: 10 !important;">${BDFDB.getData(isowner ? "ownTagName" : "ownAdminTagName", this, "inputs")}</span>`);
let tag = BDFDB.htmlToElement(`<span class="owner-tag ${isowner ? "owner-tag-owner" : "owner-tag-admin"} owner-${type}-tag ${(settings.useRoleColor ? "owner-tag-rolecolor " : "") + BDFDB.disCN.bottag + (selector ? (" " + selector) : "")}" style="order: 10 !important;">${BDFDB.DataUtils.get(this, "inputs", isowner ? "ownTagName" : "ownAdminTagName")}</span>`);
let invert = container && container.firstElementChild && !(BDFDB.containsClass(container.firstElementChild, BDFDB.disCN.userpopoutheadernormal) || BDFDB.containsClass(container.firstElementChild, BDFDB.disCN.userprofiletopsectionnormal));
BDFDB.addClass(tag, invert ? BDFDB.disCN.bottaginvert : BDFDB.disCN.bottagregular);
let EditUsersData = BDFDB.BdUtils.isPluginEnabled("EditUsers") ? BDFDB.BdUtils.getPlugin("EditUsers").getUserData(info.id, wrapper) : {};

View File

@ -425,7 +425,7 @@ class PersonalPins {
let timestamp = message.querySelector(BDFDB.dotCN.messagetimestampcozy);
timestamp.innerText = date.toLocaleString(BDFDB.getDiscordLanguage().id);
timestamp.setAttribute("datetime", date);
if (BDFDB.BdUtils.isPluginEnabled("CompleteTimestamps") && BDFDB.loadData("showInChat", "CompleteTimestamps", "settings")) {
if (BDFDB.BdUtils.isPluginEnabled("CompleteTimestamps") && BDFDB.DataUtils.load("CompleteTimestamps", "settings"), "showInChat") {
BDFDB.BdUtils.getPlugin("CompleteTimestamps").changeTimestamp(timestamp);
}
message.querySelector(BDFDB.dotCN.messagemarkup).innerHTML = noteData.markup.replace(`<span class="edited">`,`<span class="${BDFDB.disCN.messageedited}">`);

View File

@ -260,7 +260,7 @@ class PinDMs {
else {
BDFDB.removeEles(document.querySelector(`.pinned-dm[channelid="${id}"]`));
this.unhideNativeDM(id);
BDFDB.removeData(id, this, "pinnedRecents");
BDFDB.DataUtils.remove(this, "pinnedRecents", id);
this.updatePinnedPositions("pinnedRecents");
}
}
@ -434,7 +434,7 @@ class PinDMs {
BDFDB.removeClass(div, "pinned");
div.removeAttribute("channelid");
}
BDFDB.removeData(id, this, "pinnedDMs");
BDFDB.DataUtils.remove(this, "pinnedDMs", id);
this.updatePinnedPositions("pinnedDMs");
let dmsscrollerinstance = BDFDB.ReactUtils.getInstance(document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller));
if (dmsscrollerinstance) {
@ -535,7 +535,7 @@ class PinDMs {
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
BDFDB.removeEles(dmdiv);
this.unhideNativeDM(id);
BDFDB.removeData(id, this, "pinnedRecents");
BDFDB.DataUtils.remove(this, "pinnedRecents", id);
this.updatePinnedPositions("pinnedRecents");
}
})
@ -622,7 +622,7 @@ class PinDMs {
let pinneddmdiv = document.querySelector(`.pinned-dm[channelid="${id}"]`);
if (Node.prototype.isPrototypeOf(pinneddmdiv)) {
let count = BDFDB.LibraryModules.UnreadChannelUtils.getUnreadCount(id);
let showpin = BDFDB.getData("showPinIcon", this, "settings");
let showpin = BDFDB.DataUtils.get(this, "settings", "showPinIcon");
let dmdiv = BDFDB.DmUtils.getDiv(id);
let pinneddmiconwrapper = pinneddmdiv.querySelector(BDFDB.dotCN.guildiconwrapper);

View File

@ -250,7 +250,7 @@ class PluginRepo {
}
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">Add Plugin:</h3><input type="text" placeholder="Insert Raw Github Link of Plugin (https://raw.githubusercontent.com/...)" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}" id="input-pluginurl" style="flex: 1 1 auto;"><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} btn-add btn-addplugin" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}"></div></button></div>`;
settingshtml += `<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Your additional Plugin List:</h3><div class="BDFDB-settings-inner-list plugin-list ${BDFDB.disCN.marginbottom8}">`;
var ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
var ownlist = BDFDB.DataUtils.load(this, "ownlist", "ownlist") || [];
for (let url of ownlist) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.margintop4 + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis} entryurl">${url}</div></div><div class="${BDFDB.disCN.hovercardbutton} remove-plugin"></div></div>`;
}
@ -370,10 +370,10 @@ class PluginRepo {
if (pluginUrlInput && pluginList) {
var url = pluginUrlInput.value;
pluginUrlInput.value = null;
var ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
var ownlist = BDFDB.DataUtils.load(this, "ownlist", "ownlist") || [];
if (!ownlist.includes(url)) {
ownlist.push(url);
BDFDB.saveData("ownlist", ownlist, this, "ownlist");
BDFDB.DataUtils.save(ownlist, this, "ownlist", "ownlist");
let entry = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.margintop4 + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis} entryurl">${url}</div></div><div class="${BDFDB.disCN.hovercardbutton} remove-plugin"></div></div>`);
BDFDB.ListenerUtils.addToChildren(entry, "click", ".remove-plugin", e => {this.removePluginFromOwnList(e);});
pluginList.appendChild(entry);
@ -385,14 +385,14 @@ class PluginRepo {
var entry = e.currentTarget.parentElement;
var url = entry.querySelector(".entryurl").textContent;
entry.remove();
var ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
var ownlist = BDFDB.DataUtils.load(this, "ownlist", "ownlist") || [];
BDFDB.ArrayUtils.remove(ownlist, url);
BDFDB.saveData("ownlist", ownlist, this, "ownlist");
BDFDB.DataUtils.save(ownlist, this, "ownlist", "ownlist");
}
removeAllFromOwnList (settingspanel) {
BDFDB.openConfirmModal(this, "Are you sure you want to remove all added Plugins from your own list?", () => {
BDFDB.saveData("ownlist", [], this, "ownlist");
BDFDB.DataUtils.save([], this, "ownlist", "ownlist");
BDFDB.removeEles(settingspanel.querySelector(BDFDB.dotCN.hovercard));
});
}
@ -411,7 +411,7 @@ class PluginRepo {
pluginRepoModal.querySelector("#input-hideoutdated").checked = hiddenSettings.outdated && !options.showOnlyOutdated;
pluginRepoModal.querySelector("#input-hidedownloadable").checked = hiddenSettings.downloadable || options.showOnlyOutdated;
if (!BDFDB.BdUtils.isAutoLoadEnabled()) pluginRepoModal.querySelector("#RNMoption").remove();
else pluginRepoModal.querySelector("#input-rnmstart").checked = BDFDB.loadData("RNMstart", this, "RNMstart");
else pluginRepoModal.querySelector("#input-rnmstart").checked = BDFDB.DataUtils.load(this, "RNMstart", "RNMstart");
if (options.forcedSort && this.sortings.sort[options.forcedSort]) {
var sortinput = pluginRepoModal.querySelector(".sort-filter " + BDFDB.dotCN.quickselectvalue);
@ -434,10 +434,10 @@ class PluginRepo {
});
BDFDB.ListenerUtils.addToChildren(pluginRepoModal, "change", ".hide-checkbox", e => {
pluginRepoModal.updateHidden = true;
BDFDB.saveData(e.currentTarget.value, e.currentTarget.checked, this, "hidden");
BDFDB.DataUtils.save(e.currentTarget.checked, this, "hidden", e.currentTarget.value);
});
BDFDB.ListenerUtils.addToChildren(pluginRepoModal, "change", "#input-rnmstart", e => {
BDFDB.saveData("RNMstart", e.currentTarget.checked, this, "RNMstart");
BDFDB.DataUtils.save(e.currentTarget.checked, this, "RNMstart", "RNMstart");
});
BDFDB.ListenerUtils.addToChildren(pluginRepoModal, "click", ".sort-filter", e => {
BDFDB.createSortPopout(e.currentTarget, this.sortPopoutMarkup, () => {this.sortEntries(pluginRepoModal);});
@ -498,8 +498,8 @@ class PluginRepo {
favbutton.addEventListener("click", e => {
let favorize = data.fav == 1;
data.fav = favorize ? 0 : 1;
if (favorize) BDFDB.saveData(data.url, true, this, "favorites");
else BDFDB.removeData(data.url, this, "favorites");
if (favorize) BDFDB.DataUtils.save(true, this, "favorites", data.url);
else BDFDB.DataUtils.remove(this, "favorites", data.url);
pluginRepoModal.entries[data.url] = data;
});
let gitbutton = entry.querySelector(".gitIcon");
@ -591,12 +591,12 @@ class PluginRepo {
var frame, framerunning = false, framequeue = [], outdated = 0, newentries = 0, i = 0;
var tags = ["getName", "getVersion", "getAuthor", "getDescription"];
var seps = ["\"", "\'", "\`"];
var newentriesdata = BDFDB.DataUtils.load(this, "newentriesdata"), ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
var newentriesdata = BDFDB.DataUtils.load(this, "newentriesdata"), ownlist = BDFDB.DataUtils.load(this, "ownlist", "ownlist") || [];
this.cachedPlugins = (newentriesdata.urlbase64 ? atob(newentriesdata.urlbase64).split("\n") : []).concat(ownlist);
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/PluginRepo/res/PluginList.txt", (error, response, result) => {
if (!error && result) {
result = result.replace(/[\r\t]/g, "");
BDFDB.saveData("urlbase64", btoa(result), this, "newentriesdata");
BDFDB.DataUtils.save(btoa(result), this, "newentriesdata", "urlbase64");
this.loadedPlugins = {};
this.grabbedPlugins = result.split("\n").filter(n => n);
this.foundPlugins = this.grabbedPlugins.concat(ownlist);

View File

@ -203,7 +203,7 @@ class ReadAllNotificationsButton {
processRecentMentions (instance, wrapper, returnvalue) {
BDFDB.removeEles(".RAMbutton");
if (instance.props && instance.props.popoutName == "RECENT_MENTIONS_POPOUT" && BDFDB.getData("addClearButton", this, "settings")) {
if (instance.props && instance.props.popoutName == "RECENT_MENTIONS_POPOUT" && BDFDB.DataUtils.get(this, "settings", "addClearButton")) {
let recentmentionstitle = wrapper.querySelector(BDFDB.dotCN.messagespopouttitle);
if (recentmentionstitle) {
let ranbutton = BDFDB.htmlToElement(this.RAMbuttonMarkup);

View File

@ -182,7 +182,7 @@ class RemoveNicknames {
if (!info) return null;
let settings = BDFDB.DataUtils.get(this, "settings");
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id) || {};
let EditUsersData = (BDFDB.BdUtils.isPluginEnabled("EditUsers") ? BDFDB.loadData(info.id, "EditUsers", "users") : null) || {};
let EditUsersData = (BDFDB.BdUtils.isPluginEnabled("EditUsers") ? BDFDB.DataUtils.load("EditUsers", "users") : null, info.id) || {};
if (this.reseting || !member.nick || info.id == BDFDB.UserUtils.me.id && !settings.replaceOwn || info.bot && !settings.replaceBots || this.ignoreElement(wrapper)) return EditUsersData.name || member.nick || info.username;
var username = EditUsersData.name || info.username;
return settings.addNickname ? (settings.swapPositions ? (member.nick + " (" + username + ")") : (username + " (" + member.nick + ")")) : username;

View File

@ -260,7 +260,7 @@ class RepoControls {
else BDFDB.NotificationUtils.toast(`Successfully deleted ${type} "${name}".`, {type:"success"});
});
};
if (!BDFDB.getData("confirmDelete", this, "settings")) deleteFile();
if (!BDFDB.DataUtils.get(this, "settings")) deleteFile(, "confirmDelete");
else BDFDB.openConfirmModal(this, `Are you sure you want to delete the ${type} "${name}"?`, () => {
deleteFile();
});
@ -307,13 +307,13 @@ class RepoControls {
});
BDFDB.ListenerUtils.addToChildren(repocontrols, "click", ".sort-filter", e => {
BDFDB.createSortPopout(e.currentTarget, this.sortPopoutMarkup, () => {
BDFDB.saveData("sort", sortfilter.getAttribute("option"), this, "sortings");
BDFDB.DataUtils.save(sortfilter.getAttribute("option"), this, "sortings", "sort");
this.sortEntries(container, repocontrols);
});
});
BDFDB.ListenerUtils.addToChildren(repocontrols, "click", ".order-filter", e => {
BDFDB.createSortPopout(e.currentTarget, this.orderPopoutMarkup, () => {
BDFDB.saveData("order", orderfilter.getAttribute("option"), this, "sortings");
BDFDB.DataUtils.save(orderfilter.getAttribute("option"), this, "sortings", "order");
this.sortEntries(container, repocontrols);
});
});

View File

@ -107,14 +107,14 @@ class ReverseImageSearch {
onGuildContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.guild && instance.props.target) {
let guildicon = BDFDB.containsClass(instance.props.target, BDFDB.disCN.avataricon) ? instance.props.target : instance.props.target.querySelector(BDFDB.dotCN.guildicon);
if (guildicon && BDFDB.getData("addGuildIconEntry", this, "settings")) this.appendItem(menu, returnvalue, guildicon.tagName == "IMG" ? guildicon.getAttribute("src") : guildicon.style.getPropertyValue("background-image"));
if (guildicon && BDFDB.DataUtils.get(this, "settings")) this.appendItem(menu, returnvalue, guildicon.tagName == "IMG" ? guildicon.getAttribute("src") : guildicon.style.getPropertyValue("background-image"), "addGuildIconEntry");
}
}
onUserContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.user && instance.props.target) {
let avatar = BDFDB.containsClass(instance.props.target, BDFDB.disCN.avataricon) ? instance.props.target : instance.props.target.querySelector(BDFDB.dotCN.avatar);
if (avatar && BDFDB.getData("addUserAvatarEntry", this, "settings")) this.appendItem(menu, returnvalue, avatar.tagName == "IMG" ? avatar.getAttribute("src") : avatar.style.getPropertyValue("background-image"));
if (avatar && BDFDB.DataUtils.get(this, "settings")) this.appendItem(menu, returnvalue, avatar.tagName == "IMG" ? avatar.getAttribute("src") : avatar.style.getPropertyValue("background-image"), "addUserAvatarEntry");
}
}
@ -132,7 +132,7 @@ class ReverseImageSearch {
if (instance.props.target.tagName == "A" && instance.props.message.embeds && instance.props.message.embeds[0] && instance.props.message.embeds[0].type == "image") {
this.appendItem(menu, returnvalue, instance.props.target.href);
}
if (instance.props.target.tagName == "IMG" && BDFDB.containsClass(instance.props.target, "emoji", "emote", false) && BDFDB.getData("addEmojiEntry", this, "settings")) {
if (instance.props.target.tagName == "IMG" && BDFDB.containsClass(instance.props.target, "emoji", "emote", false) && BDFDB.DataUtils.get(this, "settings", "addEmojiEntry")) {
this.appendItem(menu, returnvalue, instance.props.target.src);
}
}

View File

@ -290,7 +290,7 @@ class ServerFolders {
}
onSwitch () {
if (typeof BDFDB === "object" && BDFDB.getData("forceOpenFolder", this, "settings")) {
if (typeof BDFDB === "object" && BDFDB.DataUtils.get(this, "settings", "forceOpenFolder")) {
let folder = this.getFolderOfGuildId(BDFDB.LibraryModules.LastGuildStore.getGuildId());
if (folder && !BDFDB.LibraryModules.FolderUtils.isFolderExpanded(folder.folderId)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folder.folderId);
}
@ -308,7 +308,7 @@ class ServerFolders {
let muted = data.muteFolder && folder.guildIds.every(guildid => BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildid));
if (data.muteFolder != muted) {
data.muteFolder = muted;
BDFDB.saveData(folderid, data, this, "folders");
BDFDB.DataUtils.save(data, this, "folders", folderid);
}
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:"GuildFolderMarkReadItem"});
const autoreaditem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuToggleItem, {
@ -317,7 +317,7 @@ class ServerFolders {
active: data.autoRead,
action: state => {
data.autoRead = state;
BDFDB.saveData(folderid, data, this, "folders");
BDFDB.DataUtils.save(data, this, "folders", folderid);
}
});
if (index > -1) children.splice(index + 1, 0, autoreaditem);
@ -330,7 +330,7 @@ class ServerFolders {
active: muted,
action: state => {
data.muteFolder = state;
BDFDB.saveData(folderid, data, this, "folders");
BDFDB.DataUtils.save(data, this, "folders", folderid);
for (let guildid of folder.guildIds) if (BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildid) != state) BDFDB.LibraryModules.GuildSettingsUtils.updateNotificationSettings(guildid, {muted:state, suppress_everyone:state});
}
})
@ -442,7 +442,7 @@ class ServerFolders {
}
if (state.expanded) setImmediate(() => {
for (let guildid of instance.props.guildIds) this.updateGuildInFolderContent(state.folderId, guildid);
if (this.clickedFolder == state.folderId && BDFDB.getData("closeOtherFolders", this, "settings")) for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (openFolderId != state.folderId) {
if (this.clickedFolder == state.folderId && BDFDB.DataUtils.get(this, "settings")) for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders(, "closeOtherFolders")) if (openFolderId != state.folderId) {
BDFDB.removeEles(this.foldercontent.querySelectorAll(`${BDFDB.dotCN.guildouter}[folderid="${openFolderId}"]`));
BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
}
@ -550,7 +550,7 @@ class ServerFolders {
let isCustom = BDFDB.containsClass(selectedIcon, "custom");
data.icons.openicon = folderIcons[data.iconID] ? (!isCustom ? this.createBase64SVG(folderIcons[data.iconID].openicon, data.color1, data.color2) : folderIcons[data.iconID].openicon) : null;
data.icons.closedicon = folderIcons[data.iconID] ? (!isCustom ? this.createBase64SVG(folderIcons[data.iconID].closedicon, data.color1, data.color2) : folderIcons[data.iconID].closedicon) : null;
BDFDB.saveData(folderid, data, this, "folders");
BDFDB.DataUtils.save(data, this, "folders", folderid);
instance.handleColorChange(data.color1 ? parseInt(BDFDB.colorCONVERT(data.color1 && BDFDB.ObjectUtils.is(data.color1) ? data.color1[Object.keys(data.color1)[0]] : data.color1, "HEX").slice(1), 16) : null);
this.changeFolder(folderid);
}
@ -637,7 +637,7 @@ class ServerFolders {
let iconpreviewswitching = modal.querySelector(".ui-icon-picker-icon.preview.switching");
if (!BDFDB.containsClass(iconpreviewopen, "nopic") && !BDFDB.containsClass(iconpreviewclosed, "nopic") && !BDFDB.containsClass(iconpreviewswitching, "nopic")) {
let customID = this.generateID("customicon");
BDFDB.saveData(customID, {"openicon":iconpreviewopen.url,"closedicon":iconpreviewclosed.url,customID}, this, "customicons");
BDFDB.DataUtils.save({"openicon":iconpreviewopen.url,"closedicon":iconpreviewclosed.url,customID}, this, "customicons", customID);
modal.querySelectorAll("input[type='text'][option]").forEach((input) => {input.value = "";});
let iconpreviewopeninner = iconpreviewopen.querySelector(".ui-picker-inner");
@ -691,7 +691,7 @@ class ServerFolders {
});
BDFDB.ListenerUtils.addToChildren(wrapper, "click", BDFDB.dotCN.hovercardbutton, e => {
if (BDFDB.containsClass(e.currentTarget.parentElement, "selected")) return;
BDFDB.removeData(e.currentTarget.getAttribute("value"), this, "customicons");
BDFDB.DataUtils.remove(this, "customicons", e.currentTarget.getAttribute("value"));
e.currentTarget.parentElement.remove();
BDFDB.NotificationUtils.toast(`Custom Icon was deleted.`, {type:"success"});
});
@ -742,7 +742,7 @@ class ServerFolders {
getFolderConfig (folderid) {
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(folderid) || {};
let config = BDFDB.loadData(folderid, this, "folders") || {
let config = BDFDB.DataUtils.load(this, "folders", folderid) || {
iconID: "-1",
icons: {openicon: null, closedicon: null},
muteFolder: false,
@ -778,7 +778,7 @@ class ServerFolders {
BDFDB.removeEles(folderinner.querySelectorAll(`${BDFDB.dotCN.guildupperbadge}.count`));
foldericon.parentElement.parentElement.style.removeProperty("-webkit-mask");
if (BDFDB.getData("showCountBadge", this, "settings")) {
if (BDFDB.DataUtils.get(this, "settings", "showCountBadge")) {
folderinner.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCN.guildupperbadge} count" style="opacity: 1; transform: translate(0px, 0px);"><div class="${BDFDB.disCN.guildbadgenumberbadge}" style="background-color: rgb(114, 137, 218); width: ${folder.guildIds.length > 99 ? 28 : (folder.guildIds.length > 9 ? 22 : 16)}px; padding-right: ${folder.guildIds.length > 99 ? 0 : (folder.guildIds.length > 9 ? 0 : 1)}px;">${folder.guildIds.length}</div></div>`));
let width = folder.guildIds.length > 99 ? 36 : (folder.guildIds.length > 9 ? 30 : 24);
foldericon.parentElement.parentElement.style.setProperty("-webkit-mask", `url(data:image/svg+xml;base64,${btoa(`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" fill="black" x="0" y="0" width="48" height="48"><path d="M ${width-7} 0 C ${width-5} 2 ${width-4} 5 ${width-4} 8 C ${width-4} ${width/1.8+3} 15 20 8 20 C 5 20 2 19 0 17 L 0 50 L 50 50 L 50 0 L 17 0 z"></path></svg>`)}) center/cover no-repeat`);
@ -841,7 +841,7 @@ class ServerFolders {
addSeparator (folderid) {
if (!this.foldercontentguilds) return;
if (!this.foldercontent.querySelector(`.folderseparatorouter[folderid="${folderid}"]`) && BDFDB.getData("addSeparators", this, "settings")) this.foldercontentguilds.insertBefore(BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.guildouter + BDFDB.disCN._bdguildseparator} folderseparatorouter" folderid="${folderid}"><div class="${BDFDB.disCN.guildseparator} folderseparator"></div></div>`), this.foldercontentguilds.querySelectorAll(`[folderid="${folderid}"]`)[0]);
if (!this.foldercontent.querySelector(`.folderseparatorouter[folderid="${folderid}"]`) && BDFDB.DataUtils.get(this, "settings")) this.foldercontentguilds.insertBefore(BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.guildouter + BDFDB.disCN._bdguildseparator} folderseparatorouter" folderid="${folderid}"><div class="${BDFDB.disCN.guildseparator} folderseparator"></div></div>`), this.foldercontentguilds.querySelectorAll(`[folderid="${folderid}"]`)[0], "addSeparators");
if (BDFDB.containsClass(this.foldercontentguilds.firstElementChild, "folderseparatorouter")) BDFDB.removeEles(this.foldercontentguilds.firstElementChild);
}
@ -950,7 +950,7 @@ class ServerFolders {
let ESdata = EditServers ? EditServers.getGuildData(guildid, guildcopyinner) : null;
if (ESdata && (ESdata.name || ESdata.color3 || ESdata.color4)) EditServers.changeTooltip(guild, guildcopyinner, "right");
else {
let folderData = BDFDB.loadData(folderid, this, "folders") || {};
let folderData = BDFDB.DataUtils.load(this, "folders", folderid) || {};
let color3 = folderData.copyTooltipColor ? folderData.color3 : null;
let color4 = folderData.copyTooltipColor ? folderData.color4 : null;
let isgradient3 = color3 && BDFDB.ObjectUtils.is(color3);
@ -1115,7 +1115,7 @@ class ServerFolders {
}
removeFolder (folderid) {
BDFDB.removeData(folderid, this, "folders");
BDFDB.DataUtils.remove(this, "folders", folderid);
BDFDB.removeEles(this.foldercontentguilds.querySelector(`${BDFDB.dotCN.guildouter}[folderid="${folderid}"]`));
let oldGuildFolders = Object.assign({}, BDFDB.LibraryModules.FolderStore.guildFolders);
let guildFolders = [], guildPositions = [];

View File

@ -194,7 +194,7 @@ class ServerHider {
processGuild (instance, wrapper, returnvalue, methodnames) {
if (instance.props && instance.props.guild) {
let hiddenservers = BDFDB.loadData("hiddenservers", this, "hiddenservers") || [];
let hiddenservers = BDFDB.DataUtils.load(this, "hiddenservers", "hiddenservers") || [];
if (methodnames.includes("componentDidMount")) this.toggleServer(instance.props.guild, wrapper, !hiddenservers.includes(instance.props.guild.id));
if (methodnames.includes("componentDidUpdate") && hiddenservers.includes(instance.props.guild.id) && instance.props.unread) this.unreadServer(instance.props.guild.id);
}
@ -236,17 +236,17 @@ class ServerHider {
let guilddiv = BDFDB.getParentEle(BDFDB.dotCN.guildouter, target);
if (!guilddiv || guilddiv.getAttribute("folder")) return;
BDFDB.toggleEles(guilddiv, visible);
let hiddenservers = BDFDB.loadData("hiddenservers", this, "hiddenservers") || [];
let hiddenservers = BDFDB.DataUtils.load(this, "hiddenservers", "hiddenservers") || [];
BDFDB.ArrayUtils.remove(hiddenservers, info.id);
if (!visible) {
if (BDFDB.ReactUtils.getValue(guilddiv, "return.stateNode.props").unread) this.unreadServer(info.id);
hiddenservers.push(info.id);
}
BDFDB.saveData("hiddenservers", hiddenservers, this, "hiddenservers");
BDFDB.DataUtils.save(hiddenservers, this, "hiddenservers", "hiddenservers");
}
unreadServer (id) {
if (BDFDB.getData("clearNotifications", this, "settings") && !this.isInFolder(id)) BDFDB.GuildUtils.markAsRead(id);
if (BDFDB.DataUtils.get(this, "settings") && !this.isInFolder(id)) BDFDB.GuildUtils.markAsRead(id, "clearNotifications");
}
isInFolder (id) {

View File

@ -241,12 +241,12 @@ class ShowHiddenChannels {
var visibile = !BDFDB.containsClass(wrapper, BDFDB.disCN.categorycollapsed);
BDFDB.toggleEles(category.querySelectorAll(BDFDB.dotCN.channelcontainerdefault), visibile);
BDFDB.saveData(guild.id, visibile, this, "categorystatus");
BDFDB.DataUtils.save(visibile, this, "categorystatus", guild.id);
});
for (let type in BDFDB.DiscordConstants.ChannelTypes) for (let hiddenChannel of hiddenChannels[BDFDB.DiscordConstants.ChannelTypes[type]]) this.createChannel(guild, category, hiddenChannel, type);
var isvisibile = BDFDB.loadData(guild.id, this, "categorystatus") === true;
var isvisibile = BDFDB.DataUtils.load(this, "categorystatus", guild.id) === true;
BDFDB.toggleClass(wrapper, BDFDB.disCN.categorycollapsed, !isvisibile);
BDFDB.toggleEles(category.querySelectorAll(BDFDB.dotCN.channelcontainerdefault), isvisibile);
@ -400,7 +400,7 @@ class ShowHiddenChannels {
}
if (htmlString) {
var width = window.outerWidth/2;
var tooltip = BDFDB.TooltipUtils.create(e.currentTarget, htmlString, {type:"right", selector:"showhiddenchannels-tooltip", html:true, style:`max-width: ${width < 200 ? 400 : width}px !important;`, delay:BDFDB.getData("hoverDelay", this, "amounts")});
var tooltip = BDFDB.TooltipUtils.create(e.currentTarget, htmlString, {type:"right", selector:"showhiddenchannels-tooltip", html:true, style:`max-width: ${width < 200 ? 400 : width}px !important;`, delay:BDFDB.DataUtils.get(this, "amounts")}, "hoverDelay");
var style = getComputedStyle(e.currentTarget);
tooltip.style.setProperty("top", BDFDB.getRects(tooltip).top - style.paddingBottom.replace("px","")/2 + style.paddingTop.replace("px","")/2 + "px");
}

View File

@ -123,9 +123,9 @@ class ShowImageDetails {
if (BDFDB.containsClass(image.parentElement.parentElement, BDFDB.disCN.spoilercontainer, BDFDB.disCN.spoilertext, false)) image = image.parentElement.parentElement;
BDFDB.addClass(image, "image-details-added");
image.removeEventListener("mouseenter", image.mouseenterShowImageDetails);
if (BDFDB.getData("showOnHover", this, "settings")) {
if (BDFDB.DataUtils.get(this, "settings", "showOnHover")) {
image.mouseenterShowImageDetails = () => {
BDFDB.TooltipUtils.create(image, `<div class="image-details-tooltip-name">${attachment.filename}</div><div class="image-details-tooltip-size">${BDFDB.formatBytes(attachment.size)}</div><div class="image-details-tooltip-dimensions">${attachment.width}x${attachment.height}px</div>`, {type:"right", html:true, selector:"image-details-tooltip", delay:BDFDB.getData("hoverDelay", this, "amounts")});
BDFDB.TooltipUtils.create(image, `<div class="image-details-tooltip-name">${attachment.filename}</div><div class="image-details-tooltip-size">${BDFDB.formatBytes(attachment.size)}</div><div class="image-details-tooltip-dimensions">${attachment.width}x${attachment.height}px</div>`, {type:"right", html:true, selector:"image-details-tooltip", delay:BDFDB.DataUtils.get(this, "amounts")}, "hoverDelay");
};
image.addEventListener("mouseenter", image.mouseenterShowImageDetails);
}

View File

@ -69,7 +69,7 @@ class SpellCheck {
for (let key in amounts) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCN.flexchild}" style="flex: 0 0 50%;">${this.defaults.amounts[key].description}</h3><div class="${BDFDB.disCN.inputwrapper} inputNumberWrapper ${BDFDB.disCNS.vertical}" style="flex: 1 1 auto;"><span class="numberinput-buttons-zone"><span class="numberinput-button-up"></span><span class="numberinput-button-down"></span></span><input type="number"${(!isNaN(this.defaults.amounts[key].min) && this.defaults.amounts[key].min !== null ? ' min="' + this.defaults.amounts[key].min + '"' : '') + (!isNaN(this.defaults.amounts[key].max) && this.defaults.amounts[key].max !== null ? ' max="' + this.defaults.amounts[key].max + '"' : '')} option="${key}" value="${amounts[key]}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16} amount-input"></div></div>`;
}
var ownDictionary = BDFDB.loadData(choices.dictionaryLanguage, this, "owndics") || [];
var ownDictionary = BDFDB.DataUtils.load(this, "owndics", choices.dictionaryLanguage) || [];
settingshtml += `<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Your own Dictionary:</h3><div class="BDFDB-settings-inner-list word-list ${BDFDB.disCN.marginbottom8}">`;
for (let word of ownDictionary) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.margintop4 + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis} entryword">${word}</div></div><div class="${BDFDB.disCN.hovercardbutton} remove-word"></div></div>`;
@ -116,7 +116,7 @@ class SpellCheck {
this.languages = Object.assign({}, BDFDB.LanguageUtils.languages);
this.languages = BDFDB.ObjectUtils.filter(this.languages, (lang) => {return lang.dic == true ? lang : null});
this.setDictionary(BDFDB.getData("dictionaryLanguage", this, "choices"));
this.setDictionary(BDFDB.DataUtils.get(this, "choices"), "dictionaryLanguage");
BDFDB.ModuleUtils.forceAllUpdates(this);
}
@ -272,11 +272,11 @@ class SpellCheck {
word = word.split(" ")[0].split("\n")[0].split("\r")[0].split("\t")[0];
if (word) {
var wordlow = word.toLowerCase();
var lang = BDFDB.getData("dictionaryLanguage", this, "choices");
var ownDictionary = BDFDB.loadData(lang, this, "owndics") || [];
var lang = BDFDB.DataUtils.get(this, "choices", "dictionaryLanguage");
var ownDictionary = BDFDB.DataUtils.load(this, "owndics", lang) || [];
if (!ownDictionary.includes(wordlow)) {
ownDictionary.push(wordlow);
BDFDB.saveData(lang, ownDictionary, this, "owndics");
BDFDB.DataUtils.save(ownDictionary, this, "owndics", lang);
BDFDB.NotificationUtils.toast(this.labels.toast_wordadd_text ? this.labels.toast_wordadd_text.replace("${word}", word).replace("${dicname}", this.languages[lang].name) : "", {type:"success"});
this.dictionary = this.langDictionary.concat(ownDictionary);
}
@ -287,10 +287,10 @@ class SpellCheck {
var entry = e.currentTarget.parentElement;
var word = entry.querySelector(".entryword").textContent;
entry.remove();
var lang = BDFDB.getData("dictionaryLanguage", this, "choices");
var ownDictionary = BDFDB.loadData(lang, this, "owndics") || [];
var lang = BDFDB.DataUtils.get(this, "choices", "dictionaryLanguage");
var ownDictionary = BDFDB.DataUtils.load(this, "owndics", lang) || [];
BDFDB.ArrayUtils.remove(ownDictionary, word);
BDFDB.saveData(lang, ownDictionary, this, "owndics");
BDFDB.DataUtils.save(ownDictionary, this, "owndics", lang);
this.dictionary = this.langDictionary.concat(ownDictionary);
}
@ -298,11 +298,11 @@ class SpellCheck {
if (type && choice) {
selectWrap.querySelector(BDFDB.dotCN.title).innerText = this.languages[choice].name;
this.setDictionary(choice);
BDFDB.saveData(type, choice, this, "choices");
BDFDB.DataUtils.save(choice, this, "choices", type);
var settingspanel = BDFDB.getParentEle(".BDFDB-settings", selectWrap), listcontainer = settingspanel ? settingspanel.querySelector(".word-list") : null;
if (listcontainer) {
var ownDictionary = BDFDB.loadData(choice, this, "owndics") || [];
var ownDictionary = BDFDB.DataUtils.load(this, "owndics", choice) || [];
var containerhtml = ``;
for (let word of ownDictionary) {
containerhtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.margintop4 + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis} entryword">${word}</div></div><div class="${BDFDB.disCN.hovercardbutton} remove-word"></div></div>`;
@ -317,7 +317,7 @@ class SpellCheck {
}
setDictionary (lang) {
this.dictionary = BDFDB.loadData(lang, this, "owndics") || [];
this.dictionary = BDFDB.DataUtils.load(this, "owndics", lang) || [];
this.killLanguageToast();
this.languageToast = BDFDB.NotificationUtils.toast("Grabbing dictionary (" + this.languages[lang].name + "). Please wait", {timeout:0});
this.languageToast.interval = setInterval(() => {
@ -364,7 +364,7 @@ class SpellCheck {
getSimilarWords (word) {
var maxAmount = BDFDB.getData("maxSimilarAmount", this, "amounts"), similarWords = [];
var maxAmount = BDFDB.DataUtils.get(this, "amounts", "maxSimilarAmount"), similarWords = [];
if (maxAmount > 0) {
var sameLetterDic = this.dictionary.filter(string => string.indexOf(word.toLowerCase().charAt(0)) == 0 ? string : null);
var similarities = {};

View File

@ -316,7 +316,7 @@ class ThemeRepo {
}
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">Add Theme:</h3><input type="text" placeholder="Insert Raw Github Link of Theme (https://raw.githubusercontent.com/...)" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}" id="input-themeurl" style="flex: 1 1 auto;"><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} btn-add btn-addtheme" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}"></div></button></div>`;
settingshtml += `<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Your additional Theme List:</h3><div class="BDFDB-settings-inner-list theme-list ${BDFDB.disCN.marginbottom8}">`;
var ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
var ownlist = BDFDB.DataUtils.load(this, "ownlist", "ownlist") || [];
if (ownlist) for (let url of ownlist) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.margintop4 + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis} entryurl">${url}</div></div><div class="${BDFDB.disCN.hovercardbutton} remove-theme"></div></div>`;
}
@ -430,10 +430,10 @@ class ThemeRepo {
if (themeUrlInput && themeList) {
var url = themeUrlInput.value;
themeUrlInput.value = null;
var ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
var ownlist = BDFDB.DataUtils.load(this, "ownlist", "ownlist") || [];
if (!ownlist.includes(url)) {
ownlist.push(url);
BDFDB.saveData("ownlist", ownlist, this, "ownlist");
BDFDB.DataUtils.save(ownlist, this, "ownlist", "ownlist");
let entry = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.margintop4 + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis} entryurl">${url}</div></div><div class="${BDFDB.disCN.hovercardbutton} remove-theme"></div></div>`);
BDFDB.ListenerUtils.addToChildren(entry, "click", ".remove-theme", e => {this.removeThemeFromOwnList(e);});
themeList.appendChild(entry);
@ -445,14 +445,14 @@ class ThemeRepo {
var entry = e.currentTarget.parentElement;
var url = entry.querySelector(".entryurl").textContent;
entry.remove();
var ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
var ownlist = BDFDB.DataUtils.load(this, "ownlist", "ownlist") || [];
BDFDB.ArrayUtils.remove(ownlist, url);
BDFDB.saveData("ownlist", ownlist, this, "ownlist");
BDFDB.DataUtils.save(ownlist, this, "ownlist", "ownlist");
}
removeAllFromOwnList (settingspanel) {
BDFDB.openConfirmModal(this, "Are you sure you want to remove all added Themes from your own list?", () => {
BDFDB.saveData("ownlist", [], this, "ownlist");
BDFDB.DataUtils.save([], this, "ownlist", "ownlist");
BDFDB.removeEles(settingspanel.querySelector(BDFDB.dotCN.hovercard));
});
}
@ -543,7 +543,7 @@ class ThemeRepo {
themeRepoModal.querySelector("#input-hideoutdated").checked = hiddenSettings.outdated && !options.showOnlyOutdated;
themeRepoModal.querySelector("#input-hidedownloadable").checked = hiddenSettings.downloadable || options.showOnlyOutdated;
if (!BDFDB.BdUtils.isAutoLoadEnabled()) themeRepoModal.querySelector("#RNMoption").remove();
else themeRepoModal.querySelector("#input-rnmstart").checked = BDFDB.loadData("RNMstart", this, "RNMstart");
else themeRepoModal.querySelector("#input-rnmstart").checked = BDFDB.DataUtils.load(this, "RNMstart", "RNMstart");
if (options.forcedSort && this.sortings.sort[options.forcedSort]) {
var sortinput = themeRepoModal.querySelector(".sort-filter " + BDFDB.dotCN.quickselectvalue);
@ -623,10 +623,10 @@ class ThemeRepo {
});
BDFDB.ListenerUtils.addToChildren(themeRepoModal, "change", ".hide-checkbox", e => {
themeRepoModal.updateHidden = true;
BDFDB.saveData(e.currentTarget.value, e.currentTarget.checked, this, "hidden");
BDFDB.DataUtils.save(e.currentTarget.checked, this, "hidden", e.currentTarget.value);
});
BDFDB.ListenerUtils.addToChildren(themeRepoModal, "change", "#input-rnmstart", e => {
BDFDB.saveData("RNMstart", e.currentTarget.checked, this, "RNMstart");
BDFDB.DataUtils.save(e.currentTarget.checked, this, "RNMstart", "RNMstart");
});
BDFDB.ListenerUtils.addToChildren(themeRepoModal, "click", ".sort-filter", e => {
BDFDB.createSortPopout(e.currentTarget, this.sortPopoutMarkup, () => {this.sortEntries(themeRepoModal);});
@ -780,8 +780,8 @@ class ThemeRepo {
favbutton.addEventListener("click", e => {
let favorize = data.fav == 1;
data.fav = favorize ? 0 : 1;
if (favorize) BDFDB.saveData(data.url, true, this, "favorites");
else BDFDB.removeData(data.url, this, "favorites");
if (favorize) BDFDB.DataUtils.save(true, this, "favorites", data.url);
else BDFDB.DataUtils.remove(this, "favorites", data.url);
themeRepoModal.entries[data.url] = data;
});
let gitbutton = entry.querySelector(".gitIcon");
@ -884,12 +884,12 @@ class ThemeRepo {
var settings = BDFDB.DataUtils.load(this, "settings");
var getThemeInfo, outdated = 0, newentries = 0, i = 0, NFLDreplace = null;
var tags = ["name","description","author","version"];
var newentriesdata = BDFDB.DataUtils.load(this, "newentriesdata"), ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
var newentriesdata = BDFDB.DataUtils.load(this, "newentriesdata"), ownlist = BDFDB.DataUtils.load(this, "ownlist", "ownlist") || [];
this.cachedThemes = (newentriesdata.urlbase64 ? atob(newentriesdata.urlbase64).split("\n") : []).concat(ownlist);
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeRepo/res/ThemeList.txt", (error, response, body) => {
if (!error && body) {
body = body.replace(/[\r\t]/g, "");
BDFDB.saveData("urlbase64", btoa(body), this, "newentriesdata");
BDFDB.DataUtils.save(btoa(body), this, "newentriesdata", "urlbase64");
this.loadedThemes = {};
this.grabbedThemes = body.split("\n").filter(n => n);
BDFDB.LibraryRequires.request("https://github.com/NFLD99/Better-Discord", (error2, response2, body2) => {

View File

@ -100,7 +100,7 @@ class TimedLightDarkMode {
startInterval () {
clearInterval(this.checkInterval);
if (BDFDB.getData("running", this, "settings")) {
if (BDFDB.DataUtils.get(this, "settings", "running")) {
var values = BDFDB.DataUtils.get(this, "values");
var inverted = values.timer1 > values.timer2;
var timer1LOW = this.getTime(values.timer1), timer2LOW = this.getTime(values.timer2);
@ -163,7 +163,7 @@ class TimedLightDarkMode {
document.removeEventListener("mousemove", mousemove);
BDFDB.removeEles(bubble);
BDFDB.removeLocalStyle("disableTextSelection");
BDFDB.saveData(type, value, this, "values");
BDFDB.DataUtils.save(value, this, "values", type);
this.startInterval();
};
var mousemove = e => {

View File

@ -109,7 +109,7 @@ class TopRoleEverywhere {
// begin of own functions
processMemberListItem (instance, wrapper, returnvalue) {
if (instance.props && BDFDB.getData("showInMemberList", this, "settings")) {
if (instance.props && BDFDB.DataUtils.get(this, "settings", "showInMemberList")) {
this.addRoleTag(instance.props.user, wrapper.querySelector(BDFDB.dotCN.namecontainername), "list", BDFDB.disCN.bottagmember);
}
}
@ -118,7 +118,7 @@ class TopRoleEverywhere {
let message = BDFDB.ReactUtils.getValue(instance, "props.message");
if (message) {
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
if (username && BDFDB.getData("showInChat", this, "settings")) {
if (username && BDFDB.DataUtils.get(this, "settings", "showInChat")) {
let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper);
this.addRoleTag(message.author, username, "chat", BDFDB.containsClass(messagegroup, BDFDB.disCN.messagegroupcozy) ? BDFDB.disCN.bottagmessagecozy : BDFDB.disCN.bottagmessagecompact);
}

View File

@ -145,7 +145,7 @@ class UserNotes {
}
openNotesModal (info) {
let note = BDFDB.loadData(info.id, this, "notes") || "";
let note = BDFDB.DataUtils.load(this, "notes", info.id) || "";
let userNotesModal = BDFDB.htmlToElement(this.userNotesModalMarkup);
let noteinput = userNotesModal.querySelector("#modal-inputtext");
@ -155,7 +155,7 @@ class UserNotes {
BDFDB.appendModal(userNotesModal);
BDFDB.ListenerUtils.addToChildren(userNotesModal, "click", ".btn-save", (e) => {
e.preventDefault();
BDFDB.saveData(info.id, noteinput.value, this, "notes");
BDFDB.DataUtils.save(noteinput.value, this, "notes", info.id);
});
noteinput.focus();
}