aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/stackoverflow/webview.js
diff options
context:
space:
mode:
authorLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2021-09-12 18:37:25 +0530
committerLibravatar GitHub <noreply@github.com>2021-09-12 13:07:25 +0000
commit9897921a8f0340d95198a9eea597a7c368557506 (patch)
tree0f02029655399bad70a1e69583ea4ab62d661495 /recipes/stackoverflow/webview.js
parentNew recipe: 'devRant' (#706) (diff)
downloadferdium-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.js20
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 @@
1const _path = _interopRequireDefault(require('path'));
2
3function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4
5module.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};