Add quiet arg to /context

This commit is contained in:
Cohee
2024-09-07 21:40:21 +03:00
parent 4f5097915e
commit 97a2c4b2c7
2 changed files with 19 additions and 8 deletions

View File

@ -130,19 +130,20 @@ function highlightDefaultPreset() {
/**
* Select context template if not already selected.
* @param {string} preset Preset name.
* @param {boolean} quiet Suppress info message.
*/
export function selectContextPreset(preset) {
export function selectContextPreset(preset, quiet) {
// If context template is not already selected, select it
if (preset !== power_user.context.preset) {
$('#context_presets').val(preset).trigger('change');
toastr.info(`Context Template: preset "${preset}" auto-selected`);
!quiet && toastr.info(`Context Template: preset "${preset}" auto-selected`);
}
// If instruct mode is disabled, enable it, except for default context template
if (!power_user.instruct.enabled && preset !== power_user.default_context) {
power_user.instruct.enabled = true;
$('#instruct_enabled').prop('checked', true).trigger('change');
toastr.info('Instruct Mode enabled');
!quiet && toastr.info('Instruct Mode enabled');
}
saveSettingsDebounced();