X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fcommons.js;h=77be887ee744cfc1c6891d1ed50f53cee2851a73;hb=efcfcc246458c7592395d2971ed7141c224ecf14;hp=e3e56d73ea69ec6108152a41cd4664537e0c7f59;hpb=bdb3cb2379f32bfb9279da661b1d4dbaf9712299;p=brisk.git diff --git a/web/commons.js b/web/commons.js index e3e56d7..77be887 100644 --- a/web/commons.js +++ b/web/commons.js @@ -1,7 +1,7 @@ /* * brisk - commons.js * - * Copyright (C) 2006-2008 Matteo Nastasi + * Copyright (C) 2006-2011 Matteo Nastasi * mailto: nastasi@alternativeoutput.it * matteo.nastasi@milug.org * web: http://www.alternativeoutput.it @@ -19,12 +19,10 @@ * not, write to the Free Software Foundation, Inc, 59 Temple Place - * Suite 330, Boston, MA 02111-1307, USA. * - * $Id$ - * */ var PLAYERS_N = 3; -var EXIT_BAN_TIME = 900; +var EXIT_BAN_TIME = 3600; var cookiepath = "/brisk/"; var mlang_commons = { 'imgload_a' : { 'it' : 'Immagine caricate ', @@ -767,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) { @@ -774,39 +796,34 @@ function chatt_sub(dt,data,str) var name; var flags; var isauth; + var bolder = [ (data[0] | 1), data[1] ]; + name = user_decorator(bolder); + + 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; - 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]; + + 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") ); } /*