stuff
This commit is contained in:
parent
7ca490bc32
commit
47544d9f05
|
@ -5597,6 +5597,8 @@ var BDFDB = {
|
||||||
NativeSubComponents.TooltipContainer = BDFDB.ModuleUtils.findByName("Tooltip");
|
NativeSubComponents.TooltipContainer = BDFDB.ModuleUtils.findByName("Tooltip");
|
||||||
|
|
||||||
|
|
||||||
|
LibraryComponents.Anchor = BDFDB.ModuleUtils.findByName("Anchor");
|
||||||
|
|
||||||
LibraryComponents.BotTag = reactInitialized ? class BDFDB_BotTag extends LibraryModules.React.Component {
|
LibraryComponents.BotTag = reactInitialized ? class BDFDB_BotTag extends LibraryModules.React.Component {
|
||||||
render() {
|
render() {
|
||||||
return BDFDB.ReactUtils.createElement("span", {
|
return BDFDB.ReactUtils.createElement("span", {
|
||||||
|
@ -7754,8 +7756,8 @@ var BDFDB = {
|
||||||
|
|
||||||
BDFDB.patchModules = {
|
BDFDB.patchModules = {
|
||||||
V2C_ContentColumn: "render",
|
V2C_ContentColumn: "render",
|
||||||
V2C_PluginCard: ["componentDidMount","componentDidUpdate"],
|
V2C_PluginCard: "render",
|
||||||
V2C_ThemeCard: ["componentDidMount","componentDidUpdate"],
|
V2C_ThemeCard: "render",
|
||||||
UserPopout: "componentDidMount",
|
UserPopout: "componentDidMount",
|
||||||
UserProfile: "componentDidMount",
|
UserProfile: "componentDidMount",
|
||||||
Message: ["componentDidMount","componentDidUpdate"],
|
Message: ["componentDidMount","componentDidUpdate"],
|
||||||
|
@ -7789,34 +7791,47 @@ var BDFDB = {
|
||||||
};
|
};
|
||||||
|
|
||||||
BDFDBprocessFunctions._processCard = function (e, data) {
|
BDFDBprocessFunctions._processCard = function (e, data) {
|
||||||
var author, description = null;
|
if (e.instance.state && !e.instance.state.settings) {
|
||||||
if (BDFDB.DOMUtils.containsClass(e.node, BDFDB.disCN._reposettingsclosed) && (author = e.node.querySelector(BDFDB.dotCN._repoauthor)) != null && (description = e.node.querySelector(BDFDB.dotCN._repodescription)) != null && (!BDFDB.ObjectUtils.is(data) || typeof data.getRawUrl != "function")) {
|
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props: [["className", BDFDB.disCN._repoauthor]]});
|
||||||
if (!author.firstElementChild && !description.firstElementChild && (author.innerText == "DevilBro" || author.innerText.indexOf("DevilBro,") == 0)) {
|
if (index > -1) {
|
||||||
description.style.setProperty("display", "block", "important");
|
let author = children[index].props.children;
|
||||||
author.innerHTML = `<a class="${BDFDB.disCNS.anchor + BDFDB.disCN.anchorunderlineonhover}">DevilBro</a>${author.innerText.split("DevilBro").slice(1).join("DevilBro")}`;
|
if (author && (author == "DevilBro" || author.indexOf("DevilBro,") == 0)) {
|
||||||
author.addEventListener("click", _ => {
|
children.splice(index, 1, BDFDB.ReactUtils.createElement(LibraryComponents.Anchor, {
|
||||||
|
className: BDFDB.disCN._repoauthor,
|
||||||
|
children: "DevilBro",
|
||||||
|
onClick: e => {
|
||||||
|
BDFDB.ListenerUtils.stopEvent(e);
|
||||||
if (BDFDB.UserUtils.me.id == "278543574059057154") return;
|
if (BDFDB.UserUtils.me.id == "278543574059057154") return;
|
||||||
let DMid = LibraryModules.ChannelStore.getDMFromUserId("278543574059057154")
|
let DMid = LibraryModules.ChannelStore.getDMFromUserId("278543574059057154")
|
||||||
if (DMid) LibraryModules.SelectChannelUtils.selectPrivateChannel(DMid);
|
if (DMid) LibraryModules.SelectChannelUtils.selectPrivateChannel(DMid);
|
||||||
else LibraryModules.DirectMessageUtils.openPrivateChannel(BDFDB.UserUtils.me.id, "278543574059057154");
|
else LibraryModules.DirectMessageUtils.openPrivateChannel(BDFDB.UserUtils.me.id, "278543574059057154");
|
||||||
let close = document.querySelector(BDFDB.dotCNS.settingsclosebuttoncontainer + BDFDB.dotCN.settingsclosebutton);
|
let close = document.querySelector(BDFDB.dotCNS.settingsclosebuttoncontainer + BDFDB.dotCN.settingsclosebutton);
|
||||||
if (close) close.click();
|
if (close) close.click();
|
||||||
});
|
|
||||||
let version = e.node.querySelector(BDFDB.dotCN._repoversion);
|
|
||||||
if (version && data.changelog) {
|
|
||||||
BDFDB.DOMUtils.remove(version.querySelectorAll(".BDFDB-versionchangelog"));
|
|
||||||
let changelogicon = BDFDB.DOMUtils.create(`<span class="BDFDB-versionchangelog" style="white-space: pre !important;"> </span>`);
|
|
||||||
version.appendChild(changelogicon);
|
|
||||||
changelogicon.addEventListener("click", _ => {BDFDB.PluginUtils.openChangeLog(data);});
|
|
||||||
changelogicon.addEventListener("mouseenter", _ => {
|
|
||||||
BDFDB.TooltipUtils.create(changelogicon, BDFDB.LanguageUtils.LanguageStrings.CHANGE_LOG, {type:"top", selector:"changelogicon-tooltip"});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
let links = e.node.querySelector(BDFDB.dotCN._repolinks);
|
}));
|
||||||
if (links) {
|
if (author != "DevilBro") children.splice(index + 1, author.split("DevilBro").slice(1).join("DevilBro"));
|
||||||
if (links.firstElementChild) links.appendChild(document.createTextNode(" | "));
|
|
||||||
let supportlink = BDFDB.DOMUtils.create(`<a class="${BDFDB.disCNS._repolink + BDFDB.disCN._repolink}-support" target="_blank">Support Server</a>`);
|
if (data.changelog) {
|
||||||
supportlink.addEventListener("click", e => {
|
[children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props: [["className", BDFDB.disCN._repoversion]]});
|
||||||
|
if (index > -1) children[index].props.children = [children[index].props.children, BDFDB.ReactUtils.createElement(LibraryComponents.TooltipContainer, {
|
||||||
|
text: BDFDB.LanguageUtils.LanguageStrings.CHANGE_LOG,
|
||||||
|
children: BDFDB.ReactUtils.createElement("span", {
|
||||||
|
className: "BDFDB-versionchangelog",
|
||||||
|
children: " ",
|
||||||
|
style: {whiteSpace: "pre"},
|
||||||
|
onClick: _ => {BDFDB.PluginUtils.openChangeLog(data);}
|
||||||
|
})
|
||||||
|
})];
|
||||||
|
}
|
||||||
|
|
||||||
|
[children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props: [["className", BDFDB.disCN._repolinks]]});
|
||||||
|
if (index > -1) {
|
||||||
|
if (!children[index].props.children.filter(n => n).length) children[index].props.children.push(" | ");
|
||||||
|
children[index].props.children.push(BDFDB.ReactUtils.createElement("a", {
|
||||||
|
className: `${BDFDB.disCNS._repolink + BDFDB.disCN._repolink}-support`,
|
||||||
|
target: "_blank",
|
||||||
|
children: "Support Server",
|
||||||
|
onClick: e => {
|
||||||
BDFDB.ListenerUtils.stopEvent(e);
|
BDFDB.ListenerUtils.stopEvent(e);
|
||||||
let switchguild = _ => {
|
let switchguild = _ => {
|
||||||
LibraryModules.GuildUtils.transitionToGuildSync("410787888507256842");
|
LibraryModules.GuildUtils.transitionToGuildSync("410787888507256842");
|
||||||
|
@ -7825,11 +7840,15 @@ var BDFDB = {
|
||||||
};
|
};
|
||||||
if (LibraryModules.GuildStore.getGuild("410787888507256842")) switchguild();
|
if (LibraryModules.GuildStore.getGuild("410787888507256842")) switchguild();
|
||||||
else LibraryModules.InviteUtils.acceptInvite("Jx3TjNS").then(_ => {switchguild();});
|
else LibraryModules.InviteUtils.acceptInvite("Jx3TjNS").then(_ => {switchguild();});
|
||||||
});
|
}
|
||||||
links.appendChild(supportlink);
|
}));
|
||||||
if (BDFDB.UserUtils.me.id != "98003542823944192" && BDFDB.UserUtils.me.id != "116242787980017679" && BDFDB.UserUtils.me.id != "81388395867156480") {
|
children[index].props.children.push(" | ");
|
||||||
links.appendChild(document.createTextNode(" | "));
|
children[index].props.children.push(BDFDB.ReactUtils.createElement("a", {
|
||||||
links.appendChild(BDFDB.DOMUtils.create(`<a class="${BDFDB.disCNS._repolink + BDFDB.disCN._repolink}-donations" href="https://www.paypal.me/MircoWittrien" target="_blank">Donations</a>`));
|
className: `${BDFDB.disCNS._repolink + BDFDB.disCN._repolink}-donations`,
|
||||||
|
target: "_blank",
|
||||||
|
href: "https://www.paypal.me/MircoWittrien",
|
||||||
|
children: "Donations"
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7865,18 +7884,18 @@ var BDFDB = {
|
||||||
let [children, index] = BDFDB.ReactUtils.findChildren(renderedChildren, {name:"MessageOptionButton"});
|
let [children, index] = BDFDB.ReactUtils.findChildren(renderedChildren, {name:"MessageOptionButton"});
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
let props = children[index].props;
|
let props = children[index].props;
|
||||||
if (!(props.message.author.isLocalBot() || props.message.author.id === props.currentUserId || props.canDelete || props.canPin || BDFDB.LibraryModules.CopyLinkUtils.SUPPORTS_COPY && props.developerMode)) children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PopoutContainer, {
|
if (!(props.message.author.isLocalBot() || props.message.author.id === props.currentUserId || props.canDelete || props.canPin || BDFDB.LibraryModules.CopyLinkUtils.SUPPORTS_COPY && props.developerMode)) children.push(BDFDB.ReactUtils.createElement(LibraryComponents.PopoutContainer, {
|
||||||
native: true,
|
native: true,
|
||||||
position: BDFDB.LibraryComponents.PopoutContainer.Positions.BOTTOM,
|
position: LibraryComponents.PopoutContainer.Positions.BOTTOM,
|
||||||
align: BDFDB.LibraryComponents.PopoutContainer.Align.CENTER,
|
align: LibraryComponents.PopoutContainer.Align.CENTER,
|
||||||
renderPopout: event => {
|
renderPopout: event => {
|
||||||
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MessageOptionPopout, Object.assign({}, props, {onClose: event.closePopout}));
|
return BDFDB.ReactUtils.createElement(LibraryComponents.MessageOptionPopout, Object.assign({}, props, {onClose: event.closePopout}));
|
||||||
},
|
},
|
||||||
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
|
children: BDFDB.ReactUtils.createElement(LibraryComponents.Clickable, {
|
||||||
className: BDFDB.disCN.optionpopoutbutton,
|
className: BDFDB.disCN.optionpopoutbutton,
|
||||||
"aria-label": BDFDB.LanguageUtils.LanguageStrings.MESSAGE_OPTIONS,
|
"aria-label": BDFDB.LanguageUtils.LanguageStrings.MESSAGE_OPTIONS,
|
||||||
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
children: BDFDB.ReactUtils.createElement(LibraryComponents.SvgIcon, {
|
||||||
name: BDFDB.LibraryComponents.SvgIcon.Names.OVERFLOW_MENU,
|
name: LibraryComponents.SvgIcon.Names.OVERFLOW_MENU,
|
||||||
className: BDFDB.disCN.optionpopoutbuttonicon
|
className: BDFDB.disCN.optionpopoutbuttonicon
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
||||||
class CopyRawMessage {
|
class CopyRawMessage {
|
||||||
getName () {return "CopyRawMessage";}
|
getName () {return "CopyRawMessage";}
|
||||||
|
|
||||||
getVersion () {return "1.0.2";}
|
getVersion () {return "1.0.3";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@ class CopyRawMessage {
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
this.changelog = {
|
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 = {
|
this.patchModules = {
|
||||||
"Message":"componentDidMount"
|
MessageContent: "render"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,8 @@ class CopyRawMessage {
|
||||||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||||
if (this.started) return;
|
if (this.started) return;
|
||||||
BDFDB.PluginUtils.init(this);
|
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!");
|
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
|
||||||
}
|
}
|
||||||
|
@ -62,9 +64,9 @@ class CopyRawMessage {
|
||||||
|
|
||||||
// begin of own functions
|
// begin of own functions
|
||||||
|
|
||||||
onMessageContextMenu (instance, menu, returnvalue) {
|
onMessageContextMenu (e) {
|
||||||
if (instance.props && instance.props.message && instance.props.message.content && instance.props.target && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
if (e.instance.props && e.instance.props.message && e.instance.props.message.content) {
|
||||||
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
|
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
|
||||||
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||||
children: [
|
children: [
|
||||||
|
@ -72,9 +74,9 @@ class CopyRawMessage {
|
||||||
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
|
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
|
||||||
hint: BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("Copy_Raw") : null,
|
hint: BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("Copy_Raw") : null,
|
||||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-copyraw-contextMenuItem`,
|
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-copyraw-contextMenuItem`,
|
||||||
action: e => {
|
action: _ => {
|
||||||
BDFDB.ContextMenuUtils.close(menu);
|
BDFDB.ContextMenuUtils.close(e.instance);
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({text:instance.props.message.content});
|
BDFDB.LibraryRequires.electron.clipboard.write({text:e.instance.props.message.content});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
@ -84,29 +86,18 @@ class CopyRawMessage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMessageOptionPopout (instance, popout, returnvalue) {
|
onMessageOptionPopout (e) {
|
||||||
if (instance.props.message && instance.props.channel && instance._reactInternalFiber.memoizedProps.target && !popout.querySelector(".copyrawmessage-itembtn")) {
|
if (e.instance.props && e.instance.props.message) {
|
||||||
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {props:[["label", BDFDB.LanguageUtils.LanguageStrings.DELETE]]});
|
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["label", BDFDB.LanguageUtils.LanguageStrings.DELETE]]});
|
||||||
const copyItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
const copyItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||||
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
|
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
|
||||||
className: `${BDFDB.disCN.optionpopoutitem} BDFDB-popoutMenuItem ${this.name}-popoutMenuItem ${this.name}-copyraw-popoutMenuItem`,
|
className: `${BDFDB.disCN.optionpopoutitem} BDFDB-popoutMenuItem ${this.name}-popoutMenuItem ${this.name}-copyraw-popoutMenuItem`,
|
||||||
action: e => {
|
action: _ => {
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({text:instance.props.message.content});
|
BDFDB.LibraryRequires.electron.clipboard.write({text:e.instance.props.message.content});
|
||||||
instance.props.onClose();
|
e.instance.props.onClose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
children.splice(index, 0, copyItem);
|
children.splice(index, 0, copyItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processMessage (instance, wrapper, returnvalue) {
|
|
||||||
if (instance.props && typeof instance.props.renderButtons == "function" && !wrapper.querySelector(BDFDB.dotCN.optionpopoutbutton) && BDFDB.ReactUtils.getValue(instance, "props.message.author.id") != 1) {
|
|
||||||
let buttonwrap = wrapper.querySelector(BDFDB.dotCN.messagebuttoncontainer);
|
|
||||||
if (buttonwrap) {
|
|
||||||
let optionPopoutButton = BDFDB.DOMUtils.create(`<div tabindex="0" class="${BDFDB.disCN.optionpopoutbutton}" aria-label="More Options" role="button"><svg name="OverflowMenu" class="${BDFDB.disCN.optionpopoutbuttonicon}" aria-hidden="false" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0z"></path><path fill="currentColor" d="M12 16c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2z"></path></g></svg></div>`);
|
|
||||||
optionPopoutButton.addEventListener("click", () => {BDFDB.createMessageOptionPopout(optionPopoutButton);});
|
|
||||||
buttonwrap.appendChild(optionPopoutButton);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue