This commit is contained in:
Mirco Wittrien 2020-07-03 16:50:43 +02:00
parent f72d3c342e
commit 5d3d39f006
3 changed files with 34 additions and 35 deletions

View File

@ -4126,7 +4126,13 @@
};
DiscordClassModules.CharCounter = {
charCounter: "charCounter-7fw40k",
counterAdded: "charCounterAdded-zz9O4t"
chatCounter: "chatCounter-XOMPsh",
counterAdded: "charCounterAdded-zz9O4t",
editCounter: "editCounter-pNT1Xe",
formCounter: "formCounter-iEGQQk",
nickCounter: "nickCounter-tJrO_4",
popoutNoteCounter: "popoutNoteCounter-62U4Rh",
profileNoteCounter: "profileNoteCounter-p0fWA_"
};
DiscordClassModules.DisplayLargeMessages = {
injectButton: "injectButton-8eKqGu"
@ -4490,7 +4496,13 @@
_chatfiltercensored: ["ChatFilter", "censored"],
_chatfiltercensoredstamp: ["ChatFilter", "censoredStamp"],
_charcountercounter: ["CharCounter", "charCounter"],
_charcounterchatcounter: ["CharCounter", "chatCounter"],
_charcountercounteradded: ["CharCounter", "counterAdded"],
_charcountereditcounter: ["CharCounter", "editCounter"],
_charcounterformcounter: ["CharCounter", "formCounter"],
_charcounternickcounter: ["CharCounter", "nickCounter"],
_charcounterpopoutnotecounter: ["CharCounter", "popoutNoteCounter"],
_charcounterprofilenotecounter: ["CharCounter", "profileNoteCounter"],
_displaylargemessagesinjectbutton: ["DisplayLargeMessages", "injectButton"],
_displayserversaschannelsbadge: ["DisplayServersAsChannels", "badge"],
_displayserversaschannelsname: ["DisplayServersAsChannels", "name"],
@ -9983,20 +9995,6 @@
BDFDB.LibraryComponents[component] = "div";
}
// REMOVE ONCE BD IS FIXED
if (BDFDB.BDUtils.getSettings(BdApi.settings["Public Servers"].id)) {
let failed = false;
try {BDFDB.BDUtils.toggleSettings(BdApi.settings["Public Servers"].id, false);}
catch (err) {
failed = true;
if (BDFDB.BDUtils.getSettings(BdApi.settings["Automatic Loading"].id)) {
BDFDB.BDUtils.toggleSettings(BdApi.settings["Automatic Loading"].id, false);
BDFDB.TimeUtils.timeout(_ => {BDFDB.BDUtils.toggleSettings(BdApi.settings["Automatic Loading"].id, true)}, 3000);
}
}
if (!failed) BDFDB.BDUtils.toggleSettings(BdApi.settings["Public Servers"].id, true);
}
BDFDB.loaded = true;
window.BDFDB = BDFDB;
InternalBDFDB.reloadLib = _ => {

File diff suppressed because one or more lines are too long

View File

@ -2,12 +2,12 @@
var CharCounter = (_ => {
const maxLenghts = {
normal: 2000,
chat: 2000,
edit: 2000,
form: 2000,
nickname: 32,
popout: 256,
profile: 256
nick: 32,
popoutnote: 256,
profilenote: 256
};
return class CharCounter {
@ -41,28 +41,28 @@ var CharCounter = (_ => {
pointer-events: none;
font-size: 15px;
}
${BDFDB.dotCN._charcountercounter}.normal {
${BDFDB.dotCN._charcounterchatcounter} {
right: 0;
bottom: -1.3em;
}
${BDFDB.dotCN._charcountercounter}.edit {
${BDFDB.dotCN._charcountereditcounter} {
right: 0;
bottom: -1.3em;
}
${BDFDB.dotCN._charcountercounter}.form {
${BDFDB.dotCN._charcounterformcounter} {
right: 0;
bottom: -1.0em;
}
${BDFDB.dotCN._charcountercounter}.nickname {
${BDFDB.dotCN._charcounternickcounter} {
right: 0 !important;
top: 0 !important;
}
${BDFDB.dotCN._charcountercounter}.popout {
${BDFDB.dotCN._charcounterpopoutnotecounter} {
right: 3px !important;
bottom: -8px !important;
font-size: 10px !important;
}
${BDFDB.dotCN._charcountercounter}.profile {
${BDFDB.dotCN._charcounterprofilenotecounter} {
right: 0 !important;
bottom: -10px !important;
font-size: 12px !important;
@ -121,31 +121,32 @@ var CharCounter = (_ => {
// Begin of own functions
processChannelTextAreaContainer (e) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "ChannelEditorContainer"});
if (index > -1 && children[index].props.type && maxLenghts[children[index].props.type] && !children[index].props.disabled) {
let editorContainer = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ChannelEditorContainer"});
if (editorContainer && editorContainer.props.type && maxLenghts[editorContainer.props.type] && !editorContainer.props.disabled) {
if (!BDFDB.ArrayUtils.is(e.returnvalue.props.children)) e.returnvalue.props.children = [e.returnvalue.props.children];
this.injectCounter(e.returnvalue, e.returnvalue.props.children, children[index].props.type, BDFDB.dotCN.textarea, true);
this.injectCounter(e.returnvalue, e.returnvalue.props.children, editorContainer.props.type, BDFDB.dotCN.textarea, true);
}
}
processNote (e) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: ["TextAreaAutosize", "TextArea", "PlainTextArea"]});
if (index > -1) this.injectCounter(e.returnvalue, children, e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.usernotepopout) > -1 ? "popout" : "profile", "textarea");
if (index > -1) this.injectCounter(e.returnvalue, children, e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.usernotepopout) > -1 ? "popoutnote" : "profilenote", "textarea");
}
processChangeNickname (e) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "FormItem"});
if (index > -1) {
let [children2, index2] = BDFDB.ReactUtils.findParent(children[index], {name: "TextInput"});
if (index2 > -1) this.injectCounter(children[index], children2, "nickname", BDFDB.dotCN.input);
let formItem = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "FormItem"});
if (formItem) {
let [children, index] = BDFDB.ReactUtils.findParent(formItem, {name: "TextInput"});
if (index > -1) this.injectCounter(formItem, children, "nick", BDFDB.dotCN.input);
}
}
injectCounter (parent, children, type, refClass, parsing) {
if (!children) return;
if (type == "normal") type = "chat";
parent.props.className = BDFDB.DOMUtils.formatClassName(parent.props.className, BDFDB.disCN._charcountercounteradded);
children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CharCounter, {
className: `${BDFDB.disCN._charcountercounter} ${type}`,
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN._charcountercounter, type && BDFDB.disCN[`_charcounter${type}counter`]),
refClass: refClass,
parsing: parsing,
max: maxLenghts[type],