diff options
author | 2020-10-07 22:24:06 +0800 | |
---|---|---|
committer | 2020-10-07 15:24:06 +0100 | |
commit | 12f4f7ab7487b30c31f43dbc3009fb5b8769efdc (patch) | |
tree | c44786c7a3b7699f1f8051db08e8651ea9a1b0eb /recipes/lark/webview.js | |
parent | Add recipe for Simplenote (#317) (diff) | |
download | ferdium-recipes-12f4f7ab7487b30c31f43dbc3009fb5b8769efdc.tar.gz ferdium-recipes-12f4f7ab7487b30c31f43dbc3009fb5b8769efdc.tar.zst ferdium-recipes-12f4f7ab7487b30c31f43dbc3009fb5b8769efdc.zip |
Add recipe for Lark (#315)
Diffstat (limited to 'recipes/lark/webview.js')
-rw-r--r-- | recipes/lark/webview.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/recipes/lark/webview.js b/recipes/lark/webview.js new file mode 100644 index 0000000..a3b052d --- /dev/null +++ b/recipes/lark/webview.js | |||
@@ -0,0 +1,18 @@ | |||
1 | const path = require('path'); | ||
2 | |||
3 | |||
4 | module.exports = (Franz) => { | ||
5 | const getMessages = function getMessages() { | ||
6 | |||
7 | const ele = document.querySelectorAll('.larkc-badge-count.navbarMenu-badge'); | ||
8 | if (!ele.length) { | ||
9 | Franz.setBadge(0); | ||
10 | return; | ||
11 | } | ||
12 | const messages = parseInt(ele[0].innerHTML, 10); | ||
13 | Franz.setBadge(messages); | ||
14 | }; | ||
15 | |||
16 | Franz.injectCSS(path.join(__dirname, 'service.css')); | ||
17 | Franz.loop(getMessages); | ||
18 | }; | ||