diff options
Diffstat (limited to 'recipes/google-meet/webview.js')
-rw-r--r-- | recipes/google-meet/webview.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/recipes/google-meet/webview.js b/recipes/google-meet/webview.js new file mode 100644 index 0000000..e4694ef --- /dev/null +++ b/recipes/google-meet/webview.js | |||
@@ -0,0 +1,36 @@ | |||
1 | function _interopRequireDefault(obj) { | ||
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
7 | window.addEventListener('load', () => { | ||
8 | const title = document.querySelector('.window-title').textContent; | ||
9 | |||
10 | if (title && title.includes('Google Chrome 36+')) { | ||
11 | window.location.reload(); | ||
12 | } | ||
13 | }); | ||
14 | |||
15 | module.exports = (Ferdium, settings) => { | ||
16 | const getMessages = () => { | ||
17 | const elements = document.querySelectorAll('.CxUIE, .unread'); | ||
18 | let count = 0; | ||
19 | |||
20 | for (const element of elements) { | ||
21 | if (element.querySelectorAll('*[data-icon="muted"]').length === 0) { | ||
22 | count += 1; | ||
23 | } | ||
24 | } | ||
25 | |||
26 | Ferdium.setBadge(count); | ||
27 | }; | ||
28 | |||
29 | Ferdium.loop(getMessages); | ||
30 | |||
31 | window.addEventListener('beforeunload', async () => { | ||
32 | Ferdium.clearStorageData(settings.id, { storages: ['serviceworkers'] }); | ||
33 | }); | ||
34 | |||
35 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
36 | }; | ||