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 | |
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
-rw-r--r-- | recipes/discord/package.json | 2 | ||||
-rw-r--r-- | recipes/discord/webview.js | 12 | ||||
-rw-r--r-- | recipes/skype/package.json | 2 | ||||
-rw-r--r-- | recipes/skype/webview.js | 9 | ||||
-rw-r--r-- | recipes/steamchat/package.json | 2 | ||||
-rw-r--r-- | recipes/steamchat/webview.js | 10 | ||||
-rw-r--r-- | recipes/zoom/package.json | 2 | ||||
-rw-r--r-- | recipes/zoom/webview.js | 11 |
8 files changed, 34 insertions, 16 deletions
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 @@ | |||
1 | { | 1 | { |
2 | "id": "discord", | 2 | "id": "discord", |
3 | "name": "Discord", | 3 | "name": "Discord", |
4 | "version": "1.7.2", | 4 | "version": "1.7.3", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://discordapp.com/login", | 7 | "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) { | |||
4 | return obj && obj.__esModule ? obj : { default: obj }; | 4 | return obj && obj.__esModule ? obj : { default: obj }; |
5 | } | 5 | } |
6 | 6 | ||
7 | module.exports = Ferdium => { | 7 | module.exports = (Ferdium, settings) => { |
8 | console.log('settings', settings); | ||
8 | const getMessages = () => { | 9 | const getMessages = () => { |
9 | let directCount = 0; | 10 | let directCount = 0; |
10 | const directCountPerServer = document.querySelectorAll( | 11 | const directCountPerServer = document.querySelectorAll( |
@@ -34,9 +35,12 @@ module.exports = Ferdium => { | |||
34 | if (link || button) { | 35 | if (link || button) { |
35 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); | 36 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); |
36 | 37 | ||
37 | if (url.includes('views/imgpsh_fullsize_anim')) { | 38 | event.preventDefault(); |
38 | event.preventDefault(); | 39 | event.stopPropagation(); |
39 | event.stopPropagation(); | 40 | |
41 | if (settings.trapLinkClicks === true) { | ||
42 | window.location.href = url; | ||
43 | } else { | ||
40 | Ferdium.openNewWindow(url); | 44 | Ferdium.openNewWindow(url); |
41 | } | 45 | } |
42 | } | 46 | } |
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 @@ | |||
1 | { | 1 | { |
2 | "id": "skype", | 2 | "id": "skype", |
3 | "name": "Skype", | 3 | "name": "Skype", |
4 | "version": "3.5.1", | 4 | "version": "3.5.2", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://web.skype.com/", | 7 | "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')); | |||
2 | 2 | ||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
4 | 4 | ||
5 | module.exports = Ferdium => { | 5 | module.exports = (Ferdium, settings) => { |
6 | const getMessages = () => { | 6 | const getMessages = () => { |
7 | let count = 0; | 7 | let count = 0; |
8 | const container = document.querySelector('[role="tablist"] > button > div'); | 8 | const container = document.querySelector('[role="tablist"] > button > div'); |
@@ -41,7 +41,12 @@ module.exports = Ferdium => { | |||
41 | if (url.includes('views/imgpsh_fullsize_anim')) { | 41 | if (url.includes('views/imgpsh_fullsize_anim')) { |
42 | event.preventDefault(); | 42 | event.preventDefault(); |
43 | event.stopPropagation(); | 43 | event.stopPropagation(); |
44 | Ferdium.openNewWindow(url); | 44 | |
45 | if (settings.trapLinkClicks === true) { | ||
46 | window.location.href = url; | ||
47 | } else { | ||
48 | Ferdium.openNewWindow(url); | ||
49 | } | ||
45 | } | 50 | } |
46 | } | 51 | } |
47 | }, true); | 52 | }, 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 @@ | |||
1 | { | 1 | { |
2 | "id": "steamchat", | 2 | "id": "steamchat", |
3 | "name": "SteamChat", | 3 | "name": "SteamChat", |
4 | "version": "1.4.1", | 4 | "version": "1.4.2", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://steamcommunity.com/chat", | 7 | "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 @@ | |||
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 | }; |
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 @@ | |||
1 | { | 1 | { |
2 | "id": "zoom", | 2 | "id": "zoom", |
3 | "name": "Zoom", | 3 | "name": "Zoom", |
4 | "version": "1.3.1", | 4 | "version": "1.3.2", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://zoom.us/join", | 7 | "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) { | |||
4 | return obj && obj.__esModule ? obj : { default: obj }; | 4 | return obj && obj.__esModule ? obj : { default: obj }; |
5 | } | 5 | } |
6 | 6 | ||
7 | module.exports = Ferdium => { | 7 | module.exports = (Ferdium, settings) => { |
8 | const getMessages = () => { | 8 | const getMessages = () => { |
9 | let directCount = 0; | 9 | let directCount = 0; |
10 | const directCountPerServer = document.querySelectorAll( | 10 | const directCountPerServer = document.querySelectorAll( |
@@ -34,9 +34,12 @@ module.exports = Ferdium => { | |||
34 | if (link || button) { | 34 | if (link || button) { |
35 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); | 35 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); |
36 | 36 | ||
37 | if (url.includes('views/imgpsh_fullsize_anim')) { | 37 | event.preventDefault(); |
38 | event.preventDefault(); | 38 | event.stopPropagation(); |
39 | event.stopPropagation(); | 39 | |
40 | if (settings.trapLinkClicks === true) { | ||
41 | window.location.href = url; | ||
42 | } else { | ||
40 | Ferdium.openNewWindow(url); | 43 | Ferdium.openNewWindow(url); |
41 | } | 44 | } |
42 | } | 45 | } |