This commit is contained in:
Mirco Wittrien 2019-12-28 17:39:14 +01:00
parent 52e65f6f95
commit 972ce0fc74
3 changed files with 51 additions and 67 deletions

View File

@ -1004,7 +1004,6 @@
WebModulesData.Patchtypes = ["before", "instead", "after"]; WebModulesData.Patchtypes = ["before", "instead", "after"];
WebModulesData.Patchmap = { WebModulesData.Patchmap = {
BannedCard: "BannedUser", BannedCard: "BannedUser",
ChannelTextArea: "ChannelEditorContainer",
ChannelWindow: "Channel", ChannelWindow: "Channel",
InvitationCard: "InviteRow", InvitationCard: "InviteRow",
InviteCard: "InviteRow", InviteCard: "InviteRow",
@ -2114,6 +2113,9 @@
}; };
BDFDB.ChannelUtils = {}; BDFDB.ChannelUtils = {};
BDFDB.ChannelUtils.isTextChannel = function (channel) {
return channel && channel.type && (channel.type == BDFDB.DiscordConstants.ChannelTypes.GUILD_TEXT || channel.type == BDFDB.DiscordConstants.ChannelTypes.GUILD_STORE || channel.type == BDFDB.DiscordConstants.ChannelTypes.GUILD_ANNOUNCEMENT);
};
BDFDB.ChannelUtils.getId = function (div) { BDFDB.ChannelUtils.getId = function (div) {
if (!Node.prototype.isPrototypeOf(div) || !BDFDB.ReactUtils.getInstance(div)) return; if (!Node.prototype.isPrototypeOf(div) || !BDFDB.ReactUtils.getInstance(div)) return;
div = BDFDB.DOMUtils.getParent(BDFDB.dotCNC.categorycontainerdefault + BDFDB.dotCNC.channelcontainerdefault + BDFDB.dotCN.dmchannel, div); div = BDFDB.DOMUtils.getParent(BDFDB.dotCNC.categorycontainerdefault + BDFDB.dotCNC.channelcontainerdefault + BDFDB.dotCN.dmchannel, div);

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
class SendLargeMessages { class SendLargeMessages {
getName () {return "SendLargeMessages";} getName () {return "SendLargeMessages";}
getVersion () {return "1.5.9";} getVersion () {return "1.6.0";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -12,13 +12,16 @@ class SendLargeMessages {
constructor () { constructor () {
this.changelog = { this.changelog = {
"fixed":[["Switching","Plugin acting weird after switching channels"],["New WYSIWYG Textarea","Fixed for the new WYSIWYG Textarea that is hidden by experiments"]], "fixed":[["Switching","Plugin acting weird after switching channels"],["New WYSIWYG Textarea","Fixed for the new WYSIWYG Textarea that is hidden by experiments"]],
"improved":[["Sending Messages","The plugin no longer needs the modal to send multiple messages, you can just write larger messages in the channel textarea and it will automatically split it up before sending it"]] "improved":[["Message Amount","Hovering over the red character counter when the character limit exceeds 2000 characters will now again display the amount of messages that is being sent by the plugin"],["Sending Messages","The plugin no longer needs the modal to send multiple messages, you can just write larger messages in the channel textarea and it will automatically split it up before sending it"]]
}; };
this.patchedModules = { this.patchedModules = {
before: { before: {
ChannelTextAreaForm: "render", ChannelTextAreaForm: "render",
ChannelEditorContainer: "render" ChannelEditorContainer: "render"
},
after: {
ChannelTextAreaContainer: "render",
} }
}; };
} }
@ -100,6 +103,27 @@ class SendLargeMessages {
else return e2.callOriginalMethodAfterwards(); else return e2.callOriginalMethodAfterwards();
}}, true); }}, true);
} }
processChannelTextAreaContainer (e) {
if (e.returnvalue.ref && e.returnvalue.ref.current && BDFDB.DOMUtils.getParent(BDFDB.dotCN.chatform, e.returnvalue.ref.current)) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "SlateCharacterCount"});
if (index > -1) {
let text = BDFDB.LibraryModules.SlateSelectionUtils.serialize(children[index].props.document);
if (text.length > 1000) {
let parsedLength = BDFDB.StringUtils.getParsedLength(text);
if (parsedLength > 2000) children[index] = BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCNS.textareacharcounter + BDFDB.disCN.textareacharcountererror,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: Math.ceil(parsedLength / 1900) + " " + BDFDB.LanguageUtils.LanguageStrings.MESSAGES,
children: BDFDB.ReactUtils.createElement("span", {
children: 2000 - parsedLength
})
})
});
}
}
}
}BDFDB.DataUtils.get(this, "settings", "changeInAutoComplete")
processChannelEditorContainer (e) { processChannelEditorContainer (e) {
if (e.instance.props.type && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL) e.instance.props.shouldUploadLongMessages = false; if (e.instance.props.type && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL) e.instance.props.shouldUploadLongMessages = false;
@ -155,129 +179,87 @@ class SendLargeMessages {
switch (BDFDB.LanguageUtils.getLanguage().id) { switch (BDFDB.LanguageUtils.getLanguage().id) {
case "hr": //croatian case "hr": //croatian
return { return {
toast_allsent_text: "Sve veliku poslane.", toast_allsent_text: "Sve veliku poslane."
modal_messages_warning: "Nemojte slati previše veliku!",
modal_header_text: "Pošalji veliku poruku:"
}; };
case "da": //danish case "da": //danish
return { return {
toast_allsent_text: "Alle beskeder sendes.", toast_allsent_text: "Alle beskeder sendes."
modal_messages_warning: "Send ikke for mange beskeder!",
modal_header_text: "Send stor besked:"
}; };
case "de": //german case "de": //german
return { return {
toast_allsent_text: "Alle Nachrichten versendet.", toast_allsent_text: "Alle Nachrichten versendet."
modal_messages_warning: "Schicke nicht zu viele Nachrichten!",
modal_header_text: "Große Nachricht senden:"
}; };
case "es": //spanish case "es": //spanish
return { return {
toast_allsent_text: "Todos los mensajes enviados.", toast_allsent_text: "Todos los mensajes enviados."
modal_messages_warning: "¡No envíe demasiados mensajes!",
modal_header_text: "Enviar mensaje grande:"
}; };
case "fr": //french case "fr": //french
return { return {
toast_allsent_text: "Tous les messages envoyés", toast_allsent_text: "Tous les messages envoyés"
modal_messages_warning: "N'envoyez pas trop de messages!",
modal_header_text: "Envoyer un gros message:"
}; };
case "it": //italian case "it": //italian
return { return {
toast_allsent_text: "Tutti i messaggi inviati.", toast_allsent_text: "Tutti i messaggi inviati."
modal_messages_warning: "Non inviare troppi messaggi!",
modal_header_text: "Invia grande messaggio:"
}; };
case "nl": //dutch case "nl": //dutch
return { return {
toast_allsent_text: "Alle berichten verzonden.", toast_allsent_text: "Alle berichten verzonden."
modal_messages_warning: "Stuur niet te veel berichten!",
modal_header_text: "Stuur een groot bericht:"
}; };
case "no": //norwegian case "no": //norwegian
return { return {
toast_allsent_text: "Alle meldinger sendt.", toast_allsent_text: "Alle meldinger sendt."
modal_messages_warning: "Ikke send for mange meldinger!",
modal_header_text: "Send stor melding:"
}; };
case "pl": //polish case "pl": //polish
return { return {
toast_allsent_text: "Wszystkie wiadomości zostały wysłane.", toast_allsent_text: "Wszystkie wiadomości zostały wysłane."
modal_messages_warning: "Nie wysyłaj zbyt wielu wiadomości!",
modal_header_text: "Wyślij dużą wiadomość:"
}; };
case "pt-BR": //portuguese (brazil) case "pt-BR": //portuguese (brazil)
return { return {
toast_allsent_text: "Todas as mensagens enviadas.", toast_allsent_text: "Todas as mensagens enviadas."
modal_messages_warning: "Não envie muitas mensagens!",
modal_header_text: "Enviar mensagem grande:"
}; };
case "fi": //finnish case "fi": //finnish
return { return {
toast_allsent_text: "Kaikki lähetetyt viestit.", toast_allsent_text: "Kaikki lähetetyt viestit."
modal_messages_warning: "Älä lähetä liian monta viestiä!",
modal_header_text: "Lähetä suuri viesti:"
}; };
case "sv": //swedish case "sv": //swedish
return { return {
toast_allsent_text: "Alla meddelanden skickade.", toast_allsent_text: "Alla meddelanden skickade."
modal_messages_warning: "Skicka inte för många meddelanden!",
modal_header_text: "Skicka stort meddelande:"
}; };
case "tr": //turkish case "tr": //turkish
return { return {
toast_allsent_text: "Tüm mesajlar gönderildi.", toast_allsent_text: "Tüm mesajlar gönderildi."
modal_messages_warning: "Çok fazla mesaj göndermeyin!",
modal_header_text: "Büyük mesaj gönder:"
}; };
case "cs": //czech case "cs": //czech
return { return {
toast_allsent_text: "Všechny zprávy byly odeslány.", toast_allsent_text: "Všechny zprávy byly odeslány."
modal_messages_warning: "Neposílejte příliš mnoho zpráv!",
modal_header_text: "Odeslat velkou zprávu:"
}; };
case "bg": //bulgarian case "bg": //bulgarian
return { return {
toast_allsent_text: "Всички изпратени съобщения.", toast_allsent_text: "Всички изпратени съобщения."
modal_messages_warning: "Не изпращайте твърде много съобщения!",
modal_header_text: "Изпратете голямо съобщение:"
}; };
case "ru": //russian case "ru": //russian
return { return {
toast_allsent_text: "Все отправленные сообщения.", toast_allsent_text: "Все отправленные сообщения."
modal_messages_warning: "Не отправляйте слишком много сообщений!",
modal_header_text: "Отправить сообщение:"
}; };
case "uk": //ukrainian case "uk": //ukrainian
return { return {
toast_allsent_text: "Всі повідомлення надіслано.", toast_allsent_text: "Всі повідомлення надіслано."
modal_messages_warning: "Не надсилайте надто багато повідомлень!",
modal_header_text: "Надіслати велике повідомлення:"
}; };
case "ja": //japanese case "ja": //japanese
return { return {
toast_allsent_text: "すべてのメッセージが送信されました。", toast_allsent_text: "すべてのメッセージが送信されました。"
modal_messages_warning: "あまりにも多くのメッセージを送信しないでください!",
modal_header_text: "大きなメッセージを送信する:"
}; };
case "zh-TW": //chinese (traditional) case "zh-TW": //chinese (traditional)
return { return {
toast_allsent_text: "發送的所有消息。", toast_allsent_text: "發送的所有消息。"
modal_messages_warning: "不要發送太多信息!",
modal_header_text: "發送大信息:"
}; };
case "ko": //korean case "ko": //korean
return { return {
toast_allsent_text: "모든 메시지가 전송되었습니다.", toast_allsent_text: "모든 메시지가 전송되었습니다."
modal_messages_warning: "너무 많은 메시지를 보내지 마십시오!",
modal_header_text: "큰 메시지 보내기:"
}; };
default: //default: english default: //default: english
return { return {
toast_allsent_text: "All messages sent.", toast_allsent_text: "All messages sent."
modal_messages_warning: "Do not send too many messages!",
modal_header_text: "Send large message:"
}; };
} }
} }