diff options
author | Vijay A <vraravam@users.noreply.github.com> | 2022-04-20 00:51:03 -0500 |
---|---|---|
committer | Vijay A <vraravam@users.noreply.github.com> | 2022-04-20 00:51:03 -0500 |
commit | 8477741d82e4ebac9ffb7ff90dde1dec063eaed0 (patch) | |
tree | 6c7f729b93b4f0a54f36df3815283f34a7143db7 /recipes/steamchat/webview.js | |
parent | Ignore the 'all.json' file since that is going to be autogenerated anyways (diff) | |
download | ferdium-recipes-8477741d82e4ebac9ffb7ff90dde1dec063eaed0.tar.gz ferdium-recipes-8477741d82e4ebac9ffb7ff90dde1dec063eaed0.tar.zst ferdium-recipes-8477741d82e4ebac9ffb7ff90dde1dec063eaed0.zip |
Remove duplicate code and reuse 'Ferdium.openNewWindow()'
Diffstat (limited to 'recipes/steamchat/webview.js')
-rw-r--r-- | recipes/steamchat/webview.js | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/recipes/steamchat/webview.js b/recipes/steamchat/webview.js index cfe84f3..1188c71 100644 --- a/recipes/steamchat/webview.js +++ b/recipes/steamchat/webview.js | |||
@@ -30,17 +30,13 @@ module.exports = Ferdium => { | |||
30 | 30 | ||
31 | Ferdium.loop(getMessages); | 31 | Ferdium.loop(getMessages); |
32 | 32 | ||
33 | document.addEventListener( | 33 | document.addEventListener('click', event => { |
34 | 'click', | 34 | const link = event.target.closest('a[href^="http"]'); |
35 | event => { | ||
36 | const link = event.target.closest('a[href^="http"]'); | ||
37 | 35 | ||
38 | if (link && link.getAttribute('target') === '_top') { | 36 | if (link && link.getAttribute('target') === '_top') { |
39 | event.preventDefault(); | 37 | event.preventDefault(); |
40 | event.stopPropagation(); | 38 | event.stopPropagation(); |
41 | Ferdium.openNewWindow(link.getAttribute('href')); | 39 | Ferdium.openNewWindow(link.getAttribute('href')); |
42 | } | 40 | } |
43 | }, | 41 | }, true); |
44 | true, | ||
45 | ); | ||
46 | }; | 42 | }; |