From 804aafb265e93c50abcb4d2c28e0ddfab16a36bb Mon Sep 17 00:00:00 2001 From: André Oliveira <37463445+SpecialAro@users.noreply.github.com> Date: Tue, 31 May 2022 16:07:41 +0100 Subject: Fix open image in app or externally (instead of popup) (#37) Fix #195 on Ferdium-app which causes a problem when opening images inside the discord (and possibly zoom). --- recipes/steamchat/package.json | 2 +- recipes/steamchat/webview.js | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'recipes/steamchat') diff --git a/recipes/steamchat/package.json b/recipes/steamchat/package.json index 9489add..9123671 100644 --- a/recipes/steamchat/package.json +++ b/recipes/steamchat/package.json @@ -1,7 +1,7 @@ { "id": "steamchat", "name": "SteamChat", - "version": "1.4.2", + "version": "1.4.3", "license": "MIT", "config": { "serviceURL": "https://steamcommunity.com/chat", diff --git a/recipes/steamchat/webview.js b/recipes/steamchat/webview.js index 4e8519b..9cb6d64 100644 --- a/recipes/steamchat/webview.js +++ b/recipes/steamchat/webview.js @@ -33,17 +33,19 @@ module.exports = (Ferdium, settings) => { // TODO: See how this can be moved into the main ferdium app and sent as an ipc message for opening with a new window or same Ferdium recipe's webview based on user's preferences document.addEventListener('click', event => { const link = event.target.closest('a[href^="http"]'); + const button = event.target.closest('button[title^="http"]'); - if (link && link.getAttribute('target') === '_top') { - event.preventDefault(); - event.stopPropagation(); - const url = link.getAttribute('href'); + if (link || button) { + const url = link ? link.getAttribute('href') : button.getAttribute('title'); - if (settings.trapLinkClicks === true) { - window.location.href = url; - } else { - Ferdium.openNewWindow(url); - } + event.preventDefault(); + event.stopPropagation(); + + if (settings.trapLinkClicks === true) { + window.location.href = url; + } else { + Ferdium.openNewWindow(url); + } } }, true); }; -- cgit v1.2.3-70-g09d2