aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/messenger/webview.js
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-07-31 15:28:23 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-07-31 15:28:23 +0530
commit97697e3d069972844b2912a93022f4a4904a40d6 (patch)
tree53faff30fbac9d72042f593dfe1c547809f4f121 /recipes/messenger/webview.js
parentAllow any url in the custom-service to allow for sites like 'http://translate... (diff)
downloadferdium-recipes-97697e3d069972844b2912a93022f4a4904a40d6.tar.gz
ferdium-recipes-97697e3d069972844b2912a93022f4a4904a40d6.tar.zst
ferdium-recipes-97697e3d069972844b2912a93022f4a4904a40d6.zip
Fixed eslintrc as root for this folder; Reformatted all files.
Diffstat (limited to 'recipes/messenger/webview.js')
-rw-r--r--recipes/messenger/webview.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/recipes/messenger/webview.js b/recipes/messenger/webview.js
index 4efdf8c..b146261 100644
--- a/recipes/messenger/webview.js
+++ b/recipes/messenger/webview.js
@@ -1,27 +1,25 @@
1"use strict";
2
3module.exports = Franz => { 1module.exports = Franz => {
4 const getMessages = function getMessages() { 2 const getMessages = function getMessages() {
5 let count = 0 3 let count = 0;
6 4
7 let isNotification = /^\((\d+)\)/.test(document.title); 5 const isNotification = /^\((\d+)\)/.test(document.title);
8 6
9 /* 7 /*
10 * Notification case for group chats, workaround by tamas646 8 * Notification case for group chats, workaround by tamas646
11 * see https://github.com/getferdi/ferdi/issues/1113#issuecomment-783409154 9 * see https://github.com/getferdi/ferdi/issues/1113#issuecomment-783409154
12 */ 10 */
13 if (isNotification) { 11 if (isNotification) {
14 count = parseInt(/^\((\d+)\)/.exec(document.title)[1]); 12 count = parseInt(/^\((\d+)\)/.exec(document.title)[1]);
15 } else { 13 } else {
16 /* 14 /*
17 * Notification case for direct messages, workaround by manavortex 15 * Notification case for direct messages, workaround by manavortex
18 * see https://github.com/getferdi/ferdi/issues/1113#issuecomment-846611765 16 * see https://github.com/getferdi/ferdi/issues/1113#issuecomment-846611765
19 */ 17 */
20 count = document.querySelectorAll('._5fx8:not(._569x),._1ht3:not(._569x)').length; 18 count = document.querySelectorAll('._5fx8:not(._569x),._1ht3:not(._569x)').length;
21 if (0 === count) { 19 if (count === 0) {
22 count = document.querySelectorAll('.pq6dq46d.is6700om.qu0x051f.esr5mh6w.e9989ue4.r7d6kgcz.s45kfl79.emlxlaya.bkmhp75w.spb7xbtv.cyypbtt7.fwizqjfa').length; 20 count = document.querySelectorAll('.pq6dq46d.is6700om.qu0x051f.esr5mh6w.e9989ue4.r7d6kgcz.s45kfl79.emlxlaya.bkmhp75w.spb7xbtv.cyypbtt7.fwizqjfa').length;
23 } 21 }
24 if (0 === count) { // might be obsolete, not sure - never ran into this case 22 if (count === 0) { // might be obsolete, not sure - never ran into this case
25 count = document.querySelectorAll('[aria-label="Mark as read"]').length; 23 count = document.querySelectorAll('[aria-label="Mark as read"]').length;
26 } 24 }
27 } 25 }
@@ -39,7 +37,7 @@ module.exports = Franz => {
39 Franz.loop(getMessages); 37 Franz.loop(getMessages);
40 localStorage.setItem('_cs_desktopNotifsEnabled', JSON.stringify({ 38 localStorage.setItem('_cs_desktopNotifsEnabled', JSON.stringify({
41 __t: new Date().getTime(), 39 __t: new Date().getTime(),
42 __v: true 40 __v: true,
43 })); 41 }));
44 42
45 if (typeof Franz.onNotify === 'function') { 43 if (typeof Franz.onNotify === 'function') {