From ac2accdf5c799852f243e86bf44d6e2b398f9032 Mon Sep 17 00:00:00 2001 From: Feiko Joosten Date: Tue, 21 Apr 2020 20:12:43 +0200 Subject: Fixes notifications for Steamchat (#121) - Fixes an issue where notifications for Steamchat weren't properly detected - Adds support for indirect notifications --- uncompressed/steamchat/package.json | 6 ++++-- uncompressed/steamchat/webview.js | 14 ++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'uncompressed') diff --git a/uncompressed/steamchat/package.json b/uncompressed/steamchat/package.json index 2563a61..6180284 100644 --- a/uncompressed/steamchat/package.json +++ b/uncompressed/steamchat/package.json @@ -1,13 +1,15 @@ { "id": "steamchat", "name": "SteamChat", - "version": "1.1.0", + "version": "1.1.1", "description": "Steam Chat", "main": "index.js", "author": "Kevin Oestmark ", "license": "MIT", "config": { "serviceURL": "https://steamcommunity.com/chat", - "hasNotificationSound": true + "hasNotificationSound": true, + "hasDirectMessages": true, + "hasIndirectMessages": true } } 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 => { const getMessages = function getMessages() { // get new msg count let count = 0; - let counters = document.querySelectorAll('.unread_message_count:not([style="display: none;"])'); - counters = Array.prototype.slice.call(counters, Math.floor(counters.length / 2)); - [].filter.call(counters, countValues => { - if (countValues) { - const countValue = countValues.querySelector('.unread_message_count_value'); - if (countValue.innerHTML.length > 0) { + let counters = document.querySelectorAll("[class*=FriendMessageCount]"); + [].filter.call(counters, countValue => { + if (countValue) { count += parseInt(countValue.innerHTML); - } } }); - Franz.setBadge(count); + + const indirectMessages = document.querySelectorAll("[class*=ChatUnreadMessageIndicator]").length; + Franz.setBadge(count, indirectMessages); // force scroll to bottom of chat window const chatBoxes = document.querySelectorAll('.chat_dialog'); -- cgit v1.2.3-70-g09d2