mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Don't need a hack since you're not awaiting the popup
This commit is contained in:
@ -7095,57 +7095,49 @@ function onScenarioOverrideRemoveClick() {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
function callPopup(text, type, inputValue = '', { okButton, rows, wide, large, allowHorizontalScrolling, allowVerticalScrolling, cropAspect } = {}) {
|
function callPopup(text, type, inputValue = '', { okButton, rows, wide, large, allowHorizontalScrolling, allowVerticalScrolling, cropAspect } = {}) {
|
||||||
|
function getOkButtonText() {
|
||||||
|
if (['avatarToCrop'].includes(popup_type)) {
|
||||||
|
return okButton ?? 'Accept';
|
||||||
|
} else if (['text', 'alternate_greeting', 'char_not_selected'].includes(popup_type)) {
|
||||||
|
$dialoguePopupCancel.css('display', 'none');
|
||||||
|
return okButton ?? 'Ok';
|
||||||
|
} else if (['delete_extension'].includes(popup_type)) {
|
||||||
|
return okButton ?? 'Ok';
|
||||||
|
} else if (['new_chat', 'confirm'].includes(popup_type)) {
|
||||||
|
return okButton ?? 'Yes';
|
||||||
|
} else if (['input'].includes(popup_type)) {
|
||||||
|
return okButton ?? 'Save';
|
||||||
|
}
|
||||||
|
return okButton ?? 'Delete';
|
||||||
|
}
|
||||||
|
|
||||||
dialogueCloseStop = true;
|
dialogueCloseStop = true;
|
||||||
if (type) {
|
if (type) {
|
||||||
popup_type = type;
|
popup_type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#dialogue_popup').toggleClass('wide_dialogue_popup', !!wide);
|
const $dialoguePopup = $('#dialogue_popup');
|
||||||
$('#dialogue_popup').toggleClass('large_dialogue_popup', !!large);
|
const $dialoguePopupCancel = $('#dialogue_popup_cancel');
|
||||||
$('#dialogue_popup').toggleClass('horizontal_scrolling_dialogue_popup', !!allowHorizontalScrolling);
|
const $dialoguePopupOk = $('#dialogue_popup_ok');
|
||||||
$('#dialogue_popup').toggleClass('vertical_scrolling_dialogue_popup', !!allowVerticalScrolling);
|
const $dialoguePopupInput = $('#dialogue_popup_input');
|
||||||
|
const $dialoguePopupText = $('#dialogue_popup_text');
|
||||||
|
const $shadowPopup = $('#shadow_popup');
|
||||||
|
|
||||||
$('#dialogue_popup_cancel').css('display', 'inline-block');
|
$dialoguePopup.toggleClass('wide_dialogue_popup', !!wide)
|
||||||
switch (popup_type) {
|
.toggleClass('large_dialogue_popup', !!large)
|
||||||
case 'avatarToCrop':
|
.toggleClass('horizontal_scrolling_dialogue_popup', !!allowHorizontalScrolling)
|
||||||
$('#dialogue_popup_ok').text(okButton ?? 'Accept');
|
.toggleClass('vertical_scrolling_dialogue_popup', !!allowVerticalScrolling);
|
||||||
break;
|
|
||||||
case 'text':
|
|
||||||
case 'alternate_greeting':
|
|
||||||
case 'char_not_selected':
|
|
||||||
$('#dialogue_popup_ok').text(okButton ?? 'Ok');
|
|
||||||
$('#dialogue_popup_cancel').css('display', 'none');
|
|
||||||
break;
|
|
||||||
case 'delete_extension':
|
|
||||||
$('#dialogue_popup_ok').text(okButton ?? 'Ok');
|
|
||||||
break;
|
|
||||||
case 'new_chat':
|
|
||||||
case 'confirm':
|
|
||||||
$('#dialogue_popup_ok').text(okButton ?? 'Yes');
|
|
||||||
break;
|
|
||||||
case 'del_group':
|
|
||||||
case 'rename_chat':
|
|
||||||
case 'del_chat':
|
|
||||||
default:
|
|
||||||
$('#dialogue_popup_ok').text(okButton ?? 'Delete');
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#dialogue_popup_input').val(inputValue);
|
$dialoguePopupCancel.css('display', 'inline-block');
|
||||||
$('#dialogue_popup_input').attr('rows', rows ?? 1);
|
$dialoguePopupOk.text(getOkButtonText());
|
||||||
|
$dialoguePopupInput.toggle(popup_type === 'input').val(inputValue).attr('rows', rows ?? 1);
|
||||||
|
$dialoguePopupText.empty().append(text);
|
||||||
|
$shadowPopup.css('display', 'block');
|
||||||
|
|
||||||
if (popup_type == 'input') {
|
if (popup_type == 'input') {
|
||||||
$('#dialogue_popup_input').css('display', 'block');
|
$dialoguePopupInput.trigger('focus');
|
||||||
$('#dialogue_popup_ok').text(okButton ?? 'Save');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#dialogue_popup_input').css('display', 'none');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#dialogue_popup_text').empty().append(text);
|
|
||||||
$('#shadow_popup').css('display', 'block');
|
|
||||||
if (popup_type == 'input') {
|
|
||||||
$('#dialogue_popup_input').focus();
|
|
||||||
}
|
|
||||||
if (popup_type == 'avatarToCrop') {
|
if (popup_type == 'avatarToCrop') {
|
||||||
// unset existing data
|
// unset existing data
|
||||||
crop_data = undefined;
|
crop_data = undefined;
|
||||||
@ -7161,7 +7153,8 @@ function callPopup(text, type, inputValue = '', { okButton, rows, wide, large, a
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$('#shadow_popup').transition({
|
|
||||||
|
$shadowPopup.transition({
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
duration: animation_duration,
|
duration: animation_duration,
|
||||||
easing: animation_easing,
|
easing: animation_easing,
|
||||||
|
@ -1037,17 +1037,13 @@ function onViewTagsListClick() {
|
|||||||
const tagContainer = $('<div class="tag_view_list_tags ui-sortable"></div>');
|
const tagContainer = $('<div class="tag_view_list_tags ui-sortable"></div>');
|
||||||
html.append(tagContainer);
|
html.append(tagContainer);
|
||||||
|
|
||||||
|
callPopup(html, 'text', null, { allowVerticalScrolling: true });
|
||||||
|
|
||||||
// Hacking event subscriptions to be after popup call...
|
|
||||||
setTimeout(function () {
|
|
||||||
printViewTagList();
|
printViewTagList();
|
||||||
makeTagListDraggable(tagContainer);
|
makeTagListDraggable(tagContainer);
|
||||||
|
|
||||||
$('#dialogue_popup .tag-color').on('change', (evt) => onTagColorize(evt));
|
$('#dialogue_popup .tag-color').on('change', (evt) => onTagColorize(evt));
|
||||||
$('#dialogue_popup .tag-color2').on('change', (evt) => onTagColorize2(evt));
|
$('#dialogue_popup .tag-color2').on('change', (evt) => onTagColorize2(evt));
|
||||||
}, 100);
|
|
||||||
|
|
||||||
callPopup(html, 'text', null, { allowVerticalScrolling: true });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleAutoSortTags(toggle) {
|
function toggleAutoSortTags(toggle) {
|
||||||
|
Reference in New Issue
Block a user