stuff
This commit is contained in:
parent
d298e9191b
commit
1323c482e6
|
@ -82,31 +82,28 @@ module.exports = (_ => {
|
||||||
hint: hint && (_ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuHint, {
|
hint: hint && (_ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuHint, {
|
||||||
hint: hint
|
hint: hint
|
||||||
})),
|
})),
|
||||||
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, {
|
||||||
className: BDFDB.disCN.menuicon,
|
icon: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
|
||||||
name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
|
|
||||||
}),
|
}),
|
||||||
action: _ => BDFDB.LibraryRequires.electron.clipboard.write({text: messageString})
|
action: _ => BDFDB.LibraryModules.WindowUtils.copy(messageString)
|
||||||
}),
|
}),
|
||||||
embedString && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
embedString && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw Embed)",
|
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw Embed)",
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-embed"),
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-embed"),
|
||||||
type: "Embed",
|
type: "Embed",
|
||||||
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, {
|
||||||
className: BDFDB.disCN.menuicon,
|
icon: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
|
||||||
name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
|
|
||||||
}),
|
}),
|
||||||
action: _ => BDFDB.LibraryRequires.electron.clipboard.write({text: embedString})
|
action: _ => BDFDB.LibraryModules.WindowUtils.copy(embedString)
|
||||||
}),
|
}),
|
||||||
embedData && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
embedData && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Embed JSON)",
|
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Embed JSON)",
|
||||||
type: "Embed JSON",
|
type: "Embed JSON",
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-embed-json"),
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-embed-json"),
|
||||||
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, {
|
||||||
className: BDFDB.disCN.menuicon,
|
icon: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
|
||||||
name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
|
|
||||||
}),
|
}),
|
||||||
action: _ => BDFDB.LibraryRequires.electron.clipboard.write({text: JSON.stringify(embedData)})
|
action: _ => BDFDB.LibraryModules.WindowUtils.copy(JSON.stringify(embedData))
|
||||||
})
|
})
|
||||||
].filter(n => n);
|
].filter(n => n);
|
||||||
if (entries.length) {
|
if (entries.length) {
|
||||||
|
@ -134,11 +131,10 @@ module.exports = (_ => {
|
||||||
children.splice(index + 1, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
children.splice(index + 1, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
|
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-message-raw"),
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-message-raw"),
|
||||||
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, {
|
||||||
className: BDFDB.disCN.menuicon,
|
icon: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
|
||||||
name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
|
|
||||||
}),
|
}),
|
||||||
action: _ => BDFDB.LibraryRequires.electron.clipboard.write({text: e.instance.props.message.content})
|
action: _ => BDFDB.LibraryModules.WindowUtils.copy(e.instance.props.message.content)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +147,7 @@ module.exports = (_ => {
|
||||||
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
|
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
|
||||||
className: BDFDB.disCN.messagetoolbarbutton,
|
className: BDFDB.disCN.messagetoolbarbutton,
|
||||||
onClick: _ => {
|
onClick: _ => {
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({text: e.instance.props.message.content});
|
BDFDB.LibraryModules.WindowUtils.copy(e.instance.props.message.content);
|
||||||
},
|
},
|
||||||
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
||||||
className: BDFDB.disCN.messagetoolbaricon,
|
className: BDFDB.disCN.messagetoolbaricon,
|
||||||
|
|
|
@ -364,7 +364,7 @@ module.exports = (_ => {
|
||||||
let text = this.parseQuote(message, channel);
|
let text = this.parseQuote(message, channel);
|
||||||
if (text && text.length) {
|
if (text && text.length) {
|
||||||
if (shift && !this.settings.general.alwaysCopy || !shift && this.settings.general.alwaysCopy || !(BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("SEND_MESSAGES"))) {
|
if (shift && !this.settings.general.alwaysCopy || !shift && this.settings.general.alwaysCopy || !(BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("SEND_MESSAGES"))) {
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({text: text});
|
BDFDB.LibraryModules.WindowUtils.copy(text);
|
||||||
BDFDB.NotificationUtils.toast(this.labels.toast_quotecopied, {type: "success"});
|
BDFDB.NotificationUtils.toast(this.labels.toast_quotecopied, {type: "success"});
|
||||||
}
|
}
|
||||||
else BDFDB.LibraryModules.DispatchUtils.ComponentDispatch.dispatchToLastSubscribed(BDFDB.DiscordConstants.ComponentActions.INSERT_TEXT, {
|
else BDFDB.LibraryModules.DispatchUtils.ComponentDispatch.dispatchToLastSubscribed(BDFDB.DiscordConstants.ComponentActions.INSERT_TEXT, {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @name ImageUtilities
|
* @name ImageUtilities
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 4.8.8
|
* @version 4.8.9
|
||||||
* @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)
|
* @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
module.exports = (_ => {
|
module.exports = (_ => {
|
||||||
const changeLog = {
|
const changeLog = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
|
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
|
||||||
|
@ -789,7 +790,7 @@ module.exports = (_ => {
|
||||||
label: BDFDB.LanguageUtils.LanguageStrings.COPY_LINK,
|
label: BDFDB.LanguageUtils.LanguageStrings.COPY_LINK,
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-link"),
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-link"),
|
||||||
action: _ => {
|
action: _ => {
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({text: urlData.original});
|
BDFDB.LibraryModules.WindowUtils.copy(urlData.original);
|
||||||
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"});
|
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@ -797,7 +798,7 @@ module.exports = (_ => {
|
||||||
label: BDFDB.LanguageUtils.LanguageStrings.COPY_MEDIA_LINK,
|
label: BDFDB.LanguageUtils.LanguageStrings.COPY_MEDIA_LINK,
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-media-link"),
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-media-link"),
|
||||||
action: _ => {
|
action: _ => {
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({text: urlData.file});
|
BDFDB.LibraryModules.WindowUtils.copy(urlData.file);
|
||||||
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"});
|
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@ -1456,23 +1457,10 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
copyFile (url) {
|
copyFile (url) {
|
||||||
BDFDB.LibraryRequires.request(url, {agentOptions: {rejectUnauthorized: false}, encoding: null}, (error, response, body) => {
|
|
||||||
let type = this.isValid(url, "video") ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE;
|
let type = this.isValid(url, "video") ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE;
|
||||||
if (error) BDFDB.NotificationUtils.toast(this.labels.toast_copy_failed.replace("{{var0}}", type), {type: "danger"});
|
BDFDB.LibraryModules.WindowUtils.copyImage(url);
|
||||||
else if (body) {
|
|
||||||
if (BDFDB.LibraryRequires.process.platform === "win32" || BDFDB.LibraryRequires.process.platform === "darwin") {
|
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({image: BDFDB.LibraryRequires.electron.nativeImage.createFromBuffer(body)});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let file = BDFDB.LibraryRequires.path.join(BDFDB.LibraryRequires.process.env.USERPROFILE || BDFDB.LibraryRequires.process.env.HOMEPATH || BDFDB.LibraryRequires.process.env.HOME, "imageutilstempimg.png");
|
|
||||||
BDFDB.LibraryRequires.fs.writeFileSync(file, body, {encoding: null});
|
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({image: file});
|
|
||||||
BDFDB.LibraryRequires.fs.unlinkSync(file);
|
|
||||||
}
|
|
||||||
BDFDB.NotificationUtils.toast(this.labels.toast_copy_success.replace("{{var0}}", type), {type: "success"});
|
BDFDB.NotificationUtils.toast(this.labels.toast_copy_success.replace("{{var0}}", type), {type: "success"});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getDownloadLocation () {
|
getDownloadLocation () {
|
||||||
if (downloadsFolder && BDFDB.LibraryRequires.fs.existsSync(downloadsFolder)) return downloadsFolder;
|
if (downloadsFolder && BDFDB.LibraryRequires.fs.existsSync(downloadsFolder)) return downloadsFolder;
|
||||||
|
|
|
@ -407,7 +407,7 @@ module.exports = (_ => {
|
||||||
|
|
||||||
doCopyRaw ({messageDiv, message}, action, event) {
|
doCopyRaw ({messageDiv, message}, action, event) {
|
||||||
if (message.content) {
|
if (message.content) {
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({text: message.content});
|
BDFDB.LibraryModules.WindowUtils.copy(message.content);
|
||||||
if (this.settings.toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.COPIED_TEXT), {type: "success"});
|
if (this.settings.toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.COPIED_TEXT), {type: "success"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,18 +188,18 @@ module.exports = (_ => {
|
||||||
if (message.content || message.attachments.length > 1) {
|
if (message.content || message.attachments.length > 1) {
|
||||||
let text = message.content || "";
|
let text = message.content || "";
|
||||||
for (let attachment of message.attachments) if (attachment.url) text += ((text ? "\n" : "") + attachment.url);
|
for (let attachment of message.attachments) if (attachment.url) text += ((text ? "\n" : "") + attachment.url);
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({text});
|
BDFDB.LibraryModules.WindowUtils.copy(text);
|
||||||
}
|
}
|
||||||
else if (message.attachments.length == 1 && message.attachments[0].url) {
|
else if (message.attachments.length == 1 && message.attachments[0].url) {
|
||||||
BDFDB.LibraryRequires.request(message.attachments[0].url, {encoding: null}, (error, response, body) => {
|
BDFDB.LibraryRequires.request(message.attachments[0].url, {encoding: null}, (error, response, body) => {
|
||||||
if (body) {
|
if (body) {
|
||||||
if (BDFDB.LibraryRequires.process.platform === "win32" || BDFDB.LibraryRequires.process.platform === "darwin") {
|
if (BDFDB.LibraryRequires.process.platform === "win32" || BDFDB.LibraryRequires.process.platform === "darwin") {
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({image: BDFDB.LibraryRequires.electron.nativeImage.createFromBuffer(body)});
|
BDFDB.LibraryModules.WindowUtils.copyImage(BDFDB.LibraryRequires.electron.nativeImage.createFromBuffer(body));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let file = BDFDB.LibraryRequires.path.join(BDFDB.LibraryRequires.process.env.USERPROFILE || BDFDB.LibraryRequires.process.env.HOMEPATH || BDFDB.LibraryRequires.process.env.HOME, "personalpinstemp.png");
|
let file = BDFDB.LibraryRequires.path.join(BDFDB.LibraryRequires.process.env.USERPROFILE || BDFDB.LibraryRequires.process.env.HOMEPATH || BDFDB.LibraryRequires.process.env.HOME, "personalpinstemp.png");
|
||||||
BDFDB.LibraryRequires.fs.writeFileSync(file, body, {encoding: null});
|
BDFDB.LibraryRequires.fs.writeFileSync(file, body, {encoding: null});
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({image: file});
|
BDFDB.LibraryModules.WindowUtils.copyImage(file);
|
||||||
BDFDB.LibraryRequires.fs.unlinkSync(file);
|
BDFDB.LibraryRequires.fs.unlinkSync(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,12 +207,12 @@ module.exports = (_ => {
|
||||||
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: BDFDB.LanguageUtils.LibraryStringsFormat("copy", BDFDB.LanguageUtils.LanguageStrings.USER_SETTINGS_LABEL_USERNAME),
|
label: BDFDB.LanguageUtils.LibraryStringsFormat("copy", BDFDB.LanguageUtils.LanguageStrings.USER_SETTINGS_LABEL_USERNAME),
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(_this.name, "copy-name"),
|
id: BDFDB.ContextMenuUtils.createItemId(_this.name, "copy-name"),
|
||||||
action: _ => BDFDB.LibraryRequires.electron.clipboard.write({text: c.name})
|
action: _ => BDFDB.LibraryModules.WindowUtils.copy(c.name)
|
||||||
}),
|
}),
|
||||||
url && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
url && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: BDFDB.LanguageUtils.LibraryStringsFormat("copy", BDFDB.LanguageUtils.LanguageStrings.SEARCH_ANSWER_HAS_LINK),
|
label: BDFDB.LanguageUtils.LibraryStringsFormat("copy", BDFDB.LanguageUtils.LanguageStrings.SEARCH_ANSWER_HAS_LINK),
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(_this.name, "copy-url"),
|
id: BDFDB.ContextMenuUtils.createItemId(_this.name, "copy-url"),
|
||||||
action: _ => BDFDB.LibraryRequires.electron.clipboard.write({text: url})
|
action: _ => BDFDB.LibraryModules.WindowUtils.copy(url)
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}));
|
}));
|
||||||
|
@ -293,12 +293,12 @@ module.exports = (_ => {
|
||||||
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: BDFDB.LanguageUtils.LibraryStringsFormat("copy", BDFDB.LanguageUtils.LanguageStrings.USER_SETTINGS_LABEL_USERNAME),
|
label: BDFDB.LanguageUtils.LibraryStringsFormat("copy", BDFDB.LanguageUtils.LanguageStrings.USER_SETTINGS_LABEL_USERNAME),
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(_this.name, "copy-name"),
|
id: BDFDB.ContextMenuUtils.createItemId(_this.name, "copy-name"),
|
||||||
action: _ => BDFDB.LibraryRequires.electron.clipboard.write({text: c.name})
|
action: _ => BDFDB.LibraryModules.WindowUtils.copy(c.name)
|
||||||
}),
|
}),
|
||||||
url && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
url && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: BDFDB.LanguageUtils.LibraryStringsFormat("copy", BDFDB.LanguageUtils.LanguageStrings.SEARCH_ANSWER_HAS_LINK),
|
label: BDFDB.LanguageUtils.LibraryStringsFormat("copy", BDFDB.LanguageUtils.LanguageStrings.SEARCH_ANSWER_HAS_LINK),
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(_this.name, "copy-url"),
|
id: BDFDB.ContextMenuUtils.createItemId(_this.name, "copy-url"),
|
||||||
action: _ => BDFDB.LibraryRequires.electron.clipboard.write({text: url})
|
action: _ => BDFDB.LibraryModules.WindowUtils.copy(url)
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in New Issue