From 8477741d82e4ebac9ffb7ff90dde1dec063eaed0 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Wed, 20 Apr 2022 00:51:03 -0500 Subject: Remove duplicate code and reuse 'Ferdium.openNewWindow()' --- recipes/steamchat/package.json | 2 +- recipes/steamchat/webview.js | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'recipes/steamchat') 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 @@ { "id": "steamchat", "name": "SteamChat", - "version": "1.4.0", + "version": "1.4.1", "license": "MIT", "config": { "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 => { Ferdium.loop(getMessages); - document.addEventListener( - 'click', - event => { - const link = event.target.closest('a[href^="http"]'); + document.addEventListener('click', event => { + const link = event.target.closest('a[href^="http"]'); - if (link && link.getAttribute('target') === '_top') { - event.preventDefault(); - event.stopPropagation(); - Ferdium.openNewWindow(link.getAttribute('href')); - } - }, - true, - ); + if (link && link.getAttribute('target') === '_top') { + event.preventDefault(); + event.stopPropagation(); + Ferdium.openNewWindow(link.getAttribute('href')); + } + }, true); }; -- cgit v1.2.3-70-g09d2