mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-10 00:00:53 +00:00
4.20.41
* 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:
parent
0c5dcb4d1b
commit
53b22d8a09
6 changed files with 52 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "frankerfacez",
|
||||
"author": "Dan Salvato LLC",
|
||||
"version": "4.20.40",
|
||||
"version": "4.20.41",
|
||||
"description": "FrankerFaceZ is a Twitch enhancement suite.",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
<input
|
||||
:id="item.full_key"
|
||||
ref="control"
|
||||
:type="type"
|
||||
:placeholder="placeholder"
|
||||
:value="value"
|
||||
class="tw-border-radius-medium tw-font-size-6 tw-pd-x-1 tw-pd-y-05 tw-mg-05 tw-input"
|
||||
@change="onChange"
|
||||
|
@ -62,6 +64,16 @@ export default {
|
|||
mixins: [SettingMixin],
|
||||
props: ['item', 'context'],
|
||||
|
||||
computed: {
|
||||
type() {
|
||||
return this.item.type || 'text';
|
||||
},
|
||||
|
||||
placeholder() {
|
||||
return this.item.placeholder || this.default_value;
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onChange() {
|
||||
const value = this.$refs.control.value;
|
||||
|
|
|
@ -119,11 +119,13 @@ export default class SettingsContext extends EventEmitter {
|
|||
const new_profiles = [],
|
||||
order = this.order = [];
|
||||
|
||||
for(const profile of this.manager.__profiles)
|
||||
if ( profile.toggled && profile.matches(this.__context) ) {
|
||||
new_profiles.push(profile);
|
||||
order.push(profile.id);
|
||||
}
|
||||
if ( ! this.manager.disable_profiles ) {
|
||||
for(const profile of this.manager.__profiles)
|
||||
if ( profile.toggled && profile.matches(this.__context) ) {
|
||||
new_profiles.push(profile);
|
||||
order.push(profile.id);
|
||||
}
|
||||
}
|
||||
|
||||
if ( array_equals(this.__profiles, new_profiles) )
|
||||
return false;
|
||||
|
|
|
@ -34,6 +34,15 @@ export default class SettingsManager extends Module {
|
|||
|
||||
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
|
||||
this.__contexts = [];
|
||||
this.__profiles = [];
|
||||
|
|
|
@ -161,6 +161,9 @@ export default class MenuButton extends SiteModule {
|
|||
if ( this.has_update )
|
||||
return null;
|
||||
|
||||
if ( this.settings.disable_profiles )
|
||||
return <figure class="ffz-i-cog" />;
|
||||
|
||||
if ( this.has_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.i18n.t('site.menu_button.update-desc', 'There is an update available. Please refresh your page.')}
|
||||
</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.i18n.t('site.menu_button.new-desc', 'There {count,plural,one {is one new setting} other {are # new settings}}.', {count: this._new_settings})}
|
||||
</div>)}
|
||||
|
|
|
@ -46,11 +46,23 @@ export default class ThemeEngine extends Module {
|
|||
|
||||
this.settings.add('theme.font.size', {
|
||||
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: {
|
||||
path: 'Appearance > Theme >> Fonts',
|
||||
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`',
|
||||
component: 'setting-text-box'
|
||||
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',
|
||||
type: 'number'
|
||||
},
|
||||
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');
|
||||
if ( typeof size === 'string' && /^[0-9.]+$/.test(size) )
|
||||
size = parseFloat(size);
|
||||
else
|
||||
else if ( typeof size !== 'number' )
|
||||
size = null;
|
||||
|
||||
if ( ! size || isNaN(size) || ! isFinite(size) || size < 1 || size === 13 ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue