mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-11 00:20:54 +00:00
4.20.15
* Changed: Implemented FFZ rendering of Channel Points redemption notices with no associated messages. (Experiment, 50% roll-out) * Fixed: Channel not properly detecting the current channel's branding color. * Fixed: Unable to delete the profile 0 (Default Profile) * Fixed: Twitch prevented viewer cards from appearing when moved out of the chat area. * Fixed: `addons` should not block loading while its data loads. * Fixed: Issue accessing `i18n` before `settings` has fully loaded. * Fixed: `main_menu` tries to use `i18n` before `i18n` is ready. * Fixed: Main menu throws error if profiles are changed while main menu is open. * Fixed: `site` should not block loading waiting for `settings` * Maintenance: Updated dependencies. * API Added: Initial support for using IndexedDB to store settings rather than localStorage * API Added: Messages now have a `highlights` object if they've matched filters, describing which filters they matched.
This commit is contained in:
parent
65a00df2a9
commit
1c2bf202fc
18 changed files with 478 additions and 244 deletions
|
@ -277,8 +277,10 @@ export const Mentions = {
|
|||
recipient: recipient ? recipient.toLowerCase() : ''
|
||||
});
|
||||
|
||||
if ( mentioned )
|
||||
if ( mentioned ) {
|
||||
(msg.highlights = (msg.highlights || new Set())).add('mention');
|
||||
msg.mentioned = true;
|
||||
}
|
||||
|
||||
// Push the remaining text from the token.
|
||||
text.push(segment.substr(match[0].length));
|
||||
|
@ -315,6 +317,7 @@ export const UserHighlights = {
|
|||
const u = msg.user;
|
||||
for(const [color, regex] of colors) {
|
||||
if ( regex.test(u.login) || regex.test(u.displayName) ) {
|
||||
(msg.highlights = (msg.highlights || new Set())).add('user');
|
||||
msg.mentioned = true;
|
||||
if ( color ) {
|
||||
msg.mention_color = color;
|
||||
|
@ -371,6 +374,7 @@ export const BadgeHighlights = {
|
|||
for(const badge of Object.keys(badges)) {
|
||||
if ( colors.has(badge) ) {
|
||||
const color = colors.get(badge);
|
||||
(msg.highlights = (msg.highlights || new Set())).add('badge');
|
||||
msg.mentioned = true;
|
||||
if ( color ) {
|
||||
msg.mention_color = color;
|
||||
|
@ -454,6 +458,7 @@ export const CustomHighlights = {
|
|||
if ( idx !== nix )
|
||||
out.push({type: 'text', text: text.slice(idx, nix)});
|
||||
|
||||
(msg.highlights = (msg.highlights || new Set())).add('term');
|
||||
msg.mentioned = true;
|
||||
msg.mention_color = color || msg.mention_color;
|
||||
|
||||
|
|
|
@ -252,7 +252,10 @@ export default class MainMenu extends Module {
|
|||
if ( this._update_timer )
|
||||
return;
|
||||
|
||||
this._update_timer = setTimeout(() => this.updateLiveMenu(), 250);
|
||||
this._update_timer = setTimeout(() => {
|
||||
// Make sure i18n is loaded before we try this.
|
||||
this.i18n.enable().then(() => this.updateLiveMenu());
|
||||
}, 250);
|
||||
}
|
||||
|
||||
|
||||
|
@ -597,118 +600,144 @@ export default class MainMenu extends Module {
|
|||
Vue = this.vue.Vue,
|
||||
settings = this.settings,
|
||||
context = settings.main_context,
|
||||
[profiles, profile_keys] = this.getProfiles(),
|
||||
[profiles, profile_keys] = this.getProfiles();
|
||||
|
||||
_c = {
|
||||
profiles,
|
||||
profile_keys,
|
||||
currentProfile: profile_keys[0],
|
||||
let currentProfile = profile_keys[0];
|
||||
if ( ! currentProfile ) {
|
||||
for(let i=profiles.length - 1; i >= 0; i--) {
|
||||
if ( profiles[i].live ) {
|
||||
currentProfile = profiles[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
has_update: this.has_update,
|
||||
if ( ! currentProfile )
|
||||
currentProfile = profiles[0];
|
||||
}
|
||||
|
||||
createProfile: data => {
|
||||
const profile = settings.createProfile(data);
|
||||
return t.getProfileProxy(profile, context);
|
||||
},
|
||||
const _c = {
|
||||
profiles,
|
||||
profile_keys,
|
||||
currentProfile: profile_keys[0] || profiles[0],
|
||||
|
||||
deleteProfile: profile => settings.deleteProfile(profile),
|
||||
has_update: this.has_update,
|
||||
|
||||
getFFZ: () => t.resolve('core'),
|
||||
createProfile: data => {
|
||||
const profile = settings.createProfile(data);
|
||||
return t.getProfileProxy(profile, context);
|
||||
},
|
||||
|
||||
context: {
|
||||
_users: 0,
|
||||
deleteProfile: profile => settings.deleteProfile(profile),
|
||||
|
||||
profiles: context.__profiles.map(profile => profile.id),
|
||||
get: key => context.get(key),
|
||||
uses: key => context.uses(key),
|
||||
getFFZ: () => t.resolve('core'),
|
||||
|
||||
on: (...args) => context.on(...args),
|
||||
off: (...args) => context.off(...args),
|
||||
context: {
|
||||
_users: 0,
|
||||
|
||||
order: id => context.order.indexOf(id),
|
||||
context: deep_copy(context._context),
|
||||
profiles: context.__profiles.map(profile => profile.id),
|
||||
get: key => context.get(key),
|
||||
uses: key => context.uses(key),
|
||||
|
||||
_update_profiles(changed) {
|
||||
const new_list = [],
|
||||
profiles = context.manager.__profiles;
|
||||
on: (...args) => context.on(...args),
|
||||
off: (...args) => context.off(...args),
|
||||
|
||||
for(let i=0; i < profiles.length; i++) {
|
||||
const profile = profile_keys[profiles[i].id];
|
||||
order: id => context.order.indexOf(id),
|
||||
context: deep_copy(context._context),
|
||||
|
||||
_update_profiles(changed) {
|
||||
const new_list = [],
|
||||
profiles = context.manager.__profiles;
|
||||
|
||||
for(let i=0; i < profiles.length; i++) {
|
||||
const profile = profile_keys[profiles[i].id];
|
||||
if ( profile ) {
|
||||
profile.order = i;
|
||||
|
||||
new_list.push(profile);
|
||||
}
|
||||
}
|
||||
|
||||
Vue.set(_c, 'profiles', new_list);
|
||||
Vue.set(_c, 'profiles', new_list);
|
||||
|
||||
if ( changed && changed.id === _c.currentProfile.id )
|
||||
_c.currentProfile = profile_keys[changed.id];
|
||||
},
|
||||
if ( changed && changed.id === _c.currentProfile.id )
|
||||
_c.currentProfile = profile_keys[changed.id];
|
||||
},
|
||||
|
||||
_profile_created(profile) {
|
||||
Vue.set(profile_keys, profile.id, t.getProfileProxy(profile, context));
|
||||
this._update_profiles()
|
||||
},
|
||||
_profile_created(profile) {
|
||||
Vue.set(profile_keys, profile.id, t.getProfileProxy(profile, context));
|
||||
this._update_profiles()
|
||||
},
|
||||
|
||||
_profile_changed(profile) {
|
||||
Vue.set(profile_keys, profile.id, t.getProfileProxy(profile, context));
|
||||
this._update_profiles(profile);
|
||||
},
|
||||
_profile_changed(profile) {
|
||||
Vue.set(profile_keys, profile.id, t.getProfileProxy(profile, context));
|
||||
this._update_profiles(profile);
|
||||
},
|
||||
|
||||
_profile_toggled(profile, val) {
|
||||
Vue.set(profile_keys[profile.id], 'toggled', val);
|
||||
this._update_profiles(profile);
|
||||
},
|
||||
_profile_toggled(profile, val) {
|
||||
Vue.set(profile_keys[profile.id], 'toggled', val);
|
||||
this._update_profiles(profile);
|
||||
},
|
||||
|
||||
_profile_deleted(profile) {
|
||||
Vue.delete(profile_keys, profile.id);
|
||||
this._update_profiles();
|
||||
_profile_deleted(profile) {
|
||||
Vue.delete(profile_keys, profile.id);
|
||||
this._update_profiles();
|
||||
|
||||
if ( _c.currentProfile.id === profile.id )
|
||||
_c.currentProfile = profile_keys[0]
|
||||
},
|
||||
if ( _c.currentProfile.id === profile.id ) {
|
||||
_c.currentProfile = profile_keys[0];
|
||||
if ( ! _c.currentProfile ) {
|
||||
for(let i=_c.profiles.length - 1; i >= 0; i--) {
|
||||
if ( _c.profiles[i].live ) {
|
||||
_c.currentProfile = _c.profiles[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_context_changed() {
|
||||
this.context = deep_copy(context._context);
|
||||
const profiles = context.manager.__profiles,
|
||||
ids = this.profiles = context.__profiles.map(profile => profile.id);
|
||||
|
||||
for(let i=0; i < profiles.length; i++) {
|
||||
const id = profiles[i].id,
|
||||
profile = profile_keys[id];
|
||||
|
||||
profile.live = ids.includes(id);
|
||||
}
|
||||
},
|
||||
|
||||
_add_user() {
|
||||
this._users++;
|
||||
if ( this._users === 1 ) {
|
||||
settings.on(':profile-toggled', this._profile_toggled, this);
|
||||
settings.on(':profile-created', this._profile_created, this);
|
||||
settings.on(':profile-changed', this._profile_changed, this);
|
||||
settings.on(':profile-deleted', this._profile_deleted, this);
|
||||
settings.on(':profiles-reordered', this._update_profiles, this);
|
||||
context.on('context_changed', this._context_changed, this);
|
||||
context.on('profiles_changed', this._context_changed, this);
|
||||
this.profiles = context.__profiles.map(profile => profile.id);
|
||||
}
|
||||
},
|
||||
|
||||
_remove_user() {
|
||||
this._users--;
|
||||
if ( this._users === 0 ) {
|
||||
settings.off(':profile-toggled', this._profile_toggled, this);
|
||||
settings.off(':profile-created', this._profile_created, this);
|
||||
settings.off(':profile-changed', this._profile_changed, this);
|
||||
settings.off(':profile-deleted', this._profile_deleted, this);
|
||||
settings.off(':profiles-reordered', this._update_profiles, this);
|
||||
context.off('context_changed', this._context_changed, this);
|
||||
context.off('profiles_changed', this._context_changed, this);
|
||||
if ( ! _c.currentProfile )
|
||||
_c.currentProfile = _c.profiles[0];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_context_changed() {
|
||||
this.context = deep_copy(context._context);
|
||||
const profiles = context.manager.__profiles,
|
||||
ids = this.profiles = context.__profiles.map(profile => profile.id);
|
||||
|
||||
for(let i=0; i < profiles.length; i++) {
|
||||
const id = profiles[i].id,
|
||||
profile = profile_keys[id];
|
||||
|
||||
profile.live = ids.includes(id);
|
||||
}
|
||||
},
|
||||
|
||||
_add_user() {
|
||||
this._users++;
|
||||
if ( this._users === 1 ) {
|
||||
settings.on(':profile-toggled', this._profile_toggled, this);
|
||||
settings.on(':profile-created', this._profile_created, this);
|
||||
settings.on(':profile-changed', this._profile_changed, this);
|
||||
settings.on(':profile-deleted', this._profile_deleted, this);
|
||||
settings.on(':profiles-reordered', this._update_profiles, this);
|
||||
context.on('context_changed', this._context_changed, this);
|
||||
context.on('profiles_changed', this._context_changed, this);
|
||||
this.profiles = context.__profiles.map(profile => profile.id);
|
||||
}
|
||||
},
|
||||
|
||||
_remove_user() {
|
||||
this._users--;
|
||||
if ( this._users === 0 ) {
|
||||
settings.off(':profile-toggled', this._profile_toggled, this);
|
||||
settings.off(':profile-created', this._profile_created, this);
|
||||
settings.off(':profile-changed', this._profile_changed, this);
|
||||
settings.off(':profile-deleted', this._profile_deleted, this);
|
||||
settings.off(':profiles-reordered', this._update_profiles, this);
|
||||
context.off('context_changed', this._context_changed, this);
|
||||
context.off('profiles_changed', this._context_changed, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
return _c;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue