From: Matteo Nastasi (mop) Date: Wed, 30 Nov 2011 17:55:37 +0000 (+0100) Subject: normalized user name showing X-Git-Tag: 3.6.1~1 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=70234232cbab5617dcae7a3719b7d7a75f63cf62;p=brisk.git normalized user name showing --- diff --git a/web/briskin5/briskin5.js b/web/briskin5/briskin5.js index d471964..d571b75 100644 --- a/web/briskin5/briskin5.js +++ b/web/briskin5/briskin5.js @@ -272,15 +272,15 @@ function act_reload() function set_names(so,ea,ne,nw,we) { // alert("SET NAME"); - $("name").innerHTML = italizer(so); - $("name").title = unescapeHTML(so[1]); - $("name_ea").innerHTML = italizer(ea); + $("name").innerHTML = user_decorator(so); + $("name").title = unescapeHTML(so[1]); + $("name_ea").innerHTML = user_decorator(ea); $("name_ea").title = unescapeHTML(ea[1]); - $("name_ne").innerHTML = italizer(ne); + $("name_ne").innerHTML = user_decorator(ne); $("name_ne").title = unescapeHTML(ne[1]); - $("name_nw").innerHTML = italizer(nw); + $("name_nw").innerHTML = user_decorator(nw); $("name_nw").title = unescapeHTML(nw[1]); - $("name_we").innerHTML = italizer(we); + $("name_we").innerHTML = user_decorator(we); $("name_we").title = unescapeHTML(we[1]); for (i = 0 ; i < PLAYERS_N ; i++) 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") ); } /* diff --git a/web/room.js b/web/room.js index d5d49f2..4a53d50 100644 --- a/web/room.js +++ b/web/room.js @@ -241,22 +241,7 @@ function table_walk(curtag) function j_stand_tdcont(el) { - var content = ""; - var val_el; - - val_el = el[0] & 0x03; - - if (val_el > 0) - content += ''; - - content += el[1]; - - if (val_el > 0) - content += ''; - - content += state_add(el[0]); - - return (content); + return (user_dec_and_state(el)); } function j_stand_cont(ddata) @@ -445,19 +430,9 @@ function j_tab_cont(table_idx, data) var content = ''; for (i = 0 ; i < data.length ; i++) { - var val_el; - - val_el = data[i][0] & 0x03; - - if (val_el > 0) - content += ''; - - content += data[i][1]; - - if (val_el > 0) - content += ''; - - content += state_add(data[i][0]); + // content += user_decorator(data[i]); + // content += state_add(data[i][0]); + content += j_stand_tdcont(data[i]); content += '
'; }