Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
it probably fixes something
Browse files Browse the repository at this point in the history
  • Loading branch information
userXinos committed Jun 9, 2022
1 parent 91a1786 commit 3f8b213
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 46 deletions.
2 changes: 1 addition & 1 deletion components/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class ImageToolsButton extends React.PureComponent {
const allowSubText = !this.props.settings.get('hideHints', false); // надо бы как-то рекурсивно удалять, но мне впаду
const defaultSaveDir = saveImageDirs[0]?.path || getDefaultSaveDir();
const openLink = (url, withoutEncode) => Actions.openLink(
(url + ((withoutEncode) ? src : encodeURIComponent(src))), null, { original }
(url + ((withoutEncode) ? src : encodeURIComponent(src))), { original }
);

const data = {
Expand Down
44 changes: 2 additions & 42 deletions components/Overlay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,48 +185,8 @@ module.exports = class ImageToolsOverlay extends React.PureComponent {
}
}

getButtons () {
// const Retry = getModuleByDisplayName('Retry', false);
const Dropper = getModuleByDisplayName('Dropper', false);

return [
// {
// tooltip: Messages.IMAGE_TOOLS_ROTATE,
// Icon: Retry,
// callback: () => console.log('nope')
// },
{
tooltip: Messages.IMAGE_TOOLS_COLOR_PICK,
Icon: Dropper,
callback: () => {
if (!this.ColorPicker) {
this.ColorPicker = new ImageColorPicker(this.state.$image);
}
const backupConfig = {
...this.lensConfig
};
this.additionalHandler.onWheel = { func: () => null, capture: true };
this.additionalHandler.onMouseButton = {
func: (e) => {
if (e.type === 'click') {
this.additionalHandler.onWheel = null;
this.additionalHandler.onMouseButton = null;
this.ColorPicker.copyColor();
this.updateLensConfig({
show: false,
...backupConfig
});
}
},
capture: true
};
this.updateLensConfig({
show: true,
...this.ColorPicker.lensConfig
});
}
}
];
getButtons () { // @TODO надо бы добавить настройку для скрытия этого...
return [];
}

updateCurrentImg ($image) {
Expand Down
6 changes: 3 additions & 3 deletions modules/Patcher/General.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = class General {
MessageContextMenu: this.contextMenuPatch.message,
GuildChannelUserContextMenu: this.contextMenuPatch.user,
DMUserContextMenu: this.contextMenuPatch.user,
UserGenericContextMenu: (...args) => this.contextMenuPatch.user(...args, (r) => r[0].props.children),
UserGenericContextMenu: (...args) => this.contextMenuPatch.user.call(this, ...args, (r) => r[0].props.children),
GroupDMUserContextMenu: this.contextMenuPatch.user,
GroupDMContextMenu: this.contextMenuPatch.groupDM,
GuildContextMenu: this.contextMenuPatch.guild,
Expand Down Expand Up @@ -134,7 +134,7 @@ module.exports = class General {

return {
message ([ { target, message: { content, stickerItems } } ], res, settings) {
if ((target.tagName === 'IMG') || (target.tagName === 'VIDEO' && target.loop) || (target.tagName === 'CANVAS' && stickerItems.length)) {
if ((target.tagName === 'IMG') || (target.getAttribute("data-role") === 'img') || (target.getAttribute("data-type") === 'sticker' && stickerItems.length)) {
const { width, height } = target;
const menu = res.props.children;
const hideNativeButtons = settings.get('hideNativeButtons', true);
Expand Down Expand Up @@ -369,7 +369,7 @@ module.exports = class General {
}

getImage (target) {
const src = target.src.split('?').shift();
const src = ((target.tagName === 'IMG') ? target.src : target.href).split('?').shift();
let e = src.substr(src.lastIndexOf('.') + 1, src.length);
if (e.length > 3) {
if (src.endsWith('/mp4')) {
Expand Down

0 comments on commit 3f8b213

Please sign in to comment.