From 9db43e100a672b6d6932ac68c0fbe503c129138b Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Sun, 12 Sep 2021 22:01:51 +0530 Subject: Added a check to verify that the folder name of the recipe matches the recipe id (#708) Use the recipe-id as master to rename internal folder names --- recipes/kimaicloud/webview.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 recipes/kimaicloud/webview.js (limited to 'recipes/kimaicloud/webview.js') diff --git a/recipes/kimaicloud/webview.js b/recipes/kimaicloud/webview.js new file mode 100644 index 0000000..f4e2e9f --- /dev/null +++ b/recipes/kimaicloud/webview.js @@ -0,0 +1,26 @@ +module.exports = (Ferdi) => { + const getMessages = function getMessages() { + let count = 0; + + // get amount of running timesheets + const label = document.querySelector('.main-header .navbar .dropdown.messages-menu .ticktac span.label'); + if (label !== undefined) { + count = label.textContent; + } + + // set Ferdi badge + Ferdi.setBadge(count); + }; + + document.addEventListener('click', (e) => { + const { tagName, target, href } = e.target; + + if (tagName === 'A' && target === '_blank') { + e.preventDefault(); + e.stopImmediatePropagation(); + window.open(href); + } + }); + + Ferdi.loop(getMessages); +}; -- cgit v1.2.3-70-g09d2