forked from maksrom/javascript-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·59 lines (46 loc) · 1.53 KB
/
index.js
File metadata and controls
executable file
·59 lines (46 loc) · 1.53 KB
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
50
51
52
53
54
55
56
57
58
59
require('client/polyfill');
try {
window.localStorage.testProperty = 1;
delete window.localStorage.testProperty;
} catch(e) {
// localStorage disabled or forbidden
try {
window.localStorage = {};
// so that operations on it won't fail
} catch(e) {
/* can happen TypeError: Attempted to assign to readonly property. */
}
}
if (LANG == 'ru') {
require('./unready');
//exports.init = require('./init');
exports.login = require('./login');
require('./logout');
}
exports.Modal = require('./modal');
exports.fontTest = require('./fontTest');
exports.resizeOnload = require('./resizeOnload');
require('./layout');
require('./sitetoolbar');
require('./sidebar');
require('./navigationArrows');
require('./hover');
require('./trackLinks');
// must use CommonsChunkPlugin
// to ensure that other modules use exactly this (initialized) client/notify
require('client/notification').init();
exports.showTopNotification = function() {
let notification = document.querySelector('.notification_top');
let id = notification.id;
notification.querySelector('button').onclick = function() {
localStorage.topNotificationHidden = id;
notification.style.display = 'none';
};
if (!id) throw new Error('Top notification must have an id');
// topNotificationHidden has the id of the hidden notification (current or previous one)
let hiddenId = localStorage.topNotificationHidden;
if (hiddenId == id) return;
// not same id or no id saved
delete localStorage.topNotificationHidden;
notification.style.display = '';
};