1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-10 00:00:53 +00:00
* Added: Including `?ffz-no-settings` in the URL will prevent FrankerFaceZ from enabling any settings profiles. This should allow users to recover without resetting their settings if they somehow break FFZ and/or Twitch by changing settings.
* Changed: Limit the maximum font size to 25 for the main page.
This commit is contained in:
SirStendec 2020-10-05 20:42:57 -04:00
parent 0c5dcb4d1b
commit 53b22d8a09
6 changed files with 52 additions and 9 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "frankerfacez", "name": "frankerfacez",
"author": "Dan Salvato LLC", "author": "Dan Salvato LLC",
"version": "4.20.40", "version": "4.20.41",
"description": "FrankerFaceZ is a Twitch enhancement suite.", "description": "FrankerFaceZ is a Twitch enhancement suite.",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View file

@ -12,6 +12,8 @@
<input <input
:id="item.full_key" :id="item.full_key"
ref="control" ref="control"
:type="type"
:placeholder="placeholder"
:value="value" :value="value"
class="tw-border-radius-medium tw-font-size-6 tw-pd-x-1 tw-pd-y-05 tw-mg-05 tw-input" class="tw-border-radius-medium tw-font-size-6 tw-pd-x-1 tw-pd-y-05 tw-mg-05 tw-input"
@change="onChange" @change="onChange"
@ -62,6 +64,16 @@ export default {
mixins: [SettingMixin], mixins: [SettingMixin],
props: ['item', 'context'], props: ['item', 'context'],
computed: {
type() {
return this.item.type || 'text';
},
placeholder() {
return this.item.placeholder || this.default_value;
}
},
methods: { methods: {
onChange() { onChange() {
const value = this.$refs.control.value; const value = this.$refs.control.value;

View file

@ -119,11 +119,13 @@ export default class SettingsContext extends EventEmitter {
const new_profiles = [], const new_profiles = [],
order = this.order = []; order = this.order = [];
if ( ! this.manager.disable_profiles ) {
for(const profile of this.manager.__profiles) for(const profile of this.manager.__profiles)
if ( profile.toggled && profile.matches(this.__context) ) { if ( profile.toggled && profile.matches(this.__context) ) {
new_profiles.push(profile); new_profiles.push(profile);
order.push(profile.id); order.push(profile.id);
} }
}
if ( array_equals(this.__profiles, new_profiles) ) if ( array_equals(this.__profiles, new_profiles) )
return false; return false;

View file

@ -34,6 +34,15 @@ export default class SettingsManager extends Module {
this.updateSoon = debounce(() => this.updateRoutes(), 50, false); this.updateSoon = debounce(() => this.updateRoutes(), 50, false);
// Do we want to not enable any profiles?
try {
const params = new URL(window.location).searchParams;
if ( params ) {
if ( params.has('ffz-no-settings') )
this.disable_profiles = true;
}
} catch(err) { /* no-op */ }
// State // State
this.__contexts = []; this.__contexts = [];
this.__profiles = []; this.__profiles = [];

View file

@ -161,6 +161,9 @@ export default class MenuButton extends SiteModule {
if ( this.has_update ) if ( this.has_update )
return null; return null;
if ( this.settings.disable_profiles )
return <figure class="ffz-i-cog" />;
if ( this.has_strings ) if ( this.has_strings )
return this.i18n.formatNumber(this.i18n.new_strings + this.i18n.changed_strings); return this.i18n.formatNumber(this.i18n.new_strings + this.i18n.changed_strings);
@ -326,6 +329,11 @@ export default class MenuButton extends SiteModule {
{this.has_update && (<div class="tw-mg-t-1"> {this.has_update && (<div class="tw-mg-t-1">
{this.i18n.t('site.menu_button.update-desc', 'There is an update available. Please refresh your page.')} {this.i18n.t('site.menu_button.update-desc', 'There is an update available. Please refresh your page.')}
</div>)} </div>)}
{this.settings.disable_profiles && (<div class="tw-mg-t-1">
{this.i18n.tList('site.menu_button.no-settings', 'Settings are disabled in this tab due to the inclusion of "{param}" in the URL.', {
param: <code class="ffz-monospace">?ffz-no-settings</code>
})}
</div>)}
{this._new_settings > 0 && (<div class="tw-mg-t-1"> {this._new_settings > 0 && (<div class="tw-mg-t-1">
{this.i18n.t('site.menu_button.new-desc', 'There {count,plural,one {is one new setting} other {are # new settings}}.', {count: this._new_settings})} {this.i18n.t('site.menu_button.new-desc', 'There {count,plural,one {is one new setting} other {are # new settings}}.', {count: this._new_settings})}
</div>)} </div>)}

View file

@ -46,11 +46,23 @@ export default class ThemeEngine extends Module {
this.settings.add('theme.font.size', { this.settings.add('theme.font.size', {
default: 13, default: 13,
process(ctx, val) {
if ( typeof val !== 'number' )
try {
val = parseFloat(val);
} catch(err) { val = null; }
if ( ! val || val < 1 || isNaN(val) || ! isFinite(val) || val > 25 )
val = 13;
return val;
},
ui: { ui: {
path: 'Appearance > Theme >> Fonts', path: 'Appearance > Theme >> Fonts',
title: 'Font Size', title: 'Font Size',
description: 'How large should normal text be, in pixels. This may be affected by your browser\'s zoom and font settings. The old default was: `12`', description: '**Minimum:** `1`, **Maximum:** `25`, *Old Default:* `12`\n\nHow large should normal text be, in pixels. This may be affected by your browser\'s zoom and font settings.',
component: 'setting-text-box' component: 'setting-text-box',
type: 'number'
}, },
changed: () => this.updateFont() changed: () => this.updateFont()
}); });
@ -187,7 +199,7 @@ The CSS loaded by this setting is far too heavy and can cause performance issues
let size = this.settings.get('theme.font.size'); let size = this.settings.get('theme.font.size');
if ( typeof size === 'string' && /^[0-9.]+$/.test(size) ) if ( typeof size === 'string' && /^[0-9.]+$/.test(size) )
size = parseFloat(size); size = parseFloat(size);
else else if ( typeof size !== 'number' )
size = null; size = null;
if ( ! size || isNaN(size) || ! isFinite(size) || size < 1 || size === 13 ) { if ( ! size || isNaN(size) || ! isFinite(size) || size < 1 || size === 13 ) {