summaryrefslogtreecommitdiffstats
path: root/nfsw/static/io.js
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2019-10-12 20:07:13 -0400
committerrsiddharth <s@ricketyspace.net>2019-10-12 20:07:13 -0400
commit66c323a7a0e13e3d2f25708185e7e8a8f02c4145 (patch)
treed46976b27dfaa6de3406e260bc0ea290a12663f7 /nfsw/static/io.js
parent34580ab1b696e196017fa2690de980012c73bd8d (diff)
nfsw/static/io.js: Update auto scrolling.
Don't auto scroll if user initiates an up scroll.
Diffstat (limited to 'nfsw/static/io.js')
-rw-r--r--nfsw/static/io.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/nfsw/static/io.js b/nfsw/static/io.js
index af11675..36965c5 100644
--- a/nfsw/static/io.js
+++ b/nfsw/static/io.js
@@ -11,6 +11,7 @@ document.addEventListener('DOMContentLoaded', function() {
var qipoff = function() {
window.qip = false;
+ ioconsole.autoScroll = true;
};
var spit = function(response) {
var gdg = 'Oops! getting gobbledygook from server';
@@ -65,6 +66,7 @@ document.addEventListener('DOMContentLoaded', function() {
var iipoff = function() {
window.iip = false;
+ ioconsole.autoScroll = true;
};
var spit = function(response, status) {
var r;
@@ -157,7 +159,11 @@ document.addEventListener('DOMContentLoaded', function() {
ioconsole.appendChild(p);
}
p.append(txt.substring(0, 1));
- p.scrollIntoView();
+
+ if (ioconsole.autoScroll) {
+ p.scrollIntoView(false);
+ }
+
window.setTimeout(
barfslow, 25,
@@ -170,6 +176,19 @@ document.addEventListener('DOMContentLoaded', function() {
return '';
}
var ioconsole = document.getElementsByClassName('console')[0];
+ ioconsole.onscroll = function(e) {
+ if (!window.qip && !window.iip) {
+ return;
+ }
+
+ if (e.target.scrollTop < e.target.lastScrollTop) {
+ e.target.autoScroll = false;
+ }
+
+ e.target.lastScrollTop = e.target.scrollTop;
+ };
+ ioconsole.lastScrollTop = ioconsole.scrollTop;
+ ioconsole.autoScroll = true;
/**