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/campuswire/webview.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'recipes/campuswire/webview.js') diff --git a/recipes/campuswire/webview.js b/recipes/campuswire/webview.js index 9837030..418ac9d 100644 --- a/recipes/campuswire/webview.js +++ b/recipes/campuswire/webview.js @@ -1,10 +1,12 @@ module.exports = Ferdi => { const getMessages = () => { - let count = document.querySelectorAll('._5fx8:not(._569x),._1ht3:not(._569x)').length; + let count = document.querySelectorAll( + '._5fx8:not(._569x),._1ht3:not(._569x)', + ).length; const messageRequestsElement = document.querySelector('._5nxf'); if (messageRequestsElement) { - count += Ferdi.safeParseInt(messageRequestsElement.innerHTML); + count += Ferdi.safeParseInt(messageRequestsElement.textContent); } Ferdi.setBadge(count); @@ -12,19 +14,25 @@ module.exports = Ferdi => { Ferdi.loop(getMessages); - localStorage.setItem('_cs_desktopNotifsEnabled', JSON.stringify({ - __t: new Date().getTime(), - __v: true, - })); + localStorage.setItem( + '_cs_desktopNotifsEnabled', + JSON.stringify({ + __t: Date.now(), + __v: true, + }), + ); if (typeof Ferdi.onNotify === 'function') { Ferdi.onNotify(notification => { if (typeof notification.title !== 'string') { - notification.title = ((notification.title.props || {}).content || [])[0] || 'Campuswire'; + notification.title = + ((notification.title.props || {}).content || [])[0] || 'Campuswire'; } if (typeof notification.options.body !== 'string') { - notification.options.body = (((notification.options.body || {}).props || {}).content || [])[0] || ''; + notification.options.body = + (((notification.options.body || {}).props || {}).content || [])[0] || + ''; } return notification; -- cgit v1.2.3-70-g09d2