This commit is contained in:
Mirco Wittrien 2020-05-14 17:33:14 +02:00
parent a3dcc3c524
commit ec899f6b0f
6 changed files with 101 additions and 9975 deletions

View File

@ -4142,8 +4142,7 @@
DiscordClassModules.ContextMenuReactButton = BDFDB.ModuleUtils.find(m => typeof m.wrapper == "string" && typeof m.button == "string" && typeof m.icon == "string" && Object.keys(m).length == 3);
DiscordClassModules.CtaVerification = BDFDB.ModuleUtils.findByProperties("attendeeCTA", "verificationNotice");
DiscordClassModules.Cursor = BDFDB.ModuleUtils.findByProperties("cursorDefault", "userSelectNone");
DiscordClassModules.CustomStatus = BDFDB.ModuleUtils.findByProperties("customStatusContentIcon", "customStatus");
DiscordClassModules.CustomStatusIcon = BDFDB.ModuleUtils.findByProperties("icon", "emoji");
DiscordClassModules.CustomStatusIcon = BDFDB.ModuleUtils.findByProperties("textRuler", "emoji", "icon");
DiscordClassModules.DmAddPopout = BDFDB.ModuleUtils.findByProperties("popout", "searchBarComponent");
DiscordClassModules.DmAddPopoutItems = BDFDB.ModuleUtils.findByProperties("friendSelected", "friendWrapper");
DiscordClassModules.DownloadLink = BDFDB.ModuleUtils.findByProperties("downloadLink");
@ -4204,6 +4203,7 @@
DiscordClassModules.LiveTag = BDFDB.ModuleUtils.findByProperties("liveLarge", "live");
DiscordClassModules.LoadingScreen = BDFDB.ModuleUtils.findByProperties("container", "problemsText", "problems");
DiscordClassModules.Margins = BDFDB.ModuleUtils.findByProperties("marginBottom4", "marginCenterHorz");
DiscordClassModules.Menu = BDFDB.ModuleUtils.findByProperties("menu", "styleFlexible", "item");
DiscordClassModules.Member = BDFDB.ModuleUtils.findByProperties("member", "ownerIcon");
DiscordClassModules.MembersWrap = BDFDB.ModuleUtils.findByProperties("membersWrap", "membersGroup");
DiscordClassModules.Message = BDFDB.ModuleUtils.findByProperties("message", "mentioned");
@ -4725,8 +4725,6 @@
contextmenusubcontext: ["ContextMenu", "subMenuContext"],
cursordefault: ["Cursor", "cursorDefault"],
cursorpointer: ["Cursor", "cursorPointer"],
customstatus: ["CustomStatus", "customStatus"],
customstatuscontenticon: ["CustomStatus", "customStatusContentIcon"],
customstatusemoji: ["CustomStatusIcon", "emoji"],
customstatusicon: ["CustomStatusIcon", "icon"],
defaultcolor: ["Text", "defaultColor"],
@ -5152,6 +5150,34 @@
mention: ["NotFound", "mention"],
mentioninteractive: ["NotFound", "mentionInteractive"],
mentionwrapper: ["NotFound", "mentionWrapper"],
menumenu: ["Menu", "menu"],
menuaccommodatescrollbar: ["Menu", "accommodateScrollbar"],
menucaret: ["Menu", "caret"],
menucheck: ["Menu", "check"],
menucheckbox: ["Menu", "checkbox"],
menucolorbrand: ["Menu", "colorBrand"],
menucolordanger: ["Menu", "colorDanger"],
menucolordefault: ["Menu", "colorDefault"],
menucolorpremium: ["Menu", "colorPremium"],
menucustomitem: ["Menu", "customItem"],
menudisabled: ["Menu", "disabled"],
menufocused: ["Menu", "focused"],
menuhideinteraction: ["Menu", "hideInteraction"],
menuhintcontainer: ["Menu", "hintContainer"],
menuicon: ["Menu", "icon"],
menuiconcontainer: ["Menu", "iconContainer"],
menuimage: ["Menu", "image"],
menuimagecontainer: ["Menu", "imageContainer"],
menuitem: ["Menu", "item"],
menulabel: ["Menu", "label"],
menulabelcontainer: ["Menu", "labelContainer"],
menuscroller: ["Menu", "scroller"],
menuseparator: ["Menu", "separator"],
menustylefixed: ["Menu", "styleFixed"],
menustyleflexible: ["Menu", "styleFlexible"],
menusubmenu: ["Menu", "submenu"],
menusubmenucontainer: ["Menu", "submenuContainer"],
menusubtext: ["Menu", "subtext"],
message: ["Message", "message"],
messageaccessory: ["MessageAccessory", "container"],
messageavatar: ["MessageBody", "avatar"],
@ -7157,7 +7183,6 @@
InternalComponents.LibraryComponents.ContextMenuItems.Item = InternalBDFDB.loadPatchedComp("ContextMenuItems.Item") || reactInitialized && class BDFDB_ContextMenuItem extends LibraryModules.React.Component {
render() {
let hintIsString = typeof this.props.hint == "string";
return BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.Clickable, {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.contextmenuitem, !this.props.disabled && BDFDB.disCN.contextmenuitemclickable, this.props.danger && BDFDB.disCN.contextmenuitemdanger, this.props.disabled && BDFDB.disCN.contextmenuitemdisabled, this.props.brand && BDFDB.disCN.contextmenuitembrand, this.props.className),
style: this.props.style,
@ -7219,7 +7244,7 @@
};
var ComponentTypeData = {};
ComponentTypeData.NormalContextMenus = ["DeveloperContextMenu", "GuildRoleContextMenu", "NativeContextMenu", "UserSettingsCogContextMenu"];
ComponentTypeData.NormalContextMenus = ["DeveloperContextMenu", "NativeContextMenu", "UserSettingsCogContextMenu"];
ComponentTypeData.FluxContextMenus = ["ApplicationContextMenu", "GroupDMContextMenu"];
ComponentTypeData.NonRenderContextMenus = ["ChannelContextMenu", "GuildContextMenu", "MessageContextMenu", "SlateContextMenu", "UserContextMenu"];
ComponentTypeData.ObservedContextMenus = [];
@ -7243,8 +7268,6 @@
InternalComponents.LibraryComponents.ContextMenus.GuildContextMenu = BDFDB.ModuleUtils.findByString("Error - no such ctx menu type", BDFDB.DiscordConstants.ContextMenuTypes.GUILD_CHANNEL_LIST);
InternalComponents.LibraryComponents.ContextMenus._Exports.GuildContextMenu = (BDFDB.ModuleUtils.findByString("Error - no such ctx menu type", BDFDB.DiscordConstants.ContextMenuTypes.GUILD_CHANNEL_LIST, false) || {}).exports;
InternalComponents.LibraryComponents.ContextMenus.GuildRoleContextMenu = BDFDB.ModuleUtils.findByName("GuildRoleContextMenu");
InternalComponents.LibraryComponents.ContextMenus.MessageContextMenu = BDFDB.ModuleUtils.findByString("message", "target", BDFDB.DiscordConstants.ContextMenuTypes.MESSAGE_MAIN);
InternalComponents.LibraryComponents.ContextMenus._Exports.MessageContextMenu = (BDFDB.ModuleUtils.findByString("message", "target", BDFDB.DiscordConstants.ContextMenuTypes.MESSAGE_MAIN, false) || {}).exports;
@ -7565,10 +7588,6 @@
}
};
InternalComponents.LibraryComponents.MessageGroup = BDFDB.ModuleUtils.findByName("ChannelMessage");
InternalComponents.LibraryComponents.MessagesPopoutComponents = BDFDB.ModuleUtils.findByProperties("Header", "EmptyStateBottom");
InternalComponents.LibraryComponents.MemberRole = InternalBDFDB.loadPatchedComp("MemberRole") || reactInitialized && class BDFDB_MemberRole extends LibraryModules.React.Component {
handleClick(e) {if (typeof this.props.onClick == "function") this.props.onClick(e, this);}
handleContextMenu(e) {if (typeof this.props.onContextMenu == "function") this.props.onContextMenu(e, this);}
@ -7593,6 +7612,12 @@
}
};
InternalComponents.LibraryComponents.MenuItems = BDFDB.ModuleUtils.findByProperties("MenuItem", "MenuGroup");
InternalComponents.LibraryComponents.MessageGroup = BDFDB.ModuleUtils.findByName("ChannelMessage");
InternalComponents.LibraryComponents.MessagesPopoutComponents = BDFDB.ModuleUtils.findByProperties("Header", "EmptyStateBottom");
InternalComponents.LibraryComponents.ModalComponents = Object.assign({}, BDFDB.ModuleUtils.findByProperties("ModalContent", "ModalFooter"));
InternalComponents.LibraryComponents.ModalComponents.ModalContent = InternalBDFDB.loadPatchedComp("ModalComponents.ModalContent") || reactInitialized && class BDFDB_ModalContent extends LibraryModules.React.Component {

9920
Plugins/BDFDB.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -4,13 +4,16 @@ var CopyRawMessage = (_ => {
return class CopyRawMessage {
getName () {return "CopyRawMessage";}
getVersion () {return "1.0.6";}
getVersion () {return "1.0.7";}
getAuthor () {return "DevilBro";}
getDescription () {return "Adds a entry in the contextmenu when you right click a message that allows you to copy the raw contents of a message.";}
constructor () {
this.changelog = {
"fixed":[["Crash","Fixed crash on message 3-dot menu"]]
};
this.changelog = {
"improved":[["Raw Embed Text","Right clicking inside an embed which contains a description will add an extra option in the context menu to copy the raw contents of the embed description"]]
};
@ -91,13 +94,16 @@ var CopyRawMessage = (_ => {
onMessageOptionContextMenu (e) {
if (e.instance.props.message && e.instance.props.message.content) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {key: ["mark-unread"]});
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["id", "mark-unread"]]});
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
hint: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCNS.messagetoolbaricon,
name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
}),
id: "copy-raw",
icon: _ => {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.menuicon,
name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
});
},
action: _ => {
e.instance.props.onClose();
BDFDB.LibraryRequires.electron.clipboard.write({text:e.instance.props.message.content});

View File

@ -27,13 +27,17 @@ var GoogleTranslateOption = (_ => {
return class GoogleTranslateOption {
getName () {return "GoogleTranslateOption";}
getVersion () {return "1.9.9";}
getVersion () {return "2.0.0";}
getAuthor () {return "DevilBro";}
getDescription () {return "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.";}
constructor () {
this.changelog = {
"fixed":[["Crash","Fixed crash on message 3-dot menu"]]
};
this.patchedModules = {
before: {
ChannelTextAreaForm: "render",
@ -50,6 +54,11 @@ var GoogleTranslateOption = (_ => {
}
initConstructor () {
languages = {};
translating = false;
isTranslating = false;
translatedMessages = {};
this.defaults = {
settings: {
useChromium: {value:false, description:"Use an inbuilt browser window instead of opening your default browser"},
@ -128,11 +137,6 @@ var GoogleTranslateOption = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.PluginUtils.init(this);
languages = {};
translating = false;
isTranslating = false;
translatedMessages = {};
this.setLanguages();
@ -210,19 +214,22 @@ var GoogleTranslateOption = (_ => {
}
}
}
onMessageOptionContextMenu (e) {
if (e.instance.props.message && e.instance.props.channel) {
let translated = !!translatedMessages[e.instance.props.message.id];
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {key: ["pin", "unpin"]});
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["id", ["pin", "unpin"]]]});
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: translated ? this.labels.context_messageuntranslateoption_text : this.labels.context_messagetranslateoption_text,
disabled: isTranslating,
hint: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCNS.messagetoolbaricon,
nativeClass: true,
iconSVG: translated ? translateIconUntranslate : translateIcon
}),
id: "translation",
icon: _ => {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.menuicon,
nativeClass: true,
iconSVG: translated ? translateIconUntranslate : translateIcon
});
},
action: _ => {
e.instance.props.onClose();
this.translateMessage(e.instance.props.message, e.instance.props.channel);
@ -300,7 +307,7 @@ var GoogleTranslateOption = (_ => {
}));
popoutelements.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
})),
}));
popoutelements = popoutelements.concat(this.createSelects(true));
popoutelements.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
@ -564,14 +571,14 @@ var GoogleTranslateOption = (_ => {
googleTranslateWindow.webContents.on("did-finish-load", _ => {
googleTranslateWindow.webContents.executeJavaScript(`require("electron").ipcRenderer.sendTo(${BDFDB.LibraryRequires.electron.remote.getCurrentWindow().webContents.id}, "GTO-translation", [(document.querySelector(".translation") || {}).innerText, [(new RegExp("{code:'([^']*)',name:'" + [(new RegExp((window.source_language_detected || "").replace("%1$s", "([A-z]{2,})"), "g")).exec(document.body.innerHTML)].flat()[1] +"'}", "g")).exec(document.body.innerHTML)].flat()[1]]);`);
});
BDFDB.WindowUtils.addListener(this, "GTO-translation", (event, messagedata) => {
BDFDB.WindowUtils.addListener(this, "GTO-translation", (event, messageData) => {
BDFDB.WindowUtils.close(googleTranslateWindow);
BDFDB.WindowUtils.removeListener(this, "GTO-translation");
if (!data.specialcase && messagedata[1] && languages[messagedata[1]]) {
data.input.name = languages[messagedata[1]].name;
data.input.ownlang = languages[messagedata[1]].ownlang;
if (!data.specialcase && messageData[1] && languages[messageData[1]]) {
data.input.name = languages[messageData[1]].name;
data.input.ownlang = languages[messageData[1]].ownlang;
}
callback(messagedata[0]);
callback(messageData[0]);
});
}

View File

@ -12,13 +12,13 @@ var PersonalPins = (_ => {
getDescription () {return "Similar to normal pins. Lets you save messages as notes for yourself.";}
getVersion () {return "1.9.1";}
getVersion () {return "1.9.2";}
getAuthor () {return "DevilBro";}
constructor () {
this.changelog = {
"fixed":[["Styling","Adjusted the styling to the new styling of the recent mentions popout"]]
"fixed":[["Crash","Fixed crash on message 3-dot menu"]]
};
this.patchedModules = {
@ -123,30 +123,36 @@ var PersonalPins = (_ => {
}
}
}
onMessageOptionContextMenu (e) {
if (e.instance.props.message && e.instance.props.channel) {
let note = this.getNoteData(e.instance.props.message, e.instance.props.channel);
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {key: ["pin", "unpin"]});
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["id", ["pin", "unpin"]]]});
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: note ? this.labels.context_unpinoption_text : this.labels.context_pinoption_text,
hint: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCNS.messagetoolbaricon,
nativeClass: true,
iconSVG: note ? pinIconDelete : pinIcon
}),
id: note ? "unpin-note" : "pin-note",
icon: _ => {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.menuicon,
nativeClass: true,
iconSVG: note ? pinIconDelete : pinIcon
});
},
action: _ => {
e.instance.props.onClose();
this.addMessageToNotes(e.instance.props.message, e.instance.props.channel);
}
}));
if (this.isNoteOutdated(note, e.instance.props.message)) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
if (this.isNoteOutdated(note, e.instance.props.message)) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_updateoption_text,
hint: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCNS.messagetoolbaricon,
nativeClass: true,
iconSVG: pinIconUpdate
}),
id: "update-note",
icon: _ => {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.menuicon,
nativeClass: true,
iconSVG: pinIconUpdate
});
},
action: _ => {
e.instance.props.onClose();
this.updateNoteData(note, e.instance.props.message);

View File

@ -2292,7 +2292,7 @@
</div>
<div class="REPLACE_CLASS_userpopoutcustomstatus">
<img src="https://discordapp.com/assets/ebc2b7d9c497f0e4663d46c13e35fe23.svg" alt="⛑" draggable="false" class="REPLACE_CLASS_emojiold REPLACE_CLASS_emoji REPLACE_CLASS_userpopoutcustomstatusemoji">
<span class="customStatusText-3YJeRZ">Helping</span>
<span class="REPLACE_CLASS_userpopoutcustomstatustext">Helping</span>
</div>
</div>
</div>