diff options
author | 2020-09-22 20:56:48 +0200 | |
---|---|---|
committer | 2020-09-22 19:56:48 +0100 | |
commit | 6f5e4a00588aefdda7a5a1cfe70935870e7e234a (patch) | |
tree | 9e29aa7aa0620a1a4a968ff8739b4b8ba96791a9 /recipes/steamchat/webview.js | |
parent | Updated logos for Outlook/OWA (diff) | |
download | ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.gz ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.zst ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.zip |
Unpack recipes and update recipes icons (#292)
Co-authored-by: Amine Mouafik <amine@mouafik.fr>
Diffstat (limited to 'recipes/steamchat/webview.js')
-rw-r--r-- | recipes/steamchat/webview.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/recipes/steamchat/webview.js b/recipes/steamchat/webview.js new file mode 100644 index 0000000..87f1f7a --- /dev/null +++ b/recipes/steamchat/webview.js | |||
@@ -0,0 +1,32 @@ | |||
1 | 'use strict'; | ||
2 | |||
3 | module.exports = Franz => { | ||
4 | const getMessages = function getMessages() { | ||
5 | // get new msg count | ||
6 | let count = 0; | ||
7 | let counters = document.querySelectorAll("[class*=FriendMessageCount]"); | ||
8 | [].filter.call(counters, countValue => { | ||
9 | if (countValue) { | ||
10 | count += parseInt(countValue.innerHTML); | ||
11 | } | ||
12 | }); | ||
13 | |||
14 | const indirectMessages = document.querySelectorAll("[class*=ChatUnreadMessageIndicator]").length; | ||
15 | Franz.setBadge(count, indirectMessages); | ||
16 | |||
17 | // force scroll to bottom of chat window | ||
18 | const chatBoxes = document.querySelectorAll('.chat_dialog'); | ||
19 | if (chatBoxes) { | ||
20 | const chatBox = [].filter.call(chatBoxes, chat => { | ||
21 | return chat.style.display !== 'none'; | ||
22 | }); | ||
23 | if (chatBox[0]) { | ||
24 | const chatWindow = chatBox[0].querySelector('.chat_dialog_scroll'); | ||
25 | chatWindow.scrollTop = chatWindow.scrollHeight; | ||
26 | } | ||
27 | } | ||
28 | }; | ||
29 | |||
30 | Franz.loop(getMessages); | ||
31 | }; | ||
32 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZWFtY2hhdC93ZWJ2aWV3LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJGcmFueiIsImdldE1lc3NhZ2VzIiwiY291bnQiLCJjb3VudGVycyIsImRvY3VtZW50IiwicXVlcnlTZWxlY3RvckFsbCIsIkFycmF5IiwicHJvdG90eXBlIiwic2xpY2UiLCJjYWxsIiwiTWF0aCIsImZsb29yIiwibGVuZ3RoIiwiZmlsdGVyIiwiY291bnRWYWx1ZXMiLCJjb3VudFZhbHVlIiwicXVlcnlTZWxlY3RvciIsImlubmVySFRNTCIsInBhcnNlSW50Iiwic2V0QmFkZ2UiLCJjaGF0Qm94ZXMiLCJjaGF0Qm94IiwiY2hhdCIsInN0eWxlIiwiZGlzcGxheSIsImNoYXRXaW5kb3ciLCJzY3JvbGxUb3AiLCJzY3JvbGxIZWlnaHQiLCJsb29wIl0sIm1hcHBpbmdzIjoiOztBQUVBQSxPQUFPQyxPQUFQLEdBQWtCQyxLQUFELElBQVc7QUFDMUIsUUFBTUMsY0FBYyxTQUFTQSxXQUFULEdBQXVCO0FBQ3pDO0FBQ0EsUUFBSUMsUUFBUSxDQUFaO0FBQ0EsUUFBSUMsV0FBV0MsU0FBU0MsZ0JBQVQsQ0FBMEIscURBQTFCLENBQWY7QUFDQUYsZUFBV0csTUFBTUMsU0FBTixDQUFnQkMsS0FBaEIsQ0FBc0JDLElBQXRCLENBQTJCTixRQUEzQixFQUFxQ08sS0FBS0MsS0FBTCxDQUFXUixTQUFTUyxNQUFULEdBQWtCLENBQTdCLENBQXJDLENBQVg7QUFDQSxPQUFHQyxNQUFILENBQVVKLElBQVYsQ0FBZU4sUUFBZixFQUEwQlcsV0FBRCxJQUFpQjtBQUN4QyxVQ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