aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/freshrss/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/freshrss/webview.js')
-rw-r--r--recipes/freshrss/webview.js18
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"; 1function _interopRequireDefault(obj) {
2 return obj && obj.__esModule ? obj : { default: obj };
3}
4
5const _path = _interopRequireDefault(require('path'));
2 6
3module.exports = Ferdium => { 7module.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 &nbsp 12 // Define RegExp to replace occasionally &nbsp
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};