This commit is contained in:
ebolam
2022-10-03 15:29:35 -04:00
parent b9c1ef7bfc
commit bc49577974
2 changed files with 6 additions and 6 deletions

View File

@@ -1154,12 +1154,8 @@ class KoboldStoryRegister(object):
if "WI Search Text" not in temp[int(item)]: if "WI Search Text" not in temp[int(item)]:
temp[int(item)]["WI Search Text"] = re.sub("[^0-9a-z \'\"]", "", temp[int(item)]['Selected Text']) temp[int(item)]["WI Search Text"] = re.sub("[^0-9a-z \'\"]", "", temp[int(item)]['Selected Text'])
if int(item) >= self.action_count-100: if int(item) >= self.action_count-100:
print("added item {}".format(item))
data_to_send.append({"id": item, 'action': temp[int(item)]}) data_to_send.append({"id": item, 'action': temp[int(item)]})
else:
print("Not addinig item {}".format(item))
print("sending {} actions".format(len(data_to_send)))
process_variable_changes(self.socketio, "story", 'actions', data_to_send, None) process_variable_changes(self.socketio, "story", 'actions', data_to_send, None)
self.actions = temp self.actions = temp

View File

@@ -155,6 +155,7 @@ function reset_story() {
finder_last_input = null; finder_last_input = null;
on_new_wi_item = null; on_new_wi_item = null;
current_chunk_number = null; current_chunk_number = null;
scroll_trigger_element = undefined;
var story_area = document.getElementById('Selected Text'); var story_area = document.getElementById('Selected Text');
let temp = [] let temp = []
for (child of story_area.children) { for (child of story_area.children) {
@@ -579,11 +580,14 @@ function var_changed(data) {
if ((scroll_trigger_element == undefined) || (actions[actions.length-1].id < parseInt(scroll_trigger_element.getAttribute("chunk")))) { if ((scroll_trigger_element == undefined) || (actions[actions.length-1].id < parseInt(scroll_trigger_element.getAttribute("chunk")))) {
if (scroll_trigger_element != undefined) { if (scroll_trigger_element != undefined) {
scroll_trigger_element.scrollIntoView(); scroll_trigger_element.scrollIntoView();
} else {
document.getElementById("Selected Text Chunk "+actions[actions.length-1].id).scrollIntoView();
} }
scroll_trigger_element = document.getElementById("Selected Text Chunk "+actions[actions.length-1].id);
scroll_trigger_element = document.getElementById("Selected Text Chunk "+actions[0].id);
//if we hit the top, unhide the prompt and clear the scroll trigger //if we hit the top, unhide the prompt and clear the scroll trigger
if (actions[actions.length-1].id == 0) { if (actions[actions.length-1].id == 0) {
document.getElementById("story_prompt").classList.remove("story_prompt"); document.getElementById("story_prompt").classList.remove("hidden");
scroll_trigger_element = null; scroll_trigger_element = null;
} }
} }