aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/dingtalk/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/dingtalk/webview.js')
-rw-r--r--recipes/dingtalk/webview.js36
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 @@
1const _path = _interopRequireDefault(require('path'));
2
3function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4
5module.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};