changes
This commit is contained in:
parent
707e82a99b
commit
5d8dc7fd4e
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class CharCounter {
|
class CharCounter {
|
||||||
initConstructor () {
|
initConstructor () {
|
||||||
this.moduleTypes = {
|
this.patchModules = {
|
||||||
"ChannelTextArea":"componentDidMount",
|
"ChannelTextArea":"componentDidMount",
|
||||||
"Note":"componentDidMount",
|
"Note":"componentDidMount",
|
||||||
"Modal":"componentDidMount"
|
"Modal":"componentDidMount"
|
||||||
|
@ -104,12 +104,7 @@ class CharCounter {
|
||||||
if (typeof BDFDB === "object") {
|
if (typeof BDFDB === "object") {
|
||||||
BDFDB.loadMessage(this);
|
BDFDB.loadMessage(this);
|
||||||
|
|
||||||
for (let type in this.moduleTypes) {
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
let module = BDFDB.WebModules.findByName(type);
|
|
||||||
if (module && module.prototype) BDFDB.WebModules.patch(module.prototype, this.moduleTypes[type], this, {after: (e) => {this.initiateProcess(e.thisObject, type);}});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.forceAllUpdates();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.error(this.getName() + ": Fatal Error: Could not load BD functions!");
|
console.error(this.getName() + ": Fatal Error: Could not load BD functions!");
|
||||||
|
@ -129,18 +124,6 @@ class CharCounter {
|
||||||
|
|
||||||
// begin of own functions
|
// begin of own functions
|
||||||
|
|
||||||
initiateProcess (instance, type) {
|
|
||||||
type = type.replace(/[^A-z]/g,"");
|
|
||||||
type = type[0].toUpperCase() + type.slice(1);
|
|
||||||
if (typeof this["process" + type] == "function") {
|
|
||||||
let wrapper = BDFDB.React.findDOMNodeSafe(instance);
|
|
||||||
if (wrapper) this["process" + type](instance, wrapper);
|
|
||||||
else setImmediate(() => {
|
|
||||||
this["process" + type](instance, BDFDB.React.findDOMNodeSafe(instance));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
processChannelTextArea (instance, wrapper) {
|
processChannelTextArea (instance, wrapper) {
|
||||||
if (!wrapper) return;
|
if (!wrapper) return;
|
||||||
if (instance.props && instance.props.type && this.maxLenghts[instance.props.type]) this.appendCounter(wrapper.querySelector("textarea"), instance.props.type);
|
if (instance.props && instance.props.type && this.maxLenghts[instance.props.type]) this.appendCounter(wrapper.querySelector("textarea"), instance.props.type);
|
||||||
|
@ -200,12 +183,4 @@ class CharCounter {
|
||||||
|
|
||||||
updateCounter();
|
updateCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
forceAllUpdates () {
|
|
||||||
let app = document.querySelector(BDFDB.dotCN.app);
|
|
||||||
if (app) {
|
|
||||||
let ins = BDFDB.getOwnerInstance({node:app, name:Object.keys(this.moduleTypes), all:true, noCopies:true, group:true, depth:99999999, time:99999999});
|
|
||||||
for (let type in ins) for (let i in ins[type]) this.initiateProcess(ins[type][i], type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ class EditChannels {
|
||||||
initConstructor () {
|
initConstructor () {
|
||||||
this.labels = {};
|
this.labels = {};
|
||||||
|
|
||||||
this.moduleTypes = {
|
this.patchModules = {
|
||||||
"ChannelTextArea":"componentDidMount",
|
"ChannelTextArea":"componentDidMount",
|
||||||
"AuditLog":"componentDidMount",
|
"AuditLog":"componentDidMount",
|
||||||
"ChannelCategoryItem":"componentDidMount",
|
"ChannelCategoryItem":"componentDidMount",
|
||||||
|
@ -123,7 +123,7 @@ class EditChannels {
|
||||||
.on("click", ".reset-button", () => {
|
.on("click", ".reset-button", () => {
|
||||||
if (confirm("Are you sure you want to reset all channels?")) {
|
if (confirm("Are you sure you want to reset all channels?")) {
|
||||||
BDFDB.removeAllData(this, "channels");
|
BDFDB.removeAllData(this, "channels");
|
||||||
this.forceAllUpdates();
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return settingspanel;
|
return settingspanel;
|
||||||
|
@ -151,18 +151,13 @@ class EditChannels {
|
||||||
if (typeof BDFDB === "object") {
|
if (typeof BDFDB === "object") {
|
||||||
BDFDB.loadMessage(this);
|
BDFDB.loadMessage(this);
|
||||||
|
|
||||||
for (let type in this.moduleTypes) {
|
|
||||||
let module = BDFDB.WebModules.findByName(type);
|
|
||||||
if (module && module.prototype) BDFDB.WebModules.patch(module.prototype, this.moduleTypes[type], this, {after: (e) => {this.initiateProcess(e.thisObject, type);}});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers","getUser");
|
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers","getUser");
|
||||||
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
|
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
|
||||||
this.CurrentChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getDefaultChannel");
|
this.CurrentChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getDefaultChannel");
|
||||||
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
||||||
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
||||||
|
|
||||||
this.forceAllUpdates();
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.error(this.getName() + ": Fatal Error: Could not load BD functions!");
|
console.error(this.getName() + ": Fatal Error: Could not load BD functions!");
|
||||||
|
@ -173,7 +168,7 @@ class EditChannels {
|
||||||
if (typeof BDFDB === "object") {
|
if (typeof BDFDB === "object") {
|
||||||
let data = BDFDB.loadAllData(this, "channels");
|
let data = BDFDB.loadAllData(this, "channels");
|
||||||
BDFDB.removeAllData(this, "channels");
|
BDFDB.removeAllData(this, "channels");
|
||||||
this.forceAllUpdates();
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
BDFDB.saveAllData(data, this, "channels");
|
BDFDB.saveAllData(data, this, "channels");
|
||||||
|
|
||||||
BDFDB.unloadMessage(this);
|
BDFDB.unloadMessage(this);
|
||||||
|
@ -221,7 +216,7 @@ class EditChannels {
|
||||||
.on("click", () => {
|
.on("click", () => {
|
||||||
$(menu).hide();
|
$(menu).hide();
|
||||||
BDFDB.removeData(instance.props.channel.id, this, "channels");
|
BDFDB.removeData(instance.props.channel.id, this, "channels");
|
||||||
this.forceAllUpdates();
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
BDFDB.appendSubMenu(e.currentTarget, channelContextSubMenu);
|
BDFDB.appendSubMenu(e.currentTarget, channelContextSubMenu);
|
||||||
|
@ -265,24 +260,12 @@ class EditChannels {
|
||||||
else {
|
else {
|
||||||
BDFDB.saveData(info.id, {name,color}, this, "channels");
|
BDFDB.saveData(info.id, {name,color}, this, "channels");
|
||||||
}
|
}
|
||||||
this.forceAllUpdates();
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
channelSettingsModal.find("#input-channelname").focus();
|
channelSettingsModal.find("#input-channelname").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
initiateProcess (instance, type) {
|
|
||||||
type = type.replace(/[^A-z]/g,"");
|
|
||||||
type = type[0].toUpperCase() + type.slice(1);
|
|
||||||
if (typeof this["process" + type] == "function") {
|
|
||||||
let wrapper = BDFDB.React.findDOMNodeSafe(instance);
|
|
||||||
if (wrapper) this["process" + type](instance, wrapper);
|
|
||||||
else setImmediate(() => {
|
|
||||||
this["process" + type](instance, BDFDB.React.findDOMNodeSafe(instance));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
processChannelTextArea (instance, wrapper) {
|
processChannelTextArea (instance, wrapper) {
|
||||||
if (!wrapper) return;
|
if (!wrapper) return;
|
||||||
if (instance.props && instance.props.type == "normal" && instance.props.channel && instance.props.channel.type == 0) {
|
if (instance.props && instance.props.type == "normal" && instance.props.channel && instance.props.channel.type == 0) {
|
||||||
|
@ -476,14 +459,6 @@ class EditChannels {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
forceAllUpdates () {
|
|
||||||
let app = document.querySelector(BDFDB.dotCN.app);
|
|
||||||
if (app) {
|
|
||||||
let ins = BDFDB.getOwnerInstance({node:app, name:Object.keys(this.moduleTypes), all:true, noCopies:true, group:true, depth:99999999, time:99999999});
|
|
||||||
for (let type in ins) for (let i in ins[type]) this.initiateProcess(ins[type][i], type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setLabelsByLanguage () {
|
setLabelsByLanguage () {
|
||||||
switch (BDFDB.getDiscordLanguage().id) {
|
switch (BDFDB.getDiscordLanguage().id) {
|
||||||
case "hr": //croatian
|
case "hr": //croatian
|
||||||
|
|
|
@ -4,7 +4,7 @@ class EditUsers {
|
||||||
initConstructor () {
|
initConstructor () {
|
||||||
this.labels = {};
|
this.labels = {};
|
||||||
|
|
||||||
this.moduleTypes = {
|
this.patchModules = {
|
||||||
"ChannelTextArea":"componentDidMount",
|
"ChannelTextArea":"componentDidMount",
|
||||||
"NameTag":"componentDidMount",
|
"NameTag":"componentDidMount",
|
||||||
"AuditLog":"componentDidMount",
|
"AuditLog":"componentDidMount",
|
||||||
|
@ -165,7 +165,7 @@ class EditUsers {
|
||||||
.on("click", ".reset-button", () => {
|
.on("click", ".reset-button", () => {
|
||||||
if (confirm("Are you sure you want to reset all users?")) {
|
if (confirm("Are you sure you want to reset all users?")) {
|
||||||
BDFDB.removeAllData(this, "users");
|
BDFDB.removeAllData(this, "users");
|
||||||
this.forceAllUpdates();
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return settingspanel;
|
return settingspanel;
|
||||||
|
@ -193,11 +193,6 @@ class EditUsers {
|
||||||
if (typeof BDFDB === "object") {
|
if (typeof BDFDB === "object") {
|
||||||
BDFDB.loadMessage(this);
|
BDFDB.loadMessage(this);
|
||||||
|
|
||||||
for (let type in this.moduleTypes) {
|
|
||||||
let module = BDFDB.WebModules.findByName(type);
|
|
||||||
if (module && module.prototype) BDFDB.WebModules.patch(module.prototype, this.moduleTypes[type], this, {after: (e) => {this.initiateProcess(e.thisObject, type);}});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.RelationshipUtils = BDFDB.WebModules.findByProperties("isBlocked", "isFriend");
|
this.RelationshipUtils = BDFDB.WebModules.findByProperties("isBlocked", "isFriend");
|
||||||
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers","getUser");
|
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers","getUser");
|
||||||
this.MemberUtils = BDFDB.WebModules.findByProperties("getMembers", "getMember");
|
this.MemberUtils = BDFDB.WebModules.findByProperties("getMembers", "getMember");
|
||||||
|
@ -205,7 +200,7 @@ class EditUsers {
|
||||||
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
||||||
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
||||||
|
|
||||||
this.forceAllUpdates();
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.error(this.getName() + ": Fatal Error: Could not load BD functions!");
|
console.error(this.getName() + ": Fatal Error: Could not load BD functions!");
|
||||||
|
@ -217,7 +212,7 @@ class EditUsers {
|
||||||
if (typeof BDFDB === "object") {
|
if (typeof BDFDB === "object") {
|
||||||
let data = BDFDB.loadAllData(this, "users");
|
let data = BDFDB.loadAllData(this, "users");
|
||||||
BDFDB.removeAllData(this, "users");
|
BDFDB.removeAllData(this, "users");
|
||||||
this.forceAllUpdates();
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
BDFDB.saveAllData(data, this, "users");
|
BDFDB.saveAllData(data, this, "users");
|
||||||
|
|
||||||
BDFDB.unloadMessage(this);
|
BDFDB.unloadMessage(this);
|
||||||
|
@ -267,7 +262,7 @@ class EditUsers {
|
||||||
.on("click", () => {
|
.on("click", () => {
|
||||||
$(menu).hide();
|
$(menu).hide();
|
||||||
BDFDB.removeData(instance.props.user.id, this, "users");
|
BDFDB.removeData(instance.props.user.id, this, "users");
|
||||||
this.forceAllUpdates();
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
BDFDB.appendSubMenu(e.currentTarget, userContextSubMenu);
|
BDFDB.appendSubMenu(e.currentTarget, userContextSubMenu);
|
||||||
|
@ -365,7 +360,7 @@ class EditUsers {
|
||||||
else {
|
else {
|
||||||
BDFDB.saveData(info.id, {name,tag,url,removeIcon,ignoreTagColor,color1,color2,color3,color4}, this, "users");
|
BDFDB.saveData(info.id, {name,tag,url,removeIcon,ignoreTagColor,color1,color2,color3,color4}, this, "users");
|
||||||
}
|
}
|
||||||
this.forceAllUpdates();
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
});
|
});
|
||||||
userSettingsModal.find("#input-username").focus();
|
userSettingsModal.find("#input-username").focus();
|
||||||
}
|
}
|
||||||
|
@ -409,18 +404,6 @@ class EditUsers {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initiateProcess (instance, type) {
|
|
||||||
type = type.replace(/[^A-z]/g,"");
|
|
||||||
type = type[0].toUpperCase() + type.slice(1);
|
|
||||||
if (typeof this["process" + type] == "function") {
|
|
||||||
let wrapper = BDFDB.React.findDOMNodeSafe(instance);
|
|
||||||
if (wrapper) this["process" + type](instance, wrapper);
|
|
||||||
else setImmediate(() => {
|
|
||||||
this["process" + type](instance, BDFDB.React.findDOMNodeSafe(instance));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
processChannelTextArea (instance, wrapper) {
|
processChannelTextArea (instance, wrapper) {
|
||||||
if (!wrapper) return;
|
if (!wrapper) return;
|
||||||
if (instance.props && instance.props.type == "normal" && instance.props.channel && instance.props.channel.type == 1) {
|
if (instance.props && instance.props.type == "normal" && instance.props.channel && instance.props.channel.type == 1) {
|
||||||
|
@ -746,14 +729,6 @@ class EditUsers {
|
||||||
username.style.setProperty("color", !username.classList.contains(BDFDB.disCN.voicenamedefault) ? BDFDB.colorCHANGE(color1, -50) : color1, "important");
|
username.style.setProperty("color", !username.classList.contains(BDFDB.disCN.voicenamedefault) ? BDFDB.colorCHANGE(color1, -50) : color1, "important");
|
||||||
}
|
}
|
||||||
|
|
||||||
forceAllUpdates () {
|
|
||||||
let app = document.querySelector(BDFDB.dotCN.app);
|
|
||||||
if (app) {
|
|
||||||
let ins = BDFDB.getOwnerInstance({node:app, name:Object.keys(this.moduleTypes), all:true, noCopies:true, group:true, depth:99999999, time:99999999});
|
|
||||||
for (let type in ins) for (let i in ins[type]) this.initiateProcess(ins[type][i], type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getAvatarDiv (wrapper) {
|
getAvatarDiv (wrapper) {
|
||||||
var avatar = wrapper.querySelector(BDFDB.dotCNC.avatarimage + BDFDB.dotCNC.callavatarwrapper + BDFDB.dotCNC.voiceavatarcontainer + "[class*='avatar-']");
|
var avatar = wrapper.querySelector(BDFDB.dotCNC.avatarimage + BDFDB.dotCNC.callavatarwrapper + BDFDB.dotCNC.voiceavatarcontainer + "[class*='avatar-']");
|
||||||
while (!avatar && wrapper.parentElement) {
|
while (!avatar && wrapper.parentElement) {
|
||||||
|
|
Loading…
Reference in New Issue