diff options
Diffstat (limited to 'recipes/redditchat/webview.js')
-rw-r--r-- | recipes/redditchat/webview.js | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/recipes/redditchat/webview.js b/recipes/redditchat/webview.js deleted file mode 100644 index 6dc736a..0000000 --- a/recipes/redditchat/webview.js +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | module.exports = Ferdium => { | ||
2 | // Regular expression for (*) or (1), will extract the asterisk or the number | ||
3 | const titleRegEx = /^\(([\d*])\)/; | ||
4 | const getMessages = function unreadCount() { | ||
5 | let directCount = 0; | ||
6 | let indirectCount = 0; | ||
7 | |||
8 | const matchArr = document.title.match(titleRegEx); | ||
9 | if (matchArr) { | ||
10 | if (matchArr[1] === '*') { | ||
11 | indirectCount = 1; | ||
12 | } else { | ||
13 | directCount = Number(matchArr[1]); | ||
14 | } | ||
15 | } | ||
16 | |||
17 | Ferdium.setBadge(directCount, indirectCount); | ||
18 | }; | ||
19 | |||
20 | Ferdium.loop(getMessages); | ||
21 | }; | ||