aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/steamchat
diff options
context:
space:
mode:
authorLibravatar Vijay A <vraravam@users.noreply.github.com>2022-04-20 00:51:03 -0500
committerLibravatar Vijay A <vraravam@users.noreply.github.com>2022-04-20 00:51:03 -0500
commit8477741d82e4ebac9ffb7ff90dde1dec063eaed0 (patch)
tree6c7f729b93b4f0a54f36df3815283f34a7143db7 /recipes/steamchat
parentIgnore the 'all.json' file since that is going to be autogenerated anyways (diff)
downloadferdium-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')
-rw-r--r--recipes/steamchat/package.json2
-rw-r--r--recipes/steamchat/webview.js20
2 files changed, 9 insertions, 13 deletions
diff --git a/recipes/steamchat/package.json b/recipes/steamchat/package.json
index ffc6230..28434b1 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.0", 4 "version": "1.4.1",
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 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};