Update ShowImageDetails.plugin.js
This commit is contained in:
parent
983dc06f67
commit
c608a42f58
|
@ -44,7 +44,7 @@ var ShowImageDetails = (_ => {
|
||||||
return class ShowImageDetails {
|
return class ShowImageDetails {
|
||||||
getName () {return "ShowImageDetails";}
|
getName () {return "ShowImageDetails";}
|
||||||
|
|
||||||
getVersion () {return "1.2.2";}
|
getVersion () {return "1.2.3";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -57,9 +57,6 @@ var ShowImageDetails = (_ => {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.patchedModules = {
|
this.patchedModules = {
|
||||||
before: {
|
|
||||||
LazyImage: "render"
|
|
||||||
},
|
|
||||||
after: {
|
after: {
|
||||||
LazyImage: "render"
|
LazyImage: "render"
|
||||||
}
|
}
|
||||||
|
@ -200,26 +197,23 @@ var ShowImageDetails = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
processLazyImage (e) {
|
processLazyImage (e) {
|
||||||
if (e.instance.props.original && e.instance.props.src.indexOf("https://media.discordapp.net/attachments") == 0) {
|
if (e.instance.props.original && e.instance.props.src.indexOf("https://media.discordapp.net/attachments") == 0 && typeof e.returnvalue.props.children == "function") {
|
||||||
if (!e.returnvalue) e.instance.props.className = BDFDB.DOMUtils.formatClassName(e.instance.props.className, BDFDB.disCN._showimagedetailsdetailsadded);
|
let attachment = BDFDB.ReactUtils.findValue(e.instance, "attachment", {up:true});
|
||||||
else if (typeof e.returnvalue.props.children == "function") {
|
if (!attachment) return;
|
||||||
let attachment = BDFDB.ReactUtils.findValue(e.instance, "attachment", {up:true});
|
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||||
if (!attachment) return;
|
if (settings.showOnHover) {
|
||||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
let amounts = BDFDB.DataUtils.get(this, "amounts");
|
||||||
if (settings.showOnHover) {
|
let renderChildren = e.returnvalue.props.children;
|
||||||
let amounts = BDFDB.DataUtils.get(this, "amounts");
|
e.returnvalue.props.children = (...args) => {
|
||||||
let renderChildren = e.returnvalue.props.children;
|
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
|
||||||
e.returnvalue.props.children = (...args) => {
|
text: `${attachment.filename}\n${BDFDB.NumberUtils.formatBytes(attachment.size)}\n${attachment.width}x${attachment.height}px`,
|
||||||
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
|
tooltipConfig: {
|
||||||
text: `${attachment.filename}\n${BDFDB.NumberUtils.formatBytes(attachment.size)}\n${attachment.width}x${attachment.height}px`,
|
type: "right",
|
||||||
tooltipConfig: {
|
delay: amounts.hoverDelay
|
||||||
type: "right",
|
},
|
||||||
delay: amounts.hoverDelay
|
children: renderChildren(...args)
|
||||||
},
|
});
|
||||||
children: renderChildren(...args)
|
};
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue