mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
toggle to disable world Info entries
This commit is contained in:
@@ -1870,6 +1870,7 @@
|
|||||||
<input class="text_pole wide50px" type="number" name="order" placeholder="" />
|
<input class="text_pole wide50px" type="number" name="order" placeholder="" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="flex-container flexFlowColumn flexNoGap wi-enter-footer-text">
|
<div class="flex-container flexFlowColumn flexNoGap wi-enter-footer-text">
|
||||||
<div class="world_entry_form_uid">
|
<div class="world_entry_form_uid">
|
||||||
UID:
|
UID:
|
||||||
@@ -1882,6 +1883,12 @@
|
|||||||
<span class="world_entry_form_token_counter">0</span>
|
<span class="world_entry_form_token_counter">0</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="checkbox">
|
||||||
|
<input type="checkbox" name="disable" />
|
||||||
|
<span>Disable</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<span class="world_popup_expander"> </span>
|
<span class="world_popup_expander"> </span>
|
||||||
<input class="menu_button delete_entry_button" type="submit" value="Delete Entry" />
|
<input class="menu_button delete_entry_button" type="submit" value="Delete Entry" />
|
||||||
</div>
|
</div>
|
||||||
|
@@ -240,6 +240,7 @@ function appendWorldEntry(entry) {
|
|||||||
$(this).siblings("input").click();
|
$(this).siblings("input").click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// constant
|
// constant
|
||||||
const constantInput = template.find('input[name="constant"]');
|
const constantInput = template.find('input[name="constant"]');
|
||||||
constantInput.data("uid", entry.uid);
|
constantInput.data("uid", entry.uid);
|
||||||
@@ -287,6 +288,21 @@ function appendWorldEntry(entry) {
|
|||||||
// display uid
|
// display uid
|
||||||
template.find(".world_entry_form_uid_value").html(entry.uid);
|
template.find(".world_entry_form_uid_value").html(entry.uid);
|
||||||
|
|
||||||
|
// disable
|
||||||
|
const disableInput = template.find('input[name="disable"]');
|
||||||
|
disableInput.data("uid", entry.uid);
|
||||||
|
disableInput.on("input", function () {
|
||||||
|
const uid = $(this).data("uid");
|
||||||
|
const value = $(this).prop("checked");
|
||||||
|
world_info_data.entries[uid].disable = value;
|
||||||
|
saveWorldInfo();
|
||||||
|
console.log(`WI #${entry.uid} disabled? ${world_info_data.entries[uid].disable}`);
|
||||||
|
});
|
||||||
|
disableInput.prop("checked", entry.disable).trigger("input");
|
||||||
|
disableInput.siblings(".checkbox_fancy").click(function () {
|
||||||
|
$(this).siblings("input").click();
|
||||||
|
});
|
||||||
|
|
||||||
// delete button
|
// delete button
|
||||||
const deleteButton = template.find("input.delete_entry_button");
|
const deleteButton = template.find("input.delete_entry_button");
|
||||||
deleteButton.data("uid", entry.uid);
|
deleteButton.data("uid", entry.uid);
|
||||||
@@ -319,6 +335,7 @@ function createWorldInfoEntry() {
|
|||||||
selective: false,
|
selective: false,
|
||||||
order: 100,
|
order: 100,
|
||||||
position: 0,
|
position: 0,
|
||||||
|
disable: false,
|
||||||
};
|
};
|
||||||
const newUid = getFreeWorldEntryUid();
|
const newUid = getFreeWorldEntryUid();
|
||||||
|
|
||||||
@@ -458,19 +475,20 @@ function checkWorldInfo(chat) {
|
|||||||
const sortedEntries = Object.keys(world_info_data.entries)
|
const sortedEntries = Object.keys(world_info_data.entries)
|
||||||
.map((x) => world_info_data.entries[x])
|
.map((x) => world_info_data.entries[x])
|
||||||
.sort((a, b) => b.order - a.order);
|
.sort((a, b) => b.order - a.order);
|
||||||
|
|
||||||
while (needsToScan) {
|
while (needsToScan) {
|
||||||
let activatedNow = new Set();
|
let activatedNow = new Set();
|
||||||
|
|
||||||
for (let entry of sortedEntries) {
|
for (let entry of sortedEntries) {
|
||||||
if (allActivatedEntries.has(entry.uid)) {
|
if (allActivatedEntries.has(entry.uid) && entry.disable == false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.constant) {
|
if (entry.constant && entry.disable == false) {
|
||||||
activatedNow.add(entry.uid);
|
activatedNow.add(entry.uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(entry.key) && entry.key.length) {
|
if (Array.isArray(entry.key) && entry.key.length && entry.disable == false) {
|
||||||
primary: for (let key of entry.key) {
|
primary: for (let key of entry.key) {
|
||||||
if (key && textToScan.includes(key.trim().toLowerCase())) {
|
if (key && textToScan.includes(key.trim().toLowerCase())) {
|
||||||
if (
|
if (
|
||||||
@@ -616,7 +634,7 @@ $(document).ready(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("#world_popup_delete").click(() => {
|
$("#world_popup_delete").click(() => {
|
||||||
callPopup("<h3>Delete the World Info?</h3>", "del_world");
|
callPopup("<h3>Delete the World Info?</h3>", "del_world");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#world_popup_new").click(() => {
|
$("#world_popup_new").click(() => {
|
||||||
|
Reference in New Issue
Block a user