diff options
author | 2019-09-28 12:10:25 +0200 | |
---|---|---|
committer | 2019-09-28 12:10:25 +0200 | |
commit | 728d339739b63e9bb59e457e4a84fe9a65b93fc9 (patch) | |
tree | a0fc6180ea26fa9ef397458e8eb6491031d6437d /uncompressed/mysms/webview.js | |
parent | Add list of recipes (diff) | |
download | ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.tar.gz ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.tar.zst ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.zip |
Add uncompressed recipes
Diffstat (limited to 'uncompressed/mysms/webview.js')
-rw-r--r-- | uncompressed/mysms/webview.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/uncompressed/mysms/webview.js b/uncompressed/mysms/webview.js new file mode 100644 index 0000000..20e82ac --- /dev/null +++ b/uncompressed/mysms/webview.js | |||
@@ -0,0 +1,20 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | module.exports = Franz => { | ||
4 | const getMessages = function getMessages() { | ||
5 | const elements = document.getElementsByClassName('unread'); | ||
6 | |||
7 | let count = 0; | ||
8 | for (let i = 0; i < elements.length; i++) { | ||
9 | let count_line = parseInt(elements[i].innerText.replace(/[^0-9.]/g, "")); | ||
10 | if (count_line > 0) { | ||
11 | count++; // count 1 per channel with messages | ||
12 | } | ||
13 | } | ||
14 | |||
15 | Franz.setBadge(count); | ||
16 | }; | ||
17 | |||
18 | Franz.loop(getMessages); | ||
19 | }; | ||
20 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm15c21zL3dlYnZpZXcuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIkZyYW56IiwiZ2V0TWVzc2FnZXMiLCJlbGVtZW50cyIsImRvY3VtZW50IiwiZ2V0RWxlbWVudHNCeUNsYXNzTmFtZSIsImNvdW50IiwiaSIsImxlbmd0aCIsImNvdW50X2xpbmUi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