From: Matteo Nastasi (mop) Date: Tue, 22 Apr 2008 04:38:19 +0000 (+0000) Subject: chat scroll enhancement X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=a22465e854f0f8a57dca27817b1f96a08fd343d5;p=brisk.git chat scroll enhancement --- diff --git a/web/commons.js b/web/commons.js index 342fc99..3b79ddc 100644 --- a/web/commons.js +++ b/web/commons.js @@ -841,6 +841,13 @@ var CHATT_MAXLINES = 40; /* PRO CHATT */ function chatt_sub(name,str) { + var must_scroll = false; + + // alert ($("txt").scrollTop + parseInt(getStyle($("txt"),"height", "height")) - $("txt").scrollHeight); + + if ($("txt").scrollTop + parseInt(getStyle($("txt"),"height", "height")) - $("txt").scrollHeight >= 0) + must_scroll = true; + // alert("ARRIVA NAME: "+ name + " STR:"+str); if (chatt_lines_n == CHATT_MAXLINES) { $("txt").innerHTML = ""; @@ -856,8 +863,13 @@ function chatt_sub(name,str) $("txt").innerHTML += chatt_lines[chatt_lines_n]; chatt_lines_n++; } - $("txt").innerHTML; - $("txt").scrollTop = 10000000; + // $("txt").innerHTML; + + + if (must_scroll) { + $("txt").scrollTop = 10000000; + } + // alert("scTOP "+$("txt").scrollTop+" scHEIGHT: "+$("txt").scrollHeight+" HEIGHT: "+getStyle($("txt"),"height", "height") ); } /* diff --git a/web/room.css b/web/room.css index d92e2dc..5da67cb 100644 --- a/web/room.css +++ b/web/room.css @@ -247,7 +247,7 @@ div.esco { height: 100px; overflow: auto; border: 1px solid gray; - padding: 2px; + /* padding: 2px; */ vertical-align: text-bottom; } diff --git a/web/ticker.js b/web/ticker.js index e4362ff..8c73c1a 100644 --- a/web/ticker.js +++ b/web/ticker.js @@ -49,8 +49,8 @@ train.prototype = { box: null, notebox: null, width: 0, - deltat: 100, - deltas: 5, + deltat: 250, + deltas: 12, xend: 0, timout: null, clickable: true, @@ -197,7 +197,7 @@ train.prototype = { wag.box.innerHTML = ""; wag.shut_step = 2; } - curw = wag.widthbox_get() - 4; + curw = wag.widthbox_get() - 10; wag.w = curw + 2; // 2 for border pixels if (curw <= 0) { obj.box.removeChild(wag.box); @@ -211,7 +211,7 @@ train.prototype = { } } this.redraw(); - setTimeout(function(){ arguments[0][0].shut_wagon(arguments[0]); }, 100, [ obj, wag ]); + setTimeout(function(){ arguments[0][0].shut_wagon(arguments[0]); }, 250, [ obj, wag ]); }, redraw: function()