From 7cb5441b5e2852339748f97285ccd97ed5ba4162 Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Mon, 29 May 2023 10:00:33 +0530 Subject: Add new recipe for lineworks (#378) --- pnpm-lock.yaml | 2 ++ recipes/lineworks/icon.svg | 7 +++++++ recipes/lineworks/index.js | 1 + recipes/lineworks/package.json | 10 ++++++++++ recipes/lineworks/webview.js | 19 +++++++++++++++++++ 5 files changed, 39 insertions(+) create mode 100644 recipes/lineworks/icon.svg create mode 100644 recipes/lineworks/index.js create mode 100644 recipes/lineworks/package.json create mode 100644 recipes/lineworks/webview.js diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8b20d87..f123a1c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -329,6 +329,8 @@ importers: recipes/linear: {} + recipes/lineworks: {} + recipes/linkedin: {} recipes/localazy: {} diff --git a/recipes/lineworks/icon.svg b/recipes/lineworks/icon.svg new file mode 100644 index 0000000..7cf048c --- /dev/null +++ b/recipes/lineworks/icon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/recipes/lineworks/index.js b/recipes/lineworks/index.js new file mode 100644 index 0000000..dd41f72 --- /dev/null +++ b/recipes/lineworks/index.js @@ -0,0 +1 @@ +module.exports = Ferdium => Ferdium; diff --git a/recipes/lineworks/package.json b/recipes/lineworks/package.json new file mode 100644 index 0000000..a830544 --- /dev/null +++ b/recipes/lineworks/package.json @@ -0,0 +1,10 @@ +{ + "id": "lineworks", + "name": "Line Works", + "version": "1.0.0", + "license": "MIT", + "config": { + "hasIndirectMessages": true, + "serviceURL": "https://talk.worksmobile.com/" + } +} diff --git a/recipes/lineworks/webview.js b/recipes/lineworks/webview.js new file mode 100644 index 0000000..41683ef --- /dev/null +++ b/recipes/lineworks/webview.js @@ -0,0 +1,19 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +module.exports = Ferdium => { + const getMessages = () => { + const elements = document.querySelectorAll( + 'div#chat_list > ul#chat_grp_lst > li#item_chat > dl#chat_count > span#new', + ); + let count = elements[0] ? count = Ferdium.safeParseInt(elements[0].textContent): 0; + + Ferdium.setBadge(count); + }; + Ferdium.loop(getMessages); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +} -- cgit v1.2.3-54-g00ecf