blob: f3a7e677a2efb7d8b4d4c8a0e4b3bfcc69804d41 (
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
44
45
46
47
48
49
|
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
const _path = _interopRequireDefault(require('path'));
module.exports = Ferdium => {
const getMessages = () => {
let count = document.querySelectorAll(
'._5fx8:not(._569x),._1ht3:not(._569x)',
).length;
const messageRequestsElement = document.querySelector('._5nxf');
if (messageRequestsElement) {
count += Ferdium.safeParseInt(messageRequestsElement.textContent);
}
Ferdium.setBadge(count);
};
Ferdium.loop(getMessages);
localStorage.setItem(
'_cs_desktopNotifsEnabled',
JSON.stringify({
__t: Date.now(),
__v: true,
}),
);
if (typeof Ferdium.onNotify === 'function') {
Ferdium.onNotify(notification => {
if (typeof notification.title !== 'string') {
notification.title =
((notification.title.props || {}).content || [])[0] || 'Campuswire';
}
if (typeof notification.options.body !== 'string') {
notification.options.body =
(((notification.options.body || {}).props || {}).content || [])[0] ||
'';
}
return notification;
});
}
Ferdium.injectCSS(_path.default.join(__dirname, 'css', 'franz.css'));
};
|