diff options
Diffstat (limited to 'recipes/freshrss/webview.js')
-rw-r--r-- | recipes/freshrss/webview.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/recipes/freshrss/webview.js b/recipes/freshrss/webview.js index cdc6e55..9740b08 100644 --- a/recipes/freshrss/webview.js +++ b/recipes/freshrss/webview.js | |||
@@ -1,18 +1,22 @@ | |||
1 | "use strict"; | 1 | function _interopRequireDefault(obj) { |
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | ||
2 | 6 | ||
3 | module.exports = Ferdium => { | 7 | module.exports = Ferdium => { |
4 | const getMessages = function getMessages() { | 8 | const getMessages = function getMessages() { |
5 | // Initialize empty vars | 9 | // Initialize empty vars |
6 | var unread = 0; | 10 | let unread = 0; |
7 | var match = []; | 11 | let match = []; |
8 | // Define RegExp to replace occasionally   | 12 | // Define RegExp to replace occasionally   |
9 | var re = new RegExp(String.fromCodePoint(160), "g"); | 13 | const re = new RegExp(String.fromCodePoint(160), 'g'); |
10 | // Get value of <title> tag where in case of new feed elements the number of elements appear | 14 | // Get value of <title> tag where in case of new feed elements the number of elements appear |
11 | const titleValue = document.querySelector('title').text.replace(re, ""); | 15 | const titleValue = document.querySelector('title').text.replaceAll(re, ''); |
12 | // Extract the number from the tag | 16 | // Extract the number from the tag |
13 | match = titleValue.match(/[\d\s]+/); | 17 | match = titleValue.match(/[\d\s]+/); |
14 | // Some logic to handle the match groups | 18 | // Some logic to handle the match groups |
15 | unread = match != null && match.length > 0 ? match[0] : 0; | 19 | unread = match !== null && match.length > 0 ? match[0] : 0; |
16 | // Set unread msgs badge | 20 | // Set unread msgs badge |
17 | Ferdium.setBadge(Number.parseInt(unread, 10)); | 21 | Ferdium.setBadge(Number.parseInt(unread, 10)); |
18 | }; | 22 | }; |
@@ -22,4 +26,6 @@ module.exports = Ferdium => { | |||
22 | }; | 26 | }; |
23 | 27 | ||
24 | Ferdium.loop(loopFunc); | 28 | Ferdium.loop(loopFunc); |
29 | |||
30 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
25 | }; | 31 | }; |