diff --git a/res/css/style.css b/res/css/style.css index 1860531..e96ef67 100644 --- a/res/css/style.css +++ b/res/css/style.css @@ -19,5 +19,5 @@ body { } .realtime-log { - height: 50em; + height: 15em; } diff --git a/res/index.html b/res/index.html index c741378..ed66b44 100644 --- a/res/index.html +++ b/res/index.html @@ -194,7 +194,7 @@ $("#modalTailf").modal({ show: true, // keyboard: false, - backdrop: 'static', + // backdrop: 'static', }) }); diff --git a/res/js/index.js b/res/js/index.js index b66dcb2..2e66bb3 100644 --- a/res/js/index.js +++ b/res/js/index.js @@ -198,8 +198,16 @@ $(function() { vm.log.follow = false; } }) + $('#modalTailf').on('hidden.bs.modal', function() { + // do something… + console.log("Hiddeen") + if (W.wsLog) { + console.log("close wsLog") + W.wsLog.close() + } + }) - var ws = newWebsocket("/ws/logs/hee", { + W.wsLog = newWebsocket("/ws/logs/hee", { onopen: function(evt) { vm.log.content = ""; }, @@ -208,7 +216,9 @@ $(function() { vm.log.line_count = $.trim(vm.log.content).split(/\r\n|\r|\n/).length; if (vm.log.follow) { var pre = $(".realtime-log")[0]; - pre.scrollTop = pre.scrollHeight; + setTimeout(function() { + pre.scrollTop = pre.scrollHeight - pre.clientHeight; + }, 1); } } })