Refactor and fix type errors in WI and script modules (#4123) * remove unnecessary arg passage from WI helper funcs * remove some typescript red from script.js * hide in shame * Add JSDoc to helper functions * Fix fav_ch_checked not updating * Move PWA mode match to firstLoadInit * Fix more type errors and deprecations * Fix the rest of type errors in script.js --------- Co-authored-by: RossAscends <124905043+RossAscends@users.noreply.github.com>
Signed| @@ -30,6 +30,11 @@ declare global { | ||
| 30 | 30 | izoomify(options?: any): JQuery; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | + // NPM package doesn't have the 'queue' property in the type definition | |
| 34 | + interface JQueryTransitOptions { | |
| 35 | + queue?: boolean; | |
| 36 | + } | |
| 37 | + | |
| 33 | 38 | namespace Select2 { |
| 34 | 39 | interface Options<Result = DataFormat | GroupedDataFormat, RemoteResult = any> { |
| 35 | 40 | /** |
| @@ -770,21 +770,6 @@ async function getSystemMessages() { | ||
| 770 | 770 | }; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | -// Register configuration migrations | |
| 774 | -registerPromptManagerMigration(); | |
| 775 | - | |
| 776 | -$(document).ajaxError(function myErrorHandler(_, xhr) { | |
| 777 | - // Cohee: CSRF doesn't error out in multiple tabs anymore, so this is unnecessary | |
| 778 | - /* | |
| 779 | - if (xhr.status == 403) { | |
| 780 | - toastr.warning( | |
| 781 | - 'doubleCsrf errors in console are NORMAL in this case. If you want to run ST in multiple tabs, start the server with --disableCsrf option.', | |
| 782 | - 'Looks like you\'ve opened SillyTavern in another browser tab', | |
| 783 | - { timeOut: 0, extendedTimeOut: 0, preventDuplicates: true }, | |
| 784 | - ); | |
| 785 | - } */ | |
| 786 | -}); | |
| 787 | - | |
| 788 | 773 | async function getClientVersion() { |
| 789 | 774 | try { |
| 790 | 775 | const response = await fetch('/version'); |
| @@ -865,7 +850,8 @@ export let create_save = { | ||
| 865 | 850 | creator: '', |
| 866 | 851 | personality: '', |
| 867 | 852 | first_message: '', |
| 868 | - avatar: '', | |
| 853 | + /** @type {FileList|null} */ | |
| 854 | + avatar: null, | |
| 869 | 855 | scenario: '', |
| 870 | 856 | mes_example: '', |
| 871 | 857 | world: '', |
| @@ -982,6 +968,8 @@ async function firstLoadInit() { | ||
| 982 | 968 | } |
| 983 | 969 | |
| 984 | 970 | showLoader(); |
| 971 | + registerPromptManagerMigration(); | |
| 972 | + initStandaloneMode(); | |
| 985 | 973 | initLibraryShims(); |
| 986 | 974 | addShowdownPatch(showdown); |
| 987 | 975 | reloadMarkdownProcessor(); |
| @@ -1040,6 +1028,13 @@ async function fixViewport() { | ||
| 1040 | 1028 | document.body.style.position = ''; |
| 1041 | 1029 | } |
| 1042 | 1030 | |
| 1031 | +function initStandaloneMode() { | |
| 1032 | + const isPwaMode = window.matchMedia('(display-mode: standalone)').matches; | |
| 1033 | + if (isPwaMode) { | |
| 1034 | + $('body').addClass('PWA'); | |
| 1035 | + } | |
| 1036 | +} | |
| 1037 | + | |
| 1043 | 1038 | function cancelStatusCheck(reason = 'Manually cancelled status check') { |
| 1044 | 1039 | abortStatusCheck?.abort(new AbortReason(reason)); |
| 1045 | 1040 | abortStatusCheck = new AbortController(); |
| @@ -1396,7 +1391,6 @@ export function resultCheckStatus() { | ||
| 1396 | 1391 | stopStatusLoading(); |
| 1397 | 1392 | } |
| 1398 | 1393 | |
| 1399 | - | |
| 1400 | 1394 | /** |
| 1401 | 1395 | * Switches the currently selected character to the one with the given ID. (character index, not the character key!) |
| 1402 | 1396 | * |
| @@ -3760,6 +3754,7 @@ export async function generateRaw(prompt, api, instructOverride, quietToLoud, sy | ||
| 3760 | 3754 | if (responseLengthCustomized) { |
| 3761 | 3755 | TempResponseLength.save(api, responseLength); |
| 3762 | 3756 | } |
| 3757 | + /** @type {object|any[]} */ | |
| 3763 | 3758 | let generateData = {}; |
| 3764 | 3759 | |
| 3765 | 3760 | switch (api) { |
| @@ -7138,6 +7133,11 @@ export async function saveChat({ chatName, withMetadata, mesId, force = false } | ||
| 7138 | 7133 | } |
| 7139 | 7134 | } |
| 7140 | 7135 | |
| 7136 | +/** | |
| 7137 | + * Processes the avatar image from the input element, allowing the user to crop it if necessary. | |
| 7138 | + * @param {HTMLInputElement} input - The input element containing the avatar file. | |
| 7139 | + * @returns {Promise<void>} | |
| 7140 | + */ | |
| 7141 | 7141 | async function read_avatar_load(input) { |
| 7142 | 7142 | if (input.files && input.files[0]) { |
| 7143 | 7143 | if (selected_button == 'create') { |
| @@ -7169,7 +7169,7 @@ async function read_avatar_load(input) { | ||
| 7169 | 7169 | await createOrEditCharacter(); |
| 7170 | 7170 | await delay(DEFAULT_SAVE_EDIT_TIMEOUT); |
| 7171 | 7171 | |
| 7172 | 7172 | const formData = new FormData(/** @type {HTMLFormElement} */($('#form_create').get(0))); |
| 7173 | 7173 | await fetch(getThumbnailUrl('avatar', formData.get('avatar_url')), { |
| 7174 | 7174 | method: 'GET', |
| 7175 | 7175 | cache: 'no-cache', |
| @@ -7179,22 +7179,21 @@ async function read_avatar_load(input) { | ||
| 7179 | 7179 | }, |
| 7180 | 7180 | }); |
| 7181 | 7181 | |
| 7182 | 7182 | const messages = $('.mes').each(async function toArray() {; |
| 7183 | - const nameMatch = $(this).attr('ch_name') == formData.get('ch_name'); | |
| 7183 | + for (const el of messages) { | |
| 7184 | - if ($(this).attr('is_system') == 'true' && !nameMatch) { | |
| 7184 | + const $el = $(el); | |
| 7185 | - return; | |
| 7185 | + const nameMatch = $el.attr('ch_name') == formData.get('ch_name'); | |
| 7186 | - } | |
| 7186 | + if ($el.attr('is_system') == 'true' && !nameMatch) continue; | |
| 7187 | 7187 | if ($(this)el.attr('is_user') == 'true') {continue; |
| 7188 | - return; | |
| 7188 | + | |
| 7189 | - } | |
| 7190 | 7189 | if (nameMatch) { |
| 7191 | 7190 | const previewSrc = $('#avatar_load_preview').attr('src'); |
| 7192 | 7191 | const avatar = $(this)el.find('.avatar img'); |
| 7193 | 7192 | avatar.attr('src', default_avatar); |
| 7194 | 7193 | await delay(1); |
| 7195 | 7194 | avatar.attr('src', previewSrc); |
| 7196 | 7195 | } |
| 7197 | 7196 | }); |
| 7198 | 7197 | |
| 7199 | 7198 | console.log('Avatar refreshed'); |
| 7200 | 7199 | } |
| @@ -8044,7 +8043,7 @@ export async function getChatsFromFiles(data, isGroupChat) { | ||
| 8044 | 8043 | * response is an object with an `error` property set to `true`. |
| 8045 | 8044 | */ |
| 8046 | 8045 | export async function getPastCharacterChats(characterId = null) { |
| 8047 | 8046 | characterId = characterId ?? parseInt(this_chid); |
| 8048 | 8047 | if (!characters[characterId]) return []; |
| 8049 | 8048 | |
| 8050 | 8049 | const response = await fetch('/api/characters/chats', { |
| @@ -8111,9 +8110,7 @@ export async function displayPastChats() { | ||
| 8111 | 8110 | // UX convenience: Focus the search field when the Manage Chat Files view opens. |
| 8112 | 8111 | setTimeout(function () { |
| 8113 | 8112 | const textSearchElement = $('#select_chat_search'); |
| 8114 | - textSearchElement.click(); | |
| 8113 | + textSearchElement.trigger('click').trigger('focus').trigger('select'); | |
| 8115 | - textSearchElement.focus(); | |
| 8116 | - textSearchElement.select(); // select content (if any) for easy erasing | |
| 8117 | 8114 | }, 200); |
| 8118 | 8115 | } |
| 8119 | 8116 | |
| @@ -8380,11 +8377,10 @@ function select_rm_create({ switchMenu = true } = {}) { | ||
| 8380 | 8377 | switchMenu && setMenuType('create'); |
| 8381 | 8378 | |
| 8382 | 8379 | //console.log('select_rm_Create() -- selected button: '+selected_button); |
| 8383 | 8380 | if (selected_button == 'create' && create_save.avatar) { |
| 8384 | - if (create_save.avatar != '') { | |
| 8381 | + const addAvatarInput = /** @type {HTMLInputElement} */ ($('#add_avatar_button').get(0)); | |
| 8385 | 8382 | $('#add_avatar_button').get(0) addAvatarInput.files = create_save.avatar; |
| 8386 | - read_avatar_load($('#add_avatar_button').get(0)); | |
| 8383 | + read_avatar_load(addAvatarInput); | |
| 8387 | - } | |
| 8388 | 8384 | } |
| 8389 | 8385 | |
| 8390 | 8386 | switchMenu && selectRightMenuWithAnimation('rm_ch_create_block'); |
| @@ -8510,11 +8506,18 @@ export function updateChatMetadata(newValues, reset) { | ||
| 8510 | 8506 | chat_metadata = reset ? { ...newValues } : { ...chat_metadata, ...newValues }; |
| 8511 | 8507 | } |
| 8512 | 8508 | |
| 8509 | + | |
| 8510 | +/** | |
| 8511 | + * Updates the state of the favorite button based on the provided state. | |
| 8512 | + * @param {boolean} state Whether the favorite button should be on or off. | |
| 8513 | + */ | |
| 8513 | 8514 | function updateFavButtonState(state) { |
| 8515 | + // Update global state of the flag | |
| 8516 | + // TODO: This is bad and needs to be refactored. | |
| 8514 | 8517 | fav_ch_checked = state; |
| 8515 | 8518 | $('#fav_checkbox').valprop(fav_ch_checked'checked', state); |
| 8516 | 8519 | $('#favorite_button').toggleClass('fav_on', fav_ch_checkedstate); |
| 8517 | 8520 | $('#favorite_button').toggleClass('fav_off', !fav_ch_checkedstate); |
| 8518 | 8521 | } |
| 8519 | 8522 | |
| 8520 | 8523 | export async function setScenarioOverride() { |
| @@ -8830,7 +8833,7 @@ function updateEditArrowClasses() { | ||
| 8830 | 8833 | export function closeMessageEditor(what = 'all') { |
| 8831 | 8834 | if (what === 'message' || what === 'all') { |
| 8832 | 8835 | if (this_edit_mes_id) { |
| 8833 | 8836 | $(`#chat .mes[mesid="${this_edit_mes_id}"] .mes_edit_cancel`).clicktrigger('click'); |
| 8834 | 8837 | } |
| 8835 | 8838 | } |
| 8836 | 8839 | if (what === 'reasoning' || what === 'all') { |
| @@ -8919,7 +8922,8 @@ function openCharacterWorldPopup() { | ||
| 8919 | 8922 | } |
| 8920 | 8923 | |
| 8921 | 8924 | function onExtraWorldInfoChanged() { |
| 8922 | 8925 | const selectedWorldsselectorFieldValue = $('.character_extra_world_info_selector').val(); |
| 8926 | + const selectedWorlds = Array.isArray(selectorFieldValue) ? selectorFieldValue : []; | |
| 8923 | 8927 | let charLore = world_info.charLore ?? []; |
| 8924 | 8928 | |
| 8925 | 8929 | // TODO: Maybe make this utility function not use the window context? |
| @@ -8964,7 +8968,7 @@ function openCharacterWorldPopup() { | ||
| 8964 | 8968 | // Apped to base dropdown |
| 8965 | 8969 | world_names.forEach((item, i) => { |
| 8966 | 8970 | const option = document.createElement('option'); |
| 8967 | 8971 | option.value = String(i); |
| 8968 | 8972 | option.innerText = item; |
| 8969 | 8973 | option.selected = item === worldId; |
| 8970 | 8974 | select.append(option); |
| @@ -8976,7 +8980,7 @@ function openCharacterWorldPopup() { | ||
| 8976 | 8980 | } |
| 8977 | 8981 | world_names.forEach((item, i) => { |
| 8978 | 8982 | const option = document.createElement('option'); |
| 8979 | 8983 | option.value = String(i); |
| 8980 | 8984 | option.innerText = item; |
| 8981 | 8985 | |
| 8982 | 8986 | const existingCharLore = world_info.charLore?.find((e) => e.name === getCharaFilename()); |
| @@ -9082,7 +9086,7 @@ function addAlternateGreeting(template, greeting, index, getArray, popup) { | ||
| 9082 | 9086 | */ |
| 9083 | 9087 | async function createOrEditCharacter(e) { |
| 9084 | 9088 | $('#rm_info_avatar').html(''); |
| 9085 | 9089 | const formData = new FormData(/** @type {HTMLFormElement} */($('#form_create').get(0))); |
| 9086 | 9090 | formData.set('fav', String(fav_ch_checked)); |
| 9087 | 9091 | const isNewChat = e instanceof CustomEvent && e.type === 'newChat'; |
| 9088 | 9092 | |
| @@ -9164,7 +9168,7 @@ async function createOrEditCharacter(e) { | ||
| 9164 | 9168 | |
| 9165 | 9169 | $('#character_popup-button-h3').text('Create character'); |
| 9166 | 9170 | |
| 9167 | 9171 | create_save.avatar = ''null; |
| 9168 | 9172 | |
| 9169 | 9173 | $('#add_avatar_button').replaceWith( |
| 9170 | 9174 | $('#add_avatar_button').val('').clone(true), |
| @@ -10172,9 +10176,6 @@ async function doGetChatName() { | ||
| 10172 | 10176 | return getCurrentChatDetails().sessionName; |
| 10173 | 10177 | } |
| 10174 | 10178 | |
| 10175 | -const isPwaMode = window.navigator.standalone; | |
| 10176 | -if (isPwaMode) { $('body').addClass('PWA'); } | |
| 10177 | - | |
| 10178 | 10179 | function doCharListDisplaySwitch() { |
| 10179 | 10180 | power_user.charListGrid = !power_user.charListGrid; |
| 10180 | 10181 | document.body.classList.toggle('charListGrid', power_user.charListGrid); |
| @@ -10759,23 +10760,23 @@ jQuery(async function () { | ||
| 10759 | 10760 | |
| 10760 | 10761 | //menu buttons setup |
| 10761 | 10762 | |
| 10762 | 10763 | $('#rm_button_settings').clickon('click', function () { |
| 10763 | 10764 | selected_button = 'settings'; |
| 10764 | 10765 | selectRightMenuWithAnimation('rm_api_block'); |
| 10765 | 10766 | }); |
| 10766 | 10767 | $('#rm_button_characters').clickon('click', function () { |
| 10767 | 10768 | selected_button = 'characters'; |
| 10768 | 10769 | select_rm_characters(); |
| 10769 | 10770 | }); |
| 10770 | 10771 | $('#rm_button_back').clickon('click', function () { |
| 10771 | 10772 | selected_button = 'characters'; |
| 10772 | 10773 | select_rm_characters(); |
| 10773 | 10774 | }); |
| 10774 | 10775 | $('#rm_button_create').clickon('click', function () { |
| 10775 | 10776 | selected_button = 'create'; |
| 10776 | 10777 | select_rm_create(); |
| 10777 | 10778 | }); |
| 10778 | 10779 | $('#rm_button_selected_ch').clickon('click', function () { |
| 10779 | 10780 | if (selected_group) { |
| 10780 | 10781 | select_group_chats(selected_group); |
| 10781 | 10782 | } else { |
| @@ -10870,7 +10871,7 @@ jQuery(async function () { | ||
| 10870 | 10871 | callPopup('<h3>' + t`Delete the Chat File?` + '</h3>', 'del_chat'); |
| 10871 | 10872 | }); |
| 10872 | 10873 | |
| 10873 | 10874 | $('#advanced_div').clickon('click', function () { |
| 10874 | 10875 | if (!is_advanced_char_open) { |
| 10875 | 10876 | is_advanced_char_open = true; |
| 10876 | 10877 | $('#character_popup').css({ 'display': 'flex', 'opacity': 0.0 }).addClass('open'); |
| @@ -10885,7 +10886,7 @@ jQuery(async function () { | ||
| 10885 | 10886 | } |
| 10886 | 10887 | }); |
| 10887 | 10888 | |
| 10888 | 10889 | $('#character_cross').clickon('click', function () { |
| 10889 | 10890 | is_advanced_char_open = false; |
| 10890 | 10891 | $('#character_popup').transition({ |
| 10891 | 10892 | opacity: 0, |
| @@ -10895,12 +10896,12 @@ jQuery(async function () { | ||
| 10895 | 10896 | setTimeout(function () { $('#character_popup').css('display', 'none'); }, animation_duration); |
| 10896 | 10897 | }); |
| 10897 | 10898 | |
| 10898 | 10899 | $('#character_popup_ok').clickon('click', function () { |
| 10899 | 10900 | is_advanced_char_open = false; |
| 10900 | 10901 | $('#character_popup').css('display', 'none'); |
| 10901 | 10902 | }); |
| 10902 | 10903 | |
| 10903 | 10904 | $('#dialogue_popup_ok').clickon('click', async function (e_e, customData) { |
| 10904 | 10905 | const fromSlashCommand = customData?.fromSlashCommand || false; |
| 10905 | 10906 | dialogueCloseStop = false; |
| 10906 | 10907 | $('#shadow_popup').transition({ |
| @@ -10930,7 +10931,7 @@ jQuery(async function () { | ||
| 10930 | 10931 | hideLoader(); |
| 10931 | 10932 | } else { // Open the history view again after 2 seconds (delay to avoid edge cases for deleting last chat). |
| 10932 | 10933 | setTimeout(function () { |
| 10933 | 10934 | $('#option_select_chat').clicktrigger('click'); |
| 10934 | 10935 | $('#options').hide(); // hide option popup menu |
| 10935 | 10936 | hideLoader(); |
| 10936 | 10937 | }, 2000); |
| @@ -10941,18 +10942,16 @@ jQuery(async function () { | ||
| 10941 | 10942 | if (popup_type == 'input') { |
| 10942 | 10943 | dialogueResolve($('#dialogue_popup_input').val()); |
| 10943 | 10944 | $('#dialogue_popup_input').val(''); |
| 10944 | - | |
| 10945 | 10945 | } |
| 10946 | 10946 | else { |
| 10947 | 10947 | dialogueResolve(true); |
| 10948 | - | |
| 10949 | 10948 | } |
| 10950 | 10949 | |
| 10951 | 10950 | dialogueResolve = null; |
| 10952 | 10951 | } |
| 10953 | 10952 | }); |
| 10954 | 10953 | |
| 10955 | 10954 | $('#dialogue_popup_cancel').clickon('click', function (e) { |
| 10956 | 10955 | dialogueCloseStop = false; |
| 10957 | 10956 | $('#shadow_popup').transition({ |
| 10958 | 10957 | opacity: 0, |
| @@ -10965,21 +10964,20 @@ jQuery(async function () { | ||
| 10965 | 10964 | $('#dialogue_popup').removeClass('large_dialogue_popup'); |
| 10966 | 10965 | }, animation_duration); |
| 10967 | 10966 | |
| 10968 | - //$("#shadow_popup").css("opacity:", 0.0); | |
| 10969 | 10967 | popup_type = ''; |
| 10970 | 10968 | |
| 10971 | 10969 | if (dialogueResolve) { |
| 10972 | 10970 | dialogueResolve(false); |
| 10973 | 10971 | dialogueResolve = null; |
| 10974 | 10972 | } |
| 10975 | - | |
| 10976 | 10973 | }); |
| 10977 | 10974 | |
| 10978 | 10975 | $('#add_avatar_button').changeon('change', function () { |
| 10979 | - read_avatar_load(this); | |
| 10976 | + const inputElement = /** @type {HTMLInputElement} */ (this); | |
| 10977 | + read_avatar_load(inputElement); | |
| 10980 | 10978 | }); |
| 10981 | 10979 | |
| 10982 | 10980 | $('#form_create').on('submit', (e) => createOrEditCharacter(e.originalEvent)); |
| 10983 | 10981 | |
| 10984 | 10982 | $('#delete_button').on('click', async function () { |
| 10985 | 10983 | if (this_chid === undefined || !characters[this_chid]) { |
| @@ -10990,7 +10988,7 @@ jQuery(async function () { | ||
| 10990 | 10988 | let deleteChats = false; |
| 10991 | 10989 | |
| 10992 | 10990 | const confirm = await Popup.show.confirm(t`Delete the character?`, await renderTemplateAsync('deleteConfirm'), { |
| 10993 | 10991 | onClose: () => { deleteChats = !!$('#del_char_checkbox').prop('checked'); }, |
| 10994 | 10992 | }); |
| 10995 | 10993 | if (!confirm) { |
| 10996 | 10994 | return; |
| @@ -11111,7 +11109,7 @@ jQuery(async function () { | ||
| 11111 | 11109 | |
| 11112 | 11110 | /////////////////////////////////////////////////////////////////////////////////// |
| 11113 | 11111 | |
| 11114 | 11112 | $('#api_button').clickon('click', function (e) { |
| 11115 | 11113 | if ($('#api_url_text').val() != '') { |
| 11116 | 11114 | let value = formatKoboldUrl(String($('#api_url_text').val()).trim()); |
| 11117 | 11115 | |
| @@ -11252,7 +11250,7 @@ jQuery(async function () { | ||
| 11252 | 11250 | if ((selected_group || this_chid !== undefined) && !is_send_press) { |
| 11253 | 11251 | let deleteCurrentChat = false; |
| 11254 | 11252 | const result = await Popup.show.confirm(t`Start new chat?`, await renderTemplateAsync('newChatConfirm'), { |
| 11255 | 11253 | onClose: () => { deleteCurrentChat = !!$('#del_chat_checkbox').prop('checked'); }, |
| 11256 | 11254 | }); |
| 11257 | 11255 | if (!result) { |
| 11258 | 11256 | return; |
| @@ -11356,7 +11354,7 @@ jQuery(async function () { | ||
| 11356 | 11354 | ////////////////////////////////////////////////////////////////////////////////////////////// |
| 11357 | 11355 | |
| 11358 | 11356 | //functionality for the cancel delete messages button, reverts to normal display of input form |
| 11359 | 11357 | $('#dialogue_del_mes_cancel').clickon('click', function () { |
| 11360 | 11358 | $('#dialogue_del_mes').css('display', 'none'); |
| 11361 | 11359 | $('#send_form').css('display', css_send_form_display); |
| 11362 | 11360 | $('.del_checkbox').each(function () { |
| @@ -11496,7 +11494,7 @@ jQuery(async function () { | ||
| 11496 | 11494 | |
| 11497 | 11495 | ////////////////////////////////////////////////////////////// |
| 11498 | 11496 | |
| 11499 | 11497 | $('#select_chat_cross').clickon('click', function () { |
| 11500 | 11498 | $('#shadow_select_chat_popup').transition({ |
| 11501 | 11499 | opacity: 0, |
| 11502 | 11500 | duration: animation_duration, |
| @@ -11590,8 +11588,10 @@ jQuery(async function () { | ||
| 11590 | 11588 | edit_textarea.height(0); |
| 11591 | 11589 | edit_textarea.height(edit_textarea[0].scrollHeight); |
| 11592 | 11590 | } |
| 11593 | 11591 | edit_textarea.focustrigger('focus'); |
| 11594 | - edit_textarea[0].setSelectionRange( //this sets the cursor at the end of the text | |
| 11592 | + const textAreaElement = /** @type {HTMLTextAreaElement} */ (edit_textarea[0]); | |
| 11593 | + // Sets the cursor at the end of the text | |
| 11594 | + textAreaElement.setSelectionRange( | |
| 11595 | 11595 | String(edit_textarea.val()).length, |
| 11596 | 11596 | String(edit_textarea.val()).length, |
| 11597 | 11597 | ); |
| @@ -11843,8 +11843,8 @@ jQuery(async function () { | ||
| 11843 | 11843 | //Select chat |
| 11844 | 11844 | |
| 11845 | 11845 | //**************************CHARACTER IMPORT EXPORT*************************// |
| 11846 | 11846 | $('#character_import_button').clickon('click', function () { |
| 11847 | 11847 | $('#character_import_file').clicktrigger('click'); |
| 11848 | 11848 | }); |
| 11849 | 11849 | |
| 11850 | 11850 | $('#character_import_file').on('change', async function (e) { |
| @@ -11912,12 +11912,16 @@ jQuery(async function () { | ||
| 11912 | 11912 | } |
| 11913 | 11913 | }); |
| 11914 | 11914 | //**************************CHAT IMPORT EXPORT*************************// |
| 11915 | 11915 | $('#chat_import_button').clickon('click', function () { |
| 11916 | 11916 | $('#chat_import_file').clicktrigger('click'); |
| 11917 | 11917 | }); |
| 11918 | 11918 | |
| 11919 | 11919 | $('#chat_import_file').on('change', async function (e) { |
| 11920 | - const file = e.target.files[0]; | |
| 11920 | + const targetElement = /** @type {HTMLInputElement} */ (e.target); | |
| 11921 | + if (!(targetElement instanceof HTMLInputElement)) { | |
| 11922 | + return; | |
| 11923 | + } | |
| 11924 | + const file = targetElement.files[0]; | |
| 11921 | 11925 | |
| 11922 | 11926 | if (!file) { |
| 11923 | 11927 | return; |
| @@ -11939,7 +11943,7 @@ jQuery(async function () { | ||
| 11939 | 11943 | const format = ext[1].toLowerCase(); |
| 11940 | 11944 | $('#chat_import_file_type').val(format); |
| 11941 | 11945 | |
| 11942 | 11946 | const formData = new FormData(/** @type {HTMLFormElement} */($('#form_import_chat').get(0))); |
| 11943 | 11947 | formData.append('user_name', name1); |
| 11944 | 11948 | $('#select_chat_div').html(''); |
| 11945 | 11949 | |
| @@ -11950,12 +11954,12 @@ jQuery(async function () { | ||
| 11950 | 11954 | } |
| 11951 | 11955 | }); |
| 11952 | 11956 | |
| 11953 | 11957 | $('#rm_button_group_chats').clickon('click', function () { |
| 11954 | 11958 | selected_button = 'group_chats'; |
| 11955 | 11959 | select_group_chats(); |
| 11956 | 11960 | }); |
| 11957 | 11961 | |
| 11958 | 11962 | $('#rm_button_back_from_group').clickon('click', function () { |
| 11959 | 11963 | selected_button = 'characters'; |
| 11960 | 11964 | select_rm_characters(); |
| 11961 | 11965 | }); |
| @@ -12025,7 +12029,7 @@ jQuery(async function () { | ||
| 12025 | 12029 | } |
| 12026 | 12030 | }); |
| 12027 | 12031 | |
| 12028 | 12032 | $(document).on('click', '.inline-drawer-toggle', async function (e) { |
| 12029 | 12033 | if ($(e.target).hasClass('text_pole')) { |
| 12030 | 12034 | return; |
| 12031 | 12035 | } |
| @@ -12043,10 +12047,10 @@ jQuery(async function () { | ||
| 12043 | 12047 | |
| 12044 | 12048 | // Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height |
| 12045 | 12049 | if (!CSS.supports('field-sizing', 'content')) { |
| 12046 | 12050 | const textareas = drawerContent.find('textarea.autoSetHeight').each(async function () {; |
| 12047 | - await resetScrollHeight($(this)); | |
| 12051 | + for (const textarea of textareas) { | |
| 12048 | - return; | |
| 12052 | + await resetScrollHeight($(textarea)); | |
| 12049 | 12053 | }); |
| 12050 | 12054 | } |
| 12051 | 12055 | }); |
| 12052 | 12056 | |
| @@ -12161,7 +12165,7 @@ jQuery(async function () { | ||
| 12161 | 12165 | return; |
| 12162 | 12166 | } |
| 12163 | 12167 | if (isEditVisible && power_user.auto_save_msg_edits === true) { |
| 12164 | 12168 | $(`#chat .mes[mesid="${this_edit_mes_id}"] .mes_edit_done`).clicktrigger('click'); |
| 12165 | 12169 | closeMessageEditor('reasoning'); |
| 12166 | 12170 | $('#send_textarea').focus(); |
| 12167 | 12171 | return; |
| @@ -12176,7 +12180,8 @@ jQuery(async function () { | ||
| 12176 | 12180 | }); |
| 12177 | 12181 | |
| 12178 | 12182 | $('#char-management-dropdown').on('change', async (e) => { |
| 12179 | - let target = $(e.target.selectedOptions).attr('id'); | |
| 12183 | + const targetElement = /** @type {HTMLSelectElement} */ (e.target); | |
| 12184 | + const target = $(targetElement.selectedOptions).attr('id'); | |
| 12180 | 12185 | switch (target) { |
| 12181 | 12186 | case 'set_character_world': |
| 12182 | 12187 | openCharacterWorldPopup(); |
| @@ -2529,7 +2529,16 @@ export function parseRegexFromString(input) { | ||
| 2529 | 2529 | } |
| 2530 | 2530 | } |
| 2531 | 2531 | |
| 2532 | -//MARK: getWorldEntry | |
| 2532 | +/** | |
| 2533 | + * Enables the input helper for keys in a World Info entry. | |
| 2534 | + * @param {object} params - Parameters for enabling the keys input helper. | |
| 2535 | + * @param {JQuery<HTMLElement>} params.template - The template element containing the input. | |
| 2536 | + * @param {object} params.entry - The entry object containing the keys. | |
| 2537 | + * @param {string} params.entryPropName - The property name of the entry that holds the keys. | |
| 2538 | + * @param {string} params.originalDataValueName - The name of the original data value to be set. | |
| 2539 | + * @param {string} params.name - The name of the world info entry. | |
| 2540 | + * @param {object} params.data - The data object containing entries. | |
| 2541 | + */ | |
| 2533 | 2542 | function enableKeysInputHelper({ template, entry, entryPropName, originalDataValueName, name, data }) { |
| 2534 | 2543 | const isFancyInput = !isMobile() && !power_user.wi_key_input_plaintext; |
| 2535 | 2544 | const input = isFancyInput ? template.find(`select[name="${entryPropName}"]`) : template.find(`textarea[name="${entryPropName}"]`); |
| @@ -2625,6 +2634,12 @@ function enableKeysInputHelper({ template, entry, entryPropName, originalDataVal | ||
| 2625 | 2634 | |
| 2626 | 2635 | /** |
| 2627 | 2636 | * Helper to handle match checkboxes for WI entries. |
| 2637 | + * @param {object} params - Parameters for handling match checkboxes. | |
| 2638 | + * @param {JQuery<HTMLElement>} params.template - The template element containing the checkbox. | |
| 2639 | + * @param {object} params.entry - The entry object containing the checkbox state. | |
| 2640 | + * @param {string} params.fieldName - The name of the checkbox field. | |
| 2641 | + * @param {object} params.data - The data object containing entries. | |
| 2642 | + * @param {string} params.name - The name of the world info to save changes to. | |
| 2628 | 2643 | */ |
| 2629 | 2644 | function handleMatchCheckboxHelper({ template, entry, fieldName, data, name }) { |
| 2630 | 2645 | const key = originalWIDataKeyMap[fieldName]; |
| @@ -2642,6 +2657,10 @@ function handleMatchCheckboxHelper({ template, entry, fieldName, data, name }) { | ||
| 2642 | 2657 | |
| 2643 | 2658 | /** |
| 2644 | 2659 | * Helper to update position/order display. |
| 2660 | + * @param {object} params - Parameters for updating position/order display. | |
| 2661 | + * @param {JQuery<HTMLElement>} params.template - The template element containing the display. | |
| 2662 | + * @param {object} params.data - The data object containing entries. | |
| 2663 | + * @param {string} params.uid - The unique identifier of the entry to update. | |
| 2645 | 2664 | */ |
| 2646 | 2665 | function updatePosOrdDisplayHelper({ template, data, uid }) { |
| 2647 | 2666 | let entry = data.entries[uid]; |
| @@ -2658,8 +2677,9 @@ function updatePosOrdDisplayHelper({ template, data, uid }) { | ||
| 2658 | 2677 | |
| 2659 | 2678 | /** |
| 2660 | 2679 | * Helper to initialize character filter select2. |
| 2680 | + * @param {JQuery<HTMLElement>} characterFilter - The select element for character filter. | |
| 2661 | 2681 | */ |
| 2662 | 2682 | function initCharacterFilterSelect2Helper(characterFilter, t) { |
| 2663 | 2683 | if (!isMobile()) { |
| 2664 | 2684 | $(characterFilter).select2({ |
| 2665 | 2685 | width: '100%', |
| @@ -2672,8 +2692,11 @@ function initCharacterFilterSelect2Helper(characterFilter, t) { | ||
| 2672 | 2692 | |
| 2673 | 2693 | /** |
| 2674 | 2694 | * Helper to fill character and tag options for character filter. |
| 2695 | + * @param {object} params - Parameters for filling options. | |
| 2696 | + * @param {JQuery<HTMLElement>} params.characterFilter - The select element to fill with options. | |
| 2697 | + * @param {object} params.entry - The entry object containing character filter data. | |
| 2675 | 2698 | */ |
| 2676 | 2699 | function fillCharacterAndTagOptionsHelper({ characterFilter, entry, getContext }) { |
| 2677 | 2700 | const characters = getContext().characters; |
| 2678 | 2701 | characters.forEach((character) => { |
| 2679 | 2702 | const option = document.createElement('option'); |
| @@ -2696,8 +2719,13 @@ function fillCharacterAndTagOptionsHelper({ characterFilter, entry, getContext } | ||
| 2696 | 2719 | |
| 2697 | 2720 | /** |
| 2698 | 2721 | * Helper to handle character filter changes. |
| 2722 | + * @param {object} params - Parameters for handling character filter changes. | |
| 2723 | + * @param {JQuery<HTMLElement>} params.characterFilter - The select element for character filter. | |
| 2724 | + * @param {object} params.data - The data object containing entries. | |
| 2725 | + * @param {object} params.entry - The entry object to update. | |
| 2726 | + * @param {string} params.name - The name of the world info to save changes to. | |
| 2699 | 2727 | */ |
| 2700 | 2728 | function handleCharacterFilterChangeHelper({ characterFilter, data, entry, name, world_names, getContext, setWIOriginalDataValue, saveWorldInfo, t }) { |
| 2701 | 2729 | characterFilter.on('mousedown change', async function (e) { |
| 2702 | 2730 | if (world_names.length === 0) { |
| 2703 | 2731 | e.preventDefault(); |
| @@ -2728,8 +2756,13 @@ function handleCharacterFilterChangeHelper({ characterFilter, data, entry, name, | ||
| 2728 | 2756 | |
| 2729 | 2757 | /** |
| 2730 | 2758 | * Helper to handle probability input. |
| 2759 | + * @param {object} params - Parameters for handling probability input. | |
| 2760 | + * @param {JQuery<HTMLElement>} params.probabilityInput - The input element for probability. | |
| 2761 | + * @param {object} params.data - The data object containing entries. | |
| 2762 | + * @param {object} params.entry - The entry object to update. | |
| 2763 | + * @param {string} params.name - The name of the world info to save changes to. | |
| 2731 | 2764 | */ |
| 2732 | 2765 | function handleProbabilityInputHelper({ probabilityInput, data, entry, name, setWIOriginalDataValue, saveWorldInfo }) { |
| 2733 | 2766 | probabilityInput.data('uid', entry.uid); |
| 2734 | 2767 | probabilityInput.on('input', async function (_, { noSave = false } = {}) { |
| 2735 | 2768 | const uid = $(this).data('uid'); |
| @@ -2750,8 +2783,14 @@ function handleProbabilityInputHelper({ probabilityInput, data, entry, name, set | ||
| 2750 | 2783 | |
| 2751 | 2784 | /** |
| 2752 | 2785 | * Helper to handle probability toggle. |
| 2786 | + * @param {object} params - Parameters for handling probability toggle. | |
| 2787 | + * @param {JQuery<HTMLElement>} params.probabilityToggle - The toggle element for probability. | |
| 2788 | + * @param {object} params.data - The data object containing entries. | |
| 2789 | + * @param {object} params.entry - The entry object to update. | |
| 2790 | + * @param {string} params.name - The name of the world info to save changes to. | |
| 2791 | + * @param {JQuery<HTMLElement>} params.probabilityInput - The input element for probability. | |
| 2753 | 2792 | */ |
| 2754 | 2793 | function handleProbabilityToggleHelper({ probabilityToggle, data, entry, name, probabilityInput, setWIOriginalDataValue, saveWorldInfo }) { |
| 2755 | 2794 | probabilityToggle.data('uid', entry.uid); |
| 2756 | 2795 | probabilityToggle.on('input', async function (_, { noSave = false } = {}) { |
| 2757 | 2796 | const uid = $(this).data('uid'); |
| @@ -2774,8 +2813,14 @@ function handleProbabilityToggleHelper({ probabilityToggle, data, entry, name, p | ||
| 2774 | 2813 | |
| 2775 | 2814 | /** |
| 2776 | 2815 | * Helper to handle select2 dropdowns for boolean selects. |
| 2816 | + * @param {object} params - Parameters for handling boolean selects. | |
| 2817 | + * @param {JQuery<HTMLElement>} params.selectElem - The select element for boolean values. | |
| 2818 | + * @param {object} params.entry - The entry object containing the boolean value. | |
| 2819 | + * @param {string} params.entryKey - The key in the entry object for the boolean value. | |
| 2820 | + * @param {object} params.data - The data object containing entries. | |
| 2821 | + * @param {string} params.name - The name of the world info to save changes to. | |
| 2777 | 2822 | */ |
| 2778 | 2823 | function handleBooleanSelectHelper({ selectElem, entry, entryKey, data, name, setWIOriginalDataValue, saveWorldInfo }) { |
| 2779 | 2824 | selectElem.data('uid', entry.uid); |
| 2780 | 2825 | selectElem.on('input', async function (_, { noSave = false } = {}) { |
| 2781 | 2826 | const uid = $(this).data('uid'); |
| @@ -2789,8 +2834,17 @@ function handleBooleanSelectHelper({ selectElem, entry, entryKey, data, name, se | ||
| 2789 | 2834 | |
| 2790 | 2835 | /** |
| 2791 | 2836 | * Helper to handle input fields for numbers. |
| 2837 | + * @param {object} params - Parameters for handling number inputs. | |
| 2838 | + * @param {JQuery<HTMLElement>} params.inputElem - The input element for the number. | |
| 2839 | + * @param {object} params.entry - The entry object containing the number value. | |
| 2840 | + * @param {string} params.entryKey - The key in the entry object for the number value. | |
| 2841 | + * @param {object} params.data - The data object containing entries. | |
| 2842 | + * @param {string} params.name - The name of the world info to save changes to. | |
| 2843 | + * @param {number} params.min - The minimum value for the number input. | |
| 2844 | + * @param {number} params.max - The maximum value for the number input. | |
| 2845 | + * @param {boolean} [params.clamp=false] - Whether to clamp the value within the min and max range. | |
| 2792 | 2846 | */ |
| 2793 | 2847 | function handleNumberInputHelper({ inputElem, entry, entryKey, data, name, setWIOriginalDataValue, saveWorldInfo, min, max, clamp = false }) { |
| 2794 | 2848 | inputElem.data('uid', entry.uid); |
| 2795 | 2849 | inputElem.on('input', async function (_, { noSave = false } = {}) { |
| 2796 | 2850 | const uid = $(this).data('uid'); |
| @@ -2813,8 +2867,13 @@ function handleNumberInputHelper({ inputElem, entry, entryKey, data, name, setWI | ||
| 2813 | 2867 | |
| 2814 | 2868 | /** |
| 2815 | 2869 | * Helper to handle tri-state selector for constant/normal/vectorized. |
| 2870 | + * @param {object} params - Parameters for handling the entry state selector. | |
| 2871 | + * @param {JQuery<HTMLElement>} params.entryStateSelector - The select element for entry state. | |
| 2872 | + * @param {object} params.entry - The entry object containing the state. | |
| 2873 | + * @param {object} params.data - The data object containing entries. | |
| 2874 | + * @param {string} params.name - The name of the world info to save changes to. | |
| 2816 | 2875 | */ |
| 2817 | 2876 | function handleEntryStateSelectorHelper({ entryStateSelector, entry, data, name, setWIOriginalDataValue, saveWorldInfo }) { |
| 2818 | 2877 | entryStateSelector.data('uid', entry.uid); |
| 2819 | 2878 | entryStateSelector.on('click', function (event) { |
| 2820 | 2879 | event.stopPropagation(); |
| @@ -2850,8 +2909,14 @@ function handleEntryStateSelectorHelper({ entryStateSelector, entry, data, name, | ||
| 2850 | 2909 | |
| 2851 | 2910 | /** |
| 2852 | 2911 | * Helper to handle kill switch toggle. |
| 2912 | + * @param {object} params - Parameters for handling the kill switch toggle. | |
| 2913 | + * @param {JQuery<HTMLElement>} params.entryKillSwitch - The toggle element for the kill switch. | |
| 2914 | + * @param {object} params.entry - The entry object containing the state. | |
| 2915 | + * @param {object} params.data - The data object containing entries. | |
| 2916 | + * @param {string} params.name - The name of the world info to save changes to. | |
| 2917 | + * @param {JQuery<HTMLElement>} params.template - The template element for the entry. | |
| 2853 | 2918 | */ |
| 2854 | 2919 | function handleEntryKillSwitchHelper({ entryKillSwitch, entry, data, name, setWIOriginalDataValue, saveWorldInfo, template }) { |
| 2855 | 2920 | entryKillSwitch.data('uid', entry.uid); |
| 2856 | 2921 | entryKillSwitch.on('click', async function () { |
| 2857 | 2922 | const uid = entry.uid; |
| @@ -2912,13 +2977,12 @@ export async function getWorldEntry(name, data, entry) { | ||
| 2912 | 2977 | orderInput.css('width', 'calc(3em + 15px)'); |
| 2913 | 2978 | |
| 2914 | 2979 | // Probability |
| 2915 | 2980 | handleProbabilityInputHelper({ probabilityInput: headerTemplate.find('input[name="probability"]'), data, entry, name, setWIOriginalDataValue, saveWorldInfo }); |
| 2916 | 2981 | |
| 2917 | 2982 | // Depth |
| 2918 | 2983 | handleNumberInputHelper({ |
| 2919 | 2984 | inputElem: headerTemplate.find('input[name="depth"]'), |
| 2920 | 2985 | entry, entryKey: 'depth', data, name, setWIOriginalDataValuemin: 0, saveWorldInfomax: MAX_SCAN_DEPTH, clamp: false, |
| 2921 | - min: 0, max: MAX_SCAN_DEPTH, clamp: false, | |
| 2922 | 2986 | }); |
| 2923 | 2987 | headerTemplate.find('input[name="depth"]').css('width', 'calc(3em + 15px)'); |
| 2924 | 2988 | |
| @@ -2954,13 +3018,13 @@ export async function getWorldEntry(name, data, entry) { | ||
| 2954 | 3018 | // Tri-state selector |
| 2955 | 3019 | handleEntryStateSelectorHelper({ |
| 2956 | 3020 | entryStateSelector: headerTemplate.find('select[name="entryStateSelector"]'), |
| 2957 | 3021 | entry, data, name, setWIOriginalDataValue, saveWorldInfo, |
| 2958 | 3022 | }); |
| 2959 | 3023 | |
| 2960 | 3024 | // Kill switch |
| 2961 | 3025 | handleEntryKillSwitchHelper({ |
| 2962 | 3026 | entryKillSwitch: headerTemplate.find('div[name="entryKillSwitch"]'), |
| 2963 | 3027 | entry, data, name, setWIOriginalDataValue, saveWorldInfo, template: headerTemplate, |
| 2964 | 3028 | }); |
| 2965 | 3029 | |
| 2966 | 3030 | // Duplicate/delete/move buttons |
| @@ -3087,7 +3151,6 @@ export async function getWorldEntry(name, data, entry) { | ||
| 3087 | 3151 | probabilityToggle: editTemplate.find('input[name="useProbability"]'), |
| 3088 | 3152 | data, entry, name, |
| 3089 | 3153 | probabilityInput: headerTemplate.find('input[name="probability"]'), |
| 3090 | - setWIOriginalDataValue, saveWorldInfo, | |
| 3091 | 3154 | }); |
| 3092 | 3155 | |
| 3093 | 3156 | // Comment toggle |
| @@ -3168,11 +3231,9 @@ export async function getWorldEntry(name, data, entry) { | ||
| 3168 | 3231 | |
| 3169 | 3232 | const characterFilter = editTemplate.find('select[name="characterFilter"]'); |
| 3170 | 3233 | characterFilter.data('uid', entry.uid); |
| 3171 | 3234 | initCharacterFilterSelect2Helper(characterFilter, t); |
| 3172 | 3235 | fillCharacterAndTagOptionsHelper({ characterFilter, entry, getContext }); |
| 3173 | - handleCharacterFilterChangeHelper({ | |
| 3236 | + handleCharacterFilterChangeHelper({ characterFilter, data, entry, name }); | |
| 3174 | - characterFilter, data, entry, name, world_names, getContext, setWIOriginalDataValue, saveWorldInfo, t, | |
| 3175 | - }); | |
| 3176 | 3237 | |
| 3177 | 3238 | // Content |
| 3178 | 3239 | const counter = editTemplate.find('.world_entry_form_token_counter'); |
| @@ -3246,25 +3307,21 @@ export async function getWorldEntry(name, data, entry) { | ||
| 3246 | 3307 | // Group weight |
| 3247 | 3308 | handleNumberInputHelper({ |
| 3248 | 3309 | inputElem: editTemplate.find('input[name="groupWeight"]'), |
| 3249 | 3310 | entry, entryKey: 'groupWeight', data, name, setWIOriginalDataValuemin: 1, saveWorldInfomax: 10000, clamp: true, |
| 3250 | - min: 1, max: 10000, clamp: true, | |
| 3251 | 3311 | }); |
| 3252 | 3312 | |
| 3253 | 3313 | // Sticky, cooldown, delay |
| 3254 | 3314 | handleNumberInputHelper({ |
| 3255 | 3315 | inputElem: editTemplate.find('input[name="sticky"]'), |
| 3256 | 3316 | entry, entryKey: 'sticky', data, name, setWIOriginalDataValuemin: 1, saveWorldInfomax: 10000, clamp: false, |
| 3257 | - min: 1, max: 10000, clamp: false, | |
| 3258 | 3317 | }); |
| 3259 | 3318 | handleNumberInputHelper({ |
| 3260 | 3319 | inputElem: editTemplate.find('input[name="cooldown"]'), |
| 3261 | 3320 | entry, entryKey: 'cooldown', data, name, setWIOriginalDataValuemin: 1, saveWorldInfomax: 10000, clamp: false, |
| 3262 | - min: 1, max: 10000, clamp: false, | |
| 3263 | 3321 | }); |
| 3264 | 3322 | handleNumberInputHelper({ |
| 3265 | 3323 | inputElem: editTemplate.find('input[name="delay"]'), |
| 3266 | 3324 | entry, entryKey: 'delay', data, name, setWIOriginalDataValuemin: 1, saveWorldInfomax: 10000, clamp: false, |
| 3267 | - min: 1, max: 10000, clamp: false, | |
| 3268 | 3325 | }); |
| 3269 | 3326 | |
| 3270 | 3327 | // Exclude/prevent recursion |
| @@ -3300,18 +3357,9 @@ export async function getWorldEntry(name, data, entry) { | ||
| 3300 | 3357 | delayUntilRecursionLevelInput.val(['number', 'string'].includes(typeof entry.delayUntilRecursion) ? entry.delayUntilRecursion : '').trigger('input', { noSave: true }); |
| 3301 | 3358 | |
| 3302 | 3359 | // Boolean selects |
| 3303 | - handleBooleanSelectHelper({ | |
| 3360 | + handleBooleanSelectHelper({ selectElem: editTemplate.find('select[name="caseSensitive"]'), entry, entryKey: 'caseSensitive', data, name }); | |
| 3304 | 3361 | handleBooleanSelectHelper({ selectElem: editTemplate.find('select[name="caseSensitivematchWholeWords"]'), entry, entryKey: 'matchWholeWords', data, name }); |
| 3305 | - entry, entryKey: 'caseSensitive', data, name, setWIOriginalDataValue, saveWorldInfo, | |
| 3362 | + handleBooleanSelectHelper({ selectElem: editTemplate.find('select[name="useGroupScoring"]'), entry, entryKey: 'useGroupScoring', data, name }); | |
| 3306 | - }); | |
| 3307 | - handleBooleanSelectHelper({ | |
| 3308 | - selectElem: editTemplate.find('select[name="matchWholeWords"]'), | |
| 3309 | - entry, entryKey: 'matchWholeWords', data, name, setWIOriginalDataValue, saveWorldInfo, | |
| 3310 | - }); | |
| 3311 | - handleBooleanSelectHelper({ | |
| 3312 | - selectElem: editTemplate.find('select[name="useGroupScoring"]'), | |
| 3313 | - entry, entryKey: 'useGroupScoring', data, name, setWIOriginalDataValue, saveWorldInfo, | |
| 3314 | - }); | |
| 3315 | 3363 | |
| 3316 | 3364 | // Match checkboxes |
| 3317 | 3365 | handleMatchCheckboxHelper({ template: editTemplate, entry, fieldName: 'matchPersonaDescription', data, name }); |