diff options
Diffstat (limited to 'recipes/zoom/webview.js')
-rw-r--r-- | recipes/zoom/webview.js | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/recipes/zoom/webview.js b/recipes/zoom/webview.js index 45cc5b7..f606ac9 100644 --- a/recipes/zoom/webview.js +++ b/recipes/zoom/webview.js | |||
@@ -1,9 +1,9 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { | 1 | function _interopRequireDefault(obj) { |
4 | return obj && obj.__esModule ? obj : { default: obj }; | 2 | return obj && obj.__esModule ? obj : { default: obj }; |
5 | } | 3 | } |
6 | 4 | ||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
7 | module.exports = (Ferdium, settings) => { | 7 | module.exports = (Ferdium, settings) => { |
8 | const getMessages = () => { | 8 | const getMessages = () => { |
9 | let directCount = 0; | 9 | let directCount = 0; |
@@ -27,23 +27,29 @@ module.exports = (Ferdium, settings) => { | |||
27 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | 27 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); |
28 | 28 | ||
29 | // 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 | 29 | // 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 |
30 | document.addEventListener('click', event => { | 30 | document.addEventListener( |
31 | const link = event.target.closest('a[href^="http"]'); | 31 | 'click', |
32 | const button = event.target.closest('button[title^="http"]'); | 32 | event => { |
33 | 33 | const link = event.target.closest('a[href^="http"]'); | |
34 | if (link || button) { | 34 | const button = event.target.closest('button[title^="http"]'); |
35 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); | 35 | |
36 | 36 | if (link || button) { | |
37 | if (!Ferdium.isImage(link)) { | 37 | const url = link |
38 | event.preventDefault(); | 38 | ? link.getAttribute('href') |
39 | event.stopPropagation(); | 39 | : button.getAttribute('title'); |
40 | 40 | ||
41 | if (settings.trapLinkClicks === true) { | 41 | if (!Ferdium.isImage(link)) { |
42 | window.location.href = url; | 42 | event.preventDefault(); |
43 | } else { | 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 | } | 52 | }, |
48 | }, true); | 53 | true, |
54 | ); | ||
49 | }; | 55 | }; |