-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlargeIconMode.js
More file actions
50 lines (44 loc) · 1.29 KB
/
largeIconMode.js
File metadata and controls
50 lines (44 loc) · 1.29 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
import Translation from 'src/structures/constants/translation.ts';
import { buttonCSS as css } from 'src/utils/1.variables.js';
import { infoToast } from 'src/utils/2.toasts.js';
import eventManager from 'src/utils/eventManager.js';
import * as settings from 'src/utils/settings/index.js';
import style from 'src/utils/style.js';
const setting = settings.register({
name: Translation.Setting('large.avatar'),
key: 'underscript.chat.largeIcons',
default: true,
page: 'Chat',
onChange: update,
});
const styles = style.add();
function update() {
if (styles) {
styles.remove();
}
if (setting.value()) {
styles.append(
'.message-group { clear: both; }',
'.chat-messages .avatarGroup { float: left; padding-right: 10px; }',
'.chat-messages li .avatar, .chat-messages li .rainbowAvatar { height: 45px; }',
'.chat-message { display: block; }',
);
}
}
eventManager.on('ChatDetected', () => {
update();
const value = setting.value();
const buttons = {
text: value ? 'Revert it!' : 'Enable it!',
className: 'dismiss',
css,
onclick: (e) => {
setting.set(!value);
},
};
infoToast({
text: `There's a new Large Icon mode setting for chat`,
className: 'dismissable',
buttons,
}, 'underscript.notice.largeIcons', '1');
});