aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/element/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/element/webview.js')
-rw-r--r--recipes/element/webview.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/recipes/element/webview.js b/recipes/element/webview.js
index 75df4d9..5e83ec1 100644
--- a/recipes/element/webview.js
+++ b/recipes/element/webview.js
@@ -1,4 +1,4 @@
1module.exports = Ferdi => { 1module.exports = Ferdium => {
2 function getMessages() { 2 function getMessages() {
3 // const badges = document.querySelectorAll('.mx_RoomSublist:not(.mx_RoomSublist_hidden) .mx_RoomSublist_badgeContainer'); 3 // const badges = document.querySelectorAll('.mx_RoomSublist:not(.mx_RoomSublist_hidden) .mx_RoomSublist_badgeContainer');
4 const spaceBadges = document.querySelectorAll('.mx_SpacePanel_badgeContainer .mx_NotificationBadge .mx_NotificationBadge_count'); 4 const spaceBadges = document.querySelectorAll('.mx_SpacePanel_badgeContainer .mx_NotificationBadge .mx_NotificationBadge_count');
@@ -11,28 +11,28 @@ module.exports = Ferdi => {
11 if (avatarBadges.length > 0) { 11 if (avatarBadges.length > 0) {
12 for (const badge of avatarBadges) { 12 for (const badge of avatarBadges) {
13 if (badge.parentElement.getAttribute('class').includes('mx_NotificationBadge_highlighted')) { 13 if (badge.parentElement.getAttribute('class').includes('mx_NotificationBadge_highlighted')) {
14 directCount = directCount + Ferdi.safeParseInt(badge.textContent); 14 directCount = directCount + Ferdium.safeParseInt(badge.textContent);
15 } else if (badge.parentElement.previousSibling != null && badge.parentElement.previousSibling.getAttribute('class').includes('mx_DecoratedRoomAvatar_icon_online')) { 15 } else if (badge.parentElement.previousSibling != null && badge.parentElement.previousSibling.getAttribute('class').includes('mx_DecoratedRoomAvatar_icon_online')) {
16 directCount = directCount + Ferdi.safeParseInt(badge.textContent); 16 directCount = directCount + Ferdium.safeParseInt(badge.textContent);
17 } else if (badge.parentElement.getAttribute('class').includes('mx_NotificationBadge_dot')) { 17 } else if (badge.parentElement.getAttribute('class').includes('mx_NotificationBadge_dot')) {
18 indirectCount = indirectCount + 1; // there might be dragons: incrementing does not work here? 18 indirectCount = indirectCount + 1; // there might be dragons: incrementing does not work here?
19 } else { 19 } else {
20 indirectCount = indirectCount + Ferdi.safeParseInt(badge.textContent); 20 indirectCount = indirectCount + Ferdium.safeParseInt(badge.textContent);
21 } 21 }
22 } 22 }
23 } else { 23 } else {
24 for (const badge of spaceBadges) { 24 for (const badge of spaceBadges) {
25 if (badge.parentElement.getAttribute('class').includes('mx_NotificationBadge_highlighted')) { 25 if (badge.parentElement.getAttribute('class').includes('mx_NotificationBadge_highlighted')) {
26 directCount = directCount + Ferdi.safeParseInt(badge.textContent); 26 directCount = directCount + Ferdium.safeParseInt(badge.textContent);
27 } else if (badge.parentElement.getAttribute('class').includes('mx_NotificationBadge_dot')) { 27 } else if (badge.parentElement.getAttribute('class').includes('mx_NotificationBadge_dot')) {
28 indirectCount = indirectCount + Ferdi.safeParseInt(1); // there might be dragons: incrementing does not work here? 28 indirectCount = indirectCount + Ferdium.safeParseInt(1); // there might be dragons: incrementing does not work here?
29 } else { 29 } else {
30 indirectCount = indirectCount + Ferdi.safeParseInt(badge.textContent); 30 indirectCount = indirectCount + Ferdium.safeParseInt(badge.textContent);
31 } 31 }
32 } 32 }
33 } 33 }
34 // set Ferdi badge 34 // set Ferdium badge
35 Ferdi.setBadge(directCount, indirectCount); 35 Ferdium.setBadge(directCount, indirectCount);
36 } 36 }
37 Ferdi.loop(getMessages); 37 Ferdium.loop(getMessages);
38}; 38};