Skip to content

Instantly share code, notes, and snippets.

@whiteball
Created January 21, 2022 14:29
Show Gist options
  • Save whiteball/1fc503e1376bbb84222df7bd5a26284c to your computer and use it in GitHub Desktop.
Save whiteball/1fc503e1376bbb84222df7bd5a26284c to your computer and use it in GitHub Desktop.
--- ainovel_v2_081.js Fri Jan 21 23:27:08 2022
+++ ainovel_v2_081_patch.js Fri Jan 21 23:27:20 2022
@@ -2141,8 +2141,17 @@
// write the text to data_edit
TextSharding(all_textdata,false);
- all[all.length - 1].innerHTML = all[all.length - 1].innerHTML + "<span id=\"ai_output\" style=\"color:"+document.getElementById("vis_fontcolor_ai").value+"\">" + result + "</span>";
- $("#data_container").scrollTop($("#data_edit").height()*4096);
+ let isFound = false;
+ for (const edit_area of all){
+ if (edit_area.innerHTML.indexOf('<br>@endpoint<br>') !== -1) {
+ edit_area.innerHTML = edit_area.innerHTML.replace('<br>@endpoint<br>', "<span id=\"ai_output\" style=\"color:"+document.getElementById("vis_fontcolor_ai").value+"\">" + result + "</span><br>@endpoint<br>");
+ isFound = true;
+ }
+ }
+ if ( ! isFound) {
+ all[all.length - 1].innerHTML = all[all.length - 1].innerHTML + "<span id=\"ai_output\" style=\"color:"+document.getElementById("vis_fontcolor_ai").value+"\">" + result + "</span>";
+ $("#data_container").scrollTop($("#data_edit").height()*4096);
+ }
document.getElementById("retryoptions").style.display = "";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment