mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-28 15:27:43 +00:00
4.20.84
* Fixed: Case-sensitive blocked terms not functioning correctly. * Fixed: Settings in the FFZ Control Center not reverting to a default appearance when reset. * Fixed: Current Channel and Channel Color not being properly detected in the mod view, channel pages, and dashboard. * Fixed: The channel points reward queue not functioning correctly. * Changed: Allow highlighting and blocking by add-on badge, not just Twitch badge. * Changed: Don't allocate `user.badges` and `user.emote_sets` until they're actually used to save on memory. * Changed: Don't default the `Chat > Bits and Cheering >> Display animated cheers.` setting to the `Animated Emotes` setting. * API Added: `badges.setBulk`, `badges.deleteBulk`, and `badges.extendBulk` for setting badges on users in bulk using an optimized data structure. * API Added: Tokenizers can set `msg.ffz_halt_tokens = true` to prevent further tokenizers running. Useful when just discarding a message.
This commit is contained in:
parent
a8b28b2d27
commit
1cdff0ec67
31 changed files with 533 additions and 1158 deletions
|
@ -620,18 +620,22 @@ export function generateHex(length = 40) {
|
|||
|
||||
|
||||
export class SourcedSet {
|
||||
constructor() {
|
||||
this._cache = [];
|
||||
constructor(use_set = false) {
|
||||
this._use_set = use_set;
|
||||
this._cache = use_set ? new Set : [];
|
||||
}
|
||||
|
||||
_rebuild() {
|
||||
if ( ! this._sources )
|
||||
return;
|
||||
|
||||
this._cache = [];
|
||||
const use_set = this._use_set,
|
||||
cache = this._cache = use_set ? new Set : [];
|
||||
for(const items of this._sources.values())
|
||||
for(const i of items)
|
||||
if ( ! this._cache.includes(i) )
|
||||
if ( use_set )
|
||||
cache.add(i);
|
||||
else if ( ! cache.includes(i) )
|
||||
this._cache.push(i);
|
||||
}
|
||||
|
||||
|
@ -644,7 +648,7 @@ export class SourcedSet {
|
|||
}
|
||||
|
||||
includes(val) {
|
||||
return this._cache.includes(val);
|
||||
return this._use_set ? this._cache.has(val) : this._cache.includes(val);
|
||||
}
|
||||
|
||||
delete(key) {
|
||||
|
@ -659,12 +663,17 @@ export class SourcedSet {
|
|||
this._sources = new Map;
|
||||
|
||||
const had = this.has(key);
|
||||
this._sources.set(key, [false, items]);
|
||||
if ( had )
|
||||
items = [...this._sources.get(key), ...items];
|
||||
|
||||
this._sources.set(key, items);
|
||||
if ( had )
|
||||
this._rebuild();
|
||||
else
|
||||
for(const i of items)
|
||||
if ( ! this._cache.includes(i) )
|
||||
if ( this._use_set )
|
||||
this._cache.add(i);
|
||||
else if ( ! this._cache.includes(i) )
|
||||
this._cache.push(i);
|
||||
}
|
||||
|
||||
|
@ -673,13 +682,18 @@ export class SourcedSet {
|
|||
this._sources = new Map;
|
||||
|
||||
const had = this.has(key);
|
||||
this._sources.set(key, [val]);
|
||||
if ( ! Array.isArray(val) )
|
||||
val = [val];
|
||||
|
||||
this._sources.set(key, val);
|
||||
if ( had )
|
||||
this._rebuild();
|
||||
|
||||
else if ( ! this._cache.includes(val) )
|
||||
this._cache.push(val);
|
||||
else
|
||||
for(const i of val)
|
||||
if ( this._use_set )
|
||||
this._cache.add(i);
|
||||
else if ( ! this._cache.includes(i) )
|
||||
this._cache.push(i);
|
||||
}
|
||||
|
||||
push(key, val) {
|
||||
|
@ -694,7 +708,9 @@ export class SourcedSet {
|
|||
return;
|
||||
|
||||
old_val.push(val);
|
||||
if ( ! this._cache.includes(val) )
|
||||
if ( this._use_set )
|
||||
this._cache.add(val);
|
||||
else if ( ! this._cache.includes(val) )
|
||||
this._cache.push(val);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue