mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-07 06:40:54 +00:00
4.36.0
* Added: Setting to hide specific chat token types from rendering in chat, in case you for some reason don't want to see cheers / emotes / whatever. * Added: Support for the Artist, No Audio, and No Video badges in different badge styles. * API Added: The `site.player` module now exports CSS rules for the player control containers, so that FS Chat (and maybe other add-ons) won't need updates in the future if the CSS rule changes slightly.
This commit is contained in:
parent
168db52e2b
commit
dd248838ad
9 changed files with 125 additions and 13 deletions
|
@ -37,6 +37,10 @@ function sortPriorityColorTerms(list) {
|
|||
|
||||
const TERM_FLAGS = ['g', 'gi'];
|
||||
|
||||
const UNBLOCKABLE_TOKENS = [
|
||||
'filter_test'
|
||||
];
|
||||
|
||||
function formatTerms(data) {
|
||||
const out = [];
|
||||
|
||||
|
@ -441,6 +445,29 @@ export default class Chat extends Module {
|
|||
}
|
||||
});
|
||||
|
||||
this.settings.add('chat.filtering.hidden-tokens', {
|
||||
default: [],
|
||||
type: 'array_merge',
|
||||
always_inherit: true,
|
||||
process(ctx, val) {
|
||||
const out = new Set;
|
||||
for(const v of val)
|
||||
if ( v?.v || ! UNBLOCKABLE_TOKENS.includes(v.v) )
|
||||
out.add(v.v);
|
||||
|
||||
return out;
|
||||
},
|
||||
|
||||
ui: {
|
||||
path: 'Chat > Appearance >> Hidden Token Types @{"description":"This filter allows you to prevent specific content token types from appearing chat messages, such as hiding all cheers or emotes."}',
|
||||
component: 'blocked-types',
|
||||
data: () => Object
|
||||
.keys(this.tokenizers)
|
||||
.filter(key => ! UNBLOCKABLE_TOKENS.includes(key) && this.tokenizers[key]?.render)
|
||||
.sort()
|
||||
}
|
||||
});
|
||||
|
||||
this.settings.add('chat.filtering.highlight-basic-users', {
|
||||
default: [],
|
||||
type: 'array_merge',
|
||||
|
@ -1978,12 +2005,14 @@ export default class Chat extends Module {
|
|||
tokenizers = this.tokenizers,
|
||||
l = tokens.length;
|
||||
|
||||
const hidden = this.context.get('chat.filtering.hidden-tokens');
|
||||
|
||||
for(let i=0; i < l; i++) {
|
||||
const token = tokens[i],
|
||||
type = token.type,
|
||||
tk = tokenizers[type];
|
||||
|
||||
if ( token.hidden )
|
||||
if ( token.hidden || hidden.has(type) )
|
||||
continue;
|
||||
|
||||
let res;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue