diff options
author | 2020-04-12 21:23:59 +0100 | |
---|---|---|
committer | 2020-04-12 21:23:59 +0100 | |
commit | f9101283340c7d41db5df816e3d5378bd8d0fbbc (patch) | |
tree | ae81ec067cb7a590465c0529abdc5b3f9f522770 /uncompressed/telegram/webview.js | |
parent | Merge pull request #94 from JakeSteam/master (diff) | |
download | ferdium-recipes-f9101283340c7d41db5df816e3d5378bd8d0fbbc.tar.gz ferdium-recipes-f9101283340c7d41db5df816e3d5378bd8d0fbbc.tar.zst ferdium-recipes-f9101283340c7d41db5df816e3d5378bd8d0fbbc.zip |
#56 Use alternative Telegram client
Diffstat (limited to 'uncompressed/telegram/webview.js')
-rw-r--r-- | uncompressed/telegram/webview.js | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/uncompressed/telegram/webview.js b/uncompressed/telegram/webview.js index 6610c7c..1727953 100644 --- a/uncompressed/telegram/webview.js +++ b/uncompressed/telegram/webview.js | |||
@@ -1,26 +1,19 @@ | |||
1 | 'use strict'; | 1 | "use strict"; |
2 | 2 | ||
3 | const path = require('path'); | 3 | const path = require("path"); |
4 | 4 | ||
5 | module.exports = Franz => { | 5 | module.exports = Franz => { |
6 | const getMessages = function getMessages() { | 6 | const getMessages = function getMessages() { |
7 | let count = 0; | 7 | let count = 0; |
8 | const searchElement = document.querySelector('.im_dialogs_search_field'); | 8 | const elements = document.querySelectorAll(".dialog-badge-text"); |
9 | if (searchElement && searchElement.value === '') { | 9 | if (elements) { |
10 | const elements = document.querySelectorAll('.im_dialog_badge:not(.ng-hide):not(.im_dialog_badge_muted)'); | 10 | for (let i = 0; i < elements.length; i += 1) { |
11 | if (elements) { | 11 | if (elements[i].innerHTML !== 0) { |
12 | for (let i = 0; i < elements.length; i += 1) { | 12 | count += parseInt(elements[i].innerHTML); |
13 | if (elements[i].innerHTML !== 0) { | ||
14 | count += 1; | ||
15 | } | ||
16 | } | 13 | } |
17 | } | 14 | } |
18 | } | 15 | } |
19 | |||
20 | Franz.setBadge(count); | 16 | Franz.setBadge(count); |
21 | }; | 17 | }; |
22 | |||
23 | Franz.injectCSS(path.join(__dirname, 'service.css')); | ||
24 | Franz.loop(getMessages); | 18 | Franz.loop(getMessages); |
25 | }; | 19 | }; |
26 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlbGVncmFtL3dlYnZpZXcuanMiXSwibmFtZXMiOlsicGF0aCIsInJlcXVpcmUiLCJtb2R1bGUiLCJleHBvcnRzIiwiRnJhbnoiLCJnZXRNZXNzYWdlcyIsImNvdW50Iiwic2VhcmNoRWxlbWVudCIsImRvY3VtZW50IiwicXVlcnlTZWxlY3RvciIsInZhbHVlIiwiZWxlbWVudHMiLCJxdWVyeVNlbGVjdG9yQWxsIiwiaSIsImxlbmd0aCIsImlubmVySFRNTCIsInNldEJhZGdlIiwiaW5qZWN0Q1NTIiwiam9pbiIsIl9fZGlybmFtZSIsImxvb3AiXSwibWFwcGluZ3MiOiI7O0FBQUEsTUFBTUEsT0FBT0MsUUFBUSxNQUFSLENBQWI7O0FBRUFDLE9BQU9DLE9BQVAsR0FBa0JDLEtBQUQsSUFBVztBQUMxQixRQUFNQyxjQUFjLFNBQVNBLFdBQVQsR0FBdUI7QUFDekMsUUFBSUMsUUFBUSxDQUFaO0FBQ0EsVUFBTUMsZ0JBQWdCQyxTQUFTQyxhQUFULENBQXVCLDBCQUF2QixDQUF0QjtBQUNBLFFBQUlGLGlCQUFpQkEsY0FBY0csS0FBZCxLQUF3QixFQUE3QyxFQUFpRDtBQUMvQyxZQUFNQyxXQUFXSCxTQUFTSSxnQkFBVCxDQUEwQiw0REFBMUIsQ0FBakI7QUFDQSxVQUFJRCxRQUFKLEVBQWM7QUFDWixhQUFLLElBQUlFLElBQUksQ0FBYixFQUFnQkEsSUFBSUYsU0FBU0csTUFBN0IsRUFBcUNELEtBQUssQ0FBMUMsRUFBNkM7QUFDM0MsY0FBSUYsU0FBU0UsQ0FBVCxFQUFZRSxTQU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