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/jira/webview.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 recipes/jira/webview.js (limited to 'recipes/jira/webview.js') diff --git a/recipes/jira/webview.js b/recipes/jira/webview.js new file mode 100644 index 0000000..42d32e8 --- /dev/null +++ b/recipes/jira/webview.js @@ -0,0 +1,16 @@ +"use strict"; + +module.exports = (Franz) => { + const getMessages = function getMessages() { + // get unread messages + let element = document.querySelector('#atlassian-navigation-notification-count span'); + let count = element ? element.innerText : 0; + count = parseInt(count, 10); + + // set Franz badge + Franz.setBadge(count); + }; + + // check for new messages every second and update Franz badge + Franz.loop(getMessages); +}; \ No newline at end of file -- cgit v1.2.3-70-g09d2