diff options
Diffstat (limited to 'recipes/circuit')
-rw-r--r-- | recipes/circuit/index.js | 5 | ||||
-rw-r--r-- | recipes/circuit/package.json | 2 | ||||
-rw-r--r-- | recipes/circuit/webview.js | 17 |
3 files changed, 5 insertions, 19 deletions
diff --git a/recipes/circuit/index.js b/recipes/circuit/index.js index e467459..fbbcd9a 100644 --- a/recipes/circuit/index.js +++ b/recipes/circuit/index.js | |||
@@ -1,5 +1,2 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | // just pass through Ferdi | 1 | // just pass through Ferdi |
4 | 2 | module.exports = Ferdi => Ferdi; | |
5 | module.exports = Ferdi => Ferdi; \ No newline at end of file | ||
diff --git a/recipes/circuit/package.json b/recipes/circuit/package.json index 1beaa12..82eb193 100644 --- a/recipes/circuit/package.json +++ b/recipes/circuit/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "circuit", | 2 | "id": "circuit", |
3 | "name": "Circuit", | 3 | "name": "Circuit", |
4 | "version": "1.0.1", | 4 | "version": "1.0.2", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://eu.yourcircuit.com/" | 7 | "serviceURL": "https://eu.yourcircuit.com/" |
diff --git a/recipes/circuit/webview.js b/recipes/circuit/webview.js index b5e3fd5..8cd2e2f 100644 --- a/recipes/circuit/webview.js +++ b/recipes/circuit/webview.js | |||
@@ -1,23 +1,12 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | module.exports = Ferdi => { | 1 | module.exports = Ferdi => { |
4 | const getMessages = function getMessages() { | 2 | const getMessages = function getMessages() { |
5 | // Initialize empty vars | ||
6 | var match = []; | ||
7 | // Get value of <title> tag where in case of new messages the number of messages appear | 3 | // Get value of <title> tag where in case of new messages the number of messages appear |
8 | const titleValue = document.querySelector('title').text; | 4 | const titleValue = document.querySelector('title').text; |
9 | // Extract the number from the tag | 5 | const match = titleValue.match(/\d+/); |
10 | match = titleValue.match(/\d+/); | 6 | const unread = match != null && match.length > 0 ? match[0] : 0; |
11 | unread = match != null && match.length > 0 ? match[0] : 0; | ||
12 | // Set unread msgs badge | ||
13 | 7 | ||
14 | Ferdi.setBadge(Ferdi.safeParseInt(unread)); | 8 | Ferdi.setBadge(Ferdi.safeParseInt(unread)); |
15 | }; | 9 | }; |
16 | 10 | ||
17 | const loopFunc = () => { | 11 | Ferdi.loop(getMessages); |
18 | getMessages(); | ||
19 | }; | ||
20 | |||
21 | Ferdi.loop(loopFunc); | ||
22 | |||
23 | }; | 12 | }; |