From 498d999a06ee2bf9b4422df00c40d8ad71ade0ab Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 26 Nov 2022 17:24:04 -0500 Subject: [PATCH] Added fix for UI2 to now show the back value when there is only one option (use redo to go restore it) --- static/koboldai.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/static/koboldai.js b/static/koboldai.js index e1d98fd1..5c872ed2 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -266,6 +266,30 @@ function create_options(action) { while (option_chunk.firstChild) { option_chunk.removeChild(option_chunk.firstChild); } + + //Let's check if we only have a single redo option. In that case we din't show as the user can use the redo button + seen_prev_selection = false; + show_options = false; + console.log(action.action.Options); + for (item of action.action.Options) { + if (!(item['Previous Selection'])) { + console.log(item); + show_options = true; + break; + } else if (item['Previous Selection']) { + if (seen_prev_selection) { + show_options = true; + break; + } else { + seen_prev_selection = true; + } + } + } + console.log("seen_prev_selection: "+seen_prev_selection+" show_options: "+show_options); + if (!(show_options)) { + return; + } + var table = document.createElement("div"); table.classList.add("sequences"); //Add Redo options