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/webview.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'recipes/steamchat/webview.js') 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