mirror of
https://github.com/Mibew/tray.git
synced 2025-01-23 18:40:33 +03:00
59fd9f1fa8
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@415 c66351dc-e62f-0410-b875-e3a5c0b9693f
1 line
6.8 KiB
JavaScript
1 line
6.8 KiB
JavaScript
sq.hi=mn.nn();mn.sn(sq.hi,sq.lq,{qn:function(pq){this.oq(pq);this.pq.onComplete=this.et.on(this);this.pq.jr=this.ft.on(this);this.pq.hr=this._q.on(this);this.pq.timeout=(3363+1637);this.frequency=(this.pq.frequency||2);this.gt={} ;this.$t();} ,ft:function(_t,mu){if(this.pq.lu)this.pq.lu("offline, reconnecting");this.qu();this.ru=setTimeout(this.$t.on(this),01750);} ,_q:function(_t){if(this.pq.lu)this.pq.lu("timeout, reconnecting");this.qu();this.ru=setTimeout(this.$t.on(this),(818+182));} ,qu:function(){if(this.gt.pq)this.gt.pq.onComplete=undefined;clearTimeout(this.ru);} ,$t:function(){if(this.pq.ii)this.pq.fq=(this.pq.ii)();this.gt=new sq.vq(this.pq.url,this.pq);} ,et:function(eu){try{var ju=sq.uq(eu);if(ju){(this.pq.ku||sq.kq)(ju);} else{if(this.pq.lu)this.pq.lu("reconnecting");} } catch(e){} this.ru=setTimeout(this.$t.on(this),this.frequency*(616+384));} } );var ji={ki:function(link,title,li,oi,width,height,pi){return'<a href="'+link+'"'+(pi!=null?' class="'+pi+'"':'')+' target="_blank" title="'+title+'" onclick="this.newWindow = window.open(\''+link+'\', \''+li+'\', \'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width='+width+',height='+height+',resizable=1\');this.newWindow.focus();this.newWindow.opener=window;return false;">'+oi+'</a>';} ,di:function(content){return'<table class="inner"><tr>'+content+'</tr></table>';} ,ei:function(fi,gi,id,ai,bi,ci,xt,vi){var wi=2;var link=gi+"?thread="+id;var xi='<td>';if(bi||ai){xi+=ji.ki((vi||!ai)?link:link+"&viewonly=true",localized[bi?0:1],"ImCenter"+id,fi,(475+165),0740,null);} else{xi+='<a href="#">'+fi+'</a>';} xi+='</td>';if(bi){xi+='<td class="icon">';xi+=ji.ki(link,localized[0],"ImCenter"+id,'<img src="'+ht+'/images/tbliclspeak.gif" width="15" height="15" border="0" alt="'+localized[0]+'">',(471+169),0x1e0,null);xi+='</td>';wi++;} if(ai){xi+='<td class="icon">';xi+=ji.ki(link+"&viewonly=true",localized[1],"ImCenter"+id,'<img src="'+ht+'/images/tbliclread.gif" width="15" height="15" border="0" alt="'+localized[1]+'">',(520+120),(382+98),null);xi+='</td>';wi++;} if(xt!=""){xi+='</tr><tr><td class="firstmessage" colspan="'+wi+'"><a href="javascript:void(0)" title="'+xt+'" onclick="alert(this.title);return false;">';xi+=xt.length>0x1e?xt.substring(0,(28+2))+'...':xt;xi+='</a></td>';} return ji.di(xi);} ,yi:function(id,zi){return'<td class="icon">'+ji.ki(ht+'/operator/ban.php?'+(zi?'id='+zi:'thread='+id),localized[2],"ban"+id,'<img src="'+ht+'/images/ban.gif" width="15" height="15" border="0" alt="'+localized[2]+'">',(534+186),0x1e0,null)+'</td>';} } ;sq.$i=mn.nn();mn.sn(sq.$i,sq.lq,{qn:function(pq){this.oq(pq);this.pq.ii=this.ii.on(this);this.pq.lu=this.lu.on(this);this.pq.ku=this.ku.on(this);this.pq._i=0;this.mj=new Object();this.nj=0;this.t=this.pq.qj;this.rj=new sq.hi(this.pq);} ,ii:function(){return"company="+this.pq.company+"&since="+this.pq._i;} ,nu:function(pu){this.pq.status.innerHTML=pu;} ,lu:function(s){this.nu(s);} ,sj:function(uh){var id,tj,uj,ai=false,bi=false,hj=false,ci=null,zi=null;for(var i=0;i<uh.attributes.length;i++){var ij=uh.attributes[i];if(ij.nodeName=="id")id=ij.nodeValue;else if(ij.nodeName=="stateid")tj=ij.nodeValue;else if(ij.nodeName=="state")uj=ij.nodeValue;else if(ij.nodeName=="canopen")bi=true;else if(ij.nodeName=="canview")ai=true;else if(ij.nodeName=="canban")hj=true;else if(ij.nodeName=="ban")ci=ij.nodeValue;else if(ij.nodeName=="banid")zi=ij.nodeValue;} function jj(ds,kj,id,lj){var ws=ls.fs(id,kj,ds);if(ws)ws.innerHTML=lj;} var kj=ls.os("thr"+id,this.t);if(tj=="closed"){if(kj){this.t.deleteRow(kj.rowIndex);} this.mj[id]=null;return;} var oj=qs.rs(uh,"name");var pj=qs.rs(uh,"addr");var dj=qs.rs(uh,"time");var ej=qs.rs(uh,"agent");var fj=qs.rs(uh,"modified");var xt=qs.rs(uh,"message");var gj='<td>'+qs.rs(uh,"useragent")+'</td>';if(ci!=null){gj='<td>'+qs.rs(uh,"reason")+'</td>';} if(hj){gj+=ji.yi(id,zi);} gj=ji.di(gj);var aj=ls.os("t"+tj,this.t);var bj=ls.os("t"+tj+"end",this.t);if(kj!=null&&(kj.rowIndex<=aj.rowIndex||kj.rowIndex>=bj.rowIndex)){this.t.deleteRow(kj.rowIndex);this.mj[id]=null;kj=null;} if(kj==null){kj=this.t.insertRow(aj.rowIndex+1);kj.className=(ci=="blocked"&&tj!="chat")?"ban":"in"+tj;kj.id="thr"+id;this.mj[id]=new Array(dj,fj,tj);ls.insertCell(kj,"name","visitor",null,null,ji.ei(oj,this.pq.agentservl,id,ai,bi,ci,xt,tj!='chat'));ls.insertCell(kj,"contid","visitor","center",null,pj);ls.insertCell(kj,"state","visitor","center",null,uj);ls.insertCell(kj,"op","visitor","center",null,ej);ls.insertCell(kj,"time","visitor","center",null,this.cj(dj));ls.insertCell(kj,"wait","visitor","center",null,(tj!='chat'?this.cj(fj):'-'));ls.insertCell(kj,"etc","visitor","center",null,gj);if(tj=='wait'||tj=='prio')return true;} else{this.mj[id]=new Array(dj,fj,tj);kj.className=(ci=="blocked"&&tj!="chat")?"ban":"in"+tj;jj(this.t,kj,"name",ji.ei(oj,this.pq.agentservl,id,ai,bi,ci,xt,tj!='chat'));jj(this.t,kj,"contid",pj);jj(this.t,kj,"state",uj);jj(this.t,kj,"op",ej);jj(this.t,kj,"time",this.cj(dj));jj(this.t,kj,"wait",(tj!='chat'?this.cj(fj):'-'));jj(this.t,kj,"etc",gj);} return false;} ,vj:function(){function wj(t,id){var aj=$(id);var bj=$(id+"end");if(aj==null||bj==null){return false;} return aj.rowIndex+1<bj.rowIndex;} var xj=$("statustd");if(xj){var yj=wj(this.t,"twait")||wj(this.t,"tprio")||wj(this.t,"tchat");xj.innerHTML=yj?"":this.pq.noclients;xj.height=yj?(4+1):(25+5);} } ,cj:function(zj){var $j=Math.floor(((new Date()).getTime()-zj-this.nj)/(642+358));var _j=Math.floor($j/074);var mk="";$j=$j%(49+11);if($j<012)$j="0"+$j;if(_j>=0x3c){var nk=Math.floor(_j/(40+20));_j=_j%(40+20);if(_j<012)_j="0"+_j;mk=nk+":";} return mk+_j+":"+$j;} ,qk:function(){for(var i in this.mj){if(this.mj[i]!=null){var value=this.mj[i];var kj=ls.os("thr"+i,this.t);if(kj!=null){function jj(ds,kj,id,lj){var ws=ls.fs(id,kj,ds);if(ws)ws.innerHTML=lj;} jj(this.t,kj,"time",this.cj(value[0]));jj(this.t,kj,"wait",(value[2]!='chat'?this.cj(value[1]):'-'));} } } } ,ku:function(rk){var sk=false;if(rk.tagName=='threads'){var tk=qs.ks(rk,"time");var uk=qs.ks(rk,"revision");if(tk)this.nj=(new Date()).getTime()-tk;if(uk)this.pq._i=uk;for(var i=0;i<rk.childNodes.length;i++){var uh=rk.childNodes[i];if(uh.tagName=='thread')if(this.sj(uh))sk=true;} this.vj();this.qk();this.nu("Up to date");if(sk){$s(ht+'/sounds/new_user.wav');window.focus();} } else if(rk.tagName=='error'){this.nu(qs.rs(rk,"descr"));} else{this.nu("reconnecting");} } } );function hk(){if($("sidebar")&&$("wcontent")&&$("togglemenu")){if($("wcontent").className=="contentnomenu"){$("sidebar").style.display="block";$("wcontent").className="contentinner";$("togglemenu").innerHTML=localized[(3+1)];} else{$("sidebar").style.display="none";$("wcontent").className="contentnomenu";$("togglemenu").innerHTML=localized[3];} } } er.lr({'#togglemenu':function(ti){ti.onclick=function(){hk();} ;} } );var ht="";kr.lr(window,'onload',function(){ht=updaterOptions.wroot;new sq.$i(({qj:$("threadlist"),status:$("connstatus")} ).un(updaterOptions||{} ));hk();} ); |