aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/pleroma/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/pleroma/webview.js')
-rw-r--r--recipes/pleroma/webview.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/recipes/pleroma/webview.js b/recipes/pleroma/webview.js
new file mode 100644
index 0000000..d08216d
--- /dev/null
+++ b/recipes/pleroma/webview.js
@@ -0,0 +1,14 @@
1module.exports = (Ferdi) => {
2 const titleRegex = /^\((\d+)\)/;
3
4 const getMessages = () => {
5 let directCount = 0;
6 const matchArr = document.title.match(titleRegex);
7 if (matchArr) {
8 directCount = parseInt(matchArr[1], 10);
9 }
10 Ferdi.setBadge(directCount, 0);
11 };
12
13 Ferdi.loop(getMessages);
14};