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/discord/package.json | 2 +- recipes/discord/webview.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'recipes/discord') diff --git a/recipes/discord/package.json b/recipes/discord/package.json index 0deb4a9..e0c35aa 100644 --- a/recipes/discord/package.json +++ b/recipes/discord/package.json @@ -1,7 +1,7 @@ { "id": "discord", "name": "Discord", - "version": "1.7.2", + "version": "1.7.3", "license": "MIT", "config": { "serviceURL": "https://discordapp.com/login", diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js index 7612d83..cadafb1 100644 --- a/recipes/discord/webview.js +++ b/recipes/discord/webview.js @@ -4,7 +4,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -module.exports = Ferdium => { +module.exports = (Ferdium, settings) => { + console.log('settings', settings); const getMessages = () => { let directCount = 0; const directCountPerServer = document.querySelectorAll( @@ -34,9 +35,12 @@ module.exports = Ferdium => { if (link || button) { const url = link ? link.getAttribute('href') : button.getAttribute('title'); - if (url.includes('views/imgpsh_fullsize_anim')) { - event.preventDefault(); - event.stopPropagation(); + event.preventDefault(); + event.stopPropagation(); + + if (settings.trapLinkClicks === true) { + window.location.href = url; + } else { Ferdium.openNewWindow(url); } } -- cgit v1.2.3-70-g09d2