diff options
author | 2024-03-18 12:36:05 +0000 | |
---|---|---|
committer | 2024-03-18 12:36:05 +0000 | |
commit | 006950318f1228af10eeb0cdfb0861af6ecb1e75 (patch) | |
tree | d61c790d4a4b9f6f16620f645b2ba5dce248f79d /recipes/ms-planner/webview.js | |
parent | Google Voice darkmode update for add contact (#516) (diff) | |
download | ferdium-recipes-006950318f1228af10eeb0cdfb0861af6ecb1e75.tar.gz ferdium-recipes-006950318f1228af10eeb0cdfb0861af6ecb1e75.tar.zst ferdium-recipes-006950318f1228af10eeb0cdfb0861af6ecb1e75.zip |
Add several recipes (#519)
The added recipes are as follows:
- Mastodeck (fixes https://github.com/ferdium/ferdium-app/issues/959)
- Microsoft Planner (fixes https://github.com/ferdium/ferdium-app/issues/955)
- Alibaba Chat (fixes https://github.com/ferdium/ferdium-app/issues/1376)
- Fiverr (step forward in https://github.com/ferdium/ferdium-app/issues/1377 - missing unread logic)
- Draw.io (fixes https://github.com/ferdium/ferdium-app/issues/1429)
- Canva (fixes https://github.com/ferdium/ferdium-app/issues/1447)
- Penpot (fixes https://github.com/ferdium/ferdium-app/issues/1469)
- HackerNews (fixes https://github.com/ferdium/ferdium-app/issues/1505)
- Google Maps (fixes https://github.com/ferdium/ferdium-app/issues/1513)
- Patreon (fixes https://github.com/ferdium/ferdium-app/issues/1524)
- Fandom (fixes https://github.com/ferdium/ferdium-app/issues/1540)
- Romeo (fixes https://github.com/ferdium/ferdium-app/issues/1553)
- Infomaniak Kdrive (fixes https://github.com/ferdium/ferdium-app/issues/1559)
- Notion Calendar (fixes https://github.com/ferdium/ferdium-app/issues/1599)
- Superlist (fixes https://github.com/ferdium/ferdium-app/issues/1601)
- Purelymail (fixes https://github.com/ferdium/ferdium-app/issues/1624)
- SOGo (fixes https://github.com/ferdium/ferdium-app/issues/1472)
Diffstat (limited to 'recipes/ms-planner/webview.js')
-rw-r--r-- | recipes/ms-planner/webview.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/recipes/ms-planner/webview.js b/recipes/ms-planner/webview.js new file mode 100644 index 0000000..4dd73fd --- /dev/null +++ b/recipes/ms-planner/webview.js | |||
@@ -0,0 +1,40 @@ | |||
1 | const path = require('path'); | ||
2 | |||
3 | setTimeout(() => { | ||
4 | const elem = document.querySelector('.landing-title.version-title'); | ||
5 | if (elem && elem.textContent.toLowerCase().includes('google chrome')) { | ||
6 | window.FerdiumAPI.clearCache(); | ||
7 | window.location.reload(); | ||
8 | } | ||
9 | }, 1000); | ||
10 | |||
11 | const isMutedIcon = element => | ||
12 | element.parentElement.parentElement.querySelectorAll('*[data-icon="muted"]') | ||
13 | .length > 0; | ||
14 | |||
15 | const isPinnedIcon = element => element.classList.contains('_1EFSv'); | ||
16 | |||
17 | module.exports = Ferdium => { | ||
18 | const getMessages = function getMessages() { | ||
19 | const elements = document.querySelectorAll( | ||
20 | '.CxUIE, .unread, ._0LqQ, .m61XR .ZKn2B, .VOr2j, ._1V5O7 ._2vfYK, html[dir] ._23LrM, ._1pJ9J:not(._2XH9R)', | ||
21 | ); | ||
22 | let count = 0; | ||
23 | |||
24 | for (const element of elements) { | ||
25 | try { | ||
26 | // originalLog(isMutedIcon(elements[i]), isPinnedIcon(elements[i])); | ||
27 | if (!isMutedIcon(element) && !isPinnedIcon(element)) { | ||
28 | count += 1; | ||
29 | } | ||
30 | } catch { | ||
31 | // nope; | ||
32 | } | ||
33 | } | ||
34 | |||
35 | Ferdium.setBadge(count); | ||
36 | }; | ||
37 | |||
38 | Ferdium.injectCSS(path.join(__dirname, 'service.css')); | ||
39 | Ferdium.loop(getMessages); | ||
40 | }; | ||