diff options
author | 2020-09-22 20:56:48 +0200 | |
---|---|---|
committer | 2020-09-22 19:56:48 +0100 | |
commit | 6f5e4a00588aefdda7a5a1cfe70935870e7e234a (patch) | |
tree | 9e29aa7aa0620a1a4a968ff8739b4b8ba96791a9 /uncompressed/meetfranz-lastpass/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 'uncompressed/meetfranz-lastpass/webview.js')
-rw-r--r-- | uncompressed/meetfranz-lastpass/webview.js | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/uncompressed/meetfranz-lastpass/webview.js b/uncompressed/meetfranz-lastpass/webview.js deleted file mode 100644 index 4fdd007..0000000 --- a/uncompressed/meetfranz-lastpass/webview.js +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | const { | ||
4 | remote | ||
5 | } = require('electron'); | ||
6 | |||
7 | const path = require('path'); | ||
8 | |||
9 | const webContents = remote.getCurrentWebContents(); | ||
10 | const { | ||
11 | session | ||
12 | } = webContents; | ||
13 | setTimeout(() => { | ||
14 | if (document.querySelector('body').innerHTML.includes('Google Chrome 36+')) { | ||
15 | window.location.reload(); | ||
16 | } | ||
17 | }, 1000); | ||
18 | window.addEventListener('beforeunload', async () => { | ||
19 | try { | ||
20 | session.flushStorageData(); | ||
21 | session.clearStorageData({ | ||
22 | storages: ['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb'] | ||
23 | }); | ||
24 | const registrations = await window.navigator.serviceWorker.getRegistrations(); | ||
25 | registrations.forEach(r => { | ||
26 | r.unregister(); | ||
27 | console.log('ServiceWorker unregistered'); | ||
28 | }); | ||
29 | } catch (err) { | ||
30 | console.err(err); | ||
31 | } | ||
32 | }); | ||
33 | |||
34 | module.exports = Franz => { | ||
35 | const getMessages = function getMessages() { | ||
36 | const elements = document.querySelectorAll('.CxUIE, .unread'); | ||
37 | let count = 0; | ||
38 | |||
39 | for (let i = 0; i < elements.length; i += 1) { | ||
40 | if (elements[i].querySelectorAll('*[data-icon="muted"]').length === 0) { | ||
41 | count += 1; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | Franz.setBadge(count); | ||
46 | }; | ||
47 | |||
48 | Franz.injectCSS(path.join(__dirname, 'service.css')); | ||
49 | Franz.loop(getMessages); | ||
50 | }; \ No newline at end of file | ||