Added execution time to the UI

This commit is contained in:
ebolam
2022-06-10 20:51:22 -04:00
parent cfd1147d5a
commit 5110e956d2
3 changed files with 10 additions and 0 deletions

View File

@ -882,6 +882,7 @@ function formatChunkInnerText(chunk) {
}
function dosubmit(disallow_abort) {
submit_start = Date.now();
var txt = input_text.val().replace(/\u00a0/g, " ");
if((disallow_abort || gamestate !== "wait") && !memorymode && !gamestarted && ((!adventure || !action_mode) && txt.trim().length == 0)) {
return;
@ -2099,6 +2100,10 @@ $(document).ready(function(){
scrollToBottom();
} else if(msg.cmd == "updatechunk") {
hideMessage();
if (typeof submit_start !== 'undefined') {
$("#runtime")[0].innerHTML = `Generation time: ${Math.round((Date.now() - submit_start)/1000)} sec`;
delete submit_start;
}
var index = msg.data.index;
var html = msg.data.html;
var existingChunk = game_text.children('#n' + index);