diff options
author | 2021-09-12 18:37:25 +0530 | |
---|---|---|
committer | 2021-09-12 13:07:25 +0000 | |
commit | 9897921a8f0340d95198a9eea597a7c368557506 (patch) | |
tree | 0f02029655399bad70a1e69583ea4ab62d661495 /recipes/stackoverflow/webview.js | |
parent | New recipe: 'devRant' (#706) (diff) | |
download | ferdium-recipes-9897921a8f0340d95198a9eea597a7c368557506.tar.gz ferdium-recipes-9897921a8f0340d95198a9eea597a7c368557506.tar.zst ferdium-recipes-9897921a8f0340d95198a9eea597a7c368557506.zip |
New recipe: 'stackoverflow' (#707)
Diffstat (limited to 'recipes/stackoverflow/webview.js')
-rw-r--r-- | recipes/stackoverflow/webview.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/recipes/stackoverflow/webview.js b/recipes/stackoverflow/webview.js new file mode 100644 index 0000000..4d20768 --- /dev/null +++ b/recipes/stackoverflow/webview.js | |||
@@ -0,0 +1,20 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
4 | |||
5 | module.exports = (Ferdi) => { | ||
6 | const getMessages = function getMessages() { | ||
7 | const elements = document.querySelectorAll('.CxUIE, .unread'); | ||
8 | let count = 0; | ||
9 | for (let i = 0; i < elements.length; i += 1) { | ||
10 | if (elements[i].querySelectorAll('*[data-icon="muted"]').length === 0) { | ||
11 | count += 1; | ||
12 | } | ||
13 | } | ||
14 | |||
15 | Ferdi.setBadge(count); | ||
16 | }; | ||
17 | |||
18 | Ferdi.loop(getMessages); | ||
19 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
20 | }; | ||