This commit is contained in:
Mirco Wittrien 2019-11-11 11:11:33 +01:00
parent b704460e05
commit 5ebbba15ff
16 changed files with 124 additions and 187 deletions

View File

@ -292,13 +292,13 @@ class ChatAliases {
}
onNativeContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.value && instance.props.value.trim()) {
if (instance.props.value && instance.props.value.trim()) {
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(menu, returnvalue, instance.props.value.trim());
}
}
onMessageContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.message && instance.props.channel && instance.props.target) {
if (instance.props.message && instance.props.channel && instance.props.target) {
let text = document.getSelection().toString().trim();
if (text && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(menu, returnvalue, text);
}
@ -329,7 +329,7 @@ class ChatAliases {
}
processChannelTextArea (instance, wrapper, returnvalue) {
if (instance.props && instance.props.channel && instance.props.type) {
if (instance.props.channel && instance.props.type) {
var textarea = wrapper.querySelector("textarea");
if (!textarea) return;
let settings = BDFDB.DataUtils.get(this, "settings");

View File

@ -284,13 +284,13 @@ class ChatFilter {
}
onNativeContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.value && instance.props.value.trim()) {
if (instance.props.value && instance.props.value.trim()) {
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(menu, returnvalue, instance.props.value.trim());
}
}
onMessageContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.message && instance.props.channel && instance.props.target) {
if (instance.props.message && instance.props.channel && instance.props.target) {
let text = document.getSelection().toString().trim();
if (text && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(menu, returnvalue, text);
}

View File

@ -142,7 +142,7 @@ class EditChannels {
// begin of own functions
onChannelContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.channel && !BDFDB.DOMUtils.getParent(".container-hidden", instance.props.target) && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
if (instance.props.channel && !BDFDB.DOMUtils.getParent(".container-hidden", instance.props.target) && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
children: [
@ -316,13 +316,13 @@ class EditChannels {
}
processChannelCategoryItem (instance, wrapper, returnvalue) {
if (instance.props && instance.props.channel) {
if (instance.props.channel) {
this.changeChannel(instance.props.channel, wrapper.querySelector(BDFDB.dotCN.categoryname), true);
}
}
processChannelItem (instance, wrapper, returnvalue) {
if (instance.props && instance.props.channel) {
if (instance.props.channel) {
this.changeChannel(instance.props.channel, wrapper.querySelector(BDFDB.dotCN.channelname), true);
}
}

View File

@ -133,7 +133,7 @@ class EditServers {
// begin of own functions
onGuildContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.guild && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
if (instance.props.guild && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
children: [
@ -168,7 +168,7 @@ class EditServers {
}
processGuild (instance, wrapper, returnvalue) {
if (instance.props && instance.props.guild) {
if (instance.props.guild) {
let icon = wrapper.querySelector(BDFDB.dotCN.guildicon + ":not(.fake-guildicon), " + BDFDB.dotCN.guildiconacronym + ":not(.fake-guildacronym)");
if (!icon) return;
this.changeGuildIcon(instance.props.guild, icon);
@ -177,7 +177,7 @@ class EditServers {
}
processGuildIconWrapper (instance, wrapper, returnvalue) {
if (instance.props && instance.props.guild) {
if (instance.props.guild) {
let icon = wrapper.classList && BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.avataricon) ? wrapper : wrapper.querySelector(BDFDB.dotCN.avataricon);
if (!icon) return;
this.changeGuildIcon(instance.props.guild, icon);
@ -186,7 +186,7 @@ class EditServers {
}
processGuildHeader (instance, wrapper, returnvalue) {
if (instance.props && instance.props.guild) {
if (instance.props.guild) {
this.changeGuildName(instance.props.guild, wrapper.querySelector(BDFDB.dotCN.guildheadername));
}
}

View File

@ -189,7 +189,7 @@ class EditUsers {
// begin of own functions
onUserContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.user && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
if (instance.props.user && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
children: [
@ -520,7 +520,7 @@ class EditUsers {
}
processBannedCard (instance, wrapper, returnvalue) {
if (instance.props && instance.props.user && instance.props.guild) {
if (instance.props.user && instance.props.guild) {
let username = wrapper.querySelector(BDFDB.dotCN.guildsettingsbannedusername);
if (username) {
this.changeName3(instance.props.user, username);
@ -541,7 +541,7 @@ class EditUsers {
}
processMemberCard (instance, wrapper, returnvalue) {
if (instance.props && instance.props.user && instance.props.guild) {
if (instance.props.user && instance.props.guild) {
let username = wrapper.querySelector(BDFDB.dotCN.guildsettingsmembername);
if (username) {
this.changeName2(instance.props.user, username, instance.props.guild.id);
@ -551,7 +551,7 @@ class EditUsers {
}
processInvitationCard (instance, wrapper, returnvalue) {
if (instance.props && instance.props.user) {
if (instance.props.user) {
let username = wrapper.querySelector(BDFDB.dotCN.invitemodalinviterowname);
if (username) {
this.changeName3(instance.props.user, username);
@ -582,7 +582,7 @@ class EditUsers {
}
processCallAvatar (instance, wrapper, returnvalue) {
if (instance.props && instance.props.id) {
if (instance.props.id) {
let user = BDFDB.LibraryModules.UserStore.getUser(instance.props.id);
if (!user) {
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(instance.props.id);
@ -600,18 +600,18 @@ class EditUsers {
}
processVideoTile (instance, wrapper, returnvalue) {
if (instance.props && instance.props.user) this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
if (instance.props.user) this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
}
processPictureInPictureVideo (instance, wrapper, returnvalue) {
if (instance.props && instance.props.backgroundKey) {
if (instance.props.backgroundKey) {
let user = BDFDB.LibraryModules.UserStore.getUser(instance.props.backgroundKey);
if (user) this.changeAvatar(user, this.getAvatarDiv(wrapper));
}
}
processPrivateChannel (instance, wrapper, returnvalue) {
if (instance.props && instance.props.user) {
if (instance.props.user) {
let username = wrapper.querySelector(BDFDB.dotCN.namecontainername);
this.changePrivateChannel(instance.props.user, username && username.firstElementChild ? username.firstElementChild : username);
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));

View File

@ -66,7 +66,7 @@ class ForceImagePreviews {
// begin of own functions
processMessage (instance, wrapper, returnvalue) {
if (instance.props && instance.props.message) {
if (instance.props.message) {
let accessory = wrapper.querySelector(BDFDB.dotCN.messageaccessory);
if (accessory) {
let links = [];

View File

@ -153,7 +153,7 @@ class GoogleTranslateOption {
// begin of own functions
onMessageContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.message && instance.props.channel && instance.props.target) {
if (instance.props.message && instance.props.channel && instance.props.target) {
let {messagediv, pos} = this.getMessageAndPos(instance.props.target);
if (!messagediv || pos == -1) return;
let translated = BDFDB.DOMUtils.containsClass(messagediv, "GTO-translated-message");
@ -258,7 +258,7 @@ class GoogleTranslateOption {
}
processMessageContent (instance, wrapper, returnvalue) {
if (instance.props && instance.props.message && instance.props.channel) {
if (instance.props.message && instance.props.channel) {
let messagediv = BDFDB.DOMUtils.getParent(".GTO-translated-message", wrapper);
if (messagediv && !wrapper.querySelector(".GTO-translation")) BDFDB.DOMUtils.removeClass(messagediv, "GTO-translated-message");
}

View File

@ -94,7 +94,7 @@ class ImageGallery {
// begin of own functions
processImageModal (instance, wrapper, returnvalue, methodnames) {
if (this.closemodal && instance.props && instance.props.onClose) instance.props.onClose();
if (this.closemodal && instance.props.onClose) instance.props.onClose();
else if (methodnames.includes("componentDidMount")) {
let modal = BDFDB.DOMUtils.getParent(BDFDB.dotCN.modal, wrapper);
if (!modal) return;

View File

@ -145,7 +145,7 @@ class MessageUtilities {
//begin of own functions
processMessageContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.message && instance.props.channel && instance.props.target) {
if (instance.props.message && instance.props.channel && instance.props.target) {
let changed = false;
for (let itemlabel of menu.querySelectorAll(BDFDB.dotCN.contextmenulabel)) {
let hint = itemlabel.parentElement.querySelector(BDFDB.dotCN.contextmenuhint);

View File

@ -208,7 +208,7 @@ class PinDMs {
// begin of own functions
onUserContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.user && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
if (instance.props.user && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:"UserCloseChatItem"});
if (index > -1) {
let id = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(instance.props.user.id);
@ -219,7 +219,7 @@ class PinDMs {
}
onGroupDMContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.channelId && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
if (instance.props.channelId && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:"ChangeIcon"});
if (index > -1) this.appendItem(menu, instance.props.channelId, children, index);
}
@ -278,7 +278,7 @@ class PinDMs {
}
processPrivateChannel (instance, wrapper, returnvalue) {
if (instance && instance.props && instance.props.ispin) {
if (instance.props.ispin) {
let id = BDFDB.ReactUtils.getValue(instance, "props.channel.id");
wrapper.setAttribute("channelid", id);
BDFDB.DOMUtils.addClass(wrapper, "pinned");
@ -338,7 +338,7 @@ class PinDMs {
}
processDirectMessage (instance, wrapper, returnvalue, methodnames) {
if (instance.props && instance.props.channel) {
if (instance.props.channel) {
if (methodnames.includes("componentDidMount")) {
wrapper.removeEventListener("contextmenu", wrapper.PinDMsContextMenuListener);
wrapper.PinDMsContextMenuListener = e => {

View File

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

View File

@ -3,7 +3,7 @@
class SendLargeMessages {
getName () {return "SendLargeMessages";}
getVersion () {return "1.5.4";}
getVersion () {return "1.5.5";}
getAuthor () {return "DevilBro";}
@ -11,11 +11,11 @@ class SendLargeMessages {
constructor () {
this.changelog = {
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
};
this.patchModules = {
"ChannelTextArea":"componentDidMount"
ChannelTextArea: "componentDidMount"
};
}
@ -24,59 +24,8 @@ class SendLargeMessages {
this.css = `
.${this.name}-modal textarea {
rows: 0;
cols: 0;
height: 100vw;
resize: none;
}
.${this.name}-modal #warning-message {
color: red;
}
.${this.name}-modal #character-counter {
float: right;
color: white;
opacity: .5;
height: 50vh;
}`;
this.sendMessageModalMarkup =
`<span class="${this.name}-modal BDFDB-modal">
<div class="${BDFDB.disCN.backdrop}"></div>
<div class="${BDFDB.disCN.modal}">
<div class="${BDFDB.disCN.modalinner}">
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizelarge}">
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">REPLACE_modal_header_text</h4>
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.primary}"></div>
</div>
<button type="button" class="${BDFDB.disCNS.modalclose + BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}">
<svg name="Close" width="18" height="18" viewBox="0 0 12 12" style="flex: 0 1 auto;">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h12v12H0"></path>
<path class="fill" fill="currentColor" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path>
</g>
</svg>
</div>
</button>
</div>
<div class="${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.modalcontent + BDFDB.disCNS.scrollerthemed + BDFDB.disCNS.scrollerthemeghosthairline + BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCNS.flexchild + BDFDB.disCN.modalsubinner}" style="flex: 1 1 auto;">
<textarea class="${BDFDB.disCNS.scroller + BDFDB.disCNS.inputdefault + BDFDB.disCN.input}" id="modal-inputtext"></textarea>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCNS.nowrap + BDFDB.disCNS.modalsubinner + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;">
<h5 id="warning-message" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.h5 + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightbold + BDFDB.disCNS.h5defaultmargin}" style="flex: 1 1 auto;"></h5>
<h5 id="character-counter" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.h5 + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightmedium + BDFDB.disCNS.h5defaultmargin}" style="flex: 0 0 auto;"></h5>
</div>
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
<button type="button" class="btn-send ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
<div class="${BDFDB.disCN.buttoncontents}"></div>
</button>
</div>
</div>
</div>
</div>
</span>`;
}
//legacy
@ -107,7 +56,7 @@ class SendLargeMessages {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
@ -118,6 +67,8 @@ class SendLargeMessages {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}
}
@ -125,20 +76,16 @@ class SendLargeMessages {
// begin of own functions
changeLanguageStrings () {
this.sendMessageModalMarkup = this.sendMessageModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
}
processChannelTextArea (instance, wrapper, returnvalue) {
if (instance.props && instance.props.type && instance.props.type == "normal") {
var textarea = wrapper.querySelector("textarea");
processChannelTextArea (e) {
if (e.instance.props && e.instance.props.type && e.instance.props.type == "normal") {
var textarea = e.node.querySelector("textarea");
if (!textarea) return;
let modaltext, checkTextarea = () => {
if (BDFDB.StringUtils.getParsedLength(textarea.value) > 1950) {
textarea.selectionStart = 0;
textarea.selectionEnd = textarea.value.length;
document.execCommand("insertText", false, "");
this.showSendModal(modaltext);
this.openMessageModal(modaltext, e.instance.props.channel);
}
};
BDFDB.ListenerUtils.add(this, textarea, "keyup", e => {
@ -155,47 +102,53 @@ class SendLargeMessages {
}
}
showSendModal (text) {
let sendMessageModal = BDFDB.DOMUtils.create(this.sendMessageModalMarkup);
let textinput = sendMessageModal.querySelector("#modal-inputtext");
let warning = sendMessageModal.querySelector("#warning-message");
let counter = sendMessageModal.querySelector("#character-counter");
let updateCounter = () => {
let parsedlength = BDFDB.StringUtils.getParsedLength(textinput.value);
let messageAmount = Math.ceil(parsedlength/1900);
warning.innerText = messageAmount > 15 ? this.labels.modal_messages_warning : "";
counter.innerText = parsedlength + " (" + (textinput.selectionEnd - textinput.selectionStart) + ") => " + this.labels.modal_messages_translation + ": " + messageAmount;
};
BDFDB.appendModal(sendMessageModal);
BDFDB.ListenerUtils.addToChildren(sendMessageModal, "click", ".btn-send", e => {
let messages = this.formatText(textinput.value || "");
messages.forEach((message,i) => {
BDFDB.TimeUtils.timeout(() => {
this.sendMessage(message);
if (i >= messages.length-1) BDFDB.NotificationUtils.toast(this.labels.toast_allsent_text, {type:"success"});
},this.messageDelay * i);
});
openMessageModal (text, channel) {
BDFDB.ModalUtils.open(this, {
size: "LARGE",
header: this.labels.modal_header_text,
subheader: BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `#${channel.name}`),
scroller: false,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextArea, {
className: "textmessage-textarea",
value: text,
placeholder: text,
autoFocus: true
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CharCounter, {
className: BDFDB.disCN.marginbottom8,
parsing: true,
refClass: ".textmessage-textarea",
renderPrefix: length => {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextElement, {
className: BDFDB.disCN.weightbold,
color: BDFDB.LibraryComponents.TextElement.Colors.RED,
children: Math.ceil(length/1900) > 7 ? this.labels.modal_messages_warning : null
})
});
},
renderSuffix: length => {
return ` 🠚 ${BDFDB.LanguageUtils.LanguageStrings.MESSAGES}: ${Math.ceil(length/1900)}`;
}
})
],
buttons: [{
contents: BDFDB.LanguageUtils.LanguageStrings.SEND,
color: "BRAND",
close: true,
click: modal => {
let textinput = (modal.querySelector(".textmessage-textarea").value || "").trim();
let messages = this.formatText(textinput);
messages.forEach((message,i) => {
BDFDB.TimeUtils.timeout(() => {
this.sendMessage(message);
if (i >= messages.length-1) BDFDB.NotificationUtils.toast(this.labels.toast_allsent_text, {type:"success"});
}, this.messageDelay * i);
});
}
}]
});
textinput.value = text || "";
textinput.addEventListener("keyup", () => {BDFDB.TimeUtils.timeout(() => {updateCounter();},10);});
textinput.addEventListener("click", () => {updateCounter();});
textinput.addEventListener("mousedown", () => {
var mouseup = () => {
document.removeEventListener("mouseup", mouseup);
document.removeEventListener("mousemove", mousemove);
};
var mousemove = () => {
BDFDB.TimeUtils.timeout(() => {updateCounter();},10);
};
document.addEventListener("mouseup", mouseup);
document.addEventListener("mousemove", mousemove);
});
updateCounter();
textinput.focus();
}
formatText (text) {
@ -251,7 +204,12 @@ class SendLargeMessages {
let instance = BDFDB.ReactUtils.findOwner(BDFDB.DOMUtils.getParent(BDFDB.dotCNS.chat + "form", textarea), {name:"ChannelTextAreaForm", up:true});
if (instance) {
instance.setState({textValue:text});
BDFDB.triggerSend(textarea);
BDFDB.TimeUtils.timeout(_ => {
var e = new KeyboardEvent("keypress", {key:"Enter", code:"Enter", which:13, keyCode:13, bubbles:true });
Object.defineProperty(e, "keyCode", {value:13});
Object.defineProperty(e, "which", {value:13});
textarea.dispatchEvent(e);
});
}
}
}
@ -261,149 +219,128 @@ class SendLargeMessages {
case "hr": //croatian
return {
toast_allsent_text: "Sve veliku poslane.",
modal_messages_translation: "Vijesti",
modal_messages_warning: "Nemojte slati previše veliku!",
modal_header_text: "Pošalji veliku poruku:"
modal_header_text: "Pošalji veliku poruku:"
};
case "da": //danish
return {
toast_allsent_text: "Alle beskeder sendes.",
modal_messages_translation: "Beskeder",
modal_messages_warning: "Send ikke for mange beskeder!",
modal_header_text: "Send stor besked:"
modal_header_text: "Send stor besked:"
};
case "de": //german
return {
toast_allsent_text: "Alle Nachrichten versendet.",
modal_messages_translation: "Nachrichten",
modal_messages_warning: "Schicke nicht zu viele Nachrichten!",
modal_header_text: "Große Nachricht senden:"
modal_header_text: "Große Nachricht senden:"
};
case "es": //spanish
return {
toast_allsent_text: "Todos los mensajes enviados.",
modal_messages_translation: "Mensajes",
modal_messages_warning: "¡No envíe demasiados mensajes!",
modal_header_text: "Enviar mensaje grande:"
modal_header_text: "Enviar mensaje grande:"
};
case "fr": //french
return {
toast_allsent_text: "Tous les messages envoyés",
modal_messages_translation: "Messages",
modal_messages_warning: "N'envoyez pas trop de messages!",
modal_header_text: "Envoyer un gros message:"
modal_header_text: "Envoyer un gros message:"
};
case "it": //italian
return {
toast_allsent_text: "Tutti i messaggi inviati.",
modal_messages_translation: "Messaggi",
modal_messages_warning: "Non inviare troppi messaggi!",
modal_header_text: "Invia grande messaggio:"
modal_header_text: "Invia grande messaggio:"
};
case "nl": //dutch
return {
toast_allsent_text: "Alle berichten verzonden.",
modal_messages_translation: "Berichten",
modal_messages_warning: "Stuur niet te veel berichten!",
modal_header_text: "Stuur een groot bericht:"
modal_header_text: "Stuur een groot bericht:"
};
case "no": //norwegian
return {
toast_allsent_text: "Alle meldinger sendt.",
modal_messages_translation: "Meldinger",
modal_messages_warning: "Ikke send for mange meldinger!",
modal_header_text: "Send stor melding:"
modal_header_text: "Send stor melding:"
};
case "pl": //polish
return {
toast_allsent_text: "Wszystkie wiadomości zostały wysłane.",
modal_messages_translation: "Wiadomości",
modal_messages_warning: "Nie wysyłaj zbyt wielu wiadomości!",
modal_header_text: "Wyślij dużą wiadomość:"
};
case "pt-BR": //portuguese (brazil)
return {
toast_allsent_text: "Todas as mensagens enviadas.",
modal_messages_translation: "Mensagens",
modal_messages_warning: "Não envie muitas mensagens!",
modal_header_text: "Enviar mensagem grande:"
modal_header_text: "Enviar mensagem grande:"
};
case "fi": //finnish
return {
toast_allsent_text: "Kaikki lähetetyt viestit.",
modal_messages_translation: "Viestien",
modal_messages_warning: "Älä lähetä liian monta viestiä!",
modal_header_text: "Lähetä suuri viesti:"
modal_header_text: "Lähetä suuri viesti:"
};
case "sv": //swedish
return {
toast_allsent_text: "Alla meddelanden skickade.",
modal_messages_translation: "Meddelanden",
modal_messages_warning: "Skicka inte för många meddelanden!",
modal_header_text: "Skicka stort meddelande:"
modal_header_text: "Skicka stort meddelande:"
};
case "tr": //turkish
return {
toast_allsent_text: "Tüm mesajlar gönderildi.",
modal_messages_translation: "Mesajları",
modal_messages_warning: "Çok fazla mesaj göndermeyin!",
modal_header_text: "Büyük mesaj gönder:"
modal_header_text: "Büyük mesaj gönder:"
};
case "cs": //czech
return {
toast_allsent_text: "Všechny zprávy byly odeslány.",
modal_messages_translation: "Zpráv",
modal_messages_warning: "Neposílejte příliš mnoho zpráv!",
modal_header_text: "Odeslat velkou zprávu:"
modal_header_text: "Odeslat velkou zprávu:"
};
case "bg": //bulgarian
return {
toast_allsent_text: "Всички изпратени съобщения.",
modal_messages_translation: "Съобщения",
modal_messages_warning: "Не изпращайте твърде много съобщения!",
modal_header_text: "Изпратете голямо съобщение:"
modal_header_text: "Изпратете голямо съобщение:"
};
case "ru": //russian
return {
toast_allsent_text: "Все отправленные сообщения.",
modal_messages_translation: "Сообщения",
modal_messages_warning: "Не отправляйте слишком много сообщений!",
modal_header_text: "Отправить сообщение:"
modal_header_text: "Отправить сообщение:"
};
case "uk": //ukrainian
return {
toast_allsent_text: "Всі повідомлення надіслано.",
modal_messages_translation: "Повідомлення",
modal_messages_warning: "Не надсилайте надто багато повідомлень!",
modal_header_text: "Надіслати велике повідомлення:"
modal_header_text: "Надіслати велике повідомлення:"
};
case "ja": //japanese
return {
toast_allsent_text: "すべてのメッセージが送信されました。",
modal_messages_translation: "メッセージ",
modal_messages_warning: "あまりにも多くのメッセージを送信しないでください!",
modal_header_text: "大きなメッセージを送信する:"
modal_header_text: "大きなメッセージを送信する:"
};
case "zh-TW": //chinese (traditional)
return {
toast_allsent_text: "發送的所有消息。",
modal_messages_translation: "消息",
modal_messages_warning: "不要發送太多信息!",
modal_header_text: "發送大信息:"
modal_header_text: "發送大信息:"
};
case "ko": //korean
return {
toast_allsent_text: "모든 메시지가 전송되었습니다.",
modal_messages_translation: "메시지",
modal_messages_warning: "너무 많은 메시지를 보내지 마십시오!",
modal_header_text: "큰 메시지 보내기:"
modal_header_text: "큰 메시지 보내기:"
};
default: //default: english
return {
toast_allsent_text: "All messages sent.",
modal_messages_translation: "Messages",
modal_messages_warning: "Do not send too many messages!",
modal_header_text: "Send large message:"
modal_header_text: "Send large message:"
};
}
}

View File

@ -311,7 +311,7 @@ class ServerFolders {
onGuildContextMenu (instance, menu, returnvalue) {
if (document.querySelector(".BDFDB-modal")) return;
if (instance.props && instance.props.target && instance.props.folderId && instance.props.type == "GUILD_ICON_FOLDER") {
if (instance.props.target && instance.props.folderId && instance.props.type == "GUILD_ICON_FOLDER") {
let folderid = instance.props.folderId;
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(folderid);
let data = this.getFolderConfig(folderid);
@ -355,7 +355,7 @@ class ServerFolders {
});
returnvalue.props.children.push(deleteGroup);
}
else if (instance.props && instance.props.target && instance.props.guild && instance.props.type == "GUILD_ICON_BAR") {
else if (instance.props.target && instance.props.guild && instance.props.type == "GUILD_ICON_BAR") {
let guildid = instance.props.guild.id;
let folders = this.getFolders();
let folder = this.getFolderOfGuildId(guildid);
@ -462,7 +462,7 @@ class ServerFolders {
processGuild (instance, wrapper, returnvalue, methodnames) {
if (!this.foldercontentguilds) return;
if (instance.props && instance.props.guild) {
if (instance.props.guild) {
if (methodnames.includes("componentDidMount")) {
BDFDB.ListenerUtils.add(this, wrapper, "click", () => {BDFDB.TimeUtils.timeout(() => {
let folder = this.getFolderOfGuildId(instance.props.guild.id);
@ -489,7 +489,7 @@ class ServerFolders {
}
processGuildFolderSettingsModal (instance, wrapper, returnvalue) {
if (instance.props && instance.props.folderId) {
if (instance.props.folderId) {
let folderid = instance.props.folderId;
let data = this.getFolderConfig(folderid);
wrapper = wrapper.parentElement;

View File

@ -155,7 +155,7 @@ class ServerHider {
onGuildContextMenu (instance, menu, returnvalue) {
if (document.querySelector(".BDFDB-modal")) return;
if (instance.props && instance.props.target && instance.props.type.indexOf("GUILD_ICON_") == 0 && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
if (instance.props.target && instance.props.type.indexOf("GUILD_ICON_") == 0 && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
children: [
@ -189,7 +189,7 @@ class ServerHider {
}
processGuild (instance, wrapper, returnvalue, methodnames) {
if (instance.props && instance.props.guild) {
if (instance.props.guild) {
let hiddenservers = BDFDB.DataUtils.load(this, "hiddenservers", "hiddenservers") || [];
if (methodnames.includes("componentDidMount")) this.toggleServer(instance.props.guild, wrapper, !hiddenservers.includes(instance.props.guild.id));
if (methodnames.includes("componentDidUpdate") && hiddenservers.includes(instance.props.guild.id) && instance.props.unread) this.unreadServer(instance.props.guild.id);

View File

@ -175,18 +175,18 @@ class ShowHiddenChannels {
// begin of own functions
processChannels (instance, wrapper, returnvalue, methodnames) {
if (instance.props && instance.props.guild) {
if (instance.props.guild) {
if (methodnames.includes("componentDidMount")) this.appendHiddenContainer(instance.props.guild);
if (methodnames.includes("componentDidUpdate")) this.reappendHiddenContainer(instance.props.guild);
}
}
processChannelItem (instance, wrapper, returnvalue) {
if (instance.props && instance.props.channel) this.reappendHiddenContainer(BDFDB.LibraryModules.GuildStore.getGuild(instance.props.channel.guild_id));
if (instance.props.channel) this.reappendHiddenContainer(BDFDB.LibraryModules.GuildStore.getGuild(instance.props.channel.guild_id));
}
processChannelCategoryItem (instance, wrapper, returnvalue) {
if (instance.props && instance.props.channel) this.reappendHiddenContainer(BDFDB.LibraryModules.GuildStore.getGuild(instance.props.channel.guild_id));
if (instance.props.channel) this.reappendHiddenContainer(BDFDB.LibraryModules.GuildStore.getGuild(instance.props.channel.guild_id));
}
processStandardSidebarView (instance, wrapper, returnvalue) {

View File

@ -143,7 +143,7 @@ class SpellCheck {
// begin of own functions
onNativeContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.target && instance.props.target.tagName == "TEXTAREA") {
if (instance.props.target && instance.props.target.tagName == "TEXTAREA") {
let [SCparent, SCindex] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["NativeSpellcheckGroup", "FluxContainer(NativeSpellcheckGroup)"]});
if (SCindex > -1) {
if (BDFDB.ReactUtils.findValue(instance._reactInternalFiber, "spellcheckEnabled") == true) {
@ -211,7 +211,7 @@ class SpellCheck {
}
processChannelTextArea (instance, wrapper, returnvalue) {
if (instance.props && instance.props.type) {
if (instance.props.type) {
var textarea = wrapper.querySelector("textarea");
if (!textarea) return;