X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fcommons.js;h=ec1b88ada303afce06b78e681ba79d53269e38c9;hb=70234232cbab5617dcae7a3719b7d7a75f63cf62;hp=ea42c61831300526722ca0d82dc40fa7a8e33e8f;hpb=43038b6a6a2edc22b573ccc0abac9374499154a6;p=brisk.git diff --git a/web/commons.js b/web/commons.js index ea42c61..ec1b88a 100644 --- a/web/commons.js +++ b/web/commons.js @@ -765,6 +765,30 @@ var chatt_lines_n = 0; var CHATT_MAXLINES = 40; +function user_decorator(user) +{ + var name; + var flags = user[0]; + if ((flags & 0x03) != 0) + name = ""+user[1]+""; + else + name = user[1]; + + return (name); +} + +function user_dec_and_state(el) +{ + var content = ""; + var val_el; + + content = user_decorator(el); + content += state_add(el[0]); + + return (content); +} + + /* PRO CHATT */ function chatt_sub(dt,data,str) { @@ -773,38 +797,33 @@ function chatt_sub(dt,data,str) var flags; var isauth; - flags = data[0]; - if (flags & 0x02) - name = ""+data[1]+""; - else - name = data[1]; - // 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 = ""; - for (i = 0 ; i < (CHATT_MAXLINES - 1) ; i++) { - chatt_lines[i] = chatt_lines[i+1]; - $("txt").innerHTML += chatt_lines[i]; + name = user_decorator(data) + + 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 = ""; + for (i = 0 ; i < (CHATT_MAXLINES - 1) ; i++) { + chatt_lines[i] = chatt_lines[i+1]; + $("txt").innerHTML += chatt_lines[i]; + } + chatt_lines[i] = dt+name+str+ "
"; + $("txt").innerHTML += chatt_lines[i]; + } + else { + chatt_lines[chatt_lines_n] = dt+""+name+" "+str+ "
"; + $("txt").innerHTML += chatt_lines[chatt_lines_n]; + chatt_lines_n++; + } + // $("txt").innerHTML; + + + if (must_scroll) { + $("txt").scrollTop = 10000000; } - chatt_lines[i] = dt+""+name+" "+str+ "
"; - $("txt").innerHTML += chatt_lines[i]; - } - else { - chatt_lines[chatt_lines_n] = dt+""+name+" "+str+ "
"; - $("txt").innerHTML += chatt_lines[chatt_lines_n]; - chatt_lines_n++; - } - // $("txt").innerHTML; - - - if (must_scroll) { - $("txt").scrollTop = 10000000; - } - // alert("scTOP "+$("txt").scrollTop+" scHEIGHT: "+$("txt").scrollHeight+" HEIGHT: "+getStyle($("txt"),"height", "height") ); + // alert("scTOP "+$("txt").scrollTop+" scHEIGHT: "+$("txt").scrollHeight+" HEIGHT: "+getStyle($("txt"),"height", "height") ); } /*