diff options
Diffstat (limited to 'recipes/devRant/webview.js')
-rw-r--r-- | recipes/devRant/webview.js | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/recipes/devRant/webview.js b/recipes/devRant/webview.js index 9e8b31c..7385db5 100644 --- a/recipes/devRant/webview.js +++ b/recipes/devRant/webview.js | |||
@@ -1,10 +1,16 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | 1 | const _path = _interopRequireDefault(require('path')); |
2 | 2 | ||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { |
4 | return obj && obj.__esModule ? obj : { default: obj }; | ||
5 | } | ||
4 | 6 | ||
5 | setTimeout(() => { | 7 | setTimeout(() => { |
6 | const elem = document.querySelector('.landing-title.version-title'); | 8 | const elem = document.querySelector('.landing-title.version-title'); |
7 | if (elem && elem.innerText.toLowerCase().includes('google chrome')) { | 9 | if ( |
10 | elem && | ||
11 | elem.textContent && | ||
12 | elem.textContent.toLowerCase().includes('google chrome') | ||
13 | ) { | ||
8 | window.location.reload(); | 14 | window.location.reload(); |
9 | } | 15 | } |
10 | }, 1000); | 16 | }, 1000); |
@@ -13,8 +19,11 @@ module.exports = (Ferdi, settings) => { | |||
13 | const getMessages = () => { | 19 | const getMessages = () => { |
14 | const elements = document.querySelectorAll('.CxUIE, .unread, ._0LqQ'); | 20 | const elements = document.querySelectorAll('.CxUIE, .unread, ._0LqQ'); |
15 | let count = 0; | 21 | let count = 0; |
16 | for (let i = 0; i < elements.length; i += 1) { | 22 | for (const element of elements) { |
17 | if (elements[i].querySelectorAll('.P6z4j').length === 1 && elements[i].querySelectorAll('*[data-icon="muted"]').length === 0) { | 23 | if ( |
24 | element.querySelectorAll('.P6z4j').length === 1 && | ||
25 | element.querySelectorAll('*[data-icon="muted"]').length === 0 | ||
26 | ) { | ||
18 | count += 1; | 27 | count += 1; |
19 | } | 28 | } |
20 | } | 29 | } |
@@ -23,7 +32,15 @@ module.exports = (Ferdi, settings) => { | |||
23 | }; | 32 | }; |
24 | 33 | ||
25 | window.addEventListener('beforeunload', async () => { | 34 | window.addEventListener('beforeunload', async () => { |
26 | Ferdi.clearStorageData(settings.id, { storages: ['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb'] }); | 35 | Ferdi.clearStorageData(settings.id, { |
36 | storages: [ | ||
37 | 'appcache', | ||
38 | 'serviceworkers', | ||
39 | 'cachestorage', | ||
40 | 'websql', | ||
41 | 'indexdb', | ||
42 | ], | ||
43 | }); | ||
27 | Ferdi.releaseServiceWorkers(); | 44 | Ferdi.releaseServiceWorkers(); |
28 | }); | 45 | }); |
29 | 46 | ||