blob: 35d5de27d06f9196270fb6b9defa7eac49d3c249 (
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
|
setTimeout(() => {
const elem = document.querySelector('#af-error-container');
// TODO: This will not work for non-english locales
if (
elem &&
elem.textContent &&
elem.textContent
.toLowerCase()
.includes('the requested url was not found on this server')
) {
window.location.reload();
}
}, 1000);
module.exports = (Ferdi, settings) => {
const getMessages = () => {
const messages = document.querySelectorAll('.text-content.unread').length;
Ferdi.setBadge(messages);
};
window.addEventListener('beforeunload', async () => {
Ferdi.clearStorageData(settings.id, {
storages: [
'appcache',
'serviceworkers',
'cachestorage',
'websql',
'indexdb',
],
});
Ferdi.releaseServiceWorkers();
});
Ferdi.loop(getMessages);
if (settings.isDarkModeEnabled) {
localStorage.setItem('dark_mode_enabled', 'true');
} else {
localStorage.setItem('dark_mode_enabled', 'false');
}
};
|