From d3841b766f9d37d557646003899f67525c5f755f Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Tue, 5 Oct 2021 17:04:09 +0200 Subject: chore: add eslint-plugin-unicorn (#733) --- recipes/dingtalk/webview.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'recipes/dingtalk') 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 @@ const _path = _interopRequireDefault(require('path')); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} -module.exports = (Ferdi) => { +module.exports = Ferdi => { let checkIsRun = false; const checkHeightAction = () => { checkIsRun = true; let checkHeight = setInterval(() => { - let menuPanel = document.getElementById('menu-pannel') + let menuPanel = document.querySelector('#menu-pannel'); if (!menuPanel) { - return + return; + } + if (menuPanel.parentElement) { + menuPanel.parentElement.setAttribute( + 'style', + 'height:' + (window.outerHeight - 60) + 'px', + ); } - menuPanel.parentElement.setAttribute('style', 'height:' + (window.outerHeight - 60) + 'px'); clearInterval(checkHeight); - checkIsRun = false - }, 1000) - } + checkIsRun = false; + }, 1000); + }; checkHeightAction(); @@ -26,8 +33,8 @@ module.exports = (Ferdi) => { }); const getMessages = () => { - const x = document.querySelectorAll('.unread-num em.ng-binding') - Ferdi.setBadge(x.length > 0 ? x[0].innerHTML : 0); + const x = document.querySelectorAll('.unread-num em.ng-binding'); + Ferdi.setBadge(x.length > 0 ? x[0].textContent : 0); }; Ferdi.loop(getMessages); -- cgit v1.2.3-70-g09d2