stuff
This commit is contained in:
parent
8d6be50a9b
commit
4cdbf4beb0
|
@ -50,7 +50,7 @@ var ImageUtilities = (_ => {
|
||||||
return class ImageUtilities {
|
return class ImageUtilities {
|
||||||
getName () {return "ImageUtilities";}
|
getName () {return "ImageUtilities";}
|
||||||
|
|
||||||
getVersion () {return "4.0.7";}
|
getVersion () {return "4.0.8";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ var ImageUtilities = (_ => {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.changelog = {
|
this.changelog = {
|
||||||
"progress":[["Welcome","This is the successor of ImageZoom, ImageGallery, ReverseImageSearch and ShowImageDetails. All of these plugins are now combined in one with even more useful features. Check out the plugin settings to configure the plugin the way you want it to work."]],
|
"progress":[["Welcome","This is the successor of ImageZoom, ImageGallery, ReverseImageSearch and ShowImageDetails. All of these plugins are now combined in one with even more useful features. Check out the plugin settings to configure the plugin the way you want it to work."]],
|
||||||
|
"improved":[["Animated Icons/Avatars","Right clicking a server/user with an animated icon will now give the option to either choose the .png or .gif"]],
|
||||||
"fixed":[["Image Formats","Fixed some issues with some image formats, like copy option not showing for gifs since gifs can't be copied in the clipboard"]]
|
"fixed":[["Image Formats","Fixed some issues with some image formats, like copy option not showing for gifs since gifs can't be copied in the clipboard"]]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -325,11 +326,11 @@ var ImageUtilities = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onGuildContextMenu (e) {
|
onGuildContextMenu (e) {
|
||||||
if (e.instance.props.guild && settings.addGuildIconEntry) this.injectItem(e, BDFDB.LibraryModules.IconUtils.getGuildIconURL(e.instance.props.guild));
|
if (e.instance.props.guild && !settings.addGuildIconEntry) this.injectItem(e, e.instance.props.guild.getIconURL("png"), BDFDB.LibraryModules.IconUtils.hasAnimatedGuildIcon(e.instance.props.guild) && e.instance.props.guild.getIconURL("gif"));
|
||||||
}
|
}
|
||||||
|
|
||||||
onUserContextMenu (e) {
|
onUserContextMenu (e) {
|
||||||
if (e.instance.props.user && settings.addUserAvatarEntry) this.injectItem(e, BDFDB.LibraryModules.IconUtils.getUserAvatarURL(e.instance.props.user));
|
if (e.instance.props.user && settings.addUserAvatarEntry) this.injectItem(e, e.instance.props.user.getAvatarURL("png"), BDFDB.LibraryModules.IconUtils.hasAnimatedAvatar(e.instance.props.user) && e.instance.props.user.getAvatarURL("gif"))
|
||||||
}
|
}
|
||||||
|
|
||||||
onNativeContextMenu (e) {
|
onNativeContextMenu (e) {
|
||||||
|
@ -354,21 +355,37 @@ var ImageUtilities = (_ => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
injectItem (e, url) {
|
injectItem (e, ...urls) {
|
||||||
if (this.isValidImg(url)) {
|
let types = [];
|
||||||
url = url.replace(/^url\(|\)$|"|'/g, "").replace(/\?size\=\d+$/, "?size=4096").replace(/[\?\&](height|width)=\d+/g, "");
|
let validUrls = urls.filter(n => this.isValidImg(n)).map(n => {
|
||||||
|
let url = n.replace(/^url\(|\)$|"|'/g, "").replace(/\?size\=\d+$/, "?size=4096").replace(/[\?\&](height|width)=\d+/g, "");
|
||||||
if (url.indexOf("https://images-ext-1.discordapp.net/external/") > -1) {
|
if (url.indexOf("https://images-ext-1.discordapp.net/external/") > -1) {
|
||||||
if (url.split("/https/").length != 1) url = "https://" + url.split("/https/")[url.split("/https/").length-1];
|
if (url.split("/https/").length > 1) url = "https://" + url.split("/https/").pop();
|
||||||
else if (url.split("/http/").length != 1) url = "http://" + url.split("/http/")[url.split("/http/").length-1];
|
else if (url.split("/http/").length > 1) url = "http://" + url.split("/http/").pop();
|
||||||
}
|
}
|
||||||
let enginesWithoutAll = BDFDB.ObjectUtils.filter(enabledEngines, n => n != "_all", true);
|
const file = url && (BDFDB.LibraryModules.URLParser.parse(url).pathname || "").toLowerCase();
|
||||||
let engineKeys = Object.keys(enginesWithoutAll);
|
const type = file && file.split(".").pop();
|
||||||
|
return url && type && !types.includes(type) && types.push(type) && {url, type};
|
||||||
|
}).filter(n => n);
|
||||||
|
if (!validUrls.length) return;
|
||||||
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
|
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
|
||||||
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||||
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: "Image Utilities",
|
label: "Image Utilities",
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "main-item"),
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "main-subitem"),
|
||||||
children: [
|
children: validUrls.length == 1 ? this.createUrlMenus(validUrls[0].url) : validUrls.map((urlData, i) => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
|
label: urlData.type.toUpperCase(),
|
||||||
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "subitem", i),
|
||||||
|
children: this.createUrlMenus(urlData.url)
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
createUrlMenus (url) {
|
||||||
|
let enginesWithoutAll = BDFDB.ObjectUtils.filter(enabledEngines, n => n != "_all", true);
|
||||||
|
let engineKeys = Object.keys(enginesWithoutAll);
|
||||||
|
return [
|
||||||
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: this.labels.context_viewimage_text,
|
label: this.labels.context_viewimage_text,
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "view-image"),
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "view-image"),
|
||||||
|
@ -456,10 +473,7 @@ var ImageUtilities = (_ => {
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
].filter(n => n)
|
].filter(n => n);
|
||||||
})
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processImageModal (e) {
|
processImageModal (e) {
|
||||||
|
|
|
@ -6,7 +6,6 @@ https://raw.githubusercontent.com/Azagwen/Rainbow_kittens_theme/master/Rainbow_k
|
||||||
https://raw.githubusercontent.com/A-User-s-Discord-Themes/Bash/master/bash.theme.css
|
https://raw.githubusercontent.com/A-User-s-Discord-Themes/Bash/master/bash.theme.css
|
||||||
https://raw.githubusercontent.com/BeardDesign1/Ios-switches/themes/IOS_Switches.theme.css
|
https://raw.githubusercontent.com/BeardDesign1/Ios-switches/themes/IOS_Switches.theme.css
|
||||||
https://raw.githubusercontent.com/CapnKitten/Material-Discord/master/Material-Discord.theme.css
|
https://raw.githubusercontent.com/CapnKitten/Material-Discord/master/Material-Discord.theme.css
|
||||||
https://raw.githubusercontent.com/CAtOSe/Neon-Space-BetterDiscord-Theme/master/neon-space.theme.css
|
|
||||||
https://raw.githubusercontent.com/Chloesviel/Discord-Stuff/master/minifiedMemberlist/minifiedMemberlist.theme.css
|
https://raw.githubusercontent.com/Chloesviel/Discord-Stuff/master/minifiedMemberlist/minifiedMemberlist.theme.css
|
||||||
https://raw.githubusercontent.com/ClearVision/ClearVision-v6/master/ClearVision_v6.theme.css
|
https://raw.githubusercontent.com/ClearVision/ClearVision-v6/master/ClearVision_v6.theme.css
|
||||||
https://raw.githubusercontent.com/codedotspectra/themes/master/nocturnal/nocturnal.theme.css
|
https://raw.githubusercontent.com/codedotspectra/themes/master/nocturnal/nocturnal.theme.css
|
||||||
|
|
Loading…
Reference in New Issue