From 5434536ef4fa63174be3e4af5bf33d3ebe1872b2 Mon Sep 17 00:00:00 2001 From: Abdul Hafiz Muhammad <109435420+hafiz-muhammad@users.noreply.github.com> Date: Sun, 28 Aug 2022 21:47:24 -0400 Subject: New recipe: Odysee (#165) --- recipes/odysee/webview.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 recipes/odysee/webview.js (limited to 'recipes/odysee/webview.js') diff --git a/recipes/odysee/webview.js b/recipes/odysee/webview.js new file mode 100644 index 0000000..745e807 --- /dev/null +++ b/recipes/odysee/webview.js @@ -0,0 +1,15 @@ +module.exports = (Ferdium) => { + function getNotifications() { + let unreadNotifications = 0; + for (const notificationCounterElement of document.querySelectorAll( + ".notification__count" + )) { + unreadNotifications = + unreadNotifications + + Ferdium.safeParseInt(notificationCounterElement.textContent); + } + + Ferdium.setBadge(unreadNotifications); + } + Ferdium.loop(getNotifications); +}; -- cgit v1.2.3-70-g09d2