|
12 | 12 | -->
|
13 | 13 |
|
14 | 14 | <script>
|
15 |
| - const LITEVER = 163; |
| 15 | + const LITEVER = 164; |
16 | 16 | const urlParams = new URLSearchParams(window.location.search);
|
17 | 17 | const localflag = urlParams.get('local');
|
18 | 18 | const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
|
|
5945 | 5945 | try {
|
5946 | 5946 | let new_loaded_storyobj = JSON.parse(text);
|
5947 | 5947 | //we don't want to fiddle with the file as its very complex. only handle the parts we are interested in, and just leave the rest untouched.
|
5948 |
| - if (new_loaded_storyobj.prompt != null && !new_loaded_storyobj.scenarioVersion) { |
| 5948 | + if (is_kai_json(new_loaded_storyobj) && !new_loaded_storyobj.scenarioVersion) { |
5949 | 5949 | //quick sanity check. if prompt does not exist, this is not a KAI save.
|
5950 | 5950 | kai_json_load(new_loaded_storyobj,false);
|
5951 | 5951 | if (selectedFilename && selectedFilename != "") {
|
|
6043 | 6043 | return (gametext_arr.length == 0 && current_memory == "" && current_anote == "" && current_wi.length == 0 && redo_arr.length == 0);
|
6044 | 6044 | }
|
6045 | 6045 |
|
| 6046 | + function is_kai_json(obj) |
| 6047 | + { |
| 6048 | + let is_kai = (!(tmpstory.prompt==null) || tmpstory.savedsettings!=null); |
| 6049 | + return is_kai; |
| 6050 | + } |
| 6051 | + |
6046 | 6052 | function kai_json_load(storyobj, force_load_settngs)
|
6047 | 6053 | {
|
6048 | 6054 | //either show popup or just proceed to load
|
|
6151 | 6157 | }
|
6152 | 6158 | } else {
|
6153 | 6159 | //v2 load
|
6154 |
| - if(storyobj.prompt!="") |
| 6160 | + if(storyobj.prompt != "") |
6155 | 6161 | {
|
6156 | 6162 | gametext_arr.push(storyobj.prompt);
|
6157 | 6163 | }
|
|
6517 | 6523 | {
|
6518 | 6524 | console.log("Loading nai obj");
|
6519 | 6525 | restart_new_game(false);
|
6520 |
| - if(obj.prompt!="") |
| 6526 | + if(obj.prompt != "") |
6521 | 6527 | {
|
6522 | 6528 | gametext_arr.push(obj.prompt);
|
6523 | 6529 | }
|
|
8521 | 8527 | .then(response => response.json())
|
8522 | 8528 | .then(values5 => {
|
8523 | 8529 | let tmpstory = values5;
|
8524 |
| - let is_kai = !(tmpstory.prompt==null); |
8525 |
| - if(is_kai) |
| 8530 | + if(is_kai_json(tmpstory)) |
8526 | 8531 | {
|
8527 | 8532 | if (localsettings.persist_session && !safe_to_overwrite()) {
|
8528 | 8533 | console.log("Preload story: Unsafe to overwrite");
|
|
0 commit comments