mirror of
https://github.com/Mibew/design.git
synced 2025-01-24 11:00:33 +03:00
e15e7047b2
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@458 c66351dc-e62f-0410-b875-e3a5c0b9693f
1 line
7.7 KiB
JavaScript
1 line
7.7 KiB
JavaScript
var rt={st:function(tt){if(tt.contentDocument){return tt.contentDocument;} else if(tt.contentWindow){return tt.contentWindow.document;} else if(tt.document){return tt.document;} else{return null;} } ,ut:function(tt){var ht=this.st(tt);ht.open();ht.write("<html><head>");ht.write("<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\""+it.cssfile+"\" />");ht.write("</head><body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400' marginwidth='0' marginheight='0' leftmargin='0' rightmargin='0' topmargin='0' bottommargin='0'>");ht.write("<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message' id='content'></td></tr></table><a id='bottom'/>");ht.write("</body></html>");ht.close();tt.onload=function(){if(tt.jt){rt.st(tt).getElementById('content').innerHTML+=tt.jt;rt.kt(tt);} } ;} ,lt:function(tt,ot){var pt=this.st(tt).getElementById('content');if(pt==null){if(!tt.jt)tt.jt="";tt.jt+=ot;} else{pt.innerHTML+=ot;} } ,kt:function(tt){var dt=this.st(tt).getElementById('bottom');if(myAgent=='opera'){tt.contentWindow.scrollTo(0,this.st(tt).getElementById('content').clientHeight);} else if(dt)dt.scrollIntoView(false);} } ;sq.et=mn.nn();mn.sn(sq.et,sq.lq,{qn:function(pq){this.oq(pq);this.pq.onComplete=this.ft.on(this);this.pq.jr=this.gt.on(this);this.pq.hr=this._q.on(this);this.pq.timeout=0x1388;this.at={} ;this.frequency=(this.pq.frequency||2);this.bt=0;this.ct=true;this.vt=true;this.wt=true;this.xt=this.pq.yt!=null;rt.ut(this.pq.zt);if(this.pq.yt){this.pq.yt.onkeydown=this.$t.on(this);this.pq.yt.onfocus=(function(){this.wt=true;} ).on(this);this.pq.yt.onblur=(function(){this.wt=false;} ).on(this)} this._t();} ,gt:function(mu,nu){this.qu("offline, reconnecting");this.ru();this.su=setTimeout(this._t.on(this),01750);} ,_q:function(mu){this.qu("timeout, reconnecting");this.ru();this.su=setTimeout(this._t.on(this),(667+333));} ,tu:function(uu){this.pq.fq='act='+uu+'&thread='+(this.pq.threadid||0)+'&token='+(this.pq.token||0)+'&lastid='+(this.pq.hu||0);if(this.pq.user)this.pq.fq+="&user=true";if(uu=='refresh'&&this.pq.yt&&this.pq.yt.value!='')this.pq.fq+="&typed=1";} ,iu:function(ju){if(this.pq.yt)this.pq.yt.disabled=!ju;} ,ru:function(){this.iu(true);if(this.at.pq)this.at.pq.onComplete=undefined;clearTimeout(this.su);} ,_t:function(){this.tu("refresh");this.at=new sq.vq(this.pq.servl,this.pq);} ,ft:function(hq){try{this.iu(true);this.ct=true;var ku=sq.uq(hq);if(ku&&ku.tagName=='thread'){this.lu(ku);} else{this.ou(hq,ku,'refresh messages failed');} } catch(e){} this.vt=false;this.su=setTimeout(this._t.on(this),this.frequency*01750);} ,pu:function(du){if(du==""||!this.ct){return;} this.ct=false;this.ru();this.vt=true;this.tu("post");var eu={} .un(this.pq);eu.fq+="&message="+encodeURIComponent(du);eu.onComplete=(function(fu){this.ft(fu);if(this.pq.yt){this.pq.yt.value='';this.pq.yt.focus();} } ).on(this);if(myRealAgent!='opera')this.iu(false);this.at=new sq.vq(this.pq.servl,eu);} ,gu:function(au){this.vt=true;new sq.vq(this.pq.servl,{fq:'act=rename&thread='+(this.pq.threadid||0)+'&token='+(this.pq.token||0)+'&name='+encodeURIComponent(au)} );} ,bu:function(hq){var ku=sq.uq(hq);if(ku&&ku.tagName=='closed'){setTimeout('window.close()',(1926+74));} else{this.ou(hq,ku,'cannot close');} } ,cu:function(){var vu='act=close&thread='+(this.pq.threadid||0)+'&token='+(this.pq.token||0);if(this.pq.user)vu+="&user=true";new sq.vq(this.pq.servl,{fq:vu,onComplete:this.bu.on(this)} );} ,wu:function(xu,yt){var yu=qs.us(yt);rt.lt(xu,yu);} ,zu:function($u){if($("typingdiv")){$("typingdiv").style.display=$u?'inline':'none';} } ,_u:function(mh){var nh=qs.us(mh);if(this.pq.mh&&this.pq.user){this.pq.mh.innerHTML=nh!=""?"<img src=\""+it.qh+"/images/free.gif\" width=\"7\" height=\"1\" border=\"0\" alt=\"\" /><img src=\""+nh+"\" border=\"0\" alt=\"\"/>":"";} } ,lu:function(ku){var rh=false;var sh=this.pq.zt;var th=qs.ks(ku,"lastid");if(th){this.pq.hu=th;} var uh=qs.ks(ku,"typing");if(uh){this.zu(uh=='1');} var hh=qs.ks(ku,"canpost");if(hh){if(hh=='1'&&!this.xt||this.xt&&hh!='1'){window.location.href=window.location.href;} } for(var i=0;i<ku.childNodes.length;i++){var ih=ku.childNodes[i];if(ih.tagName=='message'){rh=true;this.wu(sh,ih);} else if(ih.tagName=='avatar'){this._u(ih);} } if(window.location.search.indexOf('trace=on')>=0){var ju="updated";if(this.bt>0){var jh=((new Date()).getTime()-this.bt)/01750;ju=ju+", "+jh+" secs";if(jh>(6+4)){alert(ju);} } this.bt=(new Date()).getTime();this.qu(ju);} else{this.kh();} if(rh){rt.kt(this.pq.zt);if(!this.vt){var lh=$('soundimg');if(lh==null||lh.className.match(new RegExp("\\bisound\\b"))){$s(it.qh+'/sounds/new_message.wav');} } if(!this.wt){window.focus();} } } ,$t:function(k){if(k){oh=k.ctrlKey;k=k.which;} else{k=event.keyCode;oh=event.ctrlKey;} if(this.pq.yt&&((k==015&&(oh||myRealAgent=='opera'))||(k==(9+1)))){var ph=this.pq.yt.value;if(myRealAgent=='opera'){ph=ph.replace(/[\r\n]+$/,'');} this.pu(ph);return false;} return true;} ,ou:function(hq,ku,dh){if(ku&&ku.tagName=='error'){this.qu(qs.rs(ku,"descr"));} else{this.qu("reconnecting");} } ,eh:function(k){if($("engineinfo")){$("engineinfo").style.display='inline';$("engineinfo").innerHTML=k;} } ,qu:function(k){if(this.fh)clearTimeout(this.fh);this.eh(k);this.fh=setTimeout(this.kh.on(this),07640);} ,kh:function(){$("engineinfo").style.display='none';} } );gh=mn.nn();gh.prototype={qn:function(pq){this.pq=pq;this.ah=0;if(this.pq.bh&&this.pq.ch&&this.pq.vh){this.pq.vh.onmousedown=this.wh.on(this);this.pq.vh.onmouseup=this.xh.on(this);this.pq.vh.onmousemove=this.yh.on(this);} } ,wh:function(e){var or=e||event;if(this.pq.vh.setCapture)this.pq.vh.setCapture();this.zh=this.pq.bh.style.pixelHeight||this.pq.bh.clientHeight;this.$h=or.screenY;this.pq._h=this.pq.bh.style.pixelHeight+this.pq.ch.clientHeight-this.pq.mi;this.ah=1;} ,xh:function(){if(this.ah){if(this.pq.vh.releaseCapture)this.pq.vh.releaseCapture();this.ah=0;} } ,yh:function(e){var or=e||event;if(this.ah){var ni=this.zh-(or.screenY-this.$h);if(ni>this.pq._h)ni=this.pq._h;else if(ni<this.pq.qi)ni=this.pq.qi;if(myAgent=='moz')this.pq.bh.style.height=ni+'px';else this.pq.bh.style.pixelHeight=ni;} } } ;var it={ri:{} ,si:{} ,ti:function(){it.ri.gu($('uname').value);$('changename1').style.display='none';$('changename2').style.display='inline';$('unamelink').innerHTML=nt($('uname').value);} ,ui:function(){$('changename1').style.display='inline';$('changename2').style.display='none';} } ;er.lr({'#postmessage a':function(hi){hi.onclick=function(){var yt=$('msgwnd');if(yt)it.ri.pu(yt.value);} ;} ,'a#sndmessagelnk':function(hi){if(myRealAgent=='opera'){hi.innerHTML=hi.innerHTML.replace('Ctrl-','');} } ,'select#predefined':function(hi){hi.onchange=function(){var yt=$('msgwnd');if(this.selectedIndex!=0){yt.value=this.options[this.selectedIndex].innerText||this.options[this.selectedIndex].innerHTML;} this.selectedIndex=0;yt.focus();} ;} ,'div#changename2 a':function(hi){hi.onclick=function(){it.ui();return false;} ;} ,'div#changename1 a':function(hi){hi.onclick=function(){it.ti();return false;} ;} ,'div#changename1 input#uname':function(hi){hi.onkeydown=function(e){var or=e||event;if(or.keyCode==(9+4)){it.ti();} } ;} ,'a#refresh':function(hi){hi.onclick=function(){it.ri.ru();it.ri._t();} ;} ,'a#togglesound':function(hi){hi.onclick=function(){var lh=$('soundimg');if(!lh){return;} if(lh.className.match(new RegExp("\\bisound\\b"))){lh.className="tplimage inosound";} else{lh.className="tplimage isound";} var ii=$('msgwnd');if(ii)ii.focus();} ;} ,'a.closethread':function(hi){hi.onclick=function(){it.ri.cu();} ;} } );kr.lr(window,'onload',function(){it.qh=threadParams.wroot;it.cssfile=threadParams.cssfile;it.si=new gh({vh:$("spl1"),bh:$("msgwndtd"),ch:$("chatwndtd"),qi:(19+11),mi:036} );it.ri=new sq.et(({zt:myRealAgent=='safari'?self.frames[0]:$("chatwnd"),mh:$("avatarwnd"),yt:$("msgwnd")} ).un(threadParams||{} ));} ); |