diff options
author | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2022-05-23 05:55:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-23 10:55:44 +0000 |
commit | 4983daff125009865f8482388c37f69de8a610f7 (patch) | |
tree | 4f58493028c4a2ba683da79c32676b45590cda9c /recipes/steamchat/webview.js | |
parent | Support for self-hosted github (diff) | |
download | ferdium-recipes-4983daff125009865f8482388c37f69de8a610f7.tar.gz ferdium-recipes-4983daff125009865f8482388c37f69de8a610f7.tar.zst ferdium-recipes-4983daff125009865f8482388c37f69de8a610f7.zip |
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
Diffstat (limited to 'recipes/steamchat/webview.js')
-rw-r--r-- | recipes/steamchat/webview.js | 10 |
1 files changed, 8 insertions, 2 deletions
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 @@ | |||
1 | module.exports = Ferdium => { | 1 | module.exports = (Ferdium, settings) => { |
2 | const getMessages = () => { | 2 | const getMessages = () => { |
3 | // get new msg count | 3 | // get new msg count |
4 | let count = 0; | 4 | let count = 0; |
@@ -37,7 +37,13 @@ module.exports = Ferdium => { | |||
37 | if (link && link.getAttribute('target') === '_top') { | 37 | if (link && link.getAttribute('target') === '_top') { |
38 | event.preventDefault(); | 38 | event.preventDefault(); |
39 | event.stopPropagation(); | 39 | event.stopPropagation(); |
40 | Ferdium.openNewWindow(link.getAttribute('href')); | 40 | const url = link.getAttribute('href'); |
41 | |||
42 | if (settings.trapLinkClicks === true) { | ||
43 | window.location.href = url; | ||
44 | } else { | ||
45 | Ferdium.openNewWindow(url); | ||
46 | } | ||
41 | } | 47 | } |
42 | }, true); | 48 | }, true); |
43 | }; | 49 | }; |