From 4983daff125009865f8482388c37f69de8a610f7 Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Mon, 23 May 2022 05:55:44 -0500 Subject: Add new service-level option 'trapLinkUrls' (#30) This option can be used to allow the user to choose how to handle links (whether to open in the default browser or within the Ferdium service itself) Removed incorrect 'if' condition for zoom and discord for clickHandler --- recipes/steamchat/package.json | 2 +- recipes/steamchat/webview.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'recipes/steamchat') diff --git a/recipes/steamchat/package.json b/recipes/steamchat/package.json index 28434b1..9489add 100644 --- a/recipes/steamchat/package.json +++ b/recipes/steamchat/package.json @@ -1,7 +1,7 @@ { "id": "steamchat", "name": "SteamChat", - "version": "1.4.1", + "version": "1.4.2", "license": "MIT", "config": { "serviceURL": "https://steamcommunity.com/chat", diff --git a/recipes/steamchat/webview.js b/recipes/steamchat/webview.js index 3773bad..4e8519b 100644 --- a/recipes/steamchat/webview.js +++ b/recipes/steamchat/webview.js @@ -1,4 +1,4 @@ -module.exports = Ferdium => { +module.exports = (Ferdium, settings) => { const getMessages = () => { // get new msg count let count = 0; @@ -37,7 +37,13 @@ module.exports = Ferdium => { if (link && link.getAttribute('target') === '_top') { event.preventDefault(); event.stopPropagation(); - Ferdium.openNewWindow(link.getAttribute('href')); + const url = link.getAttribute('href'); + + if (settings.trapLinkClicks === true) { + window.location.href = url; + } else { + Ferdium.openNewWindow(url); + } } }, true); }; -- cgit v1.2.3-70-g09d2