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 ++++++++---- recipes/skype/package.json | 2 +- recipes/skype/webview.js | 9 +++++++-- recipes/steamchat/package.json | 2 +- recipes/steamchat/webview.js | 10 ++++++++-- recipes/zoom/package.json | 2 +- recipes/zoom/webview.js | 11 +++++++---- 8 files changed, 34 insertions(+), 16 deletions(-) (limited to 'recipes') 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); } } diff --git a/recipes/skype/package.json b/recipes/skype/package.json index afebf64..0a07ea3 100644 --- a/recipes/skype/package.json +++ b/recipes/skype/package.json @@ -1,7 +1,7 @@ { "id": "skype", "name": "Skype", - "version": "3.5.1", + "version": "3.5.2", "license": "MIT", "config": { "serviceURL": "https://web.skype.com/", diff --git a/recipes/skype/webview.js b/recipes/skype/webview.js index 23e6919..b317d14 100644 --- a/recipes/skype/webview.js +++ b/recipes/skype/webview.js @@ -2,7 +2,7 @@ const _path = _interopRequireDefault(require('path')); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -module.exports = Ferdium => { +module.exports = (Ferdium, settings) => { const getMessages = () => { let count = 0; const container = document.querySelector('[role="tablist"] > button > div'); @@ -41,7 +41,12 @@ module.exports = Ferdium => { if (url.includes('views/imgpsh_fullsize_anim')) { event.preventDefault(); event.stopPropagation(); - Ferdium.openNewWindow(url); + + if (settings.trapLinkClicks === true) { + window.location.href = url; + } else { + Ferdium.openNewWindow(url); + } } } }, true); 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); }; diff --git a/recipes/zoom/package.json b/recipes/zoom/package.json index 82117f7..eb8f557 100644 --- a/recipes/zoom/package.json +++ b/recipes/zoom/package.json @@ -1,7 +1,7 @@ { "id": "zoom", "name": "Zoom", - "version": "1.3.1", + "version": "1.3.2", "license": "MIT", "config": { "serviceURL": "https://zoom.us/join", diff --git a/recipes/zoom/webview.js b/recipes/zoom/webview.js index 7612d83..030c038 100644 --- a/recipes/zoom/webview.js +++ b/recipes/zoom/webview.js @@ -4,7 +4,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -module.exports = Ferdium => { +module.exports = (Ferdium, settings) => { const getMessages = () => { let directCount = 0; const directCountPerServer = document.querySelectorAll( @@ -34,9 +34,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