aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/ms-planner/webview.js
diff options
context:
space:
mode:
authorLibravatar André Oliveira <37463445+SpecialAro@users.noreply.github.com>2024-03-18 12:36:05 +0000
committerLibravatar GitHub <noreply@github.com>2024-03-18 12:36:05 +0000
commit006950318f1228af10eeb0cdfb0861af6ecb1e75 (patch)
treed61c790d4a4b9f6f16620f645b2ba5dce248f79d /recipes/ms-planner/webview.js
parentGoogle Voice darkmode update for add contact (#516) (diff)
downloadferdium-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.js40
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 @@
1const path = require('path');
2
3setTimeout(() => {
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
11const isMutedIcon = element =>
12 element.parentElement.parentElement.querySelectorAll('*[data-icon="muted"]')
13 .length > 0;
14
15const isPinnedIcon = element => element.classList.contains('_1EFSv');
16
17module.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};