Update ImageUtilities.plugin.js
This commit is contained in:
parent
8a620bf1e3
commit
4680313272
|
@ -2,7 +2,7 @@
|
||||||
* @name ImageUtilities
|
* @name ImageUtilities
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 4.9.3
|
* @version 4.9.4
|
||||||
* @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,9 +14,7 @@
|
||||||
|
|
||||||
module.exports = (_ => {
|
module.exports = (_ => {
|
||||||
const changeLog = {
|
const changeLog = {
|
||||||
"fixed": {
|
|
||||||
"Last Update": "Hopefully this fixes all bugs this time, really now, promise"
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
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 {
|
||||||
|
@ -719,17 +717,18 @@ module.exports = (_ => {
|
||||||
injectItem (e, urls, prefix) {
|
injectItem (e, urls, prefix) {
|
||||||
let validUrls = this.filterUrls(...urls);
|
let validUrls = this.filterUrls(...urls);
|
||||||
if (!validUrls.length) return;
|
if (!validUrls.length) return;
|
||||||
let [removeParent, removeIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "copy-native-link", group: true});
|
let isNative = false;
|
||||||
if (removeIndex > -1) {
|
let [nativeParent, nativeIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "copy-native-link", group: true});
|
||||||
removeParent.splice(removeIndex, 1);
|
if (nativeIndex > -1) {
|
||||||
removeIndex -= 1;
|
if (validUrls.length == 1) isNative = true;
|
||||||
|
nativeParent.splice(nativeIndex, 1);
|
||||||
|
nativeIndex -= 1;
|
||||||
|
}
|
||||||
|
for (let id of ["open-native-link", "copy-image", "save-image"]) {
|
||||||
|
let [removeParent, removeIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: id, group: true});
|
||||||
|
if (removeIndex > -1) removeParent.splice(removeIndex, 1);
|
||||||
}
|
}
|
||||||
let [removeParent2, removeIndex2] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "copy-image", group: true});
|
|
||||||
if (removeIndex2 > -1) removeParent2.splice(removeIndex2, 1);
|
|
||||||
let [removeParent3, removeIndex3] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "save-image", group: true});
|
|
||||||
if (removeIndex3 > -1) removeParent3.splice(removeIndex3, 1);
|
|
||||||
|
|
||||||
let isNative = validUrls.length == 1 && removeIndex > -1;
|
|
||||||
let subMenu = this.createSubMenus({
|
let subMenu = this.createSubMenus({
|
||||||
instance: e.instance,
|
instance: e.instance,
|
||||||
urls: validUrls,
|
urls: validUrls,
|
||||||
|
@ -737,7 +736,7 @@ module.exports = (_ => {
|
||||||
target: e.instance.props.target
|
target: e.instance.props.target
|
||||||
});
|
});
|
||||||
|
|
||||||
let [children, index] = isNative ? [removeParent, removeIndex] : BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
|
let [children, index] = isNative ? [nativeParent, nativeIndex] : BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
|
||||||
children.splice(index > -1 ? index : children.length, 0, isNative ? subMenu : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
children.splice(index > -1 ? index : children.length, 0, isNative ? subMenu : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||||
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: this.isValid(validUrls[0].file, "video") ? this.labels.context_videoactions : this.labels.context_imageactions,
|
label: this.isValid(validUrls[0].file, "video") ? this.labels.context_videoactions : this.labels.context_imageactions,
|
||||||
|
@ -792,7 +791,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.LibraryModules.WindowUtils.copy(urlData.original);
|
BDFDB.LibraryModules.WindowUtils.copy(urlData.original.split("?size")[0]);
|
||||||
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"});
|
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@ -800,7 +799,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.LibraryModules.WindowUtils.copy(urlData.file);
|
BDFDB.LibraryModules.WindowUtils.copy(urlData.file.split("?size")[0]);
|
||||||
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"});
|
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in New Issue