#1242 Add aux field selector

This commit is contained in:
Cohee 2023-11-11 18:25:43 +02:00
parent 5331b5dc8a
commit 91a1cc81a0
3 changed files with 21 additions and 4 deletions

View File

@ -2680,7 +2680,7 @@
</div> </div>
</div> </div>
</div> </div>
<div name="UserSettingsSecondColumn" id="UI-Customization" class="flex-container flexFlowColumn wide100p"> <div name="UserSettingsSecondColumn" id="UI-Customization" class="flex-container flexFlowColumn wide100p flexNoGap">
<div name="themeToggles"> <div name="themeToggles">
<h4 data-i18n="Theme Toggles">Theme Toggles</h4> <h4 data-i18n="Theme Toggles">Theme Toggles</h4>
<label data-newbie-hidden for="fast_ui_mode" class="checkbox_label" title="removes blur from window backgrounds" data-i18n="[title]removes blur from window backgrounds"> <label data-newbie-hidden for="fast_ui_mode" class="checkbox_label" title="removes blur from window backgrounds" data-i18n="[title]removes blur from window backgrounds">
@ -2737,6 +2737,13 @@
</label> </label>
</div> </div>
<h4><span data-i18n="Miscellaneous">Miscellaneous</span></h4> <h4><span data-i18n="Miscellaneous">Miscellaneous</span></h4>
<div title="If set in the advanced character definitions, this field will be displayed in the characters list.">
<label for="aux_field" data-i18n="Aux List Field">Aux List Field</label>
<select id="aux_field">
<option data-i18n="Character Version" value="character_version">Character Version</option>
<option data-i18n="Created by" value="creator">Created by</option>
</select>
</div>
<div> <div>
<label for="play_message_sound" class="checkbox_label"> <label for="play_message_sound" class="checkbox_label">
<input id="play_message_sound" type="checkbox" /> <input id="play_message_sound" type="checkbox" />

View File

@ -1038,9 +1038,10 @@ function getCharacterBlock(item, id) {
template.find('.ch_description').hide(); template.find('.ch_description').hide();
} }
const version = item.data?.character_version || ''; const auxFieldName = power_user.aux_field || 'character_version';
if (version) { const auxFieldValue = (item.data && item.data[auxFieldName]) || '';
template.find('.character_version').text(version); if (auxFieldValue) {
template.find('.character_version').text(auxFieldValue);
} }
else { else {
template.find('.character_version').hide(); template.find('.character_version').hide();

View File

@ -220,6 +220,7 @@ let power_user = {
encode_tags: false, encode_tags: false,
servers: [], servers: [],
bogus_folders: false, bogus_folders: false,
aux_field: 'character_version',
}; };
let themes = []; let themes = [];
@ -1255,6 +1256,7 @@ function loadPowerUserSettings(settings, data) {
$(`#chat_display option[value=${power_user.chat_display}]`).attr("selected", true).trigger('change'); $(`#chat_display option[value=${power_user.chat_display}]`).attr("selected", true).trigger('change');
$('#chat_width_slider').val(power_user.chat_width); $('#chat_width_slider').val(power_user.chat_width);
$("#token_padding").val(power_user.token_padding); $("#token_padding").val(power_user.token_padding);
$("#aux_field").val(power_user.aux_field);
$("#font_scale").val(power_user.font_scale); $("#font_scale").val(power_user.font_scale);
$("#font_scale_counter").val(power_user.font_scale); $("#font_scale_counter").val(power_user.font_scale);
@ -2822,6 +2824,13 @@ $(document).ready(() => {
printCharacters(true); printCharacters(true);
}); });
$('#aux_field').on('change', function() {
const value = $(this).find(':selected').val();
power_user.aux_field = String(value);
saveSettingsDebounced();
printCharacters(false);
});
$(document).on('click', '#debug_table [data-debug-function]', function () { $(document).on('click', '#debug_table [data-debug-function]', function () {
const functionId = $(this).data('debug-function'); const functionId = $(this).data('debug-function');
const functionRecord = debug_functions.find(f => f.functionId === functionId); const functionRecord = debug_functions.find(f => f.functionId === functionId);