Add type casts
This commit is contained in:
parent
75832c1ad6
commit
de1ca9af74
|
@ -451,7 +451,7 @@ let safetychat = [
|
|||
let chatSaveTimeout;
|
||||
let importFlashTimeout;
|
||||
export let isChatSaving = false;
|
||||
let chat_create_date = 0;
|
||||
let chat_create_date = '';
|
||||
let firstRun = false;
|
||||
let settingsReady = false;
|
||||
let currentVersion = '0.0.0';
|
||||
|
@ -5260,7 +5260,7 @@ export function activateSendButtons() {
|
|||
is_send_press = false;
|
||||
$('#send_but').removeClass('displayNone');
|
||||
$('#mes_continue').removeClass('displayNone');
|
||||
$('#send_textarea').attr('disabled', false);
|
||||
$('#send_textarea').attr('disabled', String(false));
|
||||
$('.mes_buttons:last').show();
|
||||
hideStopButton();
|
||||
}
|
||||
|
@ -6477,7 +6477,7 @@ export async function displayPastChats() {
|
|||
$('#select_chat_div').append(template);
|
||||
|
||||
if (currentChat === fileName.toString().replace('.jsonl', '')) {
|
||||
$('#select_chat_div').find('.select_chat_block:last').attr('highlight', true);
|
||||
$('#select_chat_div').find('.select_chat_block:last').attr('highlight', String(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7170,7 +7170,7 @@ function openCharacterWorldPopup() {
|
|||
if (previousValue && !name) {
|
||||
try {
|
||||
// Dirty hack to remove embedded lorebook from character JSON data.
|
||||
const data = JSON.parse($('#character_json_data').val());
|
||||
const data = JSON.parse(String($('#character_json_data').val()));
|
||||
|
||||
if (data?.data?.character_book) {
|
||||
data.data.character_book = undefined;
|
||||
|
@ -7327,7 +7327,7 @@ function addAlternateGreeting(template, greeting, index, getArray) {
|
|||
async function createOrEditCharacter(e) {
|
||||
$('#rm_info_avatar').html('');
|
||||
const formData = new FormData($('#form_create').get(0));
|
||||
formData.set('fav', fav_ch_checked);
|
||||
formData.set('fav', String(fav_ch_checked));
|
||||
|
||||
const rawFile = formData.get('avatar');
|
||||
if (rawFile instanceof File) {
|
||||
|
@ -7336,7 +7336,7 @@ async function createOrEditCharacter(e) {
|
|||
}
|
||||
|
||||
if ($('#form_create').attr('actiontype') == 'createcharacter') {
|
||||
if ($('#character_name_pole').val().length > 0) {
|
||||
if (String($('#character_name_pole').val()).length > 0) {
|
||||
if (is_group_generating || is_send_press) {
|
||||
toastr.error('Cannot create characters while generating. Stop the request and try again.', 'Creation aborted');
|
||||
throw new Error('Cannot import character while generating');
|
||||
|
@ -7361,7 +7361,7 @@ async function createOrEditCharacter(e) {
|
|||
url: url,
|
||||
data: formData,
|
||||
beforeSend: function () {
|
||||
$('#create_button').attr('disabled', true);
|
||||
$('#create_button').attr('disabled', String(true));
|
||||
$('#create_button').attr('value', '⏳');
|
||||
},
|
||||
cache: false,
|
||||
|
@ -7448,7 +7448,7 @@ async function createOrEditCharacter(e) {
|
|||
url: url,
|
||||
data: formData,
|
||||
beforeSend: function () {
|
||||
$('#create_button').attr('disabled', true);
|
||||
$('#create_button').attr('disabled', String(true));
|
||||
$('#create_button').attr('value', 'Save');
|
||||
},
|
||||
cache: false,
|
||||
|
@ -8569,8 +8569,7 @@ jQuery(async function () {
|
|||
e.stopPropagation();
|
||||
chat_file_for_del = $(this).attr('file_name');
|
||||
console.debug('detected cross click for' + chat_file_for_del);
|
||||
popup_type = 'del_chat';
|
||||
callPopup('<h3>Delete the Chat File?</h3>');
|
||||
callPopup('<h3>Delete the Chat File?</h3>', 'del_chat');
|
||||
});
|
||||
|
||||
$('#advanced_div').click(function () {
|
||||
|
@ -9434,10 +9433,10 @@ jQuery(async function () {
|
|||
edit_textarea.height(edit_textarea[0].scrollHeight);
|
||||
edit_textarea.focus();
|
||||
edit_textarea[0].setSelectionRange( //this sets the cursor at the end of the text
|
||||
edit_textarea.val().length,
|
||||
edit_textarea.val().length,
|
||||
String(edit_textarea.val()).length,
|
||||
String(edit_textarea.val()).length,
|
||||
);
|
||||
if (this_edit_mes_id == chat.length - 1) {
|
||||
if (Number(this_edit_mes_id) === chat.length - 1) {
|
||||
$('#chat').scrollTop(chatScrollPosition);
|
||||
}
|
||||
|
||||
|
@ -9660,6 +9659,11 @@ jQuery(async function () {
|
|||
|
||||
$('#character_import_file').on('change', async function (e) {
|
||||
$('#rm_info_avatar').html('');
|
||||
|
||||
if (!(e.target instanceof HTMLInputElement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!e.target.files.length) {
|
||||
return;
|
||||
}
|
||||
|
@ -9793,7 +9797,7 @@ jQuery(async function () {
|
|||
$(document).on('click', '.mes_create_branch', async function () {
|
||||
var selected_mes_id = $(this).closest('.mes').attr('mesid');
|
||||
if (selected_mes_id !== undefined) {
|
||||
branchChat(selected_mes_id);
|
||||
branchChat(Number(selected_mes_id));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -9899,7 +9903,7 @@ jQuery(async function () {
|
|||
|
||||
var targetParentHasOpenDrawer = clickTarget.parents('.openDrawer').length;
|
||||
if (clickTarget.hasClass('drawer-icon') == false && !clickTarget.hasClass('openDrawer')) {
|
||||
if (jQuery.find('.openDrawer').length !== 0) {
|
||||
if ($('.openDrawer').length !== 0) {
|
||||
if (targetParentHasOpenDrawer === 0) {
|
||||
//console.log($('.openDrawer').not('.pinnedOpen').length);
|
||||
$('.openDrawer').not('.pinnedOpen').addClass('resizing').slideToggle(200, 'swing', function () {
|
||||
|
@ -10144,10 +10148,10 @@ jQuery(async function () {
|
|||
const masterSelector = '#' + $(this).data('for');
|
||||
const masterElement = $(masterSelector);
|
||||
if (e.key === 'Enter') {
|
||||
let manualInput = parseFloat($(this).val());
|
||||
let manualInput = Number($(this).val());
|
||||
if (isManualInput) {
|
||||
//disallow manual inputs outside acceptable range
|
||||
if (manualInput >= $(this).attr('min') && manualInput <= $(this).attr('max')) {
|
||||
if (manualInput >= Number($(this).attr('min')) && manualInput <= Number($(this).attr('max'))) {
|
||||
//if value is ok, assign to slider and update handle text and position
|
||||
//newSlider.val(manualInput)
|
||||
//handleSlideEvent.call(newSlider, null, { value: parseFloat(manualInput) }, 'manual');
|
||||
|
@ -10172,10 +10176,10 @@ jQuery(async function () {
|
|||
.on('mouseup blur', function () {
|
||||
const masterSelector = '#' + $(this).data('for');
|
||||
const masterElement = $(masterSelector);
|
||||
let manualInput = parseFloat($(this).val());
|
||||
let manualInput = Number($(this).val());
|
||||
if (isManualInput) {
|
||||
//if value is between correct range for the slider
|
||||
if (manualInput >= $(this).attr('min') && manualInput <= $(this).attr('max')) {
|
||||
if (manualInput >= Number($(this).attr('min')) && manualInput <= Number($(this).attr('max'))) {
|
||||
valueBeforeManualInput = manualInput;
|
||||
//set the slider value to input value
|
||||
$(masterElement).val($(this).val()).trigger('input');
|
||||
|
|
Loading…
Reference in New Issue