mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-16 01:56:55 +00:00
WIP Set-Hiding
Suggestions are created every time more than 2 letters are typed after the colon, after which it updates on every new or removed letter. Optimally we'd want some caching on the very first time we "hydrate" the emotes and attach their owner information back on afterwards. As for filtering... That still needs to be done on the fly for obvious reasons.
This commit is contained in:
parent
8c9a3aa8a4
commit
d6b2c283e9
2 changed files with 48 additions and 34 deletions
|
@ -227,6 +227,10 @@ export default class Emotes extends Module {
|
|||
return this.getHidden(source).includes(id);
|
||||
}
|
||||
|
||||
isSetHidden(source, id) {
|
||||
return this.settings.provider.get('emote-menu.hidden-sets').includes(`${source}-${id}`);
|
||||
}
|
||||
|
||||
getHidden(source) {
|
||||
return this.settings.provider.get(`hidden-emotes.${source}`, []);
|
||||
}
|
||||
|
|
|
@ -478,6 +478,13 @@ export default class Input extends Module {
|
|||
return [];
|
||||
}
|
||||
|
||||
for (let i = 0; i < hydratedEmotes.length; i++) {
|
||||
const owner = inst.props.emotes[i].owner;
|
||||
if (owner) {
|
||||
hydratedEmotes[i].owner = owner;
|
||||
}
|
||||
}
|
||||
|
||||
const usageResults = [],
|
||||
startingResults = [],
|
||||
otherResults = [],
|
||||
|
@ -487,6 +494,7 @@ export default class Input extends Module {
|
|||
|
||||
for (const set of hydratedEmotes) {
|
||||
if (set && Array.isArray(set.emotes)) {
|
||||
if ( ! this.emotes.isSetHidden('twitch', set.owner?.id)) {
|
||||
for (const emote of set.emotes) {
|
||||
if (inst.doesEmoteMatchTerm(emote, search) && ! hidden.includes(emote.id)) {
|
||||
const favorite = favorites.includes(emote.id);
|
||||
|
@ -513,6 +521,7 @@ export default class Input extends Module {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
usageResults.sort((a, b) => this.EmoteUsageCount[b.replacement] - this.EmoteUsageCount[a.replacement]);
|
||||
startingResults.sort((a, b) => a.replacement.localeCompare(b.replacement));
|
||||
|
@ -590,6 +599,7 @@ export default class Input extends Module {
|
|||
|
||||
for(const set of sets) {
|
||||
if ( set && set.emotes )
|
||||
if ( ! this.emotes.isSetHidden(set.source || 'ffz', set.id))
|
||||
for(const emote of Object.values(set.emotes))
|
||||
if ( inst.doesEmoteMatchTerm(emote, search) && !added_emotes.has(emote.name) && ! this.emotes.isHidden(set.source || 'ffz', emote.id) ) {
|
||||
const favorite = this.emotes.isFavorite(set.source || 'ffz', emote.id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue