Show a page reload prompt on EME toggle (#4994) * Show a page reload prompt on EME toggle #4992 * Fix lint * Orange toast
Signed| @@ -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 */ |
| 5 | 5 | ||
| 6 | import { saveSettingsDebounced } from '/script.js'; | ||
| 7 | import { t } from '/scripts/i18n.js'; | 6 | import { t } from '/scripts/i18n.js'; |
| 8 | import { Popup, POPUP_RESULT } from '/scripts/popup.js'; | 7 | import { Popup, POPUP_RESULT } from '/scripts/popup.js'; |
| 9 | import { power_user } from '/scripts/power-user.js'; | 8 | import { 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 | } |
| 67 | 65 | ||
| 68 | // Only show this once | 66 | // Only show this once |
| @@ -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 | }); |
| 4019 | 4031 | ||
| 4020 | $('#disable_group_trimming').on('input', function () { | 4032 | $('#disable_group_trimming').on('input', function () { |