Fix scrolling and width of global WI

This commit is contained in:
Cohee
2023-06-25 12:43:37 +03:00
parent 861e0d017e
commit 951e22ac8e
2 changed files with 12 additions and 6 deletions

View File

@@ -1876,9 +1876,9 @@
</div> </div>
<div id="wi-holder" class="margin5"> <div id="wi-holder" class="margin5">
<div class="justifyContentSpaceAround wi-settings flex-container gap10px alignitemscenter"> <div class="justifyContentSpaceAround wi-settings flex-container gap10px alignitemscenter">
<div id="WIMultiSelector" class="flex alignSelfStart range-block"> <div id="WIMultiSelector" class="flex2 flex alignSelfStart range-block">
<div class="range-block-title justifyLeft"> <div class="range-block-title justifyLeft">
<small>Active World</small> <small>Active World(s)</small>
</div> </div>
<div class="range-block-range"> <div class="range-block-range">
<select id="world_info" multiple> <select id="world_info" multiple>
@@ -1886,7 +1886,7 @@
</select> </select>
</div> </div>
</div> </div>
<div class=" flex-container flexFlowColumn"> <div class="flex2 flex-container flexFlowColumn">
<div class="flex range-block"> <div class="flex range-block">
<div class="range-block-title justifyLeft"> <div class="range-block-title justifyLeft">
<label for="world_info_character_strategy"> <label for="world_info_character_strategy">
@@ -1937,7 +1937,7 @@
</div> </div>
</div> </div>
<div class="range-block flex-container flexFlowColumn"> <div class="flex1 range-block flex-container flexFlowColumn">
<label title="Entries can activate other entries by mentioning their keywords" class="checkbox_label"> <label title="Entries can activate other entries by mentioning their keywords" class="checkbox_label">
<input id="world_info_recursive" type="checkbox" /> <input id="world_info_recursive" type="checkbox" />
<small> <small>
@@ -3399,4 +3399,4 @@
</script> </script>
</body> </body>
</html> </html>

View File

@@ -1048,7 +1048,7 @@ function onWorldInfoChange(_, text) {
toastr.success(`Activated world: ${wiElement.text()}`); toastr.success(`Activated world: ${wiElement.text()}`);
} else { } else {
toastr.error(`No world found named: ${worldName}`); toastr.error(`No world found named: ${worldName}`);
} }
}) })
} else { // if no args, unset all worlds } else { // if no args, unset all worlds
toastr.success('Deactivated all worlds'); toastr.success('Deactivated all worlds');
@@ -1081,12 +1081,18 @@ jQuery(() => {
$(document).ready(function () { $(document).ready(function () {
registerSlashCommand('world', onWorldInfoChange, [], " sets active World, or unsets if no args provided", true, true); registerSlashCommand('world', onWorldInfoChange, [], " sets active World, or unsets if no args provided", true, true);
}) })
let selectScrollTop = null;
$("#world_info").on('mousedown change', async function (e) { $("#world_info").on('mousedown change', async function (e) {
if (deviceInfo.device.type === 'desktop') { if (deviceInfo.device.type === 'desktop') {
e.preventDefault(); e.preventDefault();
const option = $(e.target); const option = $(e.target);
const selectElement = $(this)[0];
selectScrollTop = selectElement.scrollTop;
option.prop('selected', !option.prop('selected')); option.prop('selected', !option.prop('selected'));
await delay(1); await delay(1);
selectElement.scrollTop = selectScrollTop;
} }
onWorldInfoChange('__notSlashCommand__'); onWorldInfoChange('__notSlashCommand__');