mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-16 01:56:55 +00:00
4.20.18
* Added: Setting to apply username colors to chat mentions. (Closes #753) * Changed: Stream links now use a darker color. * Changed: Make the icon for FFZ's Alternative Viewer Count slightly larger. * Fixed: Crazy flickering when disabling hosting. * Fixed: Stream links showing up on the home page and not just the live page. * Fixed: Better detection for channels where the Host button should appear. * Fixed: FFZ's Alternative Viewer Count metadata not updating correctly when FS Chat is in use.
This commit is contained in:
parent
2f105eb3c4
commit
fa3d73e05a
10 changed files with 158 additions and 14 deletions
|
@ -628,6 +628,16 @@ export default class Chat extends Module {
|
|||
}
|
||||
});
|
||||
|
||||
this.settings.add('chat.filtering.color-mentions', {
|
||||
default: false,
|
||||
ui: {
|
||||
component: 'setting-check-box',
|
||||
path: 'Chat > Filtering >> Appearance',
|
||||
title: 'Display mentions in chat with username colors.',
|
||||
description: '**Note:** Not compatible with color overrides as mentions do not include user IDs.'
|
||||
}
|
||||
});
|
||||
|
||||
this.settings.add('chat.filtering.bold-mentions', {
|
||||
default: true,
|
||||
ui: {
|
||||
|
@ -853,6 +863,21 @@ export default class Chat extends Module {
|
|||
for(const room of this.iterateRooms())
|
||||
room.buildBitsCSS();
|
||||
});
|
||||
|
||||
this.context.on('changed:chat.filtering.color-mentions', async val => {
|
||||
if ( val )
|
||||
await this.createColorCache();
|
||||
else
|
||||
this.color_cache = null;
|
||||
|
||||
this.emit(':update-lines');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async createColorCache() {
|
||||
const LRUCache = await require(/* webpackChunkName: 'utils' */ 'mnemonist/lru-cache');
|
||||
this.color_cache = new LRUCache(150);
|
||||
}
|
||||
|
||||
|
||||
|
@ -866,6 +891,9 @@ export default class Chat extends Module {
|
|||
|
||||
|
||||
onEnable() {
|
||||
if ( this.context.get('chat.filtering.color-mentions') )
|
||||
this.createColorCache().then(() => this.emit(':update-lines'));
|
||||
|
||||
for(const key in TOKENIZERS)
|
||||
if ( has(TOKENIZERS, key) )
|
||||
this.addTokenizer(TOKENIZERS[key]);
|
||||
|
@ -1143,6 +1171,9 @@ export default class Chat extends Module {
|
|||
user.displayName = user.displayName || user.userDisplayName || user.login || ext.displayName;
|
||||
user.isIntl = user.login && user.displayName && user.displayName.trim().toLowerCase() !== user.login;
|
||||
|
||||
if ( this.color_cache && user.color )
|
||||
this.color_cache.set(user.login, user.color);
|
||||
|
||||
// Standardize Message Content
|
||||
if ( ! msg.message && msg.messageParts )
|
||||
this.detokenizeMessage(msg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue