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 -3Showing whitespace changes
public/scripts/macros/engine/MacroDiagnostics.js+1 -3
@@ -3,7 +3,6 @@
33/** @typedef {import('chevrotain').ILexingError} ILexingError */
44/** @typedef {import('chevrotain').IRecognitionException} IRecognitionException */
55
6-import { saveSettingsDebounced } from '/script.js';
76import { t } from '/scripts/i18n.js';
87import { Popup, POPUP_RESULT } from '/scripts/popup.js';
98import { power_user } from '/scripts/power-user.js';
@@ -61,8 +60,7 @@ async function onboardingExperimentalMacroEngineUnsafe(feature = null) {
6160 <p>${t`Would you like to enable it now?`}</p>`);
6261 if (result == POPUP_RESULT.AFFIRMATIVE) {
6362 power_user.experimental_macro_engine = true;
6463 $('#experimental_macro_engine').prop('checked', power_user.experimental_macro_engine).trigger('input');
65- saveSettingsDebounced();
6664 }
6765
6866 // Only show this once
public/scripts/power-user.js+12 -0
@@ -4015,6 +4015,18 @@ jQuery(() => {
40154015 $('#experimental_macro_engine').on('input', function () {
40164016 power_user.experimental_macro_engine = !!$(this).prop('checked');
40174017 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+ });
40184030 });
40194031
40204032 $('#disable_group_trimming').on('input', function () {