From 9b8f01716774a960073e944823ab727cc867a8f6 Mon Sep 17 00:00:00 2001 From: MCMXC <16797721+mcmxcdev@users.noreply.github.com> Date: Wed, 26 Jul 2023 06:29:03 -0600 Subject: chore: improve lint setup (#397) - update eslint config to closely mirror the ones from ferdium-app - add .eslintignore - opt in to eslint `reportUnusedDisableDirectives` config option - remove `trailingComma: all` from `prettier` config which is default in `prettier` v3 - autofix or disable a lot of lint issues throughout codebase - add `volta` configuration to `package.json` to autoload correct `node` and `pnpm` versions - upgrade all `eslint` and `prettier` related dependencies to latest - update lint:fix npm script - reformat touched files with prettier - bumped up minor version for all recipes that have changes - introduced injection of 'service.css' where it was missing in many recipes --------- Co-authored-by: Vijay A --- recipes/tt-rss/index.js | 2 -- recipes/tt-rss/package.json | 2 +- recipes/tt-rss/webview.js | 50 ++++++++++++++++++++++++++------------------- 3 files changed, 30 insertions(+), 24 deletions(-) (limited to 'recipes/tt-rss') diff --git a/recipes/tt-rss/index.js b/recipes/tt-rss/index.js index 3b384eb..dd41f72 100644 --- a/recipes/tt-rss/index.js +++ b/recipes/tt-rss/index.js @@ -1,3 +1 @@ -"use strict"; - module.exports = Ferdium => Ferdium; diff --git a/recipes/tt-rss/package.json b/recipes/tt-rss/package.json index a2fff77..ebc04e8 100644 --- a/recipes/tt-rss/package.json +++ b/recipes/tt-rss/package.json @@ -1,7 +1,7 @@ { "id": "tt-rss", "name": "Tiny Tiny RSS", - "version": "1.2.0", + "version": "1.3.0", "license": "MIT", "config": { "hasCustomUrl": true diff --git a/recipes/tt-rss/webview.js b/recipes/tt-rss/webview.js index 7d90615..e0581ce 100644 --- a/recipes/tt-rss/webview.js +++ b/recipes/tt-rss/webview.js @@ -1,24 +1,22 @@ -"use strict"; +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +const _path = _interopRequireDefault(require('path')); module.exports = Ferdium => { - const _notificationCategory = new URL(window.location.href).searchParams.get("ferdiumNotificationCategory"); - - const getMessages = function getMessages() { - if (_notificationCategory) { - countMessagesUnderCategory(_notificationCategory); - } else { - countMessages(); - } - }; + const _notificationCategory = new URL(window.location.href).searchParams.get( + 'ferdiumNotificationCategory', + ); - const countMessagesUnderCategory = (notificationCategory) => { - var elements = document.querySelectorAll(".dijitTreeIsRoot") - var directMessages = 0; - var indirectMessages = 0; - for (var element of elements) { - var label = element.querySelectorAll(".dijitTreeLabel")[0]; - var unreadNode = element.querySelectorAll(".unread")[0]; - var unreadAmount = Ferdium.safeParseInt(unreadNode.textContent); + const countMessagesUnderCategory = notificationCategory => { + const elements = document.querySelectorAll('.dijitTreeIsRoot'); + let directMessages = 0; + let indirectMessages = 0; + for (const element of elements) { + const label = element.querySelectorAll('.dijitTreeLabel')[0]; + const unreadNode = element.querySelectorAll('.unread')[0]; + const unreadAmount = Ferdium.safeParseInt(unreadNode.textContent); if (label.textContent === notificationCategory) { directMessages += unreadAmount; } else { @@ -29,18 +27,28 @@ module.exports = Ferdium => { }; const _countMessagesFromTitle = () => { - var match = document.title.match(/^\((\d+)\) Tiny Tiny RSS$/); - var count = match != null && match.length > 0 ? match[1] : 0; + const match = document.title.match(/^\((\d+)\) Tiny Tiny RSS$/); + const count = match !== null && match.length > 0 ? match[1] : 0; return Ferdium.safeParseInt(count); - } + }; const countMessages = () => { Ferdium.setBadge(_countMessagesFromTitle()); }; + const getMessages = function getMessages() { + if (_notificationCategory) { + countMessagesUnderCategory(_notificationCategory); + } else { + countMessages(); + } + }; + const loopFunc = () => { getMessages(); }; Ferdium.loop(loopFunc); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); }; -- cgit v1.2.3-54-g00ecf