From 6f5e4a00588aefdda7a5a1cfe70935870e7e234a Mon Sep 17 00:00:00 2001 From: Bennett Date: Tue, 22 Sep 2020 20:56:48 +0200 Subject: Unpack recipes and update recipes icons (#292) Co-authored-by: Amine Mouafik --- recipes/anydo/webview.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 recipes/anydo/webview.js (limited to 'recipes/anydo/webview.js') diff --git a/recipes/anydo/webview.js b/recipes/anydo/webview.js new file mode 100644 index 0000000..aaff6dc --- /dev/null +++ b/recipes/anydo/webview.js @@ -0,0 +1,20 @@ +"use strict"; + +module.exports = (Franz) => { + function getTasks() { + + let incompleteCount = 0; + + const countEls = document.querySelectorAll('.AppSidebarListsItems__itemContainer__sizeContainer:not([hidden]) > .AppSidebarListsItems__itemContainer__size'); + + if (countEls.length) { + Array.from(countEls).forEach((el) => { + incompleteCount += parseInt(el.innerHTML, 10); + }); + } + + Franz.setBadge(incompleteCount); + } + + Franz.loop(getTasks); +}; -- cgit v1.2.3-54-g00ecf