diff options
-rw-r--r-- | docs/frontend_api.md | 19 | ||||
-rw-r--r-- | recipes/discord/package.json | 2 | ||||
-rw-r--r-- | recipes/discord/webview.js | 19 | ||||
-rw-r--r-- | recipes/skype/package.json | 2 | ||||
-rw-r--r-- | recipes/skype/webview.js | 16 | ||||
-rw-r--r-- | recipes/steamchat/package.json | 2 | ||||
-rw-r--r-- | recipes/steamchat/webview.js | 20 | ||||
-rw-r--r-- | recipes/zoom/package.json | 2 | ||||
-rw-r--r-- | recipes/zoom/webview.js | 18 |
9 files changed, 60 insertions, 40 deletions
diff --git a/docs/frontend_api.md b/docs/frontend_api.md index af9acf8..f1edc0f 100644 --- a/docs/frontend_api.md +++ b/docs/frontend_api.md | |||
@@ -29,9 +29,12 @@ | |||
29 | - [safeParseInt(stringText)](#safeparseintstringtext) | 29 | - [safeParseInt(stringText)](#safeparseintstringtext) |
30 | - [Arguments](#arguments-8) | 30 | - [Arguments](#arguments-8) |
31 | - [Usage](#usage-8) | 31 | - [Usage](#usage-8) |
32 | - [setDialogTitle(title)](#setdialogtitletitle-1) | 32 | - [isImage(url)](#isimageurl) |
33 | - [Arguments](#arguments-9) | 33 | - [Arguments](#arguments-9) |
34 | - [Usage](#usage-9) | 34 | - [Usage](#usage-9) |
35 | - [setDialogTitle(title)](#setdialogtitletitle-1) | ||
36 | - [Arguments](#arguments-10) | ||
37 | - [Usage](#usage-10) | ||
35 | 38 | ||
36 | # Frontend API | 39 | # Frontend API |
37 | 40 | ||
@@ -305,6 +308,20 @@ A utility method that can be used to safely parse the text content (handles null | |||
305 | Ferdium.safeParseInt(mySelector.innerText) | 308 | Ferdium.safeParseInt(mySelector.innerText) |
306 | ``` | 309 | ``` |
307 | 310 | ||
311 | ### isImage(url) | ||
312 | |||
313 | A utility method that can be used to verify if a url is an image. Returns `true` if is image and `false` if it is not an image. | ||
314 | |||
315 | #### Arguments | ||
316 | |||
317 | 1. `url` Url to be parsed. | ||
318 | |||
319 | #### Usage | ||
320 | |||
321 | ```JavaScript | ||
322 | Ferdium.isImage(url) | ||
323 | ``` | ||
324 | |||
308 | ### setDialogTitle(title) | 325 | ### setDialogTitle(title) |
309 | 326 | ||
310 | When you want to set the title of the Ferdium window (while this service is active or in focus), you can use this function | 327 | When you want to set the title of the Ferdium window (while this service is active or in focus), you can use this function |
diff --git a/recipes/discord/package.json b/recipes/discord/package.json index e0c35aa..f5549d7 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.3", | 4 | "version": "1.7.4", |
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 cadafb1..1255675 100644 --- a/recipes/discord/webview.js +++ b/recipes/discord/webview.js | |||
@@ -5,7 +5,6 @@ function _interopRequireDefault(obj) { | |||
5 | } | 5 | } |
6 | 6 | ||
7 | module.exports = (Ferdium, settings) => { | 7 | module.exports = (Ferdium, settings) => { |
8 | console.log('settings', settings); | ||
9 | const getMessages = () => { | 8 | const getMessages = () => { |
10 | let directCount = 0; | 9 | let directCount = 0; |
11 | const directCountPerServer = document.querySelectorAll( | 10 | const directCountPerServer = document.querySelectorAll( |
@@ -34,14 +33,16 @@ module.exports = (Ferdium, settings) => { | |||
34 | 33 | ||
35 | if (link || button) { | 34 | if (link || button) { |
36 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); | 35 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); |
37 | 36 | ||
38 | event.preventDefault(); | 37 | if (!Ferdium.isImage(url)) { |
39 | event.stopPropagation(); | 38 | event.preventDefault(); |
40 | 39 | event.stopPropagation(); | |
41 | if (settings.trapLinkClicks === true) { | 40 | |
42 | window.location.href = url; | 41 | if (settings.trapLinkClicks === true) { |
43 | } else { | 42 | window.location.href = url; |
44 | Ferdium.openNewWindow(url); | 43 | } else { |
44 | Ferdium.openNewWindow(url); | ||
45 | } | ||
45 | } | 46 | } |
46 | } | 47 | } |
47 | }, true); | 48 | }, true); |
diff --git a/recipes/skype/package.json b/recipes/skype/package.json index 0a07ea3..247d9c5 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.2", | 4 | "version": "3.5.3", |
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 b317d14..db97d98 100644 --- a/recipes/skype/webview.js +++ b/recipes/skype/webview.js | |||
@@ -38,15 +38,13 @@ module.exports = (Ferdium, settings) => { | |||
38 | if (link || button) { | 38 | if (link || button) { |
39 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); | 39 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); |
40 | 40 | ||
41 | if (url.includes('views/imgpsh_fullsize_anim')) { | 41 | event.preventDefault(); |
42 | event.preventDefault(); | 42 | event.stopPropagation(); |
43 | event.stopPropagation(); | 43 | |
44 | 44 | if (settings.trapLinkClicks === true) { | |
45 | if (settings.trapLinkClicks === true) { | 45 | window.location.href = url; |
46 | window.location.href = url; | 46 | } else { |
47 | } else { | 47 | Ferdium.openNewWindow(url); |
48 | Ferdium.openNewWindow(url); | ||
49 | } | ||
50 | } | 48 | } |
51 | } | 49 | } |
52 | }, true); | 50 | }, true); |
diff --git a/recipes/steamchat/package.json b/recipes/steamchat/package.json index 9489add..9123671 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.2", | 4 | "version": "1.4.3", |
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 4e8519b..9cb6d64 100644 --- a/recipes/steamchat/webview.js +++ b/recipes/steamchat/webview.js | |||
@@ -33,17 +33,19 @@ module.exports = (Ferdium, settings) => { | |||
33 | // TODO: See how this can be moved into the main ferdium app and sent as an ipc message for opening with a new window or same Ferdium recipe's webview based on user's preferences | 33 | // TODO: See how this can be moved into the main ferdium app and sent as an ipc message for opening with a new window or same Ferdium recipe's webview based on user's preferences |
34 | document.addEventListener('click', event => { | 34 | document.addEventListener('click', event => { |
35 | const link = event.target.closest('a[href^="http"]'); | 35 | const link = event.target.closest('a[href^="http"]'); |
36 | const button = event.target.closest('button[title^="http"]'); | ||
36 | 37 | ||
37 | if (link && link.getAttribute('target') === '_top') { | 38 | if (link || button) { |
38 | event.preventDefault(); | 39 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); |
39 | event.stopPropagation(); | ||
40 | const url = link.getAttribute('href'); | ||
41 | 40 | ||
42 | if (settings.trapLinkClicks === true) { | 41 | event.preventDefault(); |
43 | window.location.href = url; | 42 | event.stopPropagation(); |
44 | } else { | 43 | |
45 | Ferdium.openNewWindow(url); | 44 | if (settings.trapLinkClicks === true) { |
46 | } | 45 | window.location.href = url; |
46 | } else { | ||
47 | Ferdium.openNewWindow(url); | ||
48 | } | ||
47 | } | 49 | } |
48 | }, true); | 50 | }, true); |
49 | }; | 51 | }; |
diff --git a/recipes/zoom/package.json b/recipes/zoom/package.json index eb8f557..5357394 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.2", | 4 | "version": "1.3.3", |
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 030c038..1255675 100644 --- a/recipes/zoom/webview.js +++ b/recipes/zoom/webview.js | |||
@@ -33,14 +33,16 @@ module.exports = (Ferdium, settings) => { | |||
33 | 33 | ||
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 | event.preventDefault(); | 37 | if (!Ferdium.isImage(url)) { |
38 | event.stopPropagation(); | 38 | event.preventDefault(); |
39 | 39 | event.stopPropagation(); | |
40 | if (settings.trapLinkClicks === true) { | 40 | |
41 | window.location.href = url; | 41 | if (settings.trapLinkClicks === true) { |
42 | } else { | 42 | window.location.href = url; |
43 | Ferdium.openNewWindow(url); | 43 | } else { |
44 | Ferdium.openNewWindow(url); | ||
45 | } | ||
44 | } | 46 | } |
45 | } | 47 | } |
46 | }, true); | 48 | }, true); |