From 3f8b2130c01064e80839ea8d77879728abc1a1c7 Mon Sep 17 00:00:00 2001 From: Xinos Date: Thu, 9 Jun 2022 16:09:08 +0700 Subject: [PATCH] it probably fixes something --- components/Button.jsx | 2 +- components/Overlay.jsx | 44 ++------------------------------------ modules/Patcher/General.js | 6 +++--- 3 files changed, 6 insertions(+), 46 deletions(-) diff --git a/components/Button.jsx b/components/Button.jsx index 34aee08..21594c6 100644 --- a/components/Button.jsx +++ b/components/Button.jsx @@ -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 = { diff --git a/components/Overlay.jsx b/components/Overlay.jsx index 1955c7c..af629d5 100644 --- a/components/Overlay.jsx +++ b/components/Overlay.jsx @@ -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) { diff --git a/modules/Patcher/General.js b/modules/Patcher/General.js index efce5d0..50d5425 100644 --- a/modules/Patcher/General.js +++ b/modules/Patcher/General.js @@ -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, @@ -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); @@ -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')) {