Fix A/N and CFG menus on first in the list

14aec430644bee10b5a2de71d663051c7f3c7a24

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

2 files changed, +14 -15Showing whitespace changes
public/scripts/authors-note.js+7 -7
@@ -389,7 +389,11 @@ export function setFloatingPrompt() {
389389}
390390
391391function onANMenuItemClick() {
392392 if (!selected_group ||&& this_chid === undefined) {
393+ toastr.warning(t`Select a character before trying to use Author's Note`, '', { timeOut: 2000 });
394+ return;
395+ }
396+
393397 //show AN if it's hidden
394398 if ($('#floatingPrompt').css('display') !== 'flex') {
395399 $('#floatingPrompt').addClass('resizing');
@@ -416,22 +420,18 @@ function onANMenuItemClick() {
416420 $('#floatingPrompt').transition({
417421 opacity: 0.0,
418422 duration: animation_duration,
419- },
423+ }, async function () {
420- async function () {
421424 await delay(50);
422425 $('#floatingPrompt').removeClass('resizing');
423426 });
424427 setTimeout(function () {
425428 $('#floatingPrompt').hide();
426429 }, animation_duration);
427-
428430 }
431+
429432 //duplicate options menu close handler from script.js
430433 //because this listener takes priority
431434 $('#options').stop().fadeOut(animation_duration);
432- } else {
433- toastr.warning(t`Select a character before trying to use Author's Note`, '', { timeOut: 2000 });
434- }
435435}
436436
437437async function onChatChanged() {
public/scripts/cfg-scale.js+7 -8
@@ -69,8 +69,7 @@ function setCharCfg(tempValue, setting) {
6969 if (!existingCharaCfg.useChara &&
7070 (tempAssign.guidance_scale ?? 1.00) === 1.00 &&
7171 (tempAssign.negative_prompt?.length ?? 0) === 0 &&
7272 (tempAssign.positive_prompt?.length ?? 0) === 0) {
73- {
7473 extension_settings.cfg.chara.splice(existingCharaCfgIndex, 1);
7574 }
7675 } else if (avatarName && tempValue.length > 0) {
@@ -113,7 +112,11 @@ function setChatCfg(tempValue, setting) {
113112
114113// TODO: Only change CFG when character is selected
115114function onCfgMenuItemClick() {
116115 if (!selected_group ||&& this_chid === undefined) {
116+ toastr.warning('Select a character before trying to configure CFG', '', { timeOut: 2000 });
117+ return;
118+ }
119+
117120 //show CFG config if it's hidden
118121 if ($('#cfgConfig').css('display') !== 'flex') {
119122 $('#cfgConfig').addClass('resizing');
@@ -140,8 +143,7 @@ function onCfgMenuItemClick() {
140143 $('#cfgConfig').transition({
141144 opacity: 0.0,
142145 duration: animation_duration,
143- },
146+ }, async function () {
144- async function () {
145147 await delay(50);
146148 $('#cfgConfig').removeClass('resizing');
147149 });
@@ -153,9 +155,6 @@ function onCfgMenuItemClick() {
153155 //duplicate options menu close handler from script.js
154156 //because this listener takes priority
155157 $('#options').stop().fadeOut(animation_duration);
156- } else {
157- toastr.warning('Select a character before trying to configure CFG', '', { timeOut: 2000 });
158- }
159158}
160159
161160async function onChatChanged() {