From 5b743ecdecbebc399dfc649ff8e1a22849a5ea7f Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Sat, 27 Feb 2010 14:38:02 +0000 Subject: [PATCH] use google closure compiler git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@748 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/webim/js/164/brws.js | 2 +- src/messenger/webim/js/164/chat.js | 18 +- src/messenger/webim/js/164/common.js | 21 +- src/messenger/webim/js/164/users.js | 20 +- src/messenger/webim/js/source/JSO.java | 735 ------------------------ src/messenger/webim/js/source/build.xml | 47 +- src/messenger/webim/js/source/chat.js | 2 +- src/messenger/webim/js/source/common.js | 22 +- 8 files changed, 91 insertions(+), 776 deletions(-) delete mode 100644 src/messenger/webim/js/source/JSO.java diff --git a/src/messenger/webim/js/164/brws.js b/src/messenger/webim/js/164/brws.js index 4121bfdc..5826b50a 100644 --- a/src/messenger/webim/js/164/brws.js +++ b/src/messenger/webim/js/164/brws.js @@ -1 +1 @@ -var myAgent="";var $j=0;var myRealAgent="";function _j(){var mk=["opera","msie","safari","firefox","netscape","mozilla"];var tj=navigator.userAgent.toLowerCase();for(var i=0;i");ht.write("");ht.write("");ht.write("
");ht.write("");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'){try{tt.contentWindow.scrollTo(0,this.st(tt).getElementById('content').clientHeight);} catch(e){} } 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),(620+380));} ,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*(775+225));} ,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()',(1224+776));} 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!=""?"\"\"\"\"/":"";} } ,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=0){var ju="updated";if(this.bt>0){var jh=((new Date()).getTime()-this.bt)/(892+108);ju=ju+", "+jh+" secs";if(jh>012){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();} } } ,oh:function(ph,dh){return((dh==(12+1)&&(ph||this.pq.ignorectrl))||(dh==012));} ,$t:function(k){if(k){eh=k.ctrlKey;k=k.which;} else{k=event.keyCode;eh=event.ctrlKey;} if(this.pq.yt&&this.oh(eh,k)){var fh=this.pq.yt.value;if(this.pq.ignorectrl){fh=fh.replace(/[\r\n]+$/,'');} this.pu(fh);return false;} return true;} ,ou:function(hq,ku,gh){if(ku&&ku.tagName=='error'){this.qu(qs.rs(ku,"descr"));} else{this.qu("reconnecting");} } ,ah:function(k){if($("engineinfo")){$("engineinfo").style.display='inline';$("engineinfo").innerHTML=k;} } ,qu:function(k){if(this.bh)clearTimeout(this.bh);this.ah(k);this.bh=setTimeout(this.kh.on(this),07640);} ,kh:function(){$("engineinfo").style.display='none';} } );var it={ch:{} ,vh:function(){it.ch.gu($('uname').value);$('changename1').style.display='none';$('changename2').style.display='inline';$('unamelink').innerHTML=nt($('uname').value);} ,wh:function(){$('changename1').style.display='inline';$('changename2').style.display='none';} } ;er.lr({'#postmessage a':function(xh){xh.onclick=function(){var yt=$('msgwnd');if(yt)it.ch.pu(yt.value);} ;} ,'select#predefined':function(xh){xh.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(xh){xh.onclick=function(){it.wh();return false;} ;} ,'div#changename1 a':function(xh){xh.onclick=function(){it.vh();return false;} ;} ,'div#changename1 input#uname':function(xh){xh.onkeydown=function(e){var or=e||event;if(or.keyCode==015){it.vh();} } ;} ,'a#refresh':function(xh){xh.onclick=function(){it.ch.ru();it.ch._t();} ;} ,'a#togglesound':function(xh){xh.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 yh=$('msgwnd');if(yh)yh.focus();} ;} ,'a.closethread':function(xh){xh.onclick=function(){it.ch.cu();} ;} } );kr.lr(window,'onload',function(){it.qh=threadParams.wroot;it.cssfile=threadParams.cssfile;it.ch=new sq.et(({ignorectrl:-1,zt:myRealAgent=='safari'?self.frames[0]:$("chatwnd"),mh:$("avatarwnd"),yt:$("msgwnd")} ).un(threadParams||{} ));} ); \ No newline at end of file +var FrameUtils={getDocument:function(a){return a.contentDocument?a.contentDocument:a.contentWindow?a.contentWindow.document:a.document?a.document:null},initFrame:function(a){var b=this.getDocument(a);b.open();b.write("");b.write('');b.write("");b.write("
"); +b.write("");b.close();a.onload=function(){if(a.myHtml){FrameUtils.getDocument(a).getElementById("content").innerHTML+=a.myHtml;FrameUtils.scrollDown(a)}}},insertIntoFrame:function(a,b){var c=this.getDocument(a).getElementById("content");if(c==null){if(!a.myHtml)a.myHtml="";a.myHtml+=b}else c.innerHTML+=b},scrollDown:function(a){var b=this.getDocument(a).getElementById("bottom");if(myAgent=="opera")try{a.contentWindow.scrollTo(0,this.getDocument(a).getElementById("content").clientHeight)}catch(c){}b&& +b.scrollIntoView(false)}};Ajax.ChatThreadUpdater=Class.create(); +Class.inherit(Ajax.ChatThreadUpdater,Ajax.Base,{initialize:function(a){this.setOptions(a);this._options.onComplete=this.requestComplete.bind(this);this._options.onException=this.handleException.bind(this);this._options.onTimeout=this.handleTimeout.bind(this);this._options.timeout=5E3;this.updater={};this.frequency=this._options.frequency||2;this.lastupdate=0;this.focused=this.skipNextsound=this.cansend=true;this.ownThread=this._options.message!=null;FrameUtils.initFrame(this._options.container);if(this._options.message){this._options.message.onkeydown= +this.handleKeyDown.bind(this);this._options.message.onfocus=function(){this.focused=true}.bind(this);this._options.message.onblur=function(){this.focused=false}.bind(this)}this.update()},handleException:function(){this.setStatus("offline, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),1E3)},handleTimeout:function(){this.setStatus("timeout, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),1E3)},updateOptions:function(a){this._options.parameters= +"act="+a+"&thread="+(this._options.threadid||0)+"&token="+(this._options.token||0)+"&lastid="+(this._options.lastid||0);if(this._options.user)this._options.parameters+="&user=true";if(a=="refresh"&&this._options.message&&this._options.message.value!="")this._options.parameters+="&typed=1"},enableInput:function(a){if(this._options.message)this._options.message.disabled=!a},stopUpdate:function(){this.enableInput(true);if(this.updater._options)this.updater._options.onComplete=undefined;clearTimeout(this.timer)}, +update:function(){this.updateOptions("refresh");this.updater=new Ajax.Request(this._options.servl,this._options)},requestComplete:function(a){try{this.enableInput(true);this.cansend=true;var b=Ajax.getXml(a);b&&b.tagName=="thread"?this.updateContent(b):this.handleError(a,b,"refresh messages failed")}catch(c){}this.skipNextsound=false;this.timer=setTimeout(this.update.bind(this),this.frequency*1E3)},postMessage:function(a){if(!(a==""||!this.cansend)){this.cansend=false;this.stopUpdate();this.skipNextsound= +true;this.updateOptions("post");var b={}.extend(this._options);b.parameters+="&message="+encodeURIComponent(a);b.onComplete=function(c){this.requestComplete(c);if(this._options.message){this._options.message.value="";this._options.message.focus()}}.bind(this);myRealAgent!="opera"&&this.enableInput(false);this.updater=new Ajax.Request(this._options.servl,b)}},changeName:function(a){this.skipNextsound=true;new Ajax.Request(this._options.servl,{parameters:"act=rename&thread="+(this._options.threadid|| +0)+"&token="+(this._options.token||0)+"&name="+encodeURIComponent(a)})},onThreadClosed:function(a){var b=Ajax.getXml(a);b&&b.tagName=="closed"?setTimeout("window.close()",2E3):this.handleError(a,b,"cannot close")},closeThread:function(){var a="act=close&thread="+(this._options.threadid||0)+"&token="+(this._options.token||0);if(this._options.user)a+="&user=true";new Ajax.Request(this._options.servl,{parameters:a,onComplete:this.onThreadClosed.bind(this)})},processMessage:function(a,b){b=NodeUtils.getNodeText(b); +FrameUtils.insertIntoFrame(a,b)},showTyping:function(a){if($("typingdiv"))$("typingdiv").style.display=a?"inline":"none"},setupAvatar:function(a){a=NodeUtils.getNodeText(a);if(this._options.avatar&&this._options.user)this._options.avatar.innerHTML=a!=""?'':""},updateContent:function(a){var b=false,c=this._options.container,d=NodeUtils.getAttrValue(a,"lastid");if(d)this._options.lastid= +d;(d=NodeUtils.getAttrValue(a,"typing"))&&this.showTyping(d=="1");if(d=NodeUtils.getAttrValue(a,"canpost"))if(d=="1"&&!this.ownThread||this.ownThread&&d!="1")window.location.href=window.location.href;for(d=0;d=0){a="updated";if(this.lastupdate>0){c=((new Date).getTime()-this.lastupdate)/1E3;a=a+", "+c+" secs"; +c>10&&alert(a)}this.lastupdate=(new Date).getTime();this.setStatus(a)}else this.clearStatus();if(b){FrameUtils.scrollDown(this._options.container);if(!this.skipNextsound){b=$("soundimg");if(b==null||b.className.match(/\bisound\b/))playSound(Chat.webimRoot+"/sounds/new_message.wav")}this.focused||window.focus()}},isSendkey:function(a,b){return b==13&&(a||this._options.ignorectrl)||b==10},handleKeyDown:function(a){if(a){ctrl=a.ctrlKey;a=a.which}else{a=event.keyCode;ctrl=event.ctrlKey}if(this._options.message&& +this.isSendkey(ctrl,a)){a=this._options.message.value;if(this._options.ignorectrl)a=a.replace(/[\r\n]+$/,"");this.postMessage(a);return false}return true},handleError:function(a,b){b&&b.tagName=="error"?this.setStatus(NodeUtils.getNodeValue(b,"descr")):this.setStatus("reconnecting")},showStatusDiv:function(a){if($("engineinfo")){$("engineinfo").style.display="inline";$("engineinfo").innerHTML=a}},setStatus:function(a){this.statusTimeout&&clearTimeout(this.statusTimeout);this.showStatusDiv(a);this.statusTimeout= +setTimeout(this.clearStatus.bind(this),4E3)},clearStatus:function(){$("engineinfo").style.display="none"}});var Chat={threadUpdater:{},applyName:function(){Chat.threadUpdater.changeName($("uname").value);$("changename1").style.display="none";$("changename2").style.display="inline";$("unamelink").innerHTML=htmlescape($("uname").value)},showNameField:function(){$("changename1").style.display="inline";$("changename2").style.display="none"}}; +Behaviour.register({"#postmessage a":function(a){a.onclick=function(){var b=$("msgwnd");b&&Chat.threadUpdater.postMessage(b.value)}},"select#predefined":function(a){a.onchange=function(){var b=$("msgwnd");if(this.selectedIndex!=0)b.value=this.options[this.selectedIndex].innerText||this.options[this.selectedIndex].innerHTML;this.selectedIndex=0;b.focus()}},"div#changename2 a":function(a){a.onclick=function(){Chat.showNameField();return false}},"div#changename1 a":function(a){a.onclick=function(){Chat.applyName(); +return false}},"div#changename1 input#uname":function(a){a.onkeydown=function(b){if((b||event).keyCode==13)Chat.applyName()}},"a#refresh":function(a){a.onclick=function(){Chat.threadUpdater.stopUpdate();Chat.threadUpdater.update()}},"a#togglesound":function(a){a.onclick=function(){var b=$("soundimg");if(b){b.className=b.className.match(/\bisound\b/)?"tplimage inosound":"tplimage isound";(b=$("msgwnd"))&&b.focus()}}},"a.closethread":function(a){a.onclick=function(){Chat.threadUpdater.closeThread()}}}); +EventHelper.register(window,"onload",function(){Chat.webimRoot=threadParams.wroot;Chat.cssfile=threadParams.cssfile;Chat.threadUpdater=new Ajax.ChatThreadUpdater({ignorectrl:-1,container:myRealAgent=="safari"?self.frames[0]:$("chatwnd"),avatar:$("avatarwnd"),message:$("msgwnd")}.extend(threadParams||{}))}); diff --git a/src/messenger/webim/js/164/common.js b/src/messenger/webim/js/164/common.js index c17803e6..6b22a7d3 100644 --- a/src/messenger/webim/js/164/common.js +++ b/src/messenger/webim/js/164/common.js @@ -1 +1,20 @@ -var mn={nn:function(){return function(){this.qn.rn(this,arguments);} ;} ,sn:function(tn,parent,body){Object.un(Object.un(tn.prototype,parent.prototype),body);} } ;Object.un=function(hn,jn){for(kn in jn){hn[kn]=jn[kn];} return hn;} ;Object.prototype.un=function(ln){return Object.un.rn(this,[this,ln]);} ;Function.prototype.on=function(ln){var pn=this;return function(){return pn.rn(ln,arguments);} } ;Function.prototype.dn=function(ln){var pn=this;return function(event){pn.call(ln,event||window.event);} } ;Number.prototype.en=function(){var fn=this.toString((11+5));if(this<(13+3))return'0'+fn;return fn;} ;var gn={an:function(){var returnValue;for(var i=0;i=(161+39)&&hq.status<(247+53)){var iq=hq.responseXML;if(iq&&iq.documentElement)return iq.documentElement;} return null;} ,jq:function(hq){return hq.statusText||"connection error N"+hq.status;} ,kq:function(){} } ;sq.lq=function(){} ;sq.lq.prototype={oq:function(pq){this.pq={dq:'post',eq:true,fq:''} .un(pq||{} );} ,gq:function(){try{return this.aq.status||0;} catch(e){return 0} } ,bq:function(){var status=this.gq();return!status||(status>=0310&&status<0x12c);} ,cq:function(){return!this.bq();} } ;sq.vq=mn.nn();sq.vq.wq=['Uninitialized','Loading','Loaded','Interactive','Complete'];mn.sn(sq.vq,sq.lq,{qn:function(url,pq){this.aq=sq.tq();this.oq(pq);this.xq={} ;this.yq=false;this.zq(url);} ,zq:function(url){var fq=this.pq.fq||'';if(fq.length>0)fq+='&_=';try{if(this.pq.dq=='get'&&fq.length>0)url+='?'+fq;this.aq.open(this.pq.dq.toUpperCase(),url,this.pq.eq);if(this.pq.eq){this.aq.onreadystatechange=this.$q.on(this);if(this.pq.timeout){this.xq=setTimeout(this._q.on(this),this.pq.timeout);} } this.mr();var nr=this.pq.qr?this.pq.qr:fq;this.aq.send(this.pq.dq=='post'?nr:null);} catch(e){this.rr(e);} } ,mr:function(){var sr=['X-Requested-With','XMLHttpRequest'];if(this.pq.dq=='post'){sr.$n('Content-type','application/x-www-form-urlencoded');if(this.aq.overrideMimeType&&(navigator.userAgent.match("/Gecko\/(\d{4} )/")||[0,03725])[1]<(1793+212))sr.$n('Connection','close');} if(this.pq.sr)sr.$n.rn(sr,this.pq.sr);for(var i=0;i-1){var yr=token.split('#');var zr=yr[0];var id=yr[1];var element=document.getElementById(id);if(element==null||zr&&element.nodeName.toLowerCase()!=zr){return new Array();} xr=new Array(element);continue;} if(token.indexOf('.')>-1){var yr=token.split('.');var zr=yr[0];var $r=yr[1];if(!zr){zr='*';} var _r=new Array;var ms=0;for(var h=0;h=0)ys="audio/mpeg";} return ys;} function $s(_s){var mt=document.getElementById("player");if(mt){mt.parentNode.removeChild(mt);} mt=document.body.appendChild(document.createElement("div"));var zs=navigator.userAgent.toLowerCase();if(zs.indexOf('safari')==-1&&zs.indexOf('windows')!=-1){mt.innerHTML='';} else{mt.innerHTML='
';} } function nt(qt){return qt.replace('&','&').replace('<','<').replace('>','>').replace('"','"');} \ No newline at end of file +var Class={create:function(){return function(){this.initialize.apply(this,arguments)}},inherit:function(a,b,c){Object.extend(Object.extend(a.prototype,b.prototype),c)}};Object.extend=function(a,b){for(property in b)a[property]=b[property];return a};Object.prototype.extend=function(a){return Object.extend.apply(this,[this,a])};Function.prototype.bind=function(a){var b=this;return function(){return b.apply(a,arguments)}}; +Function.prototype.bindAsEventListener=function(a){var b=this;return function(c){b.call(a,c||window.event)}};Number.prototype.toColorPart=function(){var a=this.toString(16);if(this<16)return"0"+a;return a};var Try={these:function(){for(var a,b=0;b=200&&a.status<300)if((a=a.responseXML)&&a.documentElement)return a.documentElement;return null},getError:function(a){return a.statusText||"connection error N"+a.status},emptyFunction:function(){}};Ajax.Base=function(){}; +Ajax.Base.prototype={setOptions:function(a){this._options={_method:"post",asynchronous:true,parameters:""}.extend(a||{})},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},responseIsSuccess:function(){var a=this.getStatus();return!a||a>=200&&a<300},responseIsFailure:function(){return!this.responseIsSuccess()}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"]; +Class.inherit(Ajax.Request,Ajax.Base,{initialize:function(a,b){this.transport=Ajax.getTransport();this.setOptions(b);this.transportTimer={};this.finished=false;this.request(a)},request:function(a){var b=this._options.parameters||"";if(b.length>0)b+="&_=";try{if(this._options._method=="get"&&b.length>0)a+="?"+b;this.transport.open(this._options._method.toUpperCase(),a,this._options.asynchronous);if(this._options.asynchronous){this.transport.onreadystatechange=this.onStateChange.bind(this);if(this._options.timeout)this.transportTimer= +setTimeout(this.handleTimeout.bind(this),this._options.timeout)}this.setRequestHeaders();var c=this._options.postBody?this._options.postBody:b;this.transport.send(this._options._method=="post"?c:null)}catch(d){this.dispatchException(d)}},setRequestHeaders:function(){var a=["X-Requested-With","XMLHttpRequest"];if(this._options._method=="post"){a.push("Content-type","application/x-www-form-urlencoded");if(this.transport.overrideMimeType&&(navigator.userAgent.match("/Gecko/(d{4})/")||[0,2005])[1]<2005)a.push("Connection", +"close")}this._options.requestHeaders&&a.push.apply(a,this._options.requestHeaders);for(var b=0;b-1){var d=token.split("#"),e=d[0];b=document.getElementById(d[1]);if(b==null||e&&b.nodeName.toLowerCase()!=e)return[];b=new Array(b)}else if(token.indexOf(".")>-1){d=token.split(".");e=d[0];d=d[1];e||(e="*");for(var l=[],j=0,m=0;m=0)a="audio/mpeg";return a} +function playSound(a){var b=document.getElementById("player");b&&b.parentNode.removeChild(b);b=document.body.appendChild(document.createElement("div"));var c=navigator.userAgent.toLowerCase();b.innerHTML=c.indexOf("safari")==-1&&c.indexOf("windows")!=-1?'':'
'} +function htmlescape(a){return a.replace("&","&").replace("<","<").replace(">",">").replace('"',""")}; diff --git a/src/messenger/webim/js/164/users.js b/src/messenger/webim/js/164/users.js index b209f5e6..23ec4f78 100644 --- a/src/messenger/webim/js/164/users.js +++ b/src/messenger/webim/js/164/users.js @@ -1 +1,19 @@ -sq.zh=mn.nn();mn.sn(sq.zh,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=(4693+307);this.frequency=(this.pq.frequency||2);this.at={} ;this._t();} ,gt:function(mu,nu){if(this.pq.ou)this.pq.ou("offline, reconnecting");this.ru();this.su=setTimeout(this._t.on(this),(832+168));} ,_q:function(mu){if(this.pq.ou)this.pq.ou("timeout, reconnecting");this.ru();this.su=setTimeout(this._t.on(this),01750);} ,ru:function(){if(this.at.pq)this.at.pq.onComplete=undefined;clearTimeout(this.su);} ,_t:function(){if(this.pq.$h)this.pq.fq=(this.pq.$h)();this.at=new sq.vq(this.pq.url,this.pq);} ,ft:function(fu){try{var ku=sq.uq(fu);if(ku){(this.pq.lu||sq.kq)(ku);} else{if(this.pq.ou)this.pq.ou("reconnecting");} } catch(e){} this.su=setTimeout(this._t.on(this),this.frequency*(704+296));} } );var _h={mi:function(link,title,ni,qi,width,height,ri){return''+qi+'';} ,si:function(content){return''+content+'
';} ,ti:function(ui,hi,id,ii,ji,ki,yt,li){var oi=2;var link=hi+"?thread="+id;var pi='';if(ji||ii){pi+=_h.mi((li||!ii)?link:link+"&viewonly=true",localized[ji?0:1],"ImCenter"+id,ui,(501+139),(295+185),null);} else{pi+=''+ui+'';} pi+='';if(ji){pi+='';pi+=_h.mi(link,localized[0],"ImCenter"+id,''+localized[0]+'',01200,(437+43),null);pi+='';oi++;} if(ii){pi+='';pi+=_h.mi(link+"&viewonly=true",localized[1],"ImCenter"+id,''+localized[1]+'',(485+155),(375+105),null);pi+='';oi++;} if(yt!=""){pi+='';pi+=yt.length>036?yt.substring(0,(19+11))+'...':yt;pi+='';} return _h.si(pi);} ,di:function(id,ei){return''+_h.mi(qh+'/operator/ban.php?'+(ei?'id='+ei:'thread='+id),localized[2],"ban"+id,''+localized[2]+'',01320,(417+63),null)+'';} } ;sq.fi=mn.nn();mn.sn(sq.fi,sq.lq,{qn:function(pq){this.oq(pq);this.pq.$h=this.$h.on(this);this.pq.ou=this.ou.on(this);this.pq.lu=this.lu.on(this);this.pq.gi=0;this.ai=new Object();this.bi=0;this.t=this.pq.ci;this.vi=new sq.zh(this.pq);} ,$h:function(){return"since="+this.pq.gi+"&status="+this.pq.istatus;} ,qu:function(du){this.pq.status.innerHTML=du;} ,ou:function(s){this.qu(s);} ,wi:function(ih){var id,xi,yi,ii=false,ji=false,zi=false,ki=null,ei=null;for(var i=0;i';if(ki!=null){hj=''+qs.rs(ih,"reason")+'';} if(zi){hj+=_h.di(id,ei);} hj=_h.si(hj);var ij=ls.os("t"+xi,this.t);var jj=ls.os("t"+xi+"end",this.t);if(mj!=null&&(mj.rowIndex<=ij.rowIndex||mj.rowIndex>=jj.rowIndex)){this.t.deleteRow(mj.rowIndex);this.ai[id]=null;mj=null;} if(mj==null){mj=this.t.insertRow(ij.rowIndex+1);mj.className=(ki=="blocked"&&xi!="chat")?"ban":"in"+xi;mj.id="thr"+id;this.ai[id]=new Array(sj,uj,xi);ls.insertCell(mj,"name","visitor",null,null,_h.ti(qj,this.pq.agentservl,id,ii,ji,ki,yt,xi!='chat'));ls.insertCell(mj,"contid","visitor","center",null,rj);ls.insertCell(mj,"state","visitor","center",null,yi);ls.insertCell(mj,"op","visitor","center",null,tj);ls.insertCell(mj,"time","visitor","center",null,this.kj(sj));ls.insertCell(mj,"wait","visitor","center",null,(xi!='chat'?this.kj(uj):'-'));ls.insertCell(mj,"etc","visitor","center",null,hj);if(xi=='wait'||xi=='prio')return true;} else{this.ai[id]=new Array(sj,uj,xi);mj.className=(ki=="blocked"&&xi!="chat")?"ban":"in"+xi;_i(this.t,mj,"name",_h.ti(qj,this.pq.agentservl,id,ii,ji,ki,yt,xi!='chat'));_i(this.t,mj,"contid",rj);_i(this.t,mj,"state",yi);_i(this.t,mj,"op",tj);_i(this.t,mj,"time",this.kj(sj));_i(this.t,mj,"wait",(xi!='chat'?this.kj(uj):'-'));_i(this.t,mj,"etc",hj);} return false;} ,lj:function(){function oj(t,id){var ij=$(id);var jj=$(id+"end");if(ij==null||jj==null){return false;} return ij.rowIndex+1=074){var bj=Math.floor(gj/(46+14));gj=gj%0x3c;if(gj<012)gj="0"+gj;aj=bj+":";} return aj+gj+":"+fj;} ,cj:function(){for(var i in this.ai){if(this.ai[i]!=null){var value=this.ai[i];var mj=ls.os("thr"+i,this.t);if(mj!=null){function _i(ds,mj,id,nj){var ws=ls.fs(id,mj,ds);if(ws)ws.innerHTML=nj;} _i(this.t,mj,"time",this.kj(value[0]));_i(this.t,mj,"wait",(value[2]!='chat'?this.kj(value[1]):'-'));} } } } ,lu:function(vj){var wj=false;if(vj.tagName=='threads'){var xj=qs.ks(vj,"time");var yj=qs.ks(vj,"revision");if(xj)this.bi=(new Date()).getTime()-xj;if(yj)this.pq.gi=yj;for(var i=0;i"+d+""},generateOneRowTable:function(a){return''+a+"
"},viewOpenCell:function(a,b,c,d,e,l,j,m){l= +2;b=b+"?thread="+c;var g="";g+=e||d?HtmlGenerationUtils.popupLink(m||!d?b:b+"&viewonly=true",localized[e?0:1],"ImCenter"+c,a,640,480,null):''+a+"";g+="";if(e){g+='';g+=HtmlGenerationUtils.popupLink(b,localized[0],"ImCenter"+c,''+localized[0]+'',640,480,null);g+="";l++}if(d){g+='';g+=HtmlGenerationUtils.popupLink(b+"&viewonly=true",localized[1],"ImCenter"+ +c,''+localized[1]+'',640,480,null);g+="";l++}if(j!=""){g+='';g+=j.length>30?j.substring(0,30)+"...":j;g+=""}return HtmlGenerationUtils.generateOneRowTable(g)},banCell:function(a,b){return''+HtmlGenerationUtils.popupLink(webimRoot+"/operator/ban.php?"+ +(b?"id="+b:"thread="+a),localized[2],"ban"+a,''+localized[2]+'',720,480,null)+""}};Ajax.ThreadListUpdater=Class.create(); +Class.inherit(Ajax.ThreadListUpdater,Ajax.Base,{initialize:function(a){this.setOptions(a);this._options.updateParams=this.updateParams.bind(this);this._options.handleError=this.handleError.bind(this);this._options.updateContent=this.updateContent.bind(this);this._options.lastrevision=0;this.threadTimers={};this.delta=0;this.t=this._options.table;this.periodicalUpdater=new Ajax.PeriodicalUpdater(this._options)},updateParams:function(){return"since="+this._options.lastrevision+"&status="+this._options.istatus}, +setStatus:function(a){this._options.status.innerHTML=a},handleError:function(a){this.setStatus(a)},updateThread:function(a){function b(s,w,x,y){if(s=CommonUtils.getCell(x,w,s))s.innerHTML=y}for(var c,d,e,l=false,j=false,m=false,g=null,o=null,f=0;f"+NodeUtils.getNodeValue(a,"useragent")+"";if(g!=null)p= +""+NodeUtils.getNodeValue(a,"reason")+"";if(m)p+=HtmlGenerationUtils.banCell(c,o);p=HtmlGenerationUtils.generateOneRowTable(p);a=CommonUtils.getRow("t"+d,this.t);m=CommonUtils.getRow("t"+d+"end",this.t);if(f!=null&&(f.rowIndex<=a.rowIndex||f.rowIndex>=m.rowIndex)){this.t.deleteRow(f.rowIndex);f=this.threadTimers[c]=null}if(f==null){f=this.t.insertRow(a.rowIndex+1);f.className=g=="blocked"&&d!="chat"?"ban":"in"+d;f.id="thr"+c;this.threadTimers[c]=new Array(q,r,d);CommonUtils.insertCell(f, +"name","visitor",null,null,HtmlGenerationUtils.viewOpenCell(n,this._options.agentservl,c,l,j,g,v,d!="chat"));CommonUtils.insertCell(f,"contid","visitor","center",null,t);CommonUtils.insertCell(f,"state","visitor","center",null,e);CommonUtils.insertCell(f,"op","visitor","center",null,u);CommonUtils.insertCell(f,"time","visitor","center",null,this.getTimeSince(q));CommonUtils.insertCell(f,"wait","visitor","center",null,d!="chat"?this.getTimeSince(r):"-");CommonUtils.insertCell(f,"etc","visitor","center", +null,p);if(d=="wait"||d=="prio")return true}else{this.threadTimers[c]=new Array(q,r,d);f.className=g=="blocked"&&d!="chat"?"ban":"in"+d;b(this.t,f,"name",HtmlGenerationUtils.viewOpenCell(n,this._options.agentservl,c,l,j,g,v,d!="chat"));b(this.t,f,"contid",t);b(this.t,f,"state",e);b(this.t,f,"op",u);b(this.t,f,"time",this.getTimeSince(q));b(this.t,f,"wait",d!="chat"?this.getTimeSince(r):"-");b(this.t,f,"etc",p)}return false}},updateQueueMessages:function(){function a(d,e){d=$(e);e=$(e+"end");if(d== +null||e==null)return false;return d.rowIndex+1=60){c=Math.floor(b/60);b%=60;if(b<10)b="0"+b;c=c+":"}return c+b+":"+a},updateTimers:function(){for(var a in this.threadTimers)if(this.threadTimers[a]!=null){var b= +this.threadTimers[a],c=CommonUtils.getRow("thr"+a,this.t);if(c!=null){function d(e,l,j,m){if(e=CommonUtils.getCell(j,l,e))e.innerHTML=m}d(this.t,c,"time",this.getTimeSince(b[0]));d(this.t,c,"wait",b[2]!="chat"?this.getTimeSince(b[1]):"-")}}},updateContent:function(a){var b=false;if(a.tagName=="threads"){var c=NodeUtils.getAttrValue(a,"time"),d=NodeUtils.getAttrValue(a,"revision");if(c)this.delta=(new Date).getTime()-c;if(d)this._options.lastrevision=d;for(c=0;c - */ -public class JSO { - - private Random randomizer = new Random(321); - - public static final String[] reserved = { - "abstract", "else", "instanceof", "switch", "boolean", "enum", "int", - "synchronized", "break", "export", "interface", "this", "byte", "extends", - "long", "throw", "case", "false", "native", "throws", "catch", "final", - "new", "transient", "char", "finally", "null", "true", "class", "float", - "package", "try", "const", "for", "private", "typeof", "continue", "function", - "protected", "var", "debugger", "goto", "public", "void", "default", "if", - "return", "volatile", "delete", "implements", "short", "while", "do", "import", - "static", "with", "double", "in", "super", "undefined", "arguments" - }; - - public static final String[] builtIn = { - "history", "packages", "pageXOffset", "pageYOffset", "isNaN", "array", "java", - "plugin", "clientInformation", "prototype", "layer", "layers", "crypto", "date", "secure", - "embed", "navigator", "product", "netscape", "escape", "eval", "sun", - "taint", "fileUpload", "toString", "unescape", "untaint", "frameRate", - "valueOf", "getClass", "encodeURIComponent", "overrideMimeType", - - // Types - "Math", "Date", "Array", "RegExp", "Image", "Function", "ActiveXObject", - "Number", "String", "Object", "JavaClass", "JavaObject", "JavaPackage", "JavaArray", - - // DOM - "anchor", "image", "area", "checkbox", "password", "radio", "textarea", - "contentDocument", "contentWindow", "document", - "window", "element", "location", "option", "style", "body", - - // Properties - "accessKey", "action", "activeElement", "align", "aLink", "aLinkColor", "alt", - "altHTML", "altKey", "appCodeName", "appMinorVersion", "appName", "appVersion", - "autocomplete", "availHeight", "availWidth", "background", "backgroundAttachment", - "backgroundColor", "backgroundImage", "backgroundPosition", "backgroundPositionX", - "backgroundPositionY", "backgroundRepeat", "balance", "behavior", "bgColor", - "bgProperties", "border", "borderBottom", "borderBottomColor", "borderBottomStyle", - "borderBottomWidth", "borderCollapse", "borderColor", "borderColorDark", - "borderColorLight", "borderLeft", "borderLeftColor", "borderLeftStyle", - "borderLeftWidth", "borderRight", "borderRightColor", "borderRightStyle", - "borderRightWidth", "borderStyle", "borderTop", "borderTopColor", "borderTopStyle", - "borderTopWidth", "borderWidth", "bottom", "bottomMargin", "boundingHeight", "boundingLeft", - "boundingTop", "boundingWidth", "browserLanguage", "bufferDepth", "button", - "cancelBubble", "canHaveChildren", "caption", "cellIndex", "cellPadding", "cellSpacing", - "checked", "classid", "className", "clear", "clientHeight", "clientLeft", "clientTop", - "clientWidth", "clientX", "clientY", "clip", "clipBottom", "clipLeft", "clipRight", - "clipTop", "closed", "code", "codeBase", "codeType", "color", "colorDepth", "cols", - "colSpan", "compact", "complete", "content", "cookie", "cookieEnabled", "coords", - "cpuClass", "cssText", "ctrlKey", "cursor", "data", "dataFld", "dataFormatAs", - "dataPageSize", "dataSrc", "defaultCharset", "defaultChecked", "defaultSelected", - "defaultStatus", "defaultValue", "defer", "designMode", "dialogArguments", "dialogHeight", - "dialogLeft", "dialogTop", "dialogWidth", "dir", "direction", "disabled", "display", - "documentElement", "domain", "dropEffect", "dynsrc", "effectAllowed", "encoding", "event", - "expando", "face", "fgColor", "fileCreatedDate", "fileModifiedDate", "fileSize", - "fileUpdatedDate", "filter", "firstChild", "font", "fontFamily", "fontSize", - "fontSmoothingEnabled", "fontStyle", "fontVariant", "fontWeight", "form", "frame", - "frameBorder", "frameSpacing", "fromElement", "hash", "height", "hidden", "host", - "hostname", "href", "hspace", "htmlFor", "htmlText", "httpEquiv", "id", "imeMode", - "indeterminate", "index", "innerHTML", "innerText", "isMap", "isTextEdit", "keyCode", - "lang", "language", "lastChild", "lastModified", "layoutGrid", "layoutGridChar", - "layoutGridCharSpacing", "layoutGridLine", "layoutGridMode", "layoutGridType", "left", - "leftMargin", "length", "letterSpacing", "lineBreak", "lineHeight", "link", "linkColor", - "listStyle", "listStyleImage", "listStylePosition", "listStyleType", "loop", "lowsrc", - "margin", "marginBottom", "marginHeight", "marginLeft", "marginRight", "marginTop", - "marginWidth", "maxLength", "media", "menuArguments", "method", "Methods", "multiple", - "name", "nameProp", "nextSibling", "nodeName", "nodeType", "nodeValue", "noHref", - "noResize", "noShade", "noWrap", "object", "offscreenBuffering", "offsetHeight", - "offsetLeft", "offsetParent", "offsetTop", "offsetWidth", "offsetX", "offsetY", - "onLine", "opener", "outerHTML", "outerText", "overflow", "overflowX", "overflowY", - "owningElement", "padding", "paddingBottom", "paddingLeft", "paddingRight", "paddingTop", - "pageBreakAfter", "pageBreakBefore", "palette", "parent", "parentElement", "parentNode", - "parentStyleSheet", "parentTextEdit", "parentWindow", "pathname", "pixelBottom", - "pixelHeight", "pixelLeft", "pixelRight", "pixelTop", "pixelWidth", "platform", - "pluginspage", "port", "posBottom", "posHeight", "position", "posLeft", "posRight", - "posTop", "posWidth", "previousSibling", "propertyName", "protocol", "qualifier", - "readOnly", "reason", "recordNumber", "recordset", "referrer", "rel", - "repeat", "returnValue", "rev", "right", "rightMargin", "rowIndex", "rowSpan", - "rubyAlign", "rubyOverhang", "rubyPosition", "scopeName", "screenLeft", - "screenTop", "screenX", "screenY", "scrollAmount", "scrollDelay", - "scrollHeight", "scrolling", "scrollLeft", "scrollTop", "scrollWidth", "search", - "sectionRowIndex", "selected", "selectedIndex", "selectorText", "self", "shape", - "shiftKey", "size", "sourceIndex", "span", "specified", "src", "srcElement", "srcFilter", - "srcUrn", "start", "status", "styleFloat", "systemLanguage", "tabIndex", "tableLayout", - "tagName", "tagUrn", "target", "text", "textAlign", "textAutospace", "textDecoration", - "textDecorationLineThrough", "textDecorationNone", "textDecorationOverline", - "textDecorationUnderline", "textIndent", "textJustify", "textTransform", "tFoot", "tHead", - "title", "toElement", "top", "topMargin", "trueSpeed", "type", "unicodeBidi", "uniqueID", - "units", "updateInterval", "URL", "urn", "useMap", "userAgent", "userLanguage", "vAlign", - "value", "vcard_name", "verticalAlign", "visibility", "vLink", "vlinkColor", "volume", - "vspace", "whiteSpace", "width", "wordBreak", "wordSpacing", "wrap", "x", - "XMLDocument", "y", "zIndex", - // non-IE - "outerHeight", "innerHeight", "outerWidth", "innerWidth", - "which", "enabledPlugin", - - // collections - "all", "anchors", "applets", "areas", "attributes", "behaviorUrns", - "bookmarks", "boundElements", "cells", "childNodes", "children", - "controlRange", "elements", "embeds", "filters", "forms", "frames", - "images", "imports", "links", "mimeTypes", "options", "plugins", "rows", - "rules", "scripts", "styleSheets", "tBodies", "TextRectangle", - - // Methods - "add", "addBehavior", "AddFavorite", "addImport", "addRule", "alert", - "appendChild", "applyElement", "assign", "attachEvent", "back", "blur", - "clearAttributes", "clearData", "clearInterval", "clearRequest", - "clearTimeout", "click", "cloneNode", "close", "collapse", "compareEndPoints", - "componentFromPoint", "confirm", "contains", "createCaption", "createControlRange", - "createElement", "createRange", "createStyleSheet", "createTextNode", "createTextRange", - "createTFoot", "createTHead", "deleteCaption", "deleteCell", "deleteRow", "deleteTFoot", - "deleteTHead", "detachEvent", "doScroll", "duplicate", "elementFromPoint", - "empty", "execCommand", "execScript", "expand", "findText", "firstPage", "focus", - "forward", "getAdjacentText", "getAttribute", "getBookmark", "getBoundingClientRect", - "getClientRects", "getData", "getElementById", "getElementsByName", "getElementsByTagName", - "getExpression", "go", "hasChildNodes", "inRange", - "insertAdjacentElement", "insertAdjacentHTML", "insertAdjacentText", "insertBefore", - "insertCell", "insertRow", "isEqual", "IsSubscribed", "item", "javaEnabled", "lastPage", - "mergeAttributes", "move", "moveBy", "moveEnd", "moveRow", "moveStart", "moveTo", - "moveToBookmark", "moveToElementText", "moveToPoint", "namedRecordset", "navigate", - "NavigateAndFind", "nextPage", "open", "pasteHTML", - "previousPage", "print", "prompt", "queryCommandEnabled", "queryCommandIndeterm", - "queryCommandState", "queryCommandSupported", "queryCommandValue", "recalc", "refresh", - "releaseCapture", "reload", "remove", "removeAttribute", "removeBehavior", - "removeChild", "removeExpression", "removeNode", "removeRule", "replace", - "replaceAdjacentText", "replaceChild", "replaceNode", "reset", "resizeBy", - "resizeTo", "scroll", "scrollBy", "scrollIntoView", "scrollTo", "select", - "setAttribute", "setCapture", "setData", "setEndPoint", "setExpression", "setInterval", - "setTimeout", "ShowBrowserUI", "showHelp", "showModalDialog", "showModelessDialog", - "splitText", "stop", "submit", "swapNode", "tags", "taintEnabled", - "urns", "write", "writeln", - // builtIn - "toUpperCase", "toLowerCase", "match", "substring", "split", "indexOf", - "parseFloat", "parseInt", - "getYear", "getTime", "getMonth", "getFullYear", "getDay", "getDate", - "exec", "join", "call", "floor", "toUTCString", - - // events - "onabort", "onafterprint", "onafterupdate", "onbeforecopy", "onbeforecut", - "onbeforeeditfocus", "onbeforepaste", "onbeforeprint", "onbeforeunload", - "onbeforeupdate", "onblur", "onbounce", "oncellchange", "onchange", "onclick", - "oncontextmenu", "oncopy", "oncut", "ondataavailable", "ondatasetchanged", "ondatasetcomplete", - "ondblclick", "ondrag", "ondragend", "ondragenter", "ondragleave", "ondragover", - "ondragstart", "ondrop", "onerror", "onerrorupdate", "onfilterchange", "onfinish", - "onfocus", "onhelp", "onkeydown", "onkeypress", "onkeyup", "onload", - "onlosecapture", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", - "onpaste", "onpropertychange", "onreset", "onresize", "onrowenter", - "onrowexit", "onrowsdelete", "onrowsinserted", "onscroll", "onselect", "onselectstart", - "onstart", "onstop", "onsubmit", "onunload", - - // Ajax - "XMLHttpRequest", "readyState", "onreadystatechange", "responseXML", - "responseText", "responseBody", "statusText", - "send", "abort", "setRequestHeader", "getResponseHeader", "getAllResponseHeaders", - "timeout" - }; - - public static final char[] DELIMITER = {'?', ':', '!', '=', '(', ')', '[', ']', - '{', '}', '\r', '\n', '\t', ' ', '\"', '\'', '<', '>', ',', '.', '/', - '\\', '+', '-', '*', '&', '|', '^', '%', ';' - }; - - - public static final String[] alpha = { - "m", "n", "q", "r", "s", "t", "u", - "h", "i", "j", "k", "l", "o", "p", - "d", "e", "f", "g", "a", "b", "c", - "v", "w", "x", "y", "z", "$", "_" - }; - - public static final HashSet exclusionTokenSet = new HashSet(); - public static final HashSet forceReplace = new HashSet(); - public static final HashSet forceReplaceInStrings = new HashSet(); - - public static final HashMap forceTextualReplace = new HashMap(); - - public static int ref = alpha.length; - public static HashMap map = new HashMap(); - - public static final String ARG_EXCLUDE_TOKENS = "e="; - public static final String ARG_DESTINATION_DIR = "d="; - public static final String ARG_OBFUSCATE_STRING = "o="; - public static final String ARG_DEBUG = "debug"; - public static final String ARG_DEBUGEXCLUDE = "debugnames"; - public static final String ARG_REPLACE = "textrepl="; - - private double[] stringObfuscationParameter = {0, 0, 0.5}; - private String[] file = null; - public static boolean isDebug = false; - public static boolean isExcludeAll = false; - private String destinationDir = null; - private JSOState state = new JSOState(); - private String delimiter = new String(DELIMITER); - private HashSet encounteredInStrings = new HashSet(); - private HashMap encounteredInStringsFiles = new HashMap(); - - public static void main(String[] args) throws Exception { - ArrayList fileList = new ArrayList(args.length); - String[] file = null; - String destinationDir = null; - double[] stringObfuscationParameter = {1, .59, 0.5}; - - if (args.length == 0) { - printUsage(); - return; - } else if (args.length > 1) { - for (int i = 0; i < args.length; i++) { - if( args[i].equals(ARG_DEBUG)) { - isDebug = true; - } else if( args[i].equals(ARG_DEBUGEXCLUDE) ) { - isExcludeAll = true; - } else if (args[i].startsWith(ARG_EXCLUDE_TOKENS)) { - readexclusionTokenSet(args[i].substring(ARG_EXCLUDE_TOKENS.length())); - } else if (args[i].startsWith(ARG_DESTINATION_DIR) && destinationDir == null) { - File dir = new File(args[i].substring(ARG_DESTINATION_DIR.length())); - if (!dir.exists() && !dir.mkdirs()) { - System.err.println("Cannot create the output directory \"" + dir.getName() + "\""); - return; - } else if (dir.exists() && dir.isFile()) { - System.err.println("The output parameter \"" + args[i] + "\" is not a directory"); - return; - } - destinationDir = dir.getAbsolutePath(); - } else if (args[i].startsWith(ARG_OBFUSCATE_STRING)) { - String[] param = args[i].substring(ARG_OBFUSCATE_STRING.length()).split(",", 3); - if (param.length >= 2) { - try { - stringObfuscationParameter[0] = Double.parseDouble(param[0]); - stringObfuscationParameter[1] = Double.parseDouble(param[1]); - if (param.length == 3) { - stringObfuscationParameter[2] = Double.parseDouble(param[2]); - } - } catch (NumberFormatException e) { - System.err.println("The obfuscation parameters are not numbers."); - return; - } - } else { - System.err.println("At least 2 obfuscation parameters are required, e.g. o=0.4,0.7."); - return; - } - } else if( args[i].startsWith(ARG_REPLACE) ) { - String[] param = args[i].substring(ARG_REPLACE.length()).split(",", 3); - if (param.length == 2) { - forceTextualReplace.put(param[0], param[1]); - } else { - System.err.println("2 parameters are required, e.g. textrepl=a,b"); - return; - } - } else { - fileList.add(args[i]); - } - } - file = new String[fileList.size()]; - fileList.toArray(file); - } else { - file = new String[]{args[0]}; - } - addexclusionTokenSet(reserved); - addexclusionTokenSet(builtIn); - - JSO obfuscator = new JSO(file, destinationDir, stringObfuscationParameter); - obfuscator.run(); - } - - private static void printUsage() { - System.err.println("Usage: java JSO [options]"); - System.err.println(""); - System.err.println("where the options are:"); - System.err.println("\te="); - System.err.println("\t\t- filename of the exception list"); - System.err.println("\t\t- exception tokens are delimited by tab, space, dot, comma, "); - System.err.println("\t\t single quote and double quote"); - System.err.println("\td="); - System.err.println("\t\t- the output directory"); - System.err.println("\t\t- print to the STDOUT if not specified"); - System.err.println("\to="); - System.err.println("\t\t- If it is specified, the characters in string literals will be "); - System.err.println("\t\t encoded to either \\uXXXX (hexidemcial) or \\XXX (octal) format"); - System.err.println("\t\t- The parameters are a 2 or 3 floating point values delimited "); - System.err.println(" by commas. e.g. 0.5,0.3 or 0.5,0.3,0.9"); - System.err.println("\t\t- The values are "); - System.err.println("\t\t * probability to encode a string"); - System.err.println("\t\t * probability to encode a character in a candidate string"); - System.err.println("\t\t * probability to encode a character into \\uXXXX format"); - System.err.println("\t\t- The last parameter is set to 0.5 if not specified"); - System.err.println(""); - System.err.println("Press Enter to read the examples..."); - try{ - System.in.read(); - } catch (Exception e){} - System.err.println("Examples:"); - System.err.println(""); - System.err.println(" Obfuscate all scripts in the current directory and output to ./out directory:"); - System.err.println("\tjava JSO *.js d=out"); - System.err.println(""); - System.err.println(" Pipe the STDOUT output to x.o.js:"); - System.err.println("\tjava JSO x.js > x.o.js "); - System.err.println(""); - System.err.println(" Merge a.js and b.js and pipe the merged output to script.js. Tokens in "); - System.err.println(" exception list, noReplace.txt will not be replaced:"); - System.err.println("\tjava JSO a.js b.js e=noReplace.txt > script.js"); - System.err.println(""); - System.err.println(" Obfuscate the 100% of string literals, 68% of the characters will be encoded. "); - System.err.println(" 50% of the characters will be encoded as \\uXXXX format (default):"); - System.err.println("\tjava JSO x.js o=1,0.68"); - } - - public JSO(String[] file, String destinationDir, double[] stringObfuscationParameter){ - this.file = file; - this.destinationDir = destinationDir; - if (stringObfuscationParameter != null && stringObfuscationParameter.length >= 2) { - this.stringObfuscationParameter = stringObfuscationParameter; - } - } - - public void run() throws IOException { - for (int i = 0; i < file.length; i++) { - BufferedReader in = new BufferedReader(new FileReader(file[i])); - PrintWriter out = null; - File f = new File(file[i]); - - if (destinationDir == null) { - out = new PrintWriter(System.out, true); - } else { - out = new PrintWriter(new FileWriter(new File(destinationDir + File.separator + f.getName()))); - } - - this.obfuscate(in, out, f.getName()); - System.out.println("obfuscated " + f.getName()); - - in.close(); - out.flush(); - out.close(); - } - - - System.err.println( "Obfuscated" ); - System.err.println(map.toString().replace(',', '\n')); - - encounteredInStrings.retainAll(map.keySet()); - System.err.println( "Not Obfuscated in strings:" ); - for( Iterator it = encounteredInStrings.iterator(); it.hasNext(); ) { - String s = (String)it.next(); - System.err.println( "\t"+s+": " + (String)encounteredInStringsFiles.get(s) ); - } - } - - private void obfuscate(BufferedReader in, PrintWriter out, String fname) throws IOException { - state.reset(); - - int line_counter = 0; - for (String line = in.readLine(); line != null; line = in.readLine()) { - line_counter++; - if( !isDebug ) - line = line.trim(); - if (line.length() == 0) { - if( isDebug ) - out.println(); - continue; - } - if( line.startsWith( "//-" ) ) { - String[] toAdd = line.substring(3).split(","); - for( int i = 0; i < toAdd.length; i++ ) - exclusionTokenSet.add(toAdd[i].trim()); - continue; - } else if( line.startsWith("//+")) { - String[] toAdd = line.substring(3).split(","); - for( int i = 0; i < toAdd.length; i++ ) - forceReplace.add(toAdd[i].trim()); - continue; - } else if( line.startsWith("//'")) { - String[] toAdd = line.substring(3).split(","); - for( int i = 0; i < toAdd.length; i++ ) { - forceReplace.add(toAdd[i].trim()); - forceReplaceInStrings.add(toAdd[i].trim()); - } - } - - for( Iterator it = forceTextualReplace.keySet().iterator(); it.hasNext(); ) { - String key = (String)it.next(); - line = line.replaceAll(key, (String)forceTextualReplace.get(key)); - } - - StringTokenizer st = new StringTokenizer(line, delimiter, true); - - if (st.hasMoreTokens()) { - state.setToken(st.nextToken()); - } - - for (; state.token != null; state.skipToken()) { - if (st.hasMoreTokens()) { - state.setNextToken(st.nextToken()); - } else { - state.noToken(); - } - - boolean doubleSlashed = state.flipFlags(); - if (doubleSlashed) { - break; - } - - handleToken(out, fname, line_counter); - } - - if( isDebug ) - out.println(); - else if (!state.delimiter && !state.commented ) - out.print(" "); - } - } - - private void handleToken(PrintWriter out, String fname, int line ) { - if (state.token.length() > 0) { - if (state.delimiter) { - if (state.inString() && !state.backslashed && state.c != '\\' && - state.c != '\"' && state.c != '\'') { - state.token = obfuscateQuotedString(state.token); - } - } else { - if (state.inString()) { - if( forceReplaceInStrings.contains(state.token) && canReplace(state.token) ) { - state.token = generateToken(state.token); - } else if( Character.isJavaIdentifierStart(state.token.charAt(0))) { - encounteredInStrings.add(state.token); - String s = (String)encounteredInStringsFiles.get(state.token); - s = ( s == null ) ? "" : s + ", "; - s += fname +"[" + line + "]"; - encounteredInStringsFiles.put(state.token, s); - } - if (!state.backslashed) { - state.token = obfuscateQuotedString(state.token); - } - } else if( !state.commented ) { - if(canReplace(state.token)){ - state.token = generateToken(state.token); - } else if( state.token.length() > 0 && Character.isDigit( state.token.charAt(0) ) ) { - try { - int i = Integer.parseInt( state.token ); - double res = randomizer.nextDouble(); - int e = (int)(i * res); - - if( i > 3 ) { - if( res < 0.2 && i >= 16 ) - state.token = "0x"+Integer.toHexString(i); - else if( res < 0.6 && i >= 8 ) - state.token = "0" + Integer.toOctalString(i); - else - state.token = "(" + e + "+" + (i-e) + ")"; - } - - } catch( NumberFormatException ex ) { - } - } - } - } - } - - if (!state.commented && (state.printToken || state.inString())) { - out.print(state.token); - } - - if (state.c == '}' && !state.commented && !isDebug) { - out.print(" "); - } - } - - private static void readexclusionTokenSet(String file) throws IOException { - BufferedReader in = null; - try { - in = new BufferedReader(new FileReader(file)); - for (String line = in.readLine(); line != null; line = in.readLine()) { - StringTokenizer st = new StringTokenizer(line, "\t ,.\"\'"); - for (; st.hasMoreTokens();) { - exclusionTokenSet.add(st.nextToken()); - } - } - } finally { - if (in != null) { - in.close(); - } - } - } - - private String obfuscateQuotedString(String token) { - if (randomizer.nextDouble() < stringObfuscationParameter[0]) { - StringBuffer buffer = new StringBuffer(token.length()); - int n = token.length(); - int pos = 0; - for (int i = 0; i < n; i++) { - if (randomizer.nextDouble() < stringObfuscationParameter[1]) { - buffer.append(token.substring(pos, i)); - encode(token.charAt(i), buffer); - pos = i + 1; - } - } - if (pos < n) { - buffer.append(token.substring(pos)); - } - return buffer.toString(); - } else { - return token; - } - } - - private void encode(char c, StringBuffer buffer) { - if (randomizer.nextDouble() < stringObfuscationParameter[2] || c > 0777) { - buffer.append("\\u"); - encode(c, 16, 4, buffer); - } else { - buffer.append("\\"); - encode(c, 8, 3, buffer); - } - } - - private void encode(char c, int radix, int length, StringBuffer buffer) { - String value = Integer.toString(c, radix); - int n = length - value.length(); - - if (n > 0) { - for (int i = 0; i < n; i++) { - buffer.append('0'); - } - buffer.append(value); - } else { - buffer.append(value.substring(-n)); - } - } - - private static String generateToken(String token) { - if (map.containsKey(token)) { - return (String) map.get(token); - } else { - String result = null; - do { - StringBuffer buffer = new StringBuffer(token.length()); - for (int i = ref; i > 0; i = i / alpha.length) { - buffer.append(alpha[i % alpha.length]); - } - - ref++; - result = buffer.toString(); - } while (exclusionTokenSet.contains(result) || map.containsValue(result)); - - map.put(token, result); - return result; - } - } - - private static boolean canReplace(String token) { - if (token.length() <= 1 || token.charAt(0) == '$' ) - return false; - if (map.containsKey(token)) - return true; - if( isExcludeAll ) - return false; - if( forceReplace.contains(token) ) - return true; - if (exclusionTokenSet.contains(token) ) - return false; - if (Character.isDigit(token.charAt(0))) - return false; - if( token.charAt(0) == '_' ) - return true; - return true; - } - - private static void addexclusionTokenSet(String[] array) { - if (array != null) { - for (int i = 0; i < array.length; i++) { - if( exclusionTokenSet.contains(array[i]) ) - System.err.println( "warn, already excluded: " + array[i] ); - exclusionTokenSet.add(array[i]); - } - } - } - - public static boolean isDelimiter(String token) { - if (token != null && token.length() > 0) { - for (int i = 0; i < DELIMITER.length; i++) { - if (token.charAt(0) == DELIMITER[i]) { - return true; - } - } - } - return false; - } -} - -class JSOState { - boolean dotted = false; - boolean doubleQuoted = false; - boolean singleQuoted = false; - boolean backslashed = false; - boolean commented = false; - boolean printToken = true; - boolean delimiter = false; - - String token; - String lastToken; - String nextToken; - - char c0 = 0; - char c = 0; - char c2 = 0; - - void reset() { - dotted = false; - doubleQuoted = false; - singleQuoted = false; - backslashed = false; - commented = false; - printToken = true; - delimiter = false; - - token = null; - lastToken = null; - nextToken = null; - - c0 = 0; - c = 0; - c2 = 0; - } - - boolean printable() { - return !commented && (printToken || inString()); - } - - boolean inString() { - return doubleQuoted || singleQuoted; - } - - boolean delimiterSurrounded() { - return !JSO.isDelimiter(nextToken) && !JSO.isDelimiter(lastToken); - } - - boolean isWhitespace(){ - return Character.isWhitespace(c); - } - - String setToken(String value) { - String oldToken = lastToken; - lastToken = token; - token = value; - nextToken = null; - - if (value != null) { - c0 = c; - c = token == null ? 0 : token.charAt(0); - c2 = 0; - - backslashed = c0 == '\\'; - dotted = c0 == '.'; - delimiter = JSO.isDelimiter(token); - printToken = true; - } - - return oldToken; - } - - String tokenBackslashed() { - String result = null; - int index = 0; - if (c == 'u') { - index = 4; - } else if (Character.isDigit(c)) { - index = 3; - } else { - throw new IllegalStateException("Token not backslashed or invalid JavaScript syntax."); - } - result = token.substring(0, index); - token = token.substring(index); - - return result; - } - - void setNextToken(String value) { - nextToken = value; - c2 = value.charAt(0); - } - - void skipToken() { - this.setToken(nextToken); - } - - void noToken() { - nextToken = null; - c2 = 0; - } - - boolean flipFlags() { - if (isWhitespace()) { - printToken = delimiterSurrounded() || JSO.isDebug; - } else if (c == '/') { - if (!commented && c2 == '/') { - return true; - } else if (!commented && c2 == '*' && - !inString()) { - commented = true; - } else if (commented && c0 == '*') { - commented = false; - printToken = false; - } - } else if (c == '\"' && !singleQuoted && !backslashed && !commented) { - doubleQuoted = !doubleQuoted; - } else if (c == '\'' && !doubleQuoted && !backslashed && !commented) { - singleQuoted = !singleQuoted; - } - return false; - } -} diff --git a/src/messenger/webim/js/source/build.xml b/src/messenger/webim/js/source/build.xml index 684473f0..fcb805a2 100644 --- a/src/messenger/webim/js/source/build.xml +++ b/src/messenger/webim/js/source/build.xml @@ -2,33 +2,30 @@ ]> - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/src/messenger/webim/js/source/chat.js b/src/messenger/webim/js/source/chat.js index 211bed19..3ffb036f 100644 --- a/src/messenger/webim/js/source/chat.js +++ b/src/messenger/webim/js/source/chat.js @@ -21,7 +21,7 @@ var FrameUtils = { doc.write(""); doc.close(); frm.onload = function() { - if( frm./**/myHtml ) { + if( frm.myHtml ) { FrameUtils.getDocument(frm).getElementById('content').innerHTML += frm.myHtml; FrameUtils.scrollDown(frm); } diff --git a/src/messenger/webim/js/source/common.js b/src/messenger/webim/js/source/common.js index 983eef5a..42165cbb 100644 --- a/src/messenger/webim/js/source/common.js +++ b/src/messenger/webim/js/source/common.js @@ -18,12 +18,12 @@ var Class = { create: function() { return function() { - this./**/initialize./**/apply(this, arguments); + this.initialize.apply(this, arguments); }; }, inherit: function(child,parent,body) { - Object./**/extend(Object.extend(child.prototype, parent.prototype), body ); + Object.extend(Object.extend(child.prototype, parent.prototype), body ); } }; @@ -38,21 +38,21 @@ Object.prototype.extend = function(_object) { return Object.extend.apply(this, [this, _object]); }; -Function.prototype./**/bind = function(_object) { +Function.prototype.bind = function(_object) { var __method = this; return function() { return __method.apply(_object, arguments); } }; -Function.prototype./**/bindAsEventListener = function(_object) { +Function.prototype.bindAsEventListener = function(_object) { var __method = this; return function(event) { __method.call(_object, event || window.event); } }; -Number.prototype./**/toColorPart = function() { +Number.prototype.toColorPart = function() { var digits = this.toString(16); if (this < 16) return '0' + digits; return digits; @@ -81,9 +81,9 @@ PeriodicalExecuter.prototype = { initialize: function(callback, frequency) { this.callback = callback; this.frequency = frequency; - this./**/currentlyExecuting = false; + this.currentlyExecuting = false; - this./**/registerCallback(); + this.registerCallback(); }, registerCallback: function() { @@ -119,7 +119,7 @@ function findObj( id ) return x; } -if (!Array.prototype./**/push) { +if (!Array.prototype.push) { Array.prototype.push = function() { var startLength = this.length; for (var i = 0; i < arguments.length; i++) @@ -190,7 +190,7 @@ var Ajax = { emptyFunction: function() {} }; -Ajax./**/Base = function() {}; +Ajax.Base = function() {}; Ajax.Base.prototype = { setOptions: function(_options) { this._options = { @@ -216,8 +216,8 @@ Ajax.Base.prototype = { } }; -Ajax./**/Request = Class.create(); -Ajax.Request./**/Events = +Ajax.Request = Class.create(); +Ajax.Request.Events = ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; Class.inherit( Ajax.Request, Ajax.Base, {