aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/hey/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/hey/webview.js')
-rw-r--r--recipes/hey/webview.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/recipes/hey/webview.js b/recipes/hey/webview.js
new file mode 100644
index 0000000..d3227af
--- /dev/null
+++ b/recipes/hey/webview.js
@@ -0,0 +1,28 @@
1module.exports = (Ferdi) => {
2 const getMessages = function getMessages() {
3 if (document.location.href == "https://app.hey.com/") {
4 let screener = 0;
5 let unread = 0;
6
7 if (document.getElementsByClassName('btn--icon-screener').length > 0) {
8 let text = document.getElementsByClassName('btn--icon-screener')[0].innerText;
9
10 screener = Ferdi.safeParseInt(/[0-9]+/.exec(text)[0]);
11 }
12
13 let postings = document.getElementsByClassName('posting');
14
15 if (postings.length > 0) {
16 Array.from(postings).forEach(p => {
17 if (p.nodeName == "ARTICLE" && p.getAttribute("data-seen") !== "true") {
18 unread++;
19 }
20 });
21 }
22
23 Ferdi.setBadge(unread, screener);
24 }
25 };
26
27 Ferdi.loop(getMessages);
28}