diff options
author | Feiko Joosten <feiko_joosten@hotmail.com> | 2020-04-21 20:12:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-21 18:12:43 +0000 |
commit | ac2accdf5c799852f243e86bf44d6e2b398f9032 (patch) | |
tree | c393d317fccd80f2f74e2ea3aa272d757f5a3890 /uncompressed/steamchat/webview.js | |
parent | Fix notifications for Trello (#123) (diff) | |
download | ferdium-recipes-ac2accdf5c799852f243e86bf44d6e2b398f9032.tar.gz ferdium-recipes-ac2accdf5c799852f243e86bf44d6e2b398f9032.tar.zst ferdium-recipes-ac2accdf5c799852f243e86bf44d6e2b398f9032.zip |
Fixes notifications for Steamchat (#121)
- Fixes an issue where notifications for Steamchat weren't properly detected
- Adds support for indirect notifications
Diffstat (limited to 'uncompressed/steamchat/webview.js')
-rw-r--r-- | uncompressed/steamchat/webview.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/uncompressed/steamchat/webview.js b/uncompressed/steamchat/webview.js index 5ea0aed..87f1f7a 100644 --- a/uncompressed/steamchat/webview.js +++ b/uncompressed/steamchat/webview.js | |||
@@ -4,17 +4,15 @@ module.exports = Franz => { | |||
4 | const getMessages = function getMessages() { | 4 | const getMessages = function getMessages() { |
5 | // get new msg count | 5 | // get new msg count |
6 | let count = 0; | 6 | let count = 0; |
7 | let counters = document.querySelectorAll('.unread_message_count:not([style="display: none;"])'); | 7 | let counters = document.querySelectorAll("[class*=FriendMessageCount]"); |
8 | counters = Array.prototype.slice.call(counters, Math.floor(counters.length / 2)); | 8 | [].filter.call(counters, countValue => { |
9 | [].filter.call(counters, countValues => { | 9 | if (countValue) { |
10 | if (countValues) { | ||
11 | const countValue = countValues.querySelector('.unread_message_count_value'); | ||
12 | if (countValue.innerHTML.length > 0) { | ||
13 | count += parseInt(countValue.innerHTML); | 10 | count += parseInt(countValue.innerHTML); |
14 | } | ||
15 | } | 11 | } |
16 | }); | 12 | }); |
17 | Franz.setBadge(count); | 13 | |
14 | const indirectMessages = document.querySelectorAll("[class*=ChatUnreadMessageIndicator]").length; | ||
15 | Franz.setBadge(count, indirectMessages); | ||
18 | 16 | ||
19 | // force scroll to bottom of chat window | 17 | // force scroll to bottom of chat window |
20 | const chatBoxes = document.querySelectorAll('.chat_dialog'); | 18 | const chatBoxes = document.querySelectorAll('.chat_dialog'); |