Merge pull request #10 from VE-FORBRYDERNE/big-o

A fix for world info keyword scanning which I broke in the previous pull request, and more triggers for scrolling to bottom
This commit is contained in:
henk717 2021-08-26 21:35:22 +02:00 committed by GitHub
commit 36d5f249b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View File

@ -1632,6 +1632,7 @@ def checkworldinfo(txt):
for key in reversed(vars.actions):
chunk = vars.actions[key]
chunks.appendleft(chunk)
i += 1
if(i == depth):
break

View File

@ -391,6 +391,12 @@ function hideWaitAnimation() {
$('#waitanim').remove();
}
function scrollToBottom() {
setTimeout(function () {
$('#gamescreen').animate({scrollTop: $('#gamescreen').prop('scrollHeight')}, 500);
}, 5);
}
function hide(refs) {
for(i=0; i<refs.length; i++) {
refs[i].addClass("hidden");
@ -457,6 +463,7 @@ function exitWiMode() {
hide([wi_menu]);
show([button_actback, button_actmem, button_actretry, game_text]);
enableSendBtn();
scrollToBottom();
}
function returnWiList(ar) {
@ -629,6 +636,7 @@ function hidegenseqs() {
$('#seqselmenu').slideUp("slow", function() {
seqselcontents.html("");
});
scrollToBottom();
}
function setmodevisibility(state) {
@ -877,16 +885,12 @@ $(document).ready(function(){
$('chunk').attr('contenteditable', allowedit);
// Scroll to bottom of text
if(newly_loaded) {
setTimeout(function () {
$('#gamescreen').animate({scrollTop: $('#gamescreen').prop('scrollHeight')}, 1000);
}, 5);
scrollToBottom();
}
newly_loaded = false;
hideMessage();
} else if(msg.cmd == "scrolldown") {
setTimeout(function () {
$('#gamescreen').animate({scrollTop: $('#gamescreen').prop('scrollHeight')}, 1000);
}, 5);
scrollToBottom();
} else if(msg.cmd == "updatechunk") {
hideMessage();
const {index, html, last} = msg.data;
@ -904,9 +908,7 @@ $(document).ready(function(){
hide([$('#curtain')]);
if(last) {
// Scroll to bottom of text if it's the last element
setTimeout(function () {
$('#gamescreen').animate({scrollTop: $('#gamescreen').prop('scrollHeight')}, 1000);
}, 5);
scrollToBottom();
}
} else if(msg.cmd == "removechunk") {
hideMessage();