diff options
author | 2023-05-29 10:00:33 +0530 | |
---|---|---|
committer | 2023-05-29 04:30:33 +0000 | |
commit | 7cb5441b5e2852339748f97285ccd97ed5ba4162 (patch) | |
tree | 29e5e94568a8cf0c632d30c7b85f865b6dea979e /recipes/lineworks/webview.js | |
parent | Upgrade 'pnpm' to '8.5.1' (#377) (diff) | |
download | ferdium-recipes-7cb5441b5e2852339748f97285ccd97ed5ba4162.tar.gz ferdium-recipes-7cb5441b5e2852339748f97285ccd97ed5ba4162.tar.zst ferdium-recipes-7cb5441b5e2852339748f97285ccd97ed5ba4162.zip |
Add new recipe for lineworks (#378)
Diffstat (limited to 'recipes/lineworks/webview.js')
-rw-r--r-- | recipes/lineworks/webview.js | 19 |
1 files changed, 19 insertions, 0 deletions
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 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { | ||
4 | return obj && obj.__esModule ? obj : { default: obj }; | ||
5 | } | ||
6 | |||
7 | module.exports = Ferdium => { | ||
8 | const getMessages = () => { | ||
9 | const elements = document.querySelectorAll( | ||
10 | 'div#chat_list > ul#chat_grp_lst > li#item_chat > dl#chat_count > span#new', | ||
11 | ); | ||
12 | let count = elements[0] ? count = Ferdium.safeParseInt(elements[0].textContent): 0; | ||
13 | |||
14 | Ferdium.setBadge(count); | ||
15 | }; | ||
16 | Ferdium.loop(getMessages); | ||
17 | |||
18 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
19 | } | ||