aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/steamchat/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/steamchat/webview.js')
-rw-r--r--recipes/steamchat/webview.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/recipes/steamchat/webview.js b/recipes/steamchat/webview.js
index b9549d2..eeb0fe5 100644
--- a/recipes/steamchat/webview.js
+++ b/recipes/steamchat/webview.js
@@ -1,27 +1,23 @@
1'use strict';
2
3const { ipcRenderer } = require('electron'); 1const { ipcRenderer } = require('electron');
4 2
5module.exports = Franz => { 3module.exports = Franz => {
6 const getMessages = function getMessages() { 4 const getMessages = function getMessages() {
7 // get new msg count 5 // get new msg count
8 let count = 0; 6 let count = 0;
9 let counters = document.querySelectorAll("[class*=FriendMessageCount]"); 7 const counters = document.querySelectorAll('[class*=FriendMessageCount]');
10 [].filter.call(counters, countValue => { 8 [].filter.call(counters, countValue => {
11 if (countValue) { 9 if (countValue) {
12 count += parseInt(countValue.innerHTML); 10 count += parseInt(countValue.innerHTML);
13 } 11 }
14 }); 12 });
15 13
16 const indirectMessages = document.querySelectorAll("[class*=ChatUnreadMessageIndicator]").length; 14 const indirectMessages = document.querySelectorAll('[class*=ChatUnreadMessageIndicator]').length;
17 Franz.setBadge(count, indirectMessages); 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');
21 if (chatBoxes) { 19 if (chatBoxes) {
22 const chatBox = [].filter.call(chatBoxes, chat => { 20 const chatBox = [].filter.call(chatBoxes, chat => chat.style.display !== 'none');
23 return chat.style.display !== 'none';
24 });
25 if (chatBox[0]) { 21 if (chatBox[0]) {
26 const chatWindow = chatBox[0].querySelector('.chat_dialog_scroll'); 22 const chatWindow = chatBox[0].querySelector('.chat_dialog_scroll');
27 chatWindow.scrollTop = chatWindow.scrollHeight; 23 chatWindow.scrollTop = chatWindow.scrollHeight;
@@ -42,4 +38,4 @@ module.exports = Franz => {
42 } 38 }
43 }, true); 39 }, true);
44}; 40};
45//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZWFtY2hhdC93ZWJ2aWV3LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJGcmFueiIsImdldE1lc3NhZ2VzIiwiY291bnQiLCJjb3VudGVycyIsImRvY3VtZW50IiwicXVlcnlTZWxlY3RvckFsbCIsIkFycmF5IiwicHJvdG90eXBlIiwic2xpY2UiLCJjYWxsIiwiTWF0aCIsImZsb29yIiwibGVuZ3RoIiwiZmlsdGVyIiwiY291bnRWYWx1ZXMiLCJjb3VudFZhbHVlIiwicXVlcnlTZWxlY3RvciIsImlubmVySFRNTCIsInBhcnNlSW50Iiwic2V0QmFkZ2UiLCJjaGF0Qm94ZXMiLCJjaGF0Qm94IiwiY2hhdCIsInN0eWxlIiwiZGlzcGxheSIsImNoYXRXaW5kb3ciLCJzY3JvbGxUb3AiLCJzY3JvbGxIZWlnaHQiLCJsb29wIl0sIm1hcHBpbmdzIjoiOztBQUVBQSxPQUFPQyxPQUFQLEdBQWtCQyxLQUFELElBQVc7QUFDMUIsUUFBTUMsY0FBYyxTQUFTQSxXQUFULEdBQXVCO0FBQ3pDO0FBQ0EsUUFBSUMsUUFBUSxDQUFaO0FBQ0EsUUFBSUMsV0FBV0MsU0FBU0MsZ0JBQVQsQ0FBMEIscURBQTFCLENBQWY7QUFDQUYsZUFBV0csTUFBTUMsU0FBTixDQUFnQkMsS0FBaEIsQ0FBc0JDLElBQXRCLENBQTJCTixRQUEzQixFQUFxQ08sS0FBS0MsS0FBTCxDQUFXUixTQUFTUyxNQUFULEdBQWtCLENBQTdCLENBQXJDLENBQVg7QUFDQSxPQUFHQyxNQUFILENBQVVKLElBQVYsQ0FBZU4sUUFBZixFQUEwQlcsV0FBRCxJQUFpQjtBQUN4Qy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