Show a page reload prompt on EME toggle (#4994) * Show a page reload prompt on EME toggle #4992 * Fix lint * Orange toast

618918535eefecfcbdd0566a75f62093881644b7

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
2 files changed, +13 -3Ignore whitespace
public/scripts/macros/engine/MacroDiagnostics.js+1 -3
@@ -3,7 +3,6 @@
3/** @typedef {import('chevrotain').ILexingError} ILexingError */3/** @typedef {import('chevrotain').ILexingError} ILexingError */
4/** @typedef {import('chevrotain').IRecognitionException} IRecognitionException */4/** @typedef {import('chevrotain').IRecognitionException} IRecognitionException */
55
6import { saveSettingsDebounced } from '/script.js';
7import { t } from '/scripts/i18n.js';6import { t } from '/scripts/i18n.js';
8import { Popup, POPUP_RESULT } from '/scripts/popup.js';7import { Popup, POPUP_RESULT } from '/scripts/popup.js';
9import { power_user } from '/scripts/power-user.js';8import { power_user } from '/scripts/power-user.js';
@@ -61,8 +60,7 @@ async function onboardingExperimentalMacroEngineUnsafe(feature = null) {
61 <p>${t`Would you like to enable it now?`}</p>`);60 <p>${t`Would you like to enable it now?`}</p>`);
62 if (result == POPUP_RESULT.AFFIRMATIVE) {61 if (result == POPUP_RESULT.AFFIRMATIVE) {
63 power_user.experimental_macro_engine = true;62 power_user.experimental_macro_engine = true;
64 $('#experimental_macro_engine').prop('checked', power_user.experimental_macro_engine);63 $('#experimental_macro_engine').prop('checked', power_user.experimental_macro_engine).trigger('input');
65 saveSettingsDebounced();
66 }64 }
6765
68 // Only show this once66 // Only show this once
public/scripts/power-user.js+12 -0
@@ -4015,6 +4015,18 @@ jQuery(() => {
4015 $('#experimental_macro_engine').on('input', function () {4015 $('#experimental_macro_engine').on('input', function () {
4016 power_user.experimental_macro_engine = !!$(this).prop('checked');4016 power_user.experimental_macro_engine = !!$(this).prop('checked');
4017 saveSettingsDebounced();4017 saveSettingsDebounced();
4018
4019 eventSource.once(event_types.SETTINGS_UPDATED, function() {
4020 toastr.warning(
4021 t`Click here to reload.`,
4022 t`Toggling the Experimental Macro Engine requires a reload.`,
4023 {
4024 onclick: () => window.location.reload(),
4025 timeOut: 10000,
4026 preventDuplicates: true,
4027 },
4028 );
4029 });
4018 });4030 });
40194031
4020 $('#disable_group_trimming').on('input', function () {4032 $('#disable_group_trimming').on('input', function () {