blob: b18cc593f40054a25852352315987c57e9ba1130 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
const _path = _interopRequireDefault(require('path'));
module.exports = Ferdium => {
let checkIsRun = false;
const checkHeightAction = () => {
checkIsRun = true;
const checkHeight = setInterval(() => {
const menuPanel = document.querySelector('#menu-pannel');
if (!menuPanel) {
return;
}
if (menuPanel.parentElement) {
menuPanel.parentElement.setAttribute(
'style',
`height:${window.outerHeight - 60}px`,
);
}
clearInterval(checkHeight);
checkIsRun = false;
}, 1000);
};
checkHeightAction();
window.addEventListener('resize', () => {
if (!checkIsRun) {
checkHeightAction();
}
});
const getMessages = () => {
const x = document.querySelectorAll('.unread-num em.ng-binding');
Ferdium.setBadge(x.length > 0 ? x[0].textContent : 0);
};
Ferdium.loop(getMessages);
Ferdium.injectCSS(_path.default.join(__dirname, 'style.css'));
};
|