Add UI element for delay recursion level - Tied and only visible to the "delay until recursion" toggle - Will set it to a numerical value if used, otherwise keeps true/false state of the toggle

eeed072ebba143e19680d6efaa9a8ee8f60f705d

Wolfsblvt <wolfsblvt@gmail.com>

3 files changed, +35 -2Ignore whitespace
public/css/world-info.css+4 -0
@@ -274,3 +274,7 @@ select.keyselect+span.select2-container .select2-selection--multiple {
274 align-self: center;274 align-self: center;
275 width: 100%;275 width: 100%;
276}276}
277
278.world_entry:has(input[name="delay_until_recursion"]:not(:checked)) .world_entry_form_control:has(input[name="delayUntilRecursionLevel"]) {
279 display: none;
280}
public/index.html+7 -0
@@ -5489,6 +5489,13 @@
5489 <small class="textAlignCenter" data-i18n="Automation ID">Automation ID</small>5489 <small class="textAlignCenter" data-i18n="Automation ID">Automation ID</small>
5490 <input class="text_pole margin0" name="automationId" type="text" placeholder="( None )" data-i18n="[placeholder]( None )">5490 <input class="text_pole margin0" name="automationId" type="text" placeholder="( None )" data-i18n="[placeholder]( None )">
5491 </div>5491 </div>
5492 <div class="world_entry_form_control flex1" title="Defines delay levels for recursive scans.&#13;&#13;Initially, only the first level (smallest number) will match.&#13;Once no matches are found, the next level becomes eligible for matching.&#13;This repeats until all levels are checked.&#13;&#13;Tied to the &quot;Delay until recursion&quot; setting." data-i18n="[title]delay_until_recursion_level">
5493 <small class="textAlignCenter">
5494 <span data-i18n="Recursion Level">Recursion Level</span>
5495 <div class="fa-solid fa-circle-info opacity50p"></div>
5496 </small>
5497 <input class="text_pole margin0" name="delayUntilRecursionLevel" type="text" placeholder="1">
5498 </div>
5492 </div>5499 </div>
5493 <div name="contentAndCharFilterBlock" class="world_entry_thin_controls flex2">5500 <div name="contentAndCharFilterBlock" class="world_entry_thin_controls flex2">
5494 <div class="world_entry_form_control flex1">5501 <div class="world_entry_form_control flex1">
public/scripts/world-info.js+24 -2
@@ -2953,13 +2953,35 @@ async function getWorldEntry(name, data, entry) {
2953 delayUntilRecursionInput.data('uid', entry.uid);2953 delayUntilRecursionInput.data('uid', entry.uid);
2954 delayUntilRecursionInput.on('input', async function () {2954 delayUntilRecursionInput.on('input', async function () {
2955 const uid = $(this).data('uid');2955 const uid = $(this).data('uid');
2956 const value = $(this).prop('checked');2956 const toggled = $(this).prop('checked');
2957
2958 // If the value contains a number, we'll take that one (set by the level input), otherwise we can use true/false switch
2959 const value = toggled ? data.entries[uid].delayUntilRecursion || true : false;
2960
2957 data.entries[uid].delayUntilRecursion = value;2961 data.entries[uid].delayUntilRecursion = value;
2958 setWIOriginalDataValue(data, uid, 'extensions.delay_until_recursion', data.entries[uid].delayUntilRecursion);2962 setWIOriginalDataValue(data, uid, 'extensions.delay_until_recursion', data.entries[uid].delayUntilRecursion);
2959 await saveWorldInfo(name, data);2963 await saveWorldInfo(name, data);
2960 });2964 });
2961 delayUntilRecursionInput.prop('checked', entry.delayUntilRecursion).trigger('input');2965 delayUntilRecursionInput.prop('checked', entry.delayUntilRecursion).trigger('input');
29622966
2967 // delay until recursion level
2968 const delayUntilRecursionLevelInput = template.find('input[name="delayUntilRecursionLevel"]');
2969 delayUntilRecursionLevelInput.data('uid', entry.uid);
2970 delayUntilRecursionLevelInput.on('input', async function () {
2971 const uid = $(this).data('uid');
2972 const content = $(this).val();
2973 const value = content === '' ? (typeof data.entries[uid].delayUntilRecursion === 'boolean' ? data.entries[uid].delayUntilRecursion : true)
2974 : content === 1 ? true
2975 : !isNaN(Number(content)) ? Number(content)
2976 : false;
2977
2978 data.entries[uid].delayUntilRecursion = value;
2979 setWIOriginalDataValue(data, uid, 'extensions.delay_until_recursion', data.entries[uid].delayUntilRecursion);
2980 await saveWorldInfo(name, data);
2981 });
2982 // No need to retrigger inpout event, we'll just set the curret current value. It was edited/saved above already
2983 delayUntilRecursionLevelInput.val(['number', 'string'].includes(typeof entry.delayUntilRecursion) ? entry.delayUntilRecursion : '').trigger('input');
2984
2963 // duplicate button2985 // duplicate button
2964 const duplicateButton = template.find('.duplicate_entry_button');2986 const duplicateButton = template.find('.duplicate_entry_button');
2965 duplicateButton.data('uid', entry.uid);2987 duplicateButton.data('uid', entry.uid);
@@ -3257,7 +3279,7 @@ export const newWorldInfoEntryDefinition = {
3257 disable: { default: false, type: 'boolean' },3279 disable: { default: false, type: 'boolean' },
3258 excludeRecursion: { default: false, type: 'boolean' },3280 excludeRecursion: { default: false, type: 'boolean' },
3259 preventRecursion: { default: false, type: 'boolean' },3281 preventRecursion: { default: false, type: 'boolean' },
3260 delayUntilRecursion: { default: false, type: 'boolean' },3282 delayUntilRecursion: { default: 0, type: 'number' },
3261 probability: { default: 100, type: 'number' },3283 probability: { default: 100, type: 'number' },
3262 useProbability: { default: true, type: 'boolean' },3284 useProbability: { default: true, type: 'boolean' },
3263 depth: { default: DEFAULT_DEPTH, type: 'number' },3285 depth: { default: DEFAULT_DEPTH, type: 'number' },