From 30e5a315915eb4675b629ac2d984a42891735b67 Mon Sep 17 00:00:00 2001 From: RossAscends <124905043+RossAscends@users.noreply.github.com> Date: Thu, 5 Oct 2023 23:40:48 +0900 Subject: [PATCH] Position, Depth, Order Inputs to WI Entry header --- public/css/st-tailwind.css | 16 +++++++++++- public/css/world-info.css | 10 ++++---- public/index.html | 39 +++++++++++++++++++++++------ public/scripts/world-info.js | 48 +++++++++++++++++++++++++++--------- 4 files changed, 87 insertions(+), 26 deletions(-) diff --git a/public/css/st-tailwind.css b/public/css/st-tailwind.css index 172b7a5de..f5ab0d9f2 100644 --- a/public/css/st-tailwind.css +++ b/public/css/st-tailwind.css @@ -124,6 +124,10 @@ max-width: 100px; } +.width100px { + width: 100px; +} + .widthUnset { width: unset; } @@ -374,6 +378,11 @@ cursor: pointer; } +input:disabled, +textarea:disabled { + cursor: not-allowed; +} + .debug-red { border: 1px solid red !important; } @@ -402,6 +411,11 @@ font-size: calc(var(--mainFontSize) * 0.6) !important; } +.paddingBottom5px { + padding: unset; + padding-bottom: 5px; +} + .paddingTopBot5 { padding: 5px 0; } @@ -429,4 +443,4 @@ .opacity1 { opacity: 1 !important; -} +} \ No newline at end of file diff --git a/public/css/world-info.css b/public/css/world-info.css index 67ea3edec..aceeb58b5 100644 --- a/public/css/world-info.css +++ b/public/css/world-info.css @@ -101,7 +101,7 @@ height: auto; margin-top: 0; margin-bottom: 0; - min-height: 32px; + min-height: var(--mainFontSize); } .delete_entry_button { @@ -162,11 +162,11 @@ } .wi-card-entry { - border: 1px groove; + border: 1px solid; border-color: var(--SmartThemeBorderColor); - border-radius: 8px; - padding: 5px; - margin-bottom: 3px; + border-radius: 10px; + padding: 0 5px; + margin-bottom: 1px; } .world_entry { diff --git a/public/index.html b/public/index.html index cc43d33f1..39ea0e768 100644 --- a/public/index.html +++ b/public/index.html @@ -2726,6 +2726,7 @@ +
@@ -3932,9 +3933,31 @@
- - - + + + + + + + +
+ +
+ + +
+ +
+ + +
+
- @@ -3963,14 +3986,14 @@
- +
-
+
@@ -4073,7 +4096,7 @@
--> -
+ diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 6826692ff..481117b37 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -52,6 +52,8 @@ let updateEditor = (navigation) => { navigation; }; // Do not optimize. updateEditor is a function that is updated by the displayWorldEntries with new data. const worldInfoFilter = new FilterHelper(() => updateEditor()); +const InputWidthReference = $("#WIInputWidthReference"); + const DEFAULT_DEPTH = 4; export function getWorldInfoSettings() { @@ -289,10 +291,25 @@ function displayWorldEntries(name, data, navigation = navigation_option.none) { callback: function (page) { $("#world_popup_entries_list").empty(); const keywordHeaders = ` -
+
+ + Position + + + Depth + + + Order + + + Status + Keywords + + Logic + Optional Filter @@ -692,6 +709,7 @@ function getWorldEntry(name, data, entry) { saveWorldInfo(name, data); }); orderInput.val(entry.order).trigger("input"); + orderInput.width(InputWidthReference.width() + 15 + 'px') // probability if (entry.probability === undefined) { @@ -711,10 +729,11 @@ function getWorldEntry(name, data, entry) { saveWorldInfo(name, data); }); depthInput.val(entry.depth ?? DEFAULT_DEPTH).trigger("input"); + depthInput.width(InputWidthReference.width() + 15 + 'px'); // Hide by default unless depth is specified if (entry.position === world_info_position.atDepth) { - depthInput.parent().hide(); + //depthInput.parent().hide(); } const probabilityInput = template.find('input[name="probability"]'); @@ -776,15 +795,20 @@ function getWorldEntry(name, data, entry) { } const positionInput = template.find('select[name="position"]'); + initScrollHeight(positionInput); positionInput.data("uid", entry.uid); positionInput.on("input", function () { const uid = $(this).data("uid"); const value = Number($(this).val()); data.entries[uid].position = !isNaN(value) ? value : 0; if (value === world_info_position.atDepth) { - depthInput.parent().show(); + depthInput.prop('disabled', false); + depthInput.removeClass('disabledWIEntry') + //depthInput.parent().show(); } else { - depthInput.parent().hide(); + depthInput.prop('disabled', true); + depthInput.addClass('disabledWIEntry') + //depthInput.parent().hide(); } updatePosOrdDisplay(uid) // Spec v2 only supports before_char and after_char @@ -1583,14 +1607,14 @@ export function checkEmbeddedWorld(chid) { callPopup(`

This character has an embedded World/Lorebook.

Would you like to import it now?

If you want to import it later, select "Import Card Lore" in the "More..." dropdown menu on the character panel.
`, - 'confirm', - '', - { okButton: 'Yes', }) - .then((result) => { - if (result) { - importEmbeddedWorldInfo(true); - } - }); + 'confirm', + '', + { okButton: 'Yes', }) + .then((result) => { + if (result) { + importEmbeddedWorldInfo(true); + } + }); } return true; }