diff options
Diffstat (limited to 'recipes/hangoutschat')
-rw-r--r-- | recipes/hangoutschat/index.js | 7 | ||||
-rw-r--r-- | recipes/hangoutschat/webview.js | 12 |
2 files changed, 9 insertions, 10 deletions
diff --git a/recipes/hangoutschat/index.js b/recipes/hangoutschat/index.js index 2c8b220..c6173fa 100644 --- a/recipes/hangoutschat/index.js +++ b/recipes/hangoutschat/index.js | |||
@@ -1,6 +1,5 @@ | |||
1 | var os = require('os') | 1 | const os = require('os'); |
2 | 2 | ||
3 | // just pass through Franz | 3 | // just pass through Franz |
4 | module.exports = Franz => | 4 | module.exports = Franz => class HangoutsChat extends Franz { |
5 | class HangoutsChat extends Franz { | 5 | }; |
6 | }; | ||
diff --git a/recipes/hangoutschat/webview.js b/recipes/hangoutschat/webview.js index d344ad7..0f17116 100644 --- a/recipes/hangoutschat/webview.js +++ b/recipes/hangoutschat/webview.js | |||
@@ -1,25 +1,25 @@ | |||
1 | module.exports = (Franz) => { | 1 | module.exports = (Franz) => { |
2 | // class corresponding to the red badge that is visible for direct messages | 2 | // class corresponding to the red badge that is visible for direct messages |
3 | const directMessageSelector = "div.V6.CL.su.ahD.X9.Y2 span.akt span.XU"; | 3 | const directMessageSelector = 'div.V6.CL.su.ahD.X9.Y2 span.akt span.XU'; |
4 | 4 | ||
5 | // class corresponding to the bold text that is visible for room messages | 5 | // class corresponding to the bold text that is visible for room messages |
6 | const indirectMessageSelector = "div.V6.CL.V2.X9.Y2 span.akt span.XU"; | 6 | const indirectMessageSelector = 'div.V6.CL.V2.X9.Y2 span.akt span.XU'; |
7 | 7 | ||
8 | const getMessages = function getMessages() { | 8 | const getMessages = function getMessages() { |
9 | // get unread direct messages | 9 | // get unread direct messages |
10 | let directCount = Number(document.querySelector(directMessageSelector).innerText) | 10 | const directCount = Number(document.querySelector(directMessageSelector).innerText); |
11 | 11 | ||
12 | // get unread indirect messages | 12 | // get unread indirect messages |
13 | let indirectCount = Number(document.querySelector(indirectMessageSelector).innerText); | 13 | const indirectCount = Number(document.querySelector(indirectMessageSelector).innerText); |
14 | 14 | ||
15 | // set Franz badge | 15 | // set Franz badge |
16 | Franz.setBadge(directCount, indirectCount); | 16 | Franz.setBadge(directCount, indirectCount); |
17 | }; | 17 | }; |
18 | 18 | ||
19 | document.addEventListener("click", (e) => { | 19 | document.addEventListener('click', (e) => { |
20 | const { tagName, target, href } = e.target; | 20 | const { tagName, target, href } = e.target; |
21 | 21 | ||
22 | if (tagName === "A" && target === "_blank") { | 22 | if (tagName === 'A' && target === '_blank') { |
23 | e.preventDefault(); | 23 | e.preventDefault(); |
24 | e.stopImmediatePropagation(); | 24 | e.stopImmediatePropagation(); |
25 | window.open(href); | 25 | window.open(href); |