This commit is contained in:
Mirco Wittrien 2019-10-22 19:49:57 +02:00
parent ab4486bac0
commit 8a6b2a9ea5
37 changed files with 209 additions and 209 deletions

View File

@ -125,9 +125,9 @@ class BadgesEverywhere {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var badges = BDFDB.getAllData(this, "badges");
var indicators = BDFDB.getAllData(this, "indicators");
var settings = BDFDB.DataUtils.get(this, "settings");
var badges = BDFDB.DataUtils.get(this, "badges");
var indicators = BDFDB.DataUtils.get(this, "indicators");
var settingsitems = [], inneritems = [];
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
@ -264,9 +264,9 @@ class BadgesEverywhere {
addToWrapper (info, wrapper, type) {
BDFDB.removeEles(wrapper.querySelectorAll(".BE-badges"));
let badges = BDFDB.getAllData(this, "badges");
let indicators = BDFDB.getAllData(this, "indicators");
let settings = BDFDB.getAllData(this, "settings");
let badges = BDFDB.DataUtils.get(this, "badges");
let indicators = BDFDB.DataUtils.get(this, "indicators");
let settings = BDFDB.DataUtils.get(this, "settings");
let header = BDFDB.getParentEle(BDFDB.dotCN.userpopoutheader, wrapper);
let badgewrapper = BDFDB.htmlToElement(`<span class="BE-badges BE-badges-${type} ${!settings.useColoredVersion || (header && !BDFDB.containsClass(header, BDFDB.disCN.userpopoutheadernormal)) ? BDFDB.disCN.userprofiletopsectionplaying : BDFDB.disCN.userprofiletopsectionnormal}" style="all: unset !important; display: flex !important; flex-direction: row !important;"></span>`);
for (let flag in this.defaults.badges) {

View File

@ -69,7 +69,7 @@ class BetterSearchPage {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -153,7 +153,7 @@ class BetterSearchPage {
maxpage = 201;
}
if (currentpage == maxpage && maxpage == 201) BDFDB.addClass(pagination.querySelector(BDFDB.dotCN.searchresultspaginationnext), BDFDB.disCN.searchresultspaginationdisabled);
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
for (let btn of pagination.querySelectorAll(BDFDB.dotCNC.searchresultspaginationprevious + BDFDB.dotCN.searchresultspaginationnext)) BDFDB.addClass(btn, "pagination-button");
if (settings.addFirstLast) {
pagination.insertBefore(BDFDB.htmlToElement(`<div aria-label="First" class="${currentpage == 1 ? BDFDB.disCNS.searchresultspaginationdisabled : ""}pagination-button BSP-pagination-button BSP-pagination-first"></div>`), pagination.firstElementChild);

View File

@ -95,8 +95,8 @@ class ChatAliases {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var amounts = BDFDB.getAllData(this, "amounts");
var settings = BDFDB.DataUtils.get(this, "settings");
var amounts = BDFDB.DataUtils.get(this, "amounts");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -162,7 +162,7 @@ class ChatAliases {
if (this.started) return;
BDFDB.PluginUtils.init(this);
this.aliases = BDFDB.loadAllData(this, "words");
this.aliases = BDFDB.DataUtils.load(this, "words");
BDFDB.ListenerUtils.add(document, "click", e => {
if (!e.target.tagName === "TEXTAREA") BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
@ -189,7 +189,7 @@ class ChatAliases {
var wordvalue = null, replacevalue = null, action = ele.getAttribute("action");
var update = () => {
BDFDB.saveAllData(this.aliases, this, "words");
BDFDB.DataUtils.save(this.aliases, this, "words");
var containerhtml = ``;
for (let word in this.aliases) {
@ -228,7 +228,7 @@ class ChatAliases {
}
}
saveWord (wordvalue, replacevalue, fileselection, configs = BDFDB.getAllData(this, "configs")) {
saveWord (wordvalue, replacevalue, fileselection, configs = BDFDB.DataUtils.get(this, "configs")) {
if (!wordvalue || !replacevalue || !fileselection) return;
var filedata = null;
if (fileselection.files && fileselection.files[0] && BDFDB.LibraryRequires.fs.existsSync(replacevalue)) {
@ -268,7 +268,7 @@ class ChatAliases {
this.aliases[newwordvalue] = this.aliases[oldwordvalue];
this.aliases[newwordvalue].replace = newreplacevalue;
if (newwordvalue != oldwordvalue) delete this.aliases[oldwordvalue];
BDFDB.saveAllData(this.aliases, this, "words");
BDFDB.DataUtils.save(this.aliases, this, "words");
}
},500);
}
@ -278,7 +278,7 @@ class ChatAliases {
var config = ele.getAttribute("config");
if (wordvalue && this.aliases[wordvalue] && config) {
this.aliases[wordvalue][config] = ele.checked;
BDFDB.saveAllData(this.aliases, this, "words");
BDFDB.DataUtils.save(this.aliases, this, "words");
}
}
@ -331,7 +331,7 @@ class ChatAliases {
if (instance.props && instance.props.channel && instance.props.type) {
var textarea = wrapper.querySelector("textarea");
if (!textarea) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.ListenerUtils.add(this, textarea, "input", () => {
if (this.format) {
this.format = false;
@ -573,7 +573,7 @@ class ChatAliases {
if (configinput) configs[key] = configinput.checked;
}
this.saveWord(wordvalueinput.value.trim(), replacevalueinput.value.trim(), chataliasesAddModal.querySelector("#input-file"), configs);
BDFDB.saveAllData(this.aliases, this, "words");
BDFDB.DataUtils.save(this.aliases, this, "words");
});
wordvalueinput.focus();

View File

@ -106,8 +106,8 @@ class ChatFilter {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var replaces = BDFDB.getAllData(this, "replaces");
var settings = BDFDB.getAllData(this, "settings");
var replaces = BDFDB.DataUtils.get(this, "replaces");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
if (!this.defaults.settings[key].inner) settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -178,7 +178,7 @@ class ChatFilter {
if (this.started) return;
BDFDB.PluginUtils.init(this);
this.words = BDFDB.loadAllData(this, "words");
this.words = BDFDB.DataUtils.load(this, "words");
for (let rtype in this.defaults.replaces) if (!BDFDB.ObjectUtils.is(this.words[rtype])) this.words[rtype] = {};
BDFDB.ModuleUtils.forceAllUpdates(this);
@ -201,7 +201,7 @@ class ChatFilter {
updateContainer (settingspanel, ele) {
var wordvalue = null, replacevalue = null, action = ele.getAttribute("action"), rtype = ele.getAttribute("rtype"), update = () => {
BDFDB.saveAllData(this.words, this, "words");
BDFDB.DataUtils.save(this.words, this, "words");
var containerhtml = ``;
for (let word in this.words[rtype]) {
@ -242,7 +242,7 @@ class ChatFilter {
}
}
saveWord (wordvalue, replacevalue, rtype, configs = BDFDB.getAllData(this, "configs")) {
saveWord (wordvalue, replacevalue, rtype, configs = BDFDB.DataUtils.get(this, "configs")) {
if (!wordvalue || !replacevalue) return;
wordvalue = wordvalue.trim();
replacevalue = replacevalue.trim();
@ -270,7 +270,7 @@ class ChatFilter {
var rtype = ele.getAttribute("rtype");
if (wordvalue && this.words[rtype][wordvalue] && config) {
this.words[rtype][wordvalue][config] = ele.checked;
BDFDB.saveAllData(this.words, this, "words");
BDFDB.DataUtils.save(this.words, this, "words");
}
}
@ -344,8 +344,8 @@ class ChatFilter {
}
});
var settings = BDFDB.getAllData(this, "settings");
var replaces = BDFDB.getAllData(this, "replaces");
var settings = BDFDB.DataUtils.get(this, "settings");
var replaces = BDFDB.DataUtils.get(this, "replaces");
var blocked = false;
for (let bWord in this.words.blocked) {
var blockedReplace = this.words.blocked[bWord].empty ? "" : (this.words.blocked[bWord].replace || replaces.blocked);
@ -504,7 +504,7 @@ class ChatFilter {
}
let rtype = chatfilterAddModal.querySelector("#input-choiceblockcensor").checked ? "censored" : "blocked";
this.saveWord(wordvalueinput.value.trim(), replacevalueinput.value.trim(), rtype, configs);
BDFDB.saveAllData(this.words, this, "words");
BDFDB.DataUtils.save(this.words, this, "words");
document.querySelectorAll(`${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored, ${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored`).forEach(message => {this.resetMessage(message);});
BDFDB.ModuleUtils.forceAllUpdates(this);
});

View File

@ -47,9 +47,9 @@ class CompleteTimestamps {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let choices = BDFDB.getAllData(this, "choices");
let formats = BDFDB.getAllData(this, "formats");
let settings = BDFDB.DataUtils.get(this, "settings");
let choices = BDFDB.DataUtils.get(this, "choices");
let formats = BDFDB.DataUtils.get(this, "formats");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -156,12 +156,12 @@ class CompleteTimestamps {
for (let input of settingspanel.querySelectorAll(BDFDB.dotCN.input)) {
formats[input.getAttribute("option")] = input.value;
}
BDFDB.saveAllData(formats, this, "formats");
BDFDB.DataUtils.save(formats, this, "formats");
this.updateSettingsPanel(settingspanel);
}
updateSettingsPanel (settingspanel) {
let choices = BDFDB.getAllData(this, "choices");
let choices = BDFDB.DataUtils.get(this, "choices");
for (let key in choices) {
settingspanel.querySelector(`${BDFDB.dotCN.select}[type='${key}'] .languageTimestamp`).innerText = this.getTimestamp(this.languages[choices[key]].id);
}
@ -229,7 +229,7 @@ class CompleteTimestamps {
if (typeof time == "string") timeobj = new Date(time);
if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time));
if (timeobj.toString() == "Invalid Date") return;
let settings = BDFDB.getAllData(this, "settings"), timestring = "";
let settings = BDFDB.DataUtils.get(this, "settings"), timestring = "";
if (languageid != "own") {
let timestamp = [];
if (settings.displayDate) timestamp.push(timeobj.toLocaleDateString(languageid));

View File

@ -67,9 +67,9 @@ class CreationDate {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let choices = BDFDB.getAllData(this, "choices");
let formats = BDFDB.getAllData(this, "formats");
let settings = BDFDB.DataUtils.get(this, "settings");
let choices = BDFDB.DataUtils.get(this, "choices");
let formats = BDFDB.DataUtils.get(this, "formats");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -150,12 +150,12 @@ class CreationDate {
for (let input of settingspanel.querySelectorAll(BDFDB.dotCN.input)) {
formats[input.getAttribute("option")] = input.value;
}
BDFDB.saveAllData(formats, this, "formats");
BDFDB.DataUtils.save(formats, this, "formats");
this.updateSettingsPanel(settingspanel);
}
updateSettingsPanel (settingspanel) {
let choices = BDFDB.getAllData(this, "choices");
let choices = BDFDB.DataUtils.get(this, "choices");
for (let key in choices) {
settingspanel.querySelector(`${BDFDB.dotCN.select}[type='${key}'] .languageTimestamp`).innerText = this.getTimestamp(this.languages[choices[key]].id);
}
@ -219,7 +219,7 @@ class CreationDate {
if (typeof time == "string") timeobj = new Date(time);
if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time));
if (timeobj.toString() == "Invalid Date") return;
let settings = BDFDB.getAllData(this, "settings"), timestring = "";
let settings = BDFDB.DataUtils.get(this, "settings"), timestring = "";
if (languageid != "own") {
let timestamp = [];
if (settings.displayDate) timestamp.push(timeobj.toLocaleDateString(languageid));

View File

@ -41,7 +41,7 @@ class DisplayServersAsChannels {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var amounts = BDFDB.getAllData(this, "amounts");
var amounts = BDFDB.DataUtils.get(this, "amounts");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
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>`;

View File

@ -55,7 +55,7 @@ class EditChannels {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingsitems = [], inneritems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
@ -76,7 +76,7 @@ class EditChannels {
label: "Reset all Channels",
onClick: _ => {
BDFDB.openConfirmModal(this, "Are you sure you want to reset all channels?", () => {
BDFDB.removeAllData(this, "channels");
BDFDB.DataUtils.remove(this, "channels");
this.forceUpdateAll();
});
},
@ -124,10 +124,10 @@ class EditChannels {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
let data = BDFDB.loadAllData(this, "channels");
BDFDB.removeAllData(this, "channels");
let data = BDFDB.DataUtils.load(this, "channels");
BDFDB.DataUtils.remove(this, "channels");
try {this.forceUpdateAll();} catch (err) {}
BDFDB.saveAllData(data, this, "channels");
BDFDB.DataUtils.save(data, this, "channels");
BDFDB.removeEles(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
@ -431,7 +431,7 @@ class EditChannels {
}
let iconparent = BDFDB.containsClass(channelname, BDFDB.disCN.quickswitchresultmatch) ? channelname.parentElement.parentElement : channelname.parentElement;
if (!BDFDB.containsClass(channelname, BDFDB.disCN.autocompletedescription)) {
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
iconparent.querySelectorAll('svg [stroke]:not([stroke="none"]').forEach(icon => {
let iconcolor = color && BDFDB.getParentEle(BDFDB.dotCN.channelheadertitle, icon) ? BDFDB.colorSETALPHA(isgradient ? color[0] : color, 0.6) : (isgradient ? color[0] : color);
if (!icon.getAttribute("oldstroke")) icon.setAttribute("oldstroke", icon.getAttribute("stroke"));
@ -583,7 +583,7 @@ class EditChannels {
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);
let allenabled = true, settings = BDFDB.getAllData(this, "settings");
let allenabled = true, settings = BDFDB.DataUtils.get(this, "settings");
for (let i in settings) if (!settings[i]) {
allenabled = false;
break;
@ -608,7 +608,7 @@ class EditChannels {
let words = textarea.value.split(/\s/);
let lastword = words[words.length-1].trim();
if (lastword && lastword.length > 1 && lastword[0] == "#") {
let channels = BDFDB.loadAllData(this, "channels");
let channels = BDFDB.DataUtils.load(this, "channels");
if (!channels) return;
let channelarray = [];
for (let id in channels) if (channels[id].name) {
@ -619,7 +619,7 @@ class EditChannels {
}
channelarray = BDFDB.ArrayUtils.keySort(channelarray.filter(n => n.lowercasename.indexOf(lastword.toLowerCase().slice(1)) != -1 || (n.lowercasecatname && n.lowercasecatname.indexOf(lastword.toLowerCase().slice(1)) != -1)), "lowercasename");
if (channelarray.length) {
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCNS.autocomplete + BDFDB.dotCN.autocompleteinner), amount = 15;
if (!autocompletemenu) {
autocompletemenu = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocomplete + BDFDB.disCN.autocomplete2} autocompleteEditChannels"><div class="${BDFDB.disCN.autocompleteinner}"><div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditChannelsRow"><div class="${BDFDB.disCN.autocompleteselector} autocompleteEditChannelsSelector"><div class="${BDFDB.disCNS.autocompletecontenttitle + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.weightsemibold}">${BDFDB.LanguageUtils.LanguageStrings.TEXT_CHANNELS_MATCHING.replace("{{prefix}}", BDFDB.encodeToHTML(lastword))}</strong></div></div></div></div></div>`);

View File

@ -38,7 +38,7 @@ class EditServers {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingsitems = [], inneritems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
@ -59,7 +59,7 @@ class EditServers {
label: "Reset all Servers",
onClick: _ => {
BDFDB.openConfirmModal(this, "Are you sure you want to reset all servers?", () => {
BDFDB.removeAllData(this, "servers");
BDFDB.DataUtils.remove(this, "servers");
this.forceUpdateAll();
});
},
@ -114,10 +114,10 @@ class EditServers {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
let data = BDFDB.loadAllData(this, "servers");
BDFDB.removeAllData(this, "servers");
let data = BDFDB.DataUtils.load(this, "servers");
BDFDB.DataUtils.remove(this, "servers");
try {this.forceUpdateAll();} catch (err) {}
BDFDB.saveAllData(data, this, "servers");
BDFDB.DataUtils.save(data, this, "servers");
for (let guildobj of BDFDB.GuildUtils.getAll()) if (guildobj.instance) {
delete guildobj.instance.props.guild.EditServersCachedBanner;
@ -593,7 +593,7 @@ class EditServers {
let data = BDFDB.loadData(id, this, "servers");
this.setBanner(id, data);
if (!data) return {};
let allenabled = true, settings = BDFDB.getAllData(this, "settings");
let allenabled = true, settings = BDFDB.DataUtils.get(this, "settings");
for (let i in settings) if (!settings[i]) {
allenabled = false;
break;
@ -619,7 +619,7 @@ class EditServers {
updateGuildSidebar() {
if (document.querySelector(BDFDB.dotCN.guildheader)) {
var ins = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name: ["GuildSidebar", "GuildHeader"], all: true, noCopies: true, depth: 99999999, time: 99999999});
if (ins) for (let i in ins) ins[i].updater.enqueueForceUpdate(ins[i])
if (ins) for (let i in ins) ins[i].updater.enqueueForceUpdate(ins[i]);
}
}

View File

@ -101,7 +101,7 @@ class EditUsers {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingsitems = [], inneritems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
@ -122,7 +122,7 @@ class EditUsers {
label: "Reset all Users",
onClick: _ => {
BDFDB.openConfirmModal(this, "Are you sure you want to reset all users?", () => {
BDFDB.removeAllData(this, "users");
BDFDB.DataUtils.remove(this, "users");
this.forceUpdateAll();
});
},
@ -171,10 +171,10 @@ class EditUsers {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
let data = BDFDB.loadAllData(this, "users");
BDFDB.removeAllData(this, "users");
let data = BDFDB.DataUtils.load(this, "users");
BDFDB.DataUtils.remove(this, "users");
try {this.forceUpdateAll();} catch (err) {}
BDFDB.saveAllData(data, this, "users");
BDFDB.DataUtils.save(data, this, "users");
BDFDB.removeEles(".autocompleteEditUsers", ".autocompleteEditUsersRow");
@ -1092,7 +1092,7 @@ class EditUsers {
return data;
}
let allenabled = true, settings = BDFDB.getAllData(this, "settings");
let allenabled = true, settings = BDFDB.DataUtils.get(this, "settings");
for (let i in settings) if (!settings[i]) {
allenabled = false;
break;
@ -1134,7 +1134,7 @@ class EditUsers {
let words = textarea.value.split(/\s/);
let lastword = words[words.length-1].trim();
if (lastword && lastword.length > 1 && lastword[0] == "@") {
let users = BDFDB.loadAllData(this, "users");
let users = BDFDB.DataUtils.load(this, "users");
if (!users) return;
let userarray = [];
for (let id in users) if (users[id].name) {

View File

@ -138,8 +138,8 @@ class EmojiStatistics {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var amounts = BDFDB.getAllData(this, "amounts");
var settings = BDFDB.DataUtils.get(this, "settings");
var amounts = BDFDB.DataUtils.get(this, "amounts");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -215,7 +215,7 @@ class EmojiStatistics {
let emojipickerdiversityselector = document.querySelector(BDFDB.dotCN.emojipickerdiversityselector);
if (!emojipickerdiversityselector) return;
this.loadEmojiList();
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
if (settings.enableEmojiStatisticsButton) {
let emojiStatisticsButton = BDFDB.htmlToElement(`<div class="emojistatistics-button"></div>`);
emojipickerdiversityselector.parentElement.insertBefore(emojiStatisticsButton, emojipickerdiversityselector);

View File

@ -151,14 +151,14 @@ class FriendNotifications {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let notificationstrings = BDFDB.getAllData(this, "notificationstrings");
let notificationsounds = BDFDB.getAllData(this, "notificationsounds");
let amounts = BDFDB.getAllData(this, "amounts");
let settings = BDFDB.DataUtils.get(this, "settings");
let notificationstrings = BDFDB.DataUtils.get(this, "notificationstrings");
let notificationsounds = BDFDB.DataUtils.get(this, "notificationsounds");
let amounts = BDFDB.DataUtils.get(this, "amounts");
let friendIDs = BDFDB.LibraryModules.FriendUtils.getFriendIDs();
let friends = BDFDB.loadAllData(this, "friends");
let nonfriends = BDFDB.loadAllData(this, "nonfriends");
let friends = BDFDB.DataUtils.load(this, "friends");
let nonfriends = BDFDB.DataUtils.load(this, "nonfriends");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
settingshtml += `<div class="${BDFDB.disCNS.h2 + BDFDB.disCNS.cursorpointer + BDFDB.disCNS.margintop4 + BDFDB.disCN.marginbottom4} BDFDB-containertext"><span class="BDFDB-containerarrow closed"></span>General Settings</div><div class="BDFDB-collapsecontainer">`;
@ -218,8 +218,8 @@ class FriendNotifications {
settingshtml += `</div>`;
settingshtml += `</div></div>`;
BDFDB.saveAllData(friends, this, "friends");
BDFDB.saveAllData(nonfriends, this, "nonfriends");
BDFDB.DataUtils.save(friends, this, "friends");
BDFDB.DataUtils.save(nonfriends, this, "nonfriends");
let settingspanel = BDFDB.htmlToElement(settingshtml);
@ -364,7 +364,7 @@ class FriendNotifications {
let config = tableheader.getAttribute("config");
let group = tableheader.getAttribute("group");
if (config && group) {
let data = BDFDB.loadAllData(this, group);
let data = BDFDB.DataUtils.load(this, group);
if (config == "desktop") {
enable = !enable;
for (let id in data) data[id].disabled = false;
@ -372,7 +372,7 @@ class FriendNotifications {
}
for (let id in data) data[id][config] = enable;
for (let avatar of settingspanel.querySelectorAll(`.settings-avatar[group="${group}"]`)) BDFDB.toggleClass(avatar, config, enable);
BDFDB.saveAllData(data, this, group);
BDFDB.DataUtils.save(data, this, group);
this.SettingsUpdated = true;
}
}
@ -393,9 +393,9 @@ class FriendNotifications {
let config = tableheader.getAttribute("config");
let group = tableheader.getAttribute("group");
if (config && group) {
let data = BDFDB.loadAllData(this, group);
let data = BDFDB.DataUtils.load(this, group);
for (let id in data) data[id][config] = enable;
BDFDB.saveAllData(data, this, group);
BDFDB.DataUtils.save(data, this, group);
for (let checkbox of settingspanel.querySelectorAll(`${BDFDB.dotCN.checkboxinput}[config="${config}"][group="${group}"]`)) {
checkbox.checked = enable;
if (typeof checkbox.BDFDBupdateElement == "function") checkbox.BDFDBupdateElement();
@ -478,11 +478,11 @@ class FriendNotifications {
startInterval () {
clearInterval(this.checkInterval);
let settings = BDFDB.getAllData(this, "settings");
let amounts = BDFDB.getAllData(this, "amounts");
let notificationstrings = BDFDB.getAllData(this, "notificationstrings");
let notificationsounds = BDFDB.getAllData(this, "notificationsounds");
let users = Object.assign({}, BDFDB.loadAllData(this, "nonfriends"), BDFDB.loadAllData(this, "friends"));
let settings = BDFDB.DataUtils.get(this, "settings");
let amounts = BDFDB.DataUtils.get(this, "amounts");
let notificationstrings = BDFDB.DataUtils.get(this, "notificationstrings");
let notificationsounds = BDFDB.DataUtils.get(this, "notificationsounds");
let users = Object.assign({}, BDFDB.DataUtils.load(this, "nonfriends"), BDFDB.DataUtils.load(this, "friends"));
for (let id in users) this.userStatusStore[id] = this.getStatusWithMobileAndActivity(id, users[id]).statusname;
let toasttime = (amounts.toastTime > amounts.checkInterval ? amounts.checkInterval : amounts.toastTime) * 1000;
let desktoptime = (amounts.desktopTime > amounts.checkInterval ? amounts.checkInterval : amounts.desktopTime) * 1000;
@ -501,7 +501,7 @@ class FriendNotifications {
if (!(settings.muteOnDND && BDFDB.UserUtils.getStatus() == "dnd")) {
let openChannel = () => {
if (settings.openOnClick) {
let DMid = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(user.id)
let DMid = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(user.id);
if (DMid) BDFDB.LibraryModules.SelectChannelUtils.selectPrivateChannel(DMid);
else BDFDB.LibraryModules.DirectMessageUtils.openPrivateChannel(BDFDB.UserUtils.me.id, user.id);
BDFDB.LibraryRequires.electron.remote.getCurrentWindow().maximize();
@ -543,7 +543,7 @@ class FriendNotifications {
entry.querySelector(".log-time").innerText = `[${log.time.toLocaleTimeString()}]`;
entry.querySelector(".log-avatar").style.setProperty("background-image", `url(${log.avatar})`);
entry.querySelector(".log-description").innerHTML = log.string;
container.appendChild(entry)
container.appendChild(entry);
}
BDFDB.appendModal(timeLogModal);
}

View File

@ -43,7 +43,7 @@ class GoogleSearchReplace {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let engines = BDFDB.getAllData(this, "engines");
let engines = BDFDB.DataUtils.get(this, "engines");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">Search Engines:</h3></div><div class="BDFDB-settings-inner-list">`;
for (let key in engines) {
@ -113,7 +113,7 @@ class GoogleSearchReplace {
}
appendItem (menu, returnvalue, text) {
let engines = BDFDB.getAllData(this, "engines");
let engines = BDFDB.DataUtils.get(this, "engines");
let items = [];
for (let key in engines) if (engines[key]) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
label: this.defaults.engines[key].name,

View File

@ -138,8 +138,8 @@ class GoogleTranslateOption {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var choices = BDFDB.getAllData(this, "choices");
var settings = BDFDB.getAllData(this, "settings");
var choices = BDFDB.DataUtils.get(this, "choices");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in choices) {
let choice = this.getLanguageChoice(key);
@ -292,7 +292,7 @@ class GoogleTranslateOption {
{"braille": {name:"Braille 6-dot", id:"braille", integrated:false, dic:false}},
{"morse": {name:"Morse", id:"morse", integrated:false, dic:false}}
);
let favorites = BDFDB.loadAllData(this, "favorites")
let favorites = BDFDB.DataUtils.load(this, "favorites");
for (let id in this.languages) this.languages[id].fav = favorites[id] != undefined ? 0 : 1;
this.languages = BDFDB.ObjectUtils.sort(this.languages, "fav");
}
@ -392,7 +392,7 @@ class GoogleTranslateOption {
if (!messagediv.querySelector(BDFDB.dotCN.messageedited + ".GTO-translated")) {
var markup = messagediv.querySelector(BDFDB.dotCN.messagemarkup);
var accessory = messagediv.querySelector(BDFDB.dotCN.messageaccessory);
var embeddescriptions = messagediv.querySelectorAll(BDFDB.dotCN.embeddescription)
var embeddescriptions = messagediv.querySelectorAll(BDFDB.dotCN.embeddescription);
var fakemarkup = markup.cloneNode(true);
BDFDB.removeEles(fakemarkup.querySelectorAll(BDFDB.dotCNC.messageheadercompact + BDFDB.dotCN.messageedited));
let string = fakemarkup.innerHTML;
@ -614,7 +614,7 @@ 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")
let favorize = !BDFDB.loadData(choice, this, "favorites");
if (favorize) BDFDB.saveData(choice, true, this, "favorites");
else BDFDB.removeData(choice, this, "favorites");
this.setLanguages();

View File

@ -108,7 +108,7 @@ class ImageZoom {
let settingslink = BDFDB.htmlToElement(`<span class="${BDFDB.disCN.downloadlink} imagezoom-settings">Zoom ${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}</div>`);
inner.firstElementChild.appendChild(settingslink);
let openContext = e => {
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
let items = [];
for (let type in settings) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSliderItem, {
label: this.defaults.settings[type].name + ": " + settings[type] + this.defaults.settings[type].unit,
@ -142,7 +142,7 @@ class ImageZoom {
BDFDB.appendLocalStyle("ImageZoomCrossHair", "* {cursor: crosshair !important;}");
let imgrects = BDFDB.getRects(img);
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
let lense = BDFDB.htmlToElement(`<div class="imagezoom-lense" style="clip-path: circle(${(settings.lensesize/2) + 2}px at center) !important; border-radius: 50% !important; pointer-events: none !important; z-index: 10000 !important; width: ${settings.lensesize}px !important; height: ${settings.lensesize}px !important; position: fixed !important;"><div class="imagezoom-lense-inner" style="position: absolute !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; clip-path: circle(${settings.lensesize/2}px at center) !important;"><${img.tagName} class="imagezoom-pane" src="${img.src}" style="width: ${imgrects.width * settings.zoomlevel}px; height: ${imgrects.height * settings.zoomlevel}px; position: fixed !important;"${img.tagName == "VIDEO" ? " loop autoplay" : ""}></${img.tagName}></div></div>`);
let pane = lense.querySelector(".imagezoom-pane");

View File

@ -68,9 +68,9 @@ class JoinedAtDate {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let choices = BDFDB.getAllData(this, "choices");
let formats = BDFDB.getAllData(this, "formats");
let settings = BDFDB.DataUtils.get(this, "settings");
let choices = BDFDB.DataUtils.get(this, "choices");
let formats = BDFDB.DataUtils.get(this, "formats");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -151,12 +151,12 @@ class JoinedAtDate {
for (let input of settingspanel.querySelectorAll(BDFDB.dotCN.input)) {
formats[input.getAttribute("option")] = input.value;
}
BDFDB.saveAllData(formats, this, "formats");
BDFDB.DataUtils.save(formats, this, "formats");
this.updateSettingsPanel(settingspanel);
}
updateSettingsPanel (settingspanel) {
let choices = BDFDB.getAllData(this, "choices");
let choices = BDFDB.DataUtils.get(this, "choices");
for (let key in choices) {
settingspanel.querySelector(`${BDFDB.dotCN.select}[type='${key}'] .languageTimestamp`).innerText = this.getTimestamp(this.languages[choices[key]].id);
}
@ -231,7 +231,7 @@ class JoinedAtDate {
if (typeof time == "string") timeobj = new Date(time);
if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time));
if (timeobj.toString() == "Invalid Date") return;
let settings = BDFDB.getAllData(this, "settings"), timestring = "";
let settings = BDFDB.DataUtils.get(this, "settings"), timestring = "";
if (languageid != "own") {
let timestamp = [];
if (settings.displayDate) timestamp.push(timeobj.toLocaleDateString(languageid));

View File

@ -69,9 +69,9 @@ class LastMessageDate {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let choices = BDFDB.getAllData(this, "choices");
let formats = BDFDB.getAllData(this, "formats");
let settings = BDFDB.DataUtils.get(this, "settings");
let choices = BDFDB.DataUtils.get(this, "choices");
let formats = BDFDB.DataUtils.get(this, "formats");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -158,12 +158,12 @@ class LastMessageDate {
for (let input of settingspanel.querySelectorAll(BDFDB.dotCN.input)) {
formats[input.getAttribute("option")] = input.value;
}
BDFDB.saveAllData(formats, this, "formats");
BDFDB.DataUtils.save(formats, this, "formats");
this.updateSettingsPanel(settingspanel);
}
updateSettingsPanel (settingspanel) {
let choices = BDFDB.getAllData(this, "choices");
let choices = BDFDB.DataUtils.get(this, "choices");
for (let key in choices) {
settingspanel.querySelector(`${BDFDB.dotCN.select}[type='${key}'] .languageTimestamp`).innerText = this.getTimestamp(this.languages[choices[key]].id);
}
@ -247,7 +247,7 @@ class LastMessageDate {
if (typeof time == "string") timeobj = new Date(time);
if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time));
if (timeobj.toString() == "Invalid Date") return;
let settings = BDFDB.getAllData(this, "settings"), timestring = "";
let settings = BDFDB.DataUtils.get(this, "settings"), timestring = "";
if (languageid != "own") {
let timestamp = [];
if (settings.displayDate) timestamp.push(timeobj.toLocaleDateString(languageid));

View File

@ -56,9 +56,9 @@ class MessageUtilities {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let toasts = BDFDB.getAllData(this, "toasts");
let bindings = BDFDB.getAllData(this, "bindings");
let settings = BDFDB.DataUtils.get(this, "settings");
let toasts = BDFDB.DataUtils.get(this, "toasts");
let bindings = BDFDB.DataUtils.get(this, "bindings");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
if (this.defaults.settings[key].description) 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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -81,8 +81,8 @@ class MessageUtilities {
BDFDB.initElements(settingspanel, this);
BDFDB.ListenerUtils.add(this, settingspanel, "click", BDFDB.dotCN.hotkeycontainer, e => {this.startRecording(settingspanel, e);})
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".reset-recorder", e => {this.resetRecorder(settingspanel, e);})
BDFDB.ListenerUtils.add(this, settingspanel, "click", BDFDB.dotCN.hotkeycontainer, e => {this.startRecording(settingspanel, e);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".reset-recorder", e => {this.resetRecorder(settingspanel, e);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".reset-button", () => {this.resetAll(settingspanel);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {
BDFDB.openDropdownMenu(e, this.saveSelectChoice.bind(this), this.createSelectChoice.bind(this), this.clickMap);
@ -180,8 +180,8 @@ class MessageUtilities {
resetAll (settingspanel) {
BDFDB.openConfirmModal(this, "Are you sure you want to delete all key bindings?", () => {
BDFDB.removeAllData(this, "bindings");
let bindings = BDFDB.getAllData(this, "bindings");
BDFDB.DataUtils.remove(this, "bindings");
let bindings = BDFDB.DataUtils.get(this, "bindings");
settingspanel.querySelectorAll(BDFDB.dotCN.select).forEach(wrap => {
let type = wrap.getAttribute("type").split(" ");
wrap.setAttribute("value", bindings[type[0]][type[1]]);
@ -262,8 +262,8 @@ class MessageUtilities {
onClick (e, click, name) {
if (!this.isEventFired(name)) {
this.fireEvent(name);
let settings = BDFDB.getAllData(this, "settings");
let bindings = BDFDB.ObjectUtils.filter(BDFDB.getAllData(this, "bindings"), action => {return settings[action]}, true);
let settings = BDFDB.DataUtils.get(this, "settings");
let bindings = BDFDB.ObjectUtils.filter(BDFDB.DataUtils.get(this, "bindings"), action => {return settings[action]}, true);
let priorityaction = null;
for (let action in bindings) {
let binding = bindings[action];
@ -411,7 +411,7 @@ class MessageUtilities {
getActiveShortcutString (action) {
if (!action) return null;
let str = "", settings = BDFDB.getAllData(this, "settings");
let str = "", settings = BDFDB.DataUtils.get(this, "settings");
if (settings.addHints && settings[action]) {
let binding = BDFDB.getData(action, this, "bindings");
if (binding) for (let type in binding) {
@ -426,7 +426,7 @@ class MessageUtilities {
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.messagegroup + "> [aria-disabled]", target) || BDFDB.getParentEle(BDFDB.dotCN.messagegroup + "> * > [aria-disabled]", target) || BDFDB.getParentEle(BDFDB.dotCN.messagesystem, target);
let pos = messagediv ? Array.from(messagediv.parentElement.childNodes).filter(n => n.nodeType != Node.TEXT_NODE).indexOf(messagediv) : -1;
let instance = BDFDB.ReactUtils.getInstance(messagediv);
let message = instance ? BDFDB.ReactUtils.findValue(, instance, "message", {up:true}) : null;
let message = instance ? BDFDB.ReactUtils.findValue(instance, "message", {up:true}) : null;
return {messagediv, pos, message};
}

View File

@ -148,8 +148,8 @@ class NotificationSounds {
BDFDB.ListenerUtils.add(this, settingspanel, "keyup", ".songInput", e => {if (e.which == 13) this.saveAudio(settingspanel);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".reset-button", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to delete all added songs?", () => {
BDFDB.removeAllData(this, "choices");
BDFDB.removeAllData(this, "audios");
BDFDB.DataUtils.remove(this, "choices");
BDFDB.DataUtils.remove(this, "audios");
this.loadAudios();
this.loadChoices();
settingspanel.querySelectorAll(BDFDB.dotCN.select).forEach(wrap => {
@ -401,9 +401,9 @@ class NotificationSounds {
}
loadAudios () {
this.audios = BDFDB.loadAllData(this, "audios");
this.audios = BDFDB.DataUtils.load(this, "audios");
if (BDFDB.ObjectUtils.isEmpty(this.audios)) this.audios = this.defaults;
BDFDB.saveAllData(this.audios, this, "audios");
BDFDB.DataUtils.save(this.audios, this, "audios");
}
saveAudio (settingspanel) {
@ -445,7 +445,7 @@ class NotificationSounds {
BDFDB.NotificationUtils.toast(`Song ${song} was added to category ${category}.`, {type:"success"});
if (!this.audios[category]) this.audios[category] = {};
this.audios[category][song] = url;
BDFDB.saveAllData(this.audios, this, "audios");
BDFDB.DataUtils.save(this.audios, this, "audios");
inputs.forEach((input) => {
input.value = "";
});
@ -480,7 +480,7 @@ class NotificationSounds {
playAudio (type, audio) {
if (!audio) {
if (this.dontPlayAudio(type)) return;
audio = new Audio()
audio = new Audio();
}
else audio.pause();
audio.src = this.choices[type].src;

View File

@ -97,7 +97,7 @@ class OldTitleBar {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch${key == "displayNative" ? " nativetitlebar-switch" : ""}"${settings[key] ? " checked" : ""}></div></div>`;
@ -208,7 +208,7 @@ class OldTitleBar {
addTitleBar () {
BDFDB.removeEles(".headerbarOTB");
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
if (BDFDB.getData("addOldBar", this, "settings")) {
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);

View File

@ -45,8 +45,8 @@ class OwnerTag {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var inputs = BDFDB.getAllData(this, "inputs");
var settings = BDFDB.DataUtils.get(this, "settings");
var inputs = BDFDB.DataUtils.get(this, "inputs");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in inputs) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.inputs[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="${inputs[key]}" placeholder="${this.defaults.inputs[key].value}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}"></div></div>`;
@ -123,7 +123,7 @@ class OwnerTag {
for (let input of settingspanel.querySelectorAll(BDFDB.dotCN.input)) {
inputs[input.getAttribute("option")] = input.value;
}
BDFDB.saveAllData(inputs, this, "inputs");
BDFDB.DataUtils.save(inputs, this, "inputs");
this.SettingsUpdated = true;
}
@ -165,7 +165,7 @@ class OwnerTag {
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelid || BDFDB.LibraryModules.LastChannelStore.getChannelId());
if (!channel) return;
let guild = BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id);
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
let isowner = channel.ownerId == info.id || guild && guild.ownerId == info.id;
if (!(isowner || (settings.addForAdmins && BDFDB.UserUtils.can("ADMINISTRATOR", info.id)))) return;
let member = settings.useRoleColor ? (BDFDB.LibraryModules.MemberStore.getMember(channel.guild_id, info.id) || {}) : {};
@ -191,7 +191,7 @@ class OwnerTag {
}
addHideCSS () {
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
if (settings.hideNativeCrown || settings.useCrown) BDFDB.appendLocalStyle(this.name + "HideCrown", `${BDFDB.dotCNS.member + BDFDB.dotCN.memberownericon}:not(.owner-tag-crown) {display: none;}`);
else BDFDB.removeLocalStyle(this.name + "HideCrown");
}

View File

@ -144,7 +144,7 @@ class PersonalPins {
settingspanel.querySelector(".reset-button").addEventListener("click", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to delete all pinned notes?", () => {
BDFDB.removeAllData(this, "pins");
BDFDB.DataUtils.remove(this, "pins");
});
});
return settingspanel;
@ -351,7 +351,7 @@ class PersonalPins {
let channel = BDFDB.ChannelUtils.getSelected();
if (channel) {
let guild_id = channel.guild_id ? channel.guild_id : "@me";
let pins = BDFDB.loadAllData(this, "pins");
let pins = BDFDB.DataUtils.load(this, "pins");
if (!BDFDB.ObjectUtils.isEmpty(pins)) {
let container = notespopout.querySelector(BDFDB.dotCN.messagespopout);
let placeholder = notespopout.querySelector(BDFDB.dotCN.messagespopoutemptyplaceholder);
@ -502,7 +502,7 @@ class PersonalPins {
if (!message || !target) return;
let {messagediv, pos} = this.getMessageAndPos(target);
if (!messagediv || pos == -1) return;
let pins = BDFDB.loadAllData(this, "pins");
let pins = BDFDB.DataUtils.load(this, "pins");
let guild = BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id) || {};
let guild_id = guild.id ? guild.id : "@me";
channel = channel ? channel : BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
@ -535,18 +535,18 @@ class PersonalPins {
"markup": this.getMarkup(messagediv).innerHTML,
"accessory": messagediv.querySelector(BDFDB.dotCN.messageaccessory).innerHTML
});
BDFDB.saveAllData(pins, this, "pins");
BDFDB.DataUtils.save(pins, this, "pins");
BDFDB.NotificationUtils.toast(this.labels.toast_noteadd_text, {type:"success"});
}
else this.removeNoteData(pins[guild_id][channel.id][message.id + "_" + pos]);
}
updateNoteData (note, markup, accessory) {
let pins = BDFDB.loadAllData(this, "pins");
let pins = BDFDB.DataUtils.load(this, "pins");
pins[note.guild_id][note.channel_id][note.id + "_" + note.pos].markup = markup;
pins[note.guild_id][note.channel_id][note.id + "_" + note.pos].accessory = accessory;
pins[note.guild_id][note.channel_id][note.id + "_" + note.pos] = BDFDB.ObjectUtils.sort(pins[note.guild_id][note.channel_id][note.id + "_" + note.pos]);
BDFDB.saveAllData(pins, this, "pins");
BDFDB.DataUtils.save(pins, this, "pins");
BDFDB.NotificationUtils.toast(this.labels.toast_noteupdate_text, {type:"info"});
}
@ -561,19 +561,19 @@ class PersonalPins {
let {messagediv, pos} = this.getMessageAndPos(target);
if (!messagediv || pos == -1) return;
channel = channel ? channel : BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
let pins = BDFDB.loadAllData(this, "pins");
let pins = BDFDB.DataUtils.load(this, "pins");
let guildid = channel.guild_id ? channel.guild_id : "@me";
return pins[guildid] && pins[guildid][channel.id] && pins[guildid][channel.id][message.id + "_" + pos] ? pins[guildid][channel.id][message.id + "_" + pos] : null;
}
removeNoteData (noteData) {
let pins = BDFDB.loadAllData(this, "pins");
let pins = BDFDB.DataUtils.load(this, "pins");
delete pins[noteData.guild_id][noteData.channel_id][noteData.id + "_" + noteData.pos];
if (BDFDB.ObjectUtils.isEmpty(pins[noteData.guild_id][noteData.channel_id])) {
delete pins[noteData.guild_id][noteData.channel_id];
if (BDFDB.ObjectUtils.isEmpty(pins[noteData.guild_id])) delete pins[noteData.guild_id];
}
BDFDB.saveAllData(pins, this, "pins");
BDFDB.DataUtils.save(pins, this, "pins");
BDFDB.NotificationUtils.toast(this.labels.toast_noteremove_text, {type:"danger"});
}

View File

@ -110,7 +110,7 @@ class PinDMs {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -124,8 +124,8 @@ class PinDMs {
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".reset-button", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to unpin all pinned DMs?", () => {
BDFDB.removeAllData(this, "pinnedDMs");
BDFDB.removeAllData(this, "pinnedRecents");
BDFDB.DataUtils.remove(this, "pinnedDMs");
BDFDB.DataUtils.remove(this, "pinnedRecents");
});
});
return settingspanel;
@ -223,8 +223,8 @@ class PinDMs {
}
appendItem (menu, id, children, index) {
let pinnedInChannel = BDFDB.loadAllData(this, "pinnedDMs")[id] != undefined;
let pinnedInGuild = BDFDB.loadAllData(this, "pinnedRecents")[id] != undefined;
let pinnedInChannel = BDFDB.DataUtils.load(this, "pinnedDMs")[id] != undefined;
let pinnedInGuild = BDFDB.DataUtils.load(this, "pinnedRecents")[id] != undefined;
let items = [];
items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
label: this.labels[pinnedInChannel ? "context_unpinchannel_text" : "context_pinchannel_text"],
@ -342,7 +342,7 @@ class PinDMs {
if (methodnames.includes("componentDidMount")) {
wrapper.removeEventListener("contextmenu", wrapper.PinDMsContextMenuListener);
wrapper.PinDMsContextMenuListener = e => {
if (BDFDB.loadAllData(this, "pinnedRecents")[instance.props.channel.id] == undefined) {
if (BDFDB.DataUtils.load(this, "pinnedRecents")[instance.props.channel.id] == undefined) {
const itemGroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
children: [
@ -362,7 +362,7 @@ class PinDMs {
};
wrapper.addEventListener("contextmenu", wrapper.PinDMsContextMenuListener);
}
let pinnedRecents = BDFDB.loadAllData(this, "pinnedRecents");
let pinnedRecents = BDFDB.DataUtils.load(this, "pinnedRecents");
if (pinnedRecents[instance.props.channel.id] != undefined) {
if (methodnames.includes("componentDidMount")) {
if (!document.querySelector(`.pinned-dm[channelid="${instance.props.channel.id}"]`)) this.addPinnedRecent(instance.props.channel.id);
@ -458,7 +458,7 @@ class PinDMs {
}
sortAndUpdate (type) {
let pinnedDMs = BDFDB.loadAllData(this, type);
let pinnedDMs = BDFDB.DataUtils.load(this, type);
delete pinnedDMs[""];
delete pinnedDMs["null"];
let sortedDMs = [], existingDMs = [], sortDM = (id, pos) => {
@ -516,7 +516,7 @@ class PinDMs {
});
avatar.parentElement.addEventListener("click", e => {
if (user) {
let DMid = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(user.id)
let DMid = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(user.id);
if (DMid) BDFDB.LibraryModules.SelectChannelUtils.selectPrivateChannel(DMid);
else BDFDB.LibraryModules.DirectMessageUtils.openPrivateChannel(BDFDB.UserUtils.me.id, user.id);
}
@ -610,11 +610,11 @@ class PinDMs {
updatePinnedPositions (type) {
setImmediate(() => {
let newPinned = {}, oldPinned = BDFDB.loadAllData(this, type);
let newPinned = {}, oldPinned = BDFDB.DataUtils.load(this, type);
let pins = Array.from(document.querySelectorAll(type == "pinnedRecents" ? `.pinned-dm` : `${BDFDB.dotCNS.dmchannels + BDFDB.dotCN.dmchannel}.pinned`)).map(div => {return div.getAttribute("channelid");}).reverse();
for (let i in pins) if (pins[i]) newPinned[pins[i]] = parseInt(i);
for (let id in oldPinned) if (newPinned[id] == undefined) newPinned[id] = Object.keys(newPinned).length;
BDFDB.saveAllData(newPinned, this, type);
BDFDB.DataUtils.save(newPinned, this, type);
});
}

View File

@ -243,7 +243,7 @@ class PluginRepo {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -266,7 +266,7 @@ class PluginRepo {
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".btn-addplugin", () => {this.addPluginToOwnList(settingspanel);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", "#input-pluginurl", e => {if (e.which == 13) this.addPluginToOwnList(settingspanel);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".remove-plugin", e => {this.removePluginFromOwnList(e);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".remove-all", () => {this.removeAllFromOwnList(settingspanel);})
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".remove-all", () => {this.removeAllFromOwnList(settingspanel);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".refresh-button", () => {
this.loading = {is:false, timeout:null, amount:0};
this.loadPlugins();
@ -354,7 +354,7 @@ class PluginRepo {
if (folderbutton) {
var repoButton = BDFDB.htmlToElement(`<button class="${BDFDB.disCN._repofolderbutton} bd-pluginrepobutton">PluginRepo</button>`);
repoButton.addEventListener("click", () => {
this.openPluginRepoModal()
this.openPluginRepoModal();
});
repoButton.addEventListener("mouseenter", () => {
BDFDB.TooltipUtils.create(repoButton, "Open Plugin Repo", {type:"top",selector:"pluginrepo-button-tooltip"});
@ -406,7 +406,7 @@ class PluginRepo {
var pluginRepoModal = BDFDB.htmlToElement(this.pluginRepoModalMarkup);
var tabbar = pluginRepoModal.querySelector(BDFDB.dotCN.tabbar);
tabbar.parentElement.insertBefore(BDFDB.createSearchBar("small"), tabbar.nextElementSibling);
var hiddenSettings = BDFDB.loadAllData(this, "hidden");
var hiddenSettings = BDFDB.DataUtils.load(this, "hidden");
pluginRepoModal.querySelector("#input-hideupdated").checked = hiddenSettings.updated || options.showOnlyOutdated;
pluginRepoModal.querySelector("#input-hideoutdated").checked = hiddenSettings.outdated && !options.showOnlyOutdated;
pluginRepoModal.querySelector("#input-hidedownloadable").checked = hiddenSettings.downloadable || options.showOnlyOutdated;
@ -452,7 +452,7 @@ class PluginRepo {
}
});
let favorites = BDFDB.loadAllData(this, "favorites");
let favorites = BDFDB.DataUtils.load(this, "favorites");
let container = pluginRepoModal.querySelector(".plugins");
pluginRepoModal.entries = {};
for (let url in this.loadedPlugins) {
@ -586,12 +586,12 @@ class PluginRepo {
loadPlugins () {
BDFDB.removeEles("iframe.discordSandbox",".pluginrepo-loadingicon");
var settings = BDFDB.loadAllData(this, "settings");
var settings = BDFDB.DataUtils.load(this, "settings");
var getPluginInfo, createFrame, runInFrame;
var frame, framerunning = false, framequeue = [], outdated = 0, newentries = 0, i = 0;
var tags = ["getName", "getVersion", "getAuthor", "getDescription"];
var seps = ["\"", "\'", "\`"];
var newentriesdata = BDFDB.loadAllData(this, "newentriesdata"), ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
var newentriesdata = BDFDB.DataUtils.load(this, "newentriesdata"), ownlist = BDFDB.loadData("ownlist", this, "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) {

View File

@ -58,7 +58,7 @@ class ReadAllNotificationsButton {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingsitems = [], inneritems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
@ -137,7 +137,7 @@ class ReadAllNotificationsButton {
let ranbutton = BDFDB.htmlToElement(this.RANbuttonMarkup);
insertnode.parentElement.insertBefore(ranbutton, insertnode);
ranbutton.addEventListener("click", () => {
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
if (settings.includeGuilds) BDFDB.GuildUtils.markAsRead(settings.includeMuted ? BDFDB.GuildUtils.getAll() : BDFDB.GuildUtils.getUnread());
if (settings.includeDMs) BDFDB.DmUtils.markAsRead(BDFDB.DmUtils.getAll());
});

View File

@ -42,7 +42,7 @@ class RemoveNicknames {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
if (!this.defaults.settings[key].inner) settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -180,7 +180,7 @@ class RemoveNicknames {
getNewName (info, wrapper) {
if (!info) return null;
let settings = BDFDB.getAllData(this, "settings");
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) || {};
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;
@ -189,7 +189,7 @@ class RemoveNicknames {
}
ignoreElement (id, wrapper) {
let allenabled = true, settings = BDFDB.ObjectUtils.filter(BDFDB.getAllData(this, "settings"), key => {return this.defaults.settings[key].inner;}, true);
let allenabled = true, settings = BDFDB.ObjectUtils.filter(BDFDB.DataUtils.get(this, "settings"), key => {return this.defaults.settings[key].inner;}, true);
for (let i in settings) if (!settings[i]) {
allenabled = false;
break;

View File

@ -133,7 +133,7 @@ class RepoControls {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -212,7 +212,7 @@ class RepoControls {
processV2CPluginCard (instance, wrapper, returnvalue, methodnames) {
if (wrapper.querySelector(BDFDB.dotCN._reponame)) {
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
if (instance.props && settings.addDeleteButton) this.addDeleteButton("plugin", wrapper);
if (instance.props && settings.addEditButton) this.addEditButton("plugin", wrapper);
if (methodnames.includes("componentDidUpdate")) this.changeTextToHTML(wrapper, "");
@ -221,7 +221,7 @@ class RepoControls {
processV2CThemeCard (instance, wrapper, returnvalue, methodnames) {
if (wrapper.querySelector(BDFDB.dotCN._reponame)) {
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
if (instance.props && settings.addDeleteButton) this.addDeleteButton("theme", wrapper);
if (instance.props && settings.addEditButton) this.addEditButton("theme", wrapper);
if (methodnames.includes("componentDidUpdate")) this.changeTextToHTML(wrapper, "");
@ -278,7 +278,7 @@ class RepoControls {
container.style.setProperty("display", "flex", "important");
container.style.setProperty("flex-direction", "column", "important");
let sortings = BDFDB.getAllData(this, "sortings");
let sortings = BDFDB.DataUtils.get(this, "sortings");
let repocontrols = BDFDB.htmlToElement(this.repoControlsMarkup);
repocontrols.insertBefore(BDFDB.createSearchBar("small"), repocontrols.firstElementChild);
@ -352,7 +352,7 @@ class RepoControls {
if (typeof container.entries != "object") return;
let searchstring = repocontrols.querySelector(BDFDB.dotCN.searchbarinput).value.replace(/[<|>]/g, "").toUpperCase();
let sortings = BDFDB.getAllData(this, "sortings");
let sortings = BDFDB.DataUtils.get(this, "sortings");
let entries = BDFDB.ObjectUtils.filter(container.entries, entry => {return entry.search.indexOf(searchstring) > -1 ? entry : null;});
entries = BDFDB.ObjectUtils.sort(entries, sortings.sort);
if (sortings.order == "desc") entries = BDFDB.ObjectUtils.reverse(entries);
@ -371,7 +371,7 @@ class RepoControls {
}
}
else li.style.removeProperty("order");
BDFDB.toggleEles(li, pos > -1)
BDFDB.toggleEles(li, pos > -1);
}
}

View File

@ -42,8 +42,8 @@ class ReverseImageSearch {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let engines = BDFDB.getAllData(this, "engines");
let settings = BDFDB.DataUtils.get(this, "settings");
let engines = BDFDB.DataUtils.get(this, "engines");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">Add a contextmenu entry when right clicking</h3></div><div class="BDFDB-settings-inner-list">`;
for (let key in settings) {
@ -145,7 +145,7 @@ class ReverseImageSearch {
if (url.split("/https/").length != 1) url = "https://" + url.split("/https/")[url.split("/https/").length-1];
else if (url.split("/http/").length != 1) url = "http://" + url.split("/http/")[url.split("/http/").length-1];
}
let engines = BDFDB.getAllData(this, "engines");
let engines = BDFDB.DataUtils.get(this, "engines");
let items = [];
for (let key in engines) if (engines[key]) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
label: this.defaults.engines[key].name,

View File

@ -172,7 +172,7 @@ class ServerFolders {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -186,7 +186,7 @@ class ServerFolders {
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".removecustom-button", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to remove all custom icons?", () => {
BDFDB.removeAllData(this, "customicons");
BDFDB.DataUtils.remove(this, "customicons");
});
});
return settingspanel;
@ -219,7 +219,7 @@ class ServerFolders {
BDFDB.PluginUtils.init(this);
// REMOVE 08.10.2019
let foldersdata = BDFDB.ObjectUtils.sort(BDFDB.loadAllData(this, "folders"), "position");
let foldersdata = BDFDB.ObjectUtils.sort(BDFDB.DataUtils.load(this, "folders"), "position");
let folders = Object.keys(foldersdata).filter(n => n.indexOf("folder") == 0);
if (folders.length) BDFDB.openConfirmModal(this, `Old ServerFolders data detected!\nFound ${folders.length} old custom folders in the ServerFolders.config.json.\nPress the '${BDFDB.LanguageUtils.LanguageStrings.OKAY}' button to automatically create a native folder for each old folder and to automatically put the servers in them.`, "Convert?", () => {
let oldGuildFolders = Object.assign({}, BDFDB.LibraryModules.FolderStore.guildFolders);
@ -252,8 +252,8 @@ class ServerFolders {
for (let i in oldGuildFolders) if (oldGuildFolders[i].folderId || !guildsInFolders.includes(oldGuildFolders[i].guildIds[0])) guildFolders.push(Object.assign({}, oldGuildFolders[i]));
for (let i in guildFolders) for (let guildid of guildFolders[i].guildIds) guildPositions.push(guildid);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({guildPositions, guildFolders});
BDFDB.removeAllData(this, "folders");
BDFDB.saveAllData(newfoldersdata, this, "folders");
BDFDB.DataUtils.remove(this, "folders");
BDFDB.DataUtils.save(newfoldersdata, this, "folders");
});
BDFDB.ModuleUtils.forceAllUpdates(this);
@ -466,7 +466,7 @@ class ServerFolders {
BDFDB.ListenerUtils.add(this, wrapper, "click", () => {setImmediate(() => {
let folder = this.getFolderOfGuildId(instance.props.guild.id);
let folderid = folder ? folder.folderId : null;
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
if (settings.closeAllFolders) for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (!folderid || openFolderId != folderid || !settings.forceOpenFolder) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
else if (folderid && settings.closeTheFolder && !settings.forceOpenFolder && BDFDB.LibraryModules.FolderUtils.isFolderExpanded(folderid)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folderid);
@ -571,7 +571,7 @@ class ServerFolders {
loadAllIcons () {
let icons = {};
this.folderIcons.forEach((array,i) => {icons[i] = {"openicon":array.openicon,"closedicon":array.closedicon,"customID":null};});
Object.assign(icons, BDFDB.loadAllData(this, "customicons"));
Object.assign(icons, BDFDB.DataUtils.load(this, "customicons"));
return icons;
}
@ -663,7 +663,7 @@ class ServerFolders {
return BDFDB.LibraryModules.FolderStore.guildFolders.every(n => !n.folderId || n.folderId != id) ? id : this.generateID(prefix);
}
else {
let data = BDFDB.loadAllData(this, prefix + "s");
let data = BDFDB.DataUtils.load(this, prefix + "s");
let id = prefix + "_" + Math.round(Math.random()*10000000000000000);
return data[id] ? this.generateID(prefix) : id;
}
@ -982,7 +982,7 @@ class ServerFolders {
if (BDFDB.pressedKeys.includes(46)) this.removeGuildFromFolder(folderid, guildid);
else {
BDFDB.LibraryModules.GuildUtils.transitionToGuildSync(guild.id);
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
if (settings.closeAllFolders) for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (openFolderId != folderid || !settings.forceOpenFolder) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
else if (settings.closeTheFolder && !settings.forceOpenFolder && BDFDB.LibraryModules.FolderUtils.isFolderExpanded(folderid)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folderid);
}

View File

@ -77,7 +77,7 @@ class ServerHider {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -91,7 +91,7 @@ class ServerHider {
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".reset-button", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to reset all servers?", () => {
BDFDB.removeAllData(this, "servers");
BDFDB.DataUtils.remove(this, "servers");
BDFDB.GuildUtils.getAll().forEach(info => {if (!info.div.getAttribute("folder")) BDFDB.toggleEles(info.div, false);});
});
});
@ -251,7 +251,7 @@ class ServerHider {
isInFolder (id) {
if (!BDFDB.BdUtils.isPluginEnabled("ServerFolders")) return false;
let folders = BDFDB.loadAllData("ServerFolders", "folders");
let folders = BDFDB.DataUtils.load("ServerFolders", "folders");
for (let folderid in folders) if ((folders[folderid].servers || []).includes(id)) return true;
return false;
}

View File

@ -105,8 +105,8 @@ class ShowHiddenChannels {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var amounts = BDFDB.getAllData(this, "amounts");
var settings = BDFDB.DataUtils.get(this, "settings");
var amounts = BDFDB.DataUtils.get(this, "amounts");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
if (!this.defaults.settings[key].inner) settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -223,7 +223,7 @@ class ShowHiddenChannels {
}
}
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var count = 0;
for (let type in BDFDB.DiscordConstants.ChannelTypes) {
if (this.settingsMap[type] && !settings[this.settingsMap[type]]) hiddenChannels[BDFDB.DiscordConstants.ChannelTypes[type]] = [];
@ -309,7 +309,7 @@ class ShowHiddenChannels {
showAccessRoles (guild, channel, e, allowed) {
if ((e.type != "mouseenter" && e.type != "mouseover") || !guild || !channel) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var myMember = BDFDB.LibraryModules.MemberStore.getMember(guild.id, BDFDB.UserUtils.me.id);
var allowedRoles = [], allowedUsers = [], overwrittenRoles = [], deniedRoles = [], deniedUsers = [];
var everyoneDenied = false;

View File

@ -45,8 +45,8 @@ class ShowImageDetails {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let amounts = BDFDB.getAllData(this, "amounts");
let settings = BDFDB.DataUtils.get(this, "settings");
let amounts = BDFDB.DataUtils.get(this, "amounts");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;

View File

@ -56,9 +56,9 @@ class SpellCheck {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var choices = BDFDB.getAllData(this, "choices");
var amounts = BDFDB.getAllData(this, "amounts");
var settings = BDFDB.DataUtils.get(this, "settings");
var choices = BDFDB.DataUtils.get(this, "choices");
var amounts = BDFDB.DataUtils.get(this, "amounts");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;

View File

@ -309,7 +309,7 @@ class ThemeRepo {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -332,7 +332,7 @@ class ThemeRepo {
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".btn-addtheme", () => {this.addThemeToOwnList(settingspanel);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", "#input-themeurl", e => {if (e.which == 13) this.addThemeToOwnList(settingspanel);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".remove-theme", e => {this.removeThemeFromOwnList(e);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".remove-all", () => {this.removeAllFromOwnList(settingspanel);})
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".remove-all", () => {this.removeAllFromOwnList(settingspanel);});
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".refresh-button", () => {
this.loading = {is:false, timeout:null, amount:0};
this.loadThemes();
@ -414,7 +414,7 @@ class ThemeRepo {
if (folderbutton) {
var repoButton = BDFDB.htmlToElement(`<button class="${BDFDB.disCN._repofolderbutton} bd-themerepobutton">ThemeRepo</button>`);
repoButton.addEventListener("click", () => {
this.openThemeRepoModal()
this.openThemeRepoModal();
});
repoButton.addEventListener("mouseenter", () => {
BDFDB.TooltipUtils.create(repoButton, "Open Theme Repo", {type:"top",selector:"themerepo-button-tooltip"});
@ -434,7 +434,7 @@ class ThemeRepo {
if (!ownlist.includes(url)) {
ownlist.push(url);
BDFDB.saveData("ownlist", ownlist, this, "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>`)
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);
}
@ -530,7 +530,7 @@ class ThemeRepo {
var themeRepoModal = BDFDB.htmlToElement(this.themeRepoModalMarkup);
var tabbar = themeRepoModal.querySelector(BDFDB.dotCN.tabbar);
tabbar.parentElement.insertBefore(BDFDB.createSearchBar("small"), tabbar.nextElementSibling);
var hiddenSettings = BDFDB.loadAllData(this, "hidden");
var hiddenSettings = BDFDB.DataUtils.load(this, "hidden");
var darklightinput = themeRepoModal.querySelector("#input-darklight");
var normalizeinput = themeRepoModal.querySelector("#input-normalize");
var customcssinput = themeRepoModal.querySelector("#input-customcss");
@ -643,7 +643,7 @@ class ThemeRepo {
}
});
let favorites = BDFDB.loadAllData(this, "favorites");
let favorites = BDFDB.DataUtils.load(this, "favorites");
let container = themeRepoModal.querySelector(".themes");
themeRepoModal.entries = {};
for (let url in this.loadedThemes) {
@ -881,10 +881,10 @@ class ThemeRepo {
loadThemes () {
BDFDB.removeEles(".themerepo-loadingicon");
var settings = BDFDB.loadAllData(this, "settings");
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.loadAllData(this, "newentriesdata"), ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
var newentriesdata = BDFDB.DataUtils.load(this, "newentriesdata"), ownlist = BDFDB.loadData("ownlist", this, "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) {

View File

@ -81,8 +81,8 @@ class TimedLightDarkMode {
processRadioGroup (instance, wrapper, returnvalue) {
if (instance.props && Array.isArray(instance.props.options) && instance.props.options[0] && instance.props.options[0].value == "light" && instance.props.options[1] && instance.props.options[1].value == "dark" && wrapper.parentElement.firstElementChild.innerText && wrapper.parentElement.firstElementChild.innerText.toUpperCase() == BDFDB.LanguageUtils.LanguageStrings.THEME.toUpperCase()) {
var settings = BDFDB.getAllData(this, "settings");
var values = BDFDB.getAllData(this, "values");
var settings = BDFDB.DataUtils.get(this, "settings");
var values = BDFDB.DataUtils.get(this, "values");
var settingsbox = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.margintop8} TLDM-settingsbox"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><h5 class="${BDFDB.disCN.h5}">${BDFDB.LanguageUtils.LanguageStrings.THEME} Timer</h5><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings running" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings.running ? " checked" : ""}></div></div><div class="${BDFDB.disCNS.slider + BDFDB.disCN.margintop20}${!settings.running ? (" " + BDFDB.disCN.sliderdisabled): ""}"><input type="number" key="timer1" class="${BDFDB.disCN.sliderinput}" value="${values.timer1}" readonly=""><input type="number" key="timer2" class="${BDFDB.disCN.sliderinput}" value="${values.timer2}" readonly=""><div class="${BDFDB.disCN.slidertrack}"><div class="${BDFDB.disCN.slidermark}" style="left: 0%;"><div class="${BDFDB.disCN.slidermarkvalue}">00:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 12.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">03:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 25%;"><div class="${BDFDB.disCN.slidermarkvalue}">06:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 37.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">09:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 50%;"><div class="${BDFDB.disCN.slidermarkvalue}">12:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 62.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">15:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 75%;"><div class="${BDFDB.disCN.slidermarkvalue}">18:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 87.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">21:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 100%;"><div class="${BDFDB.disCN.slidermarkvalue}">24:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div></div><div class="${BDFDB.disCN.sliderbar}"><div class="${BDFDB.disCN.sliderbarfill}"></div></div><div class="${BDFDB.disCN.slidertrack}"><div class="${BDFDB.disCN.slidergrabber} timer-grabber" key="timer1" style="left: ${values.timer1}%;"></div><div class="${BDFDB.disCN.slidergrabber} timer-grabber" key="timer2" style="left: ${values.timer2}%;"></div><div class="${BDFDB.disCN.slidergrabber} date-grabber" key="current" style="left: ${this.getPercent(new Date())}%; cursor: help !important; height: 12px; margin-top: -7px;"></div></div></div></div>`);
wrapper.parentElement.appendChild(settingsbox);
var slider = settingsbox.querySelector(BDFDB.dotCN.slider);
@ -101,7 +101,7 @@ class TimedLightDarkMode {
startInterval () {
clearInterval(this.checkInterval);
if (BDFDB.getData("running", this, "settings")) {
var values = BDFDB.getAllData(this, "values");
var values = BDFDB.DataUtils.get(this, "values");
var inverted = values.timer1 > values.timer2;
var timer1LOW = this.getTime(values.timer1), timer2LOW = this.getTime(values.timer2);
var timer1HIGH = this.getHighTime(timer2LOW), timer2HIGH = this.getHighTime(timer1LOW);
@ -146,7 +146,7 @@ class TimedLightDarkMode {
if (BDFDB.containsClass(track.parentNode, BDFDB.disCN.sliderdisabled)) return;
var type = grabber.getAttribute("key");
var input = track.parentNode.querySelector(`${BDFDB.dotCN.sliderinput}[key="${type}"]`);
var values = BDFDB.getAllData(this, "values");
var values = BDFDB.DataUtils.get(this, "values");
BDFDB.appendLocalStyle("disableTextSelection", `*{user-select: none !important;}`);

View File

@ -51,7 +51,7 @@ class TopRoleEverywhere {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
for (let key in settings) {
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
@ -137,7 +137,7 @@ class TopRoleEverywhere {
if (!info || !username) return;
BDFDB.removeEles(username.parentElement.querySelectorAll(".TRE-tag"));
let guild = BDFDB.LibraryModules.GuildStore.getGuild(BDFDB.LibraryModules.LastGuildStore.getGuildId());
let settings = BDFDB.getAllData(this, "settings");
let settings = BDFDB.DataUtils.get(this, "settings");
if (!guild || info.bot && settings.disableForBots) return;
let role = BDFDB.LibraryModules.PermissionRoleUtils.getHighestRole(guild, info.id);
if ((role && (role.colorString || settings.includeColorless)) || info.id == 278543574059057154) {

View File

@ -65,7 +65,7 @@ class UserNotes {
getSettingsPanel () {
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
var settings = BDFDB.getAllData(this, "settings");
var settings = BDFDB.DataUtils.get(this, "settings");
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.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: 1 1 auto;">Remove all User Notes.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} remove-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Remove</div></button></div>`;
settingshtml += `</div></div>`;
@ -76,7 +76,7 @@ class UserNotes {
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".remove-button", () => {
BDFDB.openConfirmModal(this, "Are you sure you want to remove all usernotes?", () => {
BDFDB.removeAllData(this, "notes");
BDFDB.DataUtils.remove(this, "notes");
});
});
return settingspanel;
@ -148,14 +148,14 @@ class UserNotes {
let note = BDFDB.loadData(info.id, this, "notes") || "";
let userNotesModal = BDFDB.htmlToElement(this.userNotesModalMarkup);
let noteinput = userNotesModal.querySelector("#modal-inputtext")
let noteinput = userNotesModal.querySelector("#modal-inputtext");
userNotesModal.querySelector(BDFDB.dotCN.modalguildname).innerText = info.username || "";
noteinput.value = note;
noteinput.setAttribute("placeholder", note);
BDFDB.appendModal(userNotesModal);
BDFDB.ListenerUtils.addToChildren(userNotesModal, "click", ".btn-save", (e) => {
e.preventDefault();
BDFDB.saveData(info.id, noteinput.value, this, "notes")
BDFDB.saveData(info.id, noteinput.value, this, "notes");
});
noteinput.focus();
}