Added scroll-to-bottom for closing genseqs/W Info

Scroll time is halved now also.
This commit is contained in:
Gnome Ann 2021-08-26 15:15:42 -04:00
parent 75c68c2b78
commit 0fbf620f22
1 changed files with 11 additions and 9 deletions

View File

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