diff options
Diffstat (limited to 'recipes/ms-planner')
-rw-r--r-- | recipes/ms-planner/icon.svg | 15 | ||||
-rw-r--r-- | recipes/ms-planner/index.js | 27 | ||||
-rw-r--r-- | recipes/ms-planner/package.json | 14 | ||||
-rw-r--r-- | recipes/ms-planner/service.css | 15 | ||||
-rw-r--r-- | recipes/ms-planner/webview.js | 40 |
5 files changed, 111 insertions, 0 deletions
diff --git a/recipes/ms-planner/icon.svg b/recipes/ms-planner/icon.svg new file mode 100644 index 0000000..43a4cfc --- /dev/null +++ b/recipes/ms-planner/icon.svg | |||
@@ -0,0 +1,15 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- Generator: Adobe Illustrator 28.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | ||
3 | <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" | ||
4 | viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve"> | ||
5 | <style type="text/css"> | ||
6 | .st0{fill:#185C37;} | ||
7 | .st1{fill:#33C481;} | ||
8 | .st2{fill:#107C41;} | ||
9 | .st3{fill:#21A366;} | ||
10 | </style> | ||
11 | <path class="st0" d="M15.2,50H4.8c-1.2,0-2.3-1-2.3-2.3V24.2l7.9-2.3l7.1,2.3v23.5C17.5,49,16.5,50,15.2,50L15.2,50z"/> | ||
12 | <path class="st1" d="M31.5,0h13.7c1.3,0,2.3,1,2.3,2.3c0,0,0,0,0,0v27.3c0,1.3-1,2.3-2.3,2.3h0H31.5l-2.7-17.1L31.5,0z"/> | ||
13 | <path class="st2" d="M2.5,2.3V25h15v16h12.7c1.3,0,2.3-1,2.3-2.3v0V0H4.8C3.5,0,2.5,1,2.5,2.3z"/> | ||
14 | <path class="st3" d="M17.5,0h15v17h-15V0z"/> | ||
15 | </svg> | ||
diff --git a/recipes/ms-planner/index.js b/recipes/ms-planner/index.js new file mode 100644 index 0000000..cc0b44a --- /dev/null +++ b/recipes/ms-planner/index.js | |||
@@ -0,0 +1,27 @@ | |||
1 | module.exports = Ferdium => | ||
2 | class Planner extends Ferdium { | ||
3 | overrideUserAgent() { | ||
4 | return window.navigator.userAgent | ||
5 | .replace(/(Ferdium|Electron)(\S+\s)/g, '') | ||
6 | .replace(/(Chrome\/)([^ ]*)/g, '$163.0.3239.84'); | ||
7 | } | ||
8 | |||
9 | // https://docs.microsoft.com/en-us/microsoftteams/troubleshoot/teams-sign-in/sign-in-loop#resolution | ||
10 | knownCertificateHosts() { | ||
11 | return ['tasks.office.com']; | ||
12 | } | ||
13 | |||
14 | // we need to allow all cookies for ms teams | ||
15 | onHeadersReceived(details, callback) { | ||
16 | if ( | ||
17 | details.responseHeaders && | ||
18 | details.responseHeaders['Set-Cookie'] && | ||
19 | details.responseHeaders['Set-Cookie'].length > 0 && | ||
20 | !details.responseHeaders['Set-Cookie'][0].includes('SameSite=none') | ||
21 | ) { | ||
22 | details.responseHeaders['Set-Cookie'][0] = | ||
23 | `${details.responseHeaders['Set-Cookie'][0]}; SameSite=none`; | ||
24 | } | ||
25 | callback({ cancel: false, responseHeaders: details.responseHeaders }); | ||
26 | } | ||
27 | }; | ||
diff --git a/recipes/ms-planner/package.json b/recipes/ms-planner/package.json new file mode 100644 index 0000000..ca74458 --- /dev/null +++ b/recipes/ms-planner/package.json | |||
@@ -0,0 +1,14 @@ | |||
1 | { | ||
2 | "id": "ms-planner", | ||
3 | "name": "Microsoft Planner", | ||
4 | "aliases": [ | ||
5 | "office", | ||
6 | "tasks" | ||
7 | ], | ||
8 | "version": "1.0.0", | ||
9 | "license": "MIT", | ||
10 | "config": { | ||
11 | "serviceURL": "https://tasks.office.com/", | ||
12 | "hasNotificationSound": true | ||
13 | } | ||
14 | } | ||
diff --git a/recipes/ms-planner/service.css b/recipes/ms-planner/service.css new file mode 100644 index 0000000..d28527c --- /dev/null +++ b/recipes/ms-planner/service.css | |||
@@ -0,0 +1,15 @@ | |||
1 | .app-wrapper-web .app, | ||
2 | .app-wrapper-web ._36Q2N, | ||
3 | .app-wrapper-web .h70RQ, | ||
4 | .app-wrapper-web ._3QfZd, | ||
5 | .app-wrapper-web ._1jJ70, | ||
6 | ._1XkO3.two { | ||
7 | width: 100% !important; | ||
8 | max-width: 100% !important; | ||
9 | height: 100% !important; | ||
10 | top: 0 !important; | ||
11 | } | ||
12 | |||
13 | ._1Wk6A ._3YewW._31v_P._2Ptrm { | ||
14 | display: none; | ||
15 | } | ||
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 | }; | ||