From d3841b766f9d37d557646003899f67525c5f755f Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Tue, 5 Oct 2021 17:04:09 +0200 Subject: chore: add eslint-plugin-unicorn (#733) --- recipes/steamchat/webview.js | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'recipes/steamchat') diff --git a/recipes/steamchat/webview.js b/recipes/steamchat/webview.js index 61d57ad..2990131 100644 --- a/recipes/steamchat/webview.js +++ b/recipes/steamchat/webview.js @@ -3,19 +3,24 @@ module.exports = Ferdi => { // get new msg count let count = 0; const counters = document.querySelectorAll('[class*=FriendMessageCount]'); - [].filter.call(counters, countValue => { + Array.prototype.filter.call(counters, countValue => { if (countValue) { - count += Ferdi.safeParseInt(countValue.innerHTML); + count += Ferdi.safeParseInt(countValue.textContent); } }); - const indirectMessages = document.querySelectorAll('[class*=ChatUnreadMessageIndicator]').length; + const indirectMessages = document.querySelectorAll( + '[class*=ChatUnreadMessageIndicator]', + ).length; Ferdi.setBadge(count, indirectMessages); // force scroll to bottom of chat window const chatBoxes = document.querySelectorAll('.chat_dialog'); if (chatBoxes) { - const chatBox = [].filter.call(chatBoxes, chat => chat.style.display !== 'none'); + const chatBox = Array.prototype.filter.call( + chatBoxes, + chat => chat.style.display !== 'none', + ); if (chatBox[0]) { const chatWindow = chatBox[0].querySelector('.chat_dialog_scroll'); chatWindow.scrollTop = chatWindow.scrollHeight; @@ -25,13 +30,17 @@ module.exports = Ferdi => { Ferdi.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(); - Ferdi.openNewWindow(link.getAttribute('href')); - } - }, true); + if (link && link.getAttribute('target') === '_top') { + event.preventDefault(); + event.stopPropagation(); + Ferdi.openNewWindow(link.getAttribute('href')); + } + }, + true, + ); }; -- cgit v1.2.3-70-g09d2