This commit is contained in:
Mirco Wittrien 2020-09-23 09:29:56 +02:00
parent cb1c92259c
commit 8a084e73f1
5 changed files with 102 additions and 9 deletions

View File

@ -5,8 +5,13 @@ module.exports = (_ => {
"info": {
"name": "CopyRawMessage",
"author": "DevilBro",
"version": "1.1.1",
"version": "1.1.2",
"description": "Adds a entry in the contextmenu when you right click a message that allows you to copy the raw contents of a message."
},
"changeLog": {
"improved": {
"Quick Action": "Added Icon to quick action bar. Holding shift while hovering a message shows the quick action bar"
}
}
};
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
@ -128,7 +133,7 @@ module.exports = (_ => {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "mark-unread"});
children.splice(index + 1, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-message"),
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-message-raw"),
icon: _ => {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.menuicon,
@ -141,6 +146,25 @@ module.exports = (_ => {
}));
}
}
onMessageOptionToolbar (e) {
if (e.instance.props.expanded && e.instance.props.message && e.instance.props.channel) {
e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
key: "copy-message-raw",
text: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCN.messagetoolbarbutton,
onClick: _ => {
BDFDB.LibraryRequires.electron.clipboard.write({text:e.instance.props.message.content});
},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.messagetoolbaricon,
name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
})
})
}));
}
}
};
})(window.BDFDB_Global.PluginUtils.buildPlugin(config));
})();

View File

@ -5,8 +5,13 @@ module.exports = (_ => {
"info": {
"name": "GoogleTranslateOption",
"author": "DevilBro",
"version": "2.0.9",
"version": "2.1.0",
"description": "Adds a Google Translate option to your context menu, which shows a preview of the translated text and on click will open the selected text in Google Translate. Also adds a translation button to your textareas, which will automatically translate the text for you before it is being send."
},
"changeLog": {
"improved": {
"Quick Action": "Added Icon to quick action bar. Holding shift while hovering a message shows the quick action bar"
}
}
};
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
@ -252,6 +257,26 @@ module.exports = (_ => {
}));
}
}
onMessageOptionToolbar (e) {
if (e.instance.props.expanded && e.instance.props.message && e.instance.props.channel) {
let translated = !!translatedMessages[e.instance.props.message.id];
e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
key: translated ? "untranslate-message" : "translate-message",
text: translated ? this.labels.context_messageuntranslateoption_text : this.labels.context_messagetranslateoption_text,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCN.messagetoolbarbutton,
onClick: _ => {
if (!isTranslating) this.translateMessage(e.instance.props.message, e.instance.props.channel);
},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.messagetoolbaricon,
iconSVG: translated ? translateIconUntranslate : translateIcon
})
})
}));
}
}
processChannelTextAreaForm (e) {
BDFDB.PatchUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => {

View File

@ -5,8 +5,13 @@ module.exports = (_ => {
"info": {
"name": "MessageUtilities",
"author": "DevilBro",
"version": "1.7.8",
"version": "1.7.9",
"description": "Offers a number of useful message options. Remap the keybindings in the settings."
},
"changeLog": {
"fixed": {
"Quick Action": "No longer interferes with quick action bar"
}
}
};
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
@ -78,10 +83,10 @@ module.exports = (_ => {
onStart() {
BDFDB.ListenerUtils.add(this, document, "click", BDFDB.dotCNC.message + BDFDB.dotCN.searchresultsgroupcozy, e => {
this.onClick(e, 0, "onSglClick");
if (!BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagetoolbarbutton, e.target)) this.onClick(e, 0, "onSglClick");
});
BDFDB.ListenerUtils.add(this, document, "dblclick", BDFDB.dotCNC.message + BDFDB.dotCN.searchresultsgroupcozy, e => {
this.onClick(e, 1, "onDblClick");
if (!BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagetoolbarbutton, e.target)) this.onClick(e, 1, "onDblClick");
});
BDFDB.ListenerUtils.add(this, document, "keydown", e => {
if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.textareawrapchat, document.activeElement)) this.onKeyDown(document.activeElement, e.which, "onKeyDown");

View File

@ -5,8 +5,13 @@ module.exports = (_ => {
"info": {
"name": "PersonalPins",
"author": "DevilBro",
"version": "1.9.8",
"version": "1.9.9",
"description": "Similar to normal pins. Lets you save messages as notes for yourself."
},
"changeLog": {
"improved": {
"Quick Action": "Added Icon to quick action bar. Holding shift while hovering a message shows the quick action bar"
}
}
};
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
@ -176,6 +181,40 @@ module.exports = (_ => {
}));
}
}
onMessageOptionToolbar (e) {
if (e.instance.props.expanded && e.instance.props.message && e.instance.props.channel) {
let note = this.getNoteData(e.instance.props.message, e.instance.props.channel);
e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
key: note ? "unpin-note" : "pin-note",
text: note ? this.labels.context_unpinoption_text : this.labels.context_pinoption_text,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCN.messagetoolbarbutton,
onClick: _ => {
this.addMessageToNotes(e.instance.props.message, e.instance.props.channel);
},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.messagetoolbaricon,
iconSVG: note ? pinIconDelete : pinIcon
})
})
}));
if (this.isNoteOutdated(note, e.instance.props.message)) e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
key: "update-note",
text: this.labels.context_updateoption_text,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCN.messagetoolbarbutton,
onClick: _ => {
this.updateNoteData(note, e.instance.props.message);
},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.messagetoolbaricon,
iconSVG: pinIconUpdate
})
})
}));
}
}
processHeaderBarContainer (e) {
let [children, index] = BDFDB.ReactUtils.findParent(BDFDB.ObjectUtils.get(e.returnvalue, "props.toolbar"), {name: "FluxContainer(Search)"});

View File

@ -45,7 +45,7 @@ module.exports = (_ => {
onStop() {}
onMessageOptionToolbar (e) {
if (e.instance.props.message.author.id != BDFDB.UserUtils.me.id && e.instance.props.message.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT && (BDFDB.UserUtils.can("SEND_MESSAGES") || e.instance.props.channel.type == BDFDB.DiscordConstants.ChannelTypes.DM || e.instance.props.channel.type == BDFDB.DiscordConstants.ChannelTypes.GROUP_DM)) e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
if (!e.instance.props.expanded && e.instance.props.message.author.id != BDFDB.UserUtils.me.id && e.instance.props.message.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT && (BDFDB.UserUtils.can("SEND_MESSAGES") || e.instance.props.channel.type == BDFDB.DiscordConstants.ChannelTypes.DM || e.instance.props.channel.type == BDFDB.DiscordConstants.ChannelTypes.GROUP_DM)) e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
key: "mention",
text: BDFDB.LanguageUtils.LanguageStrings.MENTION,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
@ -56,7 +56,7 @@ module.exports = (_ => {
});
},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCNS.messagetoolbaricon,
className: BDFDB.disCN.messagetoolbaricon,
nativeClass: true,
name: BDFDB.LibraryComponents.SvgIcon.Names.NOVA_AT
})