diff options
author | 2020-10-10 10:21:29 +0700 | |
---|---|---|
committer | 2020-10-10 04:21:29 +0100 | |
commit | 00275a80cd70cea3ac53d00ca68a643dee25b5aa (patch) | |
tree | 819b39b93c0e7b18425561260ba6ee02bd3b3a8f /recipes/mstodo/webview.js | |
parent | Fixed Slite querySelector and code style improvements (#324) (diff) | |
download | ferdium-recipes-00275a80cd70cea3ac53d00ca68a643dee25b5aa.tar.gz ferdium-recipes-00275a80cd70cea3ac53d00ca68a643dee25b5aa.tar.zst ferdium-recipes-00275a80cd70cea3ac53d00ca68a643dee25b5aa.zip |
Add recipe for Microsoft To Do (#325)
Diffstat (limited to 'recipes/mstodo/webview.js')
-rw-r--r-- | recipes/mstodo/webview.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/recipes/mstodo/webview.js b/recipes/mstodo/webview.js new file mode 100644 index 0000000..8f5f0e9 --- /dev/null +++ b/recipes/mstodo/webview.js | |||
@@ -0,0 +1,24 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | var _path = _interopRequireDefault(require("path")); | ||
4 | |||
5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
6 | |||
7 | module.exports = Ferdi => { | ||
8 | const getMessages = function getMessages() { | ||
9 | const elements = document.querySelectorAll('.taskItem'); | ||
10 | let count = 0; | ||
11 | |||
12 | for (let i = 0; i < elements.length; i += 1) { | ||
13 | if (elements[i].querySelectorAll('.completed').length === 0) { | ||
14 | count += 1; | ||
15 | } | ||
16 | } | ||
17 | |||
18 | // set Ferdi badge | ||
19 | Ferdi.setBadge(count); | ||
20 | }; | ||
21 | |||
22 | Ferdi.loop(getMessages); | ||
23 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
24 | }; | ||