-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnotify.new.js
More file actions
32 lines (29 loc) · 839 Bytes
/
notify.new.js
File metadata and controls
32 lines (29 loc) · 839 Bytes
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
settings.register({
name: 'Disable Chat Ping <span style="color: yellow;">(highlighting)</span>',
key: 'underscript.disable.ping',
page: 'Chat',
});
settings.register({
name: 'Use Original Chat Ping Detection',
key: 'underscript.disable.notify',
page: 'Chat',
});
eventManager.on('ChatDetected', () => {
const mask = '<span style="color: yellow;">$1</span>';
const oNotify = notif;
notif = (text) => {
if (!settings.value('underscript.disable.ping') && !pendingIgnore.get()) {
if (settings.value('underscript.disable.notify')) {
return oNotify(text);
}
const regex = fn.pingRegex();
if (regex.test(text)) {
if (soundsEnabled) {
(new Audio("sounds/highlight.wav")).play();
}
return text.replace(regex, mask);
}
}
return text;
};
});