1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-10-10 13:20:51 +00:00
* Added: Profiles can now be toggled on and off, rather than relying on rules to control them.
* Added: Right-clicking the FFZ menu button in the top right of the page will open a Profiles dialog, letting you quickly toggle a profile on or off.
* Added: Profiles can now be enabled or disabled based upon the time of day.
* Added: Polish and Serbian pluralization rules.
* Fixed: Ensure tool-tips work on the new dashboard.
* Fixed: Ensure the FFZ Control Center works on the new dashboard.
This commit is contained in:
SirStendec 2019-10-09 16:02:25 -04:00
parent 02efd61f00
commit 62bb6440f3
30 changed files with 503 additions and 52 deletions

View file

@ -24,6 +24,7 @@ export default class SettingsProfile extends EventEmitter {
this.data = data;
this.prefix = `p:${this.id}:`;
this.enabled_key = `${this.prefix}:enabled`;
}
get data() {
@ -38,6 +39,7 @@ export default class SettingsProfile extends EventEmitter {
desc_i18n_key: this.desc_i18n_key,
url: this.url,
show_toggle: this.show_toggle,
context: this.context
}
@ -72,6 +74,7 @@ export default class SettingsProfile extends EventEmitter {
version: 2,
type: 'profile',
profile: this.data,
toggled: this.toggled,
values: {}
};
@ -107,6 +110,23 @@ export default class SettingsProfile extends EventEmitter {
}
// ========================================================================
// Toggled
// ========================================================================
get toggled() {
return this.provider.get(this.enabled_key, true);
}
set toggled(val) {
if ( val === this.toggleState )
return;
this.provider.set(this.enabled_key, val);
this.emit('toggled', this, val);
}
// ========================================================================
// Context
// ========================================================================
@ -158,7 +178,7 @@ export default class SettingsProfile extends EventEmitter {
len = p.length;
for(const key of this.provider.keys())
if ( key.startsWith(p) )
if ( key.startsWith(p) && key !== this.enabled_key )
out.push(key.slice(len));
return out;
@ -168,7 +188,7 @@ export default class SettingsProfile extends EventEmitter {
const p = this.prefix,
len = p.length;
for(const key of this.provider.keys())
if ( key.startsWith(p) ) {
if ( key.startsWith(p) && key !== this.enabled_key ) {
this.provider.delete(key);
this.emit('changed', key.slice(len), undefined, true);
}
@ -179,7 +199,7 @@ export default class SettingsProfile extends EventEmitter {
len = p.length;
for(const key of this.provider.keys())
if ( key.startsWith(p) )
if ( key.startsWith(p) && key !== this.enabled_key )
yield [key.slice(len), this.provider.get(key)];
}
@ -188,7 +208,7 @@ export default class SettingsProfile extends EventEmitter {
let count = 0;
for(const key of this.provider.keys())
if ( key.startsWith(p) )
if ( key.startsWith(p) && key !== this.enabled_key )
count++;
return count;