diff options
author | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2021-09-12 08:36:16 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-12 03:06:16 +0000 |
commit | ea9f52797889740c465f1bcaef1283642cc2ef27 (patch) | |
tree | bcb07685c8dfa8c8b683b05ae22031b0cb16e217 /recipes/dingtalk/webview.js | |
parent | New recipe: 'yandex-mail' (fixes #421) (#685) (diff) | |
download | ferdium-recipes-ea9f52797889740c465f1bcaef1283642cc2ef27.tar.gz ferdium-recipes-ea9f52797889740c465f1bcaef1283642cc2ef27.tar.zst ferdium-recipes-ea9f52797889740c465f1bcaef1283642cc2ef27.zip |
Diffstat (limited to 'recipes/dingtalk/webview.js')
-rw-r--r-- | recipes/dingtalk/webview.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/recipes/dingtalk/webview.js b/recipes/dingtalk/webview.js new file mode 100644 index 0000000..68de1b6 --- /dev/null +++ b/recipes/dingtalk/webview.js | |||
@@ -0,0 +1,36 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
4 | |||
5 | module.exports = (Ferdi) => { | ||
6 | let checkIsRun = false; | ||
7 | checkHeightAction = () => { | ||
8 | checkIsRun = true; | ||
9 | let checkHeight = setInterval(() => { | ||
10 | let menuPanel = document.getElementById('menu-pannel') | ||
11 | if (!menuPanel) { | ||
12 | return | ||
13 | } | ||
14 | menuPanel.parentElement.setAttribute('style', 'height:' + (window.outerHeight - 60) + 'px'); | ||
15 | clearInterval(checkHeight); | ||
16 | checkIsRun = false | ||
17 | }, 1000) | ||
18 | } | ||
19 | |||
20 | checkHeightAction(); | ||
21 | |||
22 | window.addEventListener('resize', () => { | ||
23 | if (!checkIsRun) { | ||
24 | checkHeightAction(); | ||
25 | } | ||
26 | }); | ||
27 | |||
28 | const getMessages = function getMessages() { | ||
29 | const x = document.querySelectorAll('.unread-num em.ng-binding') | ||
30 | Ferdi.setBadge(x.length > 0 ? x[0].innerHTML : 0); | ||
31 | }; | ||
32 | |||
33 | Ferdi.loop(getMessages); | ||
34 | |||
35 | Ferdi.injectCSS(_path.default.join(__dirname, 'style.css')); | ||
36 | }; | ||