mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-07 06:40:54 +00:00
4.20.90
* Added: Support for custom VIP Badge images. * Fixed: Certain emotes breaking when `Large Emotes` is combined with `Fix bad Twitch emotes`. (Closes #1020) * Fixed: Remember the Compressor state, if it was toggled, when resetting the player. (Closes #1024) * API Added: The `chat` module has two methods for maintaining a list of possible message highlight reasons, for use populating UI. Accessible via methods `addHighlightReason(key, data)` and `getHighlightReasons()`. * API Added: `basic_array_merge` setting type. * API Added: Logs now include the initial URL that the script was loaded into. * API Changed: `<select>` settings can now support multiple selected values.
This commit is contained in:
parent
ae90b8e4fe
commit
a80728a10d
13 changed files with 183 additions and 28 deletions
|
@ -8,7 +8,7 @@ import dayjs from 'dayjs';
|
|||
|
||||
import Module from 'utilities/module';
|
||||
import {createElement, ManagedStyle} from 'utilities/dom';
|
||||
import {timeout, has, glob_to_regex, escape_regex, split_chars} from 'utilities/object';
|
||||
import {timeout, has, glob_to_regex, escape_regex, split_chars, deep_copy} from 'utilities/object';
|
||||
|
||||
import Badges from './badges';
|
||||
import Emotes from './emotes';
|
||||
|
@ -88,11 +88,28 @@ export default class Chat extends Module {
|
|||
this.rich_providers = {};
|
||||
this.__rich_providers = [];
|
||||
|
||||
this._hl_reasons = {};
|
||||
this.addHighlightReason('mention', 'Mentioned');
|
||||
this.addHighlightReason('user', 'Highlight User');
|
||||
this.addHighlightReason('badge', 'Highlight Badge');
|
||||
this.addHighlightReason('term', 'Highlight Term');
|
||||
|
||||
// ========================================================================
|
||||
// Settings
|
||||
// ========================================================================
|
||||
|
||||
/*this.settings.add('debug.highlight-reason', {
|
||||
default: [],
|
||||
type: 'basic_array_merge',
|
||||
ui: {
|
||||
path: 'Chat > Debugging >> General',
|
||||
title: 'Test',
|
||||
component: 'setting-select-box',
|
||||
multiple: true,
|
||||
data: () => this.getHighlightReasons()
|
||||
}
|
||||
});*/
|
||||
|
||||
this.settings.add('debug.link-resolver.source', {
|
||||
default: null,
|
||||
ui: {
|
||||
|
@ -1598,6 +1615,28 @@ export default class Chat extends Module {
|
|||
}
|
||||
|
||||
|
||||
addHighlightReason(key, data) {
|
||||
if ( typeof key === 'object' && key.key ) {
|
||||
data = key;
|
||||
key = data.key;
|
||||
|
||||
} else if ( typeof data === 'string' )
|
||||
data = {title: data};
|
||||
|
||||
data.value = data.key = key;
|
||||
if ( ! data.i18n_key )
|
||||
data.i18n_key = `hl-reason.${key}`;
|
||||
|
||||
if ( this._hl_reasons[key] )
|
||||
throw new Error(`Highlight Reason already exists with key ${key}`);
|
||||
|
||||
this._hl_reasons[key] = data;
|
||||
}
|
||||
|
||||
getHighlightReasons() {
|
||||
return Object.values(this._hl_reasons);
|
||||
}
|
||||
|
||||
addTokenizer(tokenizer) {
|
||||
const type = tokenizer.type;
|
||||
this.tokenizers[type] = tokenizer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue