diff options
Diffstat (limited to 'recipes/dingtalk/webview.js')
-rw-r--r-- | recipes/dingtalk/webview.js | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/recipes/dingtalk/webview.js b/recipes/dingtalk/webview.js index aa5f2a3..59881cf 100644 --- a/recipes/dingtalk/webview.js +++ b/recipes/dingtalk/webview.js | |||
@@ -1,21 +1,28 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | 1 | const _path = _interopRequireDefault(require('path')); |
2 | 2 | ||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { |
4 | return obj && obj.__esModule ? obj : { default: obj }; | ||
5 | } | ||
4 | 6 | ||
5 | module.exports = (Ferdi) => { | 7 | module.exports = Ferdi => { |
6 | let checkIsRun = false; | 8 | let checkIsRun = false; |
7 | const checkHeightAction = () => { | 9 | const checkHeightAction = () => { |
8 | checkIsRun = true; | 10 | checkIsRun = true; |
9 | let checkHeight = setInterval(() => { | 11 | let checkHeight = setInterval(() => { |
10 | let menuPanel = document.getElementById('menu-pannel') | 12 | let menuPanel = document.querySelector('#menu-pannel'); |
11 | if (!menuPanel) { | 13 | if (!menuPanel) { |
12 | return | 14 | return; |
15 | } | ||
16 | if (menuPanel.parentElement) { | ||
17 | menuPanel.parentElement.setAttribute( | ||
18 | 'style', | ||
19 | 'height:' + (window.outerHeight - 60) + 'px', | ||
20 | ); | ||
13 | } | 21 | } |
14 | menuPanel.parentElement.setAttribute('style', 'height:' + (window.outerHeight - 60) + 'px'); | ||
15 | clearInterval(checkHeight); | 22 | clearInterval(checkHeight); |
16 | checkIsRun = false | 23 | checkIsRun = false; |
17 | }, 1000) | 24 | }, 1000); |
18 | } | 25 | }; |
19 | 26 | ||
20 | checkHeightAction(); | 27 | checkHeightAction(); |
21 | 28 | ||
@@ -26,8 +33,8 @@ module.exports = (Ferdi) => { | |||
26 | }); | 33 | }); |
27 | 34 | ||
28 | const getMessages = () => { | 35 | const getMessages = () => { |
29 | const x = document.querySelectorAll('.unread-num em.ng-binding') | 36 | const x = document.querySelectorAll('.unread-num em.ng-binding'); |
30 | Ferdi.setBadge(x.length > 0 ? x[0].innerHTML : 0); | 37 | Ferdi.setBadge(x.length > 0 ? x[0].textContent : 0); |
31 | }; | 38 | }; |
32 | 39 | ||
33 | Ferdi.loop(getMessages); | 40 | Ferdi.loop(getMessages); |