mirror of
https://github.com/Mibew/i18n.git
synced 2025-01-22 21:40:28 +03:00
install page: links to check the sound
This commit is contained in:
parent
2a5943c058
commit
5595bd0f6e
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd webim/js/source
|
||||
/usr/local/ant/bin/ant
|
||||
ant
|
||||
rm -rf bin
|
||||
|
@ -804,6 +804,16 @@ table.awaiting td.visitor {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
#check-nv, #check-nm {
|
||||
color: #2f7599;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#check-nv:hover, #check-nm:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
/* chat */
|
||||
|
||||
.message {
|
||||
|
@ -31,6 +31,7 @@ $page = array(
|
||||
$page['done'] = array();
|
||||
$page['nextstep'] = false;
|
||||
$page['nextnotice'] = false;
|
||||
$page['soundcheck'] = false;
|
||||
$errors = array();
|
||||
|
||||
function check_webimroot()
|
||||
@ -143,6 +144,16 @@ function check_columns($link)
|
||||
return true;
|
||||
}
|
||||
|
||||
function check_sound() {
|
||||
global $page;
|
||||
|
||||
$page['soundcheck'] = true;
|
||||
$page['done'][] = getlocal2("install.5.text", array(
|
||||
"<a id='check-nv' href='javascript:void(0)'>".getlocal("install.5.newvisitor")."</a>",
|
||||
"<a id='check-nm' href='javascript:void(0)'>".getlocal("install.5.newmessage")."</a>"
|
||||
));
|
||||
}
|
||||
|
||||
function check_status()
|
||||
{
|
||||
global $page, $webimroot, $settings, $dbversion;
|
||||
@ -171,6 +182,8 @@ function check_status()
|
||||
return;
|
||||
}
|
||||
|
||||
check_sound();
|
||||
|
||||
$page['done'][] = getlocal("installed.message");
|
||||
|
||||
$page['nextstep'] = getlocal("installed.login_link");
|
||||
|
@ -1 +1 @@
|
||||
var myAgent="",myVer=0,myRealAgent="";function detectAgent(){for(var a=["opera","msie","safari","firefox","netscape","mozilla"],b=navigator.userAgent.toLowerCase(),c=0;c<a.length;c++){var d=a[c];if(b.indexOf(d)!=-1){myAgent=d;if(!window.RegExp)break;if((new RegExp(d+"[ /]?([0-9]+(.[0-9]+)?)")).exec(b)!=null)myVer=parseFloat(RegExp.$1);break}}myRealAgent=myAgent;if(navigator.product=="Gecko")myAgent="moz"}detectAgent();function getEl(a){return document.getElementById(a)};
|
||||
var myAgent="",myVer=0,myRealAgent="";function detectAgent(){for(var a=["opera","msie","safari","firefox","netscape","mozilla"],b=navigator.userAgent.toLowerCase(),c=0;c<a.length;c++){var d=a[c];if(b.indexOf(d)!=-1){myAgent=d;if(!window.RegExp)break;RegExp(d+"[ /]?([0-9]+(.[0-9]+)?)").exec(b)!=null&&(myVer=parseFloat(RegExp.$1));break}}myRealAgent=myAgent;navigator.product=="Gecko"&&(myAgent="moz")}detectAgent();function getEl(a){return document.getElementById(a)};
|
||||
|
@ -6,19 +6,19 @@
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
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("<html><head>");b.write('<link rel="stylesheet" type="text/css" media="all" href="'+Chat.cssfile+'">');b.write("</head><body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400'>");b.write("<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message' id='content'></td></tr></table><a id='bottom'></a>");
|
||||
b.write("</body></html>");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!=""?'<img src="'+Chat.webimRoot+'/images/free.gif" width="7" height="1" border="0" alt="" /><img src="'+a+'" border="0" alt=""/>':""},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<a.childNodes.length;d++){var e=a.childNodes[d];if(e.tagName=="message"){b=true;this.processMessage(c,e)}else e.tagName=="avatar"&&this.setupAvatar(e)}if(window.location.search.indexOf("trace=on")>=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){(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()}}});
|
||||
b.write("</body></html>");b.close();a.onload=function(){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(!1)}};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=!0;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=!0}.bind(this),this._options.message.onblur=function(){this.focused=!1}.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);this._options.user&&(this._options.parameters+="&user=true");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(!0);if(this.updater._options)this.updater._options.onComplete=void 0;clearTimeout(this.timer)},
|
||||
update:function(){this.updateOptions("refresh");this.updater=new Ajax.Request(this._options.servl,this._options)},requestComplete:function(a){try{this.enableInput(!0);this.cansend=!0;var b=Ajax.getXml(a);b&&b.tagName=="thread"?this.updateContent(b):this.handleError(a,b,"refresh messages failed")}catch(c){}this.skipNextsound=!1;this.timer=setTimeout(this.update.bind(this),this.frequency*1E3)},postMessage:function(a){if(a!=""&&this.cansend){this.cansend=!1;this.stopUpdate();this.skipNextsound=!0;this.updateOptions("post");
|
||||
var b={}.extend(this._options);b.parameters+="&message="+encodeURIComponent(a);b.onComplete=function(a){this.requestComplete(a);if(this._options.message)this._options.message.value="",this._options.message.focus()}.bind(this);myRealAgent!="opera"&&this.enableInput(!1);this.updater=new Ajax.Request(this._options.servl,b)}},changeName:function(a){this.skipNextsound=!0;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);this._options.user&&(a+="&user=true");new Ajax.Request(this._options.servl,{parameters:a,onComplete:this.onThreadClosed.bind(this)})},processMessage:function(a,b){var c=NodeUtils.getNodeText(b);FrameUtils.insertIntoFrame(a,
|
||||
c)},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!=""?'<img src="'+Chat.webimRoot+'/images/free.gif" width="7" height="1" border="0" alt="" /><img src="'+a+'" border="0" alt=""/>':""},updateContent:function(a){var b=!1,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"))&&(d=="1"&&!this.ownThread||this.ownThread&&d!="1"))window.location.href=window.location.href;for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];e.tagName=="message"?(b=!0,this.processMessage(c,e)):e.tagName=="avatar"&&this.setupAvatar(e)}window.location.search.indexOf("trace=on")>=0?(a="updated",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)):this.clearStatus();b&&(FrameUtils.scrollDown(this._options.container),this.skipNextsound||(b=$("soundimg"),(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){a?(ctrl=a.ctrlKey,a=a.which):(a=event.keyCode,ctrl=event.ctrlKey);if(this._options.message&&this.isSendkey(ctrl,a))return a=this._options.message.value,
|
||||
this._options.ignorectrl&&(a=a.replace(/[\r\n]+$/,"")),this.postMessage(a),!1;return!0},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 a=$("msgwnd");a&&Chat.threadUpdater.postMessage(a.value)}},"select#predefined":function(a){a.onchange=function(){var a=$("msgwnd");if(this.selectedIndex!=0)a.value=this.options[this.selectedIndex].innerText||this.options[this.selectedIndex].innerHTML;this.selectedIndex=0;a.focus()}},"div#changename2 a":function(a){a.onclick=function(){Chat.showNameField();return!1}},"div#changename1 a":function(a){a.onclick=function(){Chat.applyName();
|
||||
return!1}},"div#changename1 input#uname":function(a){a.onkeydown=function(a){(a||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 a=$("soundimg");if(a)a.className=a.className.match(/\bisound\b/)?"tplimage inosound":"tplimage isound",(a=$("msgwnd"))&&a.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||{}))});
|
||||
|
@ -7,21 +7,21 @@
|
||||
*/
|
||||
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<arguments.length;b++){var c=arguments[b];try{a=c();break}catch(d){}}return a}},PeriodicalExecuter=Class.create();
|
||||
PeriodicalExecuter.prototype={initialize:function(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1E3)},onTimerEvent:function(){if(!this.currentlyExecuting)try{this.currentlyExecuting=true;this.callback()}finally{this.currentlyExecuting=false}}};
|
||||
function findObj(a){var b;if(!(b=document[a])&&document.all)b=document.all[a];if(!b&&document.getElementById)b=document.getElementById(a);if(!b&&!document.all&&document.getElementsByName){b=document.getElementsByName(a);if(b.length==0)return null;if(b.length==1)return b[0]}return b}if(!Array.prototype.push)Array.prototype.push=function(){for(var a=this.length,b=0;b<arguments.length;b++)this[a+b]=arguments[b];return this.length};
|
||||
function $(){for(var a=[],b=0;b<arguments.length;b++){var c=arguments[b];if(typeof c=="string")c=findObj(c);if(arguments.length==1)return c;a.push(c)}return a}
|
||||
var Ajax={getTransport:function(){return Try.these(function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest})||false},getXml:function(a){if(a&&a.status>=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<a.length;b+=2)this.transport.setRequestHeader(a[b],a[b+1])},onStateChange:function(){this.transport.readyState!=1&&this.respondToReadyState(this.transport.readyState)},handleTimeout:function(){if(!this.finished){this.finished=true;(this._options.onTimeout||Ajax.emptyFunction)(this)}},respondToReadyState:function(a){if(Ajax.Request.Events[a]=="Complete"){try{if(!this.finished){this.finished=true;this._options.timeout&&
|
||||
clearTimeout(this.transportTimer);(this._options.onComplete||Ajax.emptyFunction)(this.transport)}}catch(b){this.dispatchException(b)}this.transport.onreadystatechange=Ajax.emptyFunction}},dispatchException:function(a){(this._options.onException||Ajax.emptyFunction)(this,a)}});
|
||||
PeriodicalExecuter.prototype={initialize:function(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=!1;this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1E3)},onTimerEvent:function(){if(!this.currentlyExecuting)try{this.currentlyExecuting=!0,this.callback()}finally{this.currentlyExecuting=!1}}};
|
||||
function findObj(a){var b;if(!(b=document[a])&&document.all)b=document.all[a];!b&&document.getElementById&&(b=document.getElementById(a));if(!b&&!document.all&&document.getElementsByName){b=document.getElementsByName(a);if(b.length==0)return null;if(b.length==1)return b[0]}return b}if(!Array.prototype.push)Array.prototype.push=function(){for(var a=this.length,b=0;b<arguments.length;b++)this[a+b]=arguments[b];return this.length};
|
||||
function $(){for(var a=[],b=0;b<arguments.length;b++){var c=arguments[b];typeof c=="string"&&(c=findObj(c));if(arguments.length==1)return c;a.push(c)}return a}
|
||||
var Ajax={getTransport:function(){return Try.these(function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest})||!1},getXml:function(a){if(a&&a.status>=200&&a.status<300&&(a=a.responseXML)&&a.documentElement)return a.documentElement;return null},getError:function(a){return a.statusText||"connection error N"+a.status},emptyFunction:function(){},Base:function(){}};
|
||||
Ajax.Base.prototype={setOptions:function(a){this._options={_method:"post",asynchronous:!0,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=!1;this.request(a)},request:function(a){var b=this._options.parameters||"";b.length>0&&(b+="&_=");try{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),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"];this._options._method=="post"&&(a.push("Content-type","application/x-www-form-urlencoded"),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<a.length;b+=2)this.transport.setRequestHeader(a[b],a[b+1])},onStateChange:function(){this.transport.readyState!=1&&this.respondToReadyState(this.transport.readyState)},handleTimeout:function(){if(!this.finished)this.finished=!0,(this._options.onTimeout||Ajax.emptyFunction)(this)},respondToReadyState:function(a){if(Ajax.Request.Events[a]=="Complete"){try{if(!this.finished)this.finished=!0,this._options.timeout&&
|
||||
clearTimeout(this.transportTimer),(this._options.onComplete||Ajax.emptyFunction)(this.transport)}catch(b){this.dispatchException(b)}this.transport.onreadystatechange=Ajax.emptyFunction}},dispatchException:function(a){(this._options.onException||Ajax.emptyFunction)(this,a)}});
|
||||
var EventHelper={register:function(a,b,c){var d=a[b];a[b]=typeof d!="function"?c:function(){d();c()}}},Behaviour={list:[],register:function(a){Behaviour.list.push(a)},init:function(){EventHelper.register(window,"onload",function(){Behaviour.apply()})},apply:function(){for(h=0;sheet=Behaviour.list[h];h++)for(selector in sheet)if(list=document.getElementsBySelector(selector))for(i=0;element=list[i];i++)sheet[selector](element)}};Behaviour.init();
|
||||
function getAllChildren(a){return a.all?a.all:a.getElementsByTagName("*")}
|
||||
document.getElementsBySelector=function(a){if(!document.getElementsByTagName)return[];a=a.split(" ");for(var b=new Array(document),c=0;c<a.length;c++){token=a[c].replace(/^\s+/,"").replace(/\s+$/,"");if(token.indexOf("#")>-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 j=[],l=0,m=0;m<b.length;m++){var g;g=e=="*"?getAllChildren(b[m]):
|
||||
b[m].getElementsByTagName(e);if(g!=null)for(var o=0;o<g.length;o++)j[l++]=g[o]}b=[];for(l=e=0;l<j.length;l++)if(j[l].className&&j[l].className.match(new RegExp("\\b"+d+"\\b")))b[e++]=j[l]}else{if(!b[0])return;e=token;j=[];for(m=l=0;m<b.length;m++){g=b[m].getElementsByTagName(e);for(o=0;o<g.length;o++)j[l++]=g[o]}b=j}}return b};
|
||||
var NodeUtils={getNodeValue:function(a,b){a=a.getElementsByTagName(b);if(a.length==0)return"";a=a[0].childNodes;b="";for(i=0;i<a.length;i++)b+=a[i].nodeValue;return b},getNodeText:function(a){a=a.childNodes;var b="";for(i=0;i<a.length;i++)b+=a[i].nodeValue;return b},getAttrValue:function(a,b){for(k=0;k<a.attributes.length;k++)if(a.attributes[k].nodeName==b)return a.attributes[k].nodeValue;return null}},CommonUtils={getRow:function(a,b){var c=b.rows[a];if(c!=null)return c;if(b.rows.head!=null)return null;
|
||||
for(k=0;k<b.rows.length;k++)if(b.rows[k].id==a)return b.rows[k];return null},getCell:function(a,b,c){var d=b.cells[a];if(d!=null)return d;if(c.rows.head!=null)return null;for(k=0;k<b.cells.length;k++)if(b.cells[k].id==a)return b.cells[k];return null},insertCell:function(a,b,c,d,e,j){a=a.insertCell(-1);a.id=b;if(d)a.align=d;a.className=c;if(e)a.height=e;a.innerHTML=j}};
|
||||
function getWavMimeType(){var a="application/x-mplayer2",b=navigator.userAgent.toLowerCase();if(navigator.mimeTypes&&b.indexOf("windows")==-1)if(navigator.mimeTypes["audio/mpeg"].enabledPlugin||b.indexOf("opera")>=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?'<embed type="'+getWavMimeType()+'" src="'+a+'" loop="0" autostart="1" width="0" height="0">':'<div style="position: static; width: 0px; height: 0px"><embed type="'+getWavMimeType()+'" src="'+a+'" hidden="true" loop="false" autostart="true"></div>'}
|
||||
document.getElementsBySelector=function(a){if(!document.getElementsByTagName)return[];for(var a=a.split(" "),b=Array(document),c=0;c<a.length;c++)if(token=a[c].replace(/^\s+/,"").replace(/\s+$/,""),token.indexOf("#")>-1){var d=token.split("#"),e=d[0],b=document.getElementById(d[1]);if(b==null||e&&b.nodeName.toLowerCase()!=e)return[];b=Array(b)}else if(token.indexOf(".")>-1){d=token.split(".");e=d[0];d=d[1];e||(e="*");for(var l=[],j=0,n=0;n<b.length;n++){var g;g=e=="*"?getAllChildren(b[n]):b[n].getElementsByTagName(e);
|
||||
if(g!=null)for(var o=0;o<g.length;o++)l[j++]=g[o]}b=[];for(j=e=0;j<l.length;j++)l[j].className&&l[j].className.match(RegExp("\\b"+d+"\\b"))&&(b[e++]=l[j])}else{if(!b[0])return;e=token;l=[];for(n=j=0;n<b.length;n++){g=b[n].getElementsByTagName(e);for(o=0;o<g.length;o++)l[j++]=g[o]}b=l}return b};
|
||||
var NodeUtils={getNodeValue:function(a,b){var c=a.getElementsByTagName(b);if(c.length==0)return"";var c=c[0].childNodes,d="";for(i=0;i<c.length;i++)d+=c[i].nodeValue;return d},getNodeText:function(a){var a=a.childNodes,b="";for(i=0;i<a.length;i++)b+=a[i].nodeValue;return b},getAttrValue:function(a,b){for(k=0;k<a.attributes.length;k++)if(a.attributes[k].nodeName==b)return a.attributes[k].nodeValue;return null}},CommonUtils={getRow:function(a,b){var c=b.rows[a];if(c!=null)return c;if(b.rows.head!=null)return null;
|
||||
for(k=0;k<b.rows.length;k++)if(b.rows[k].id==a)return b.rows[k];return null},getCell:function(a,b,c){var d=b.cells[a];if(d!=null)return d;if(c.rows.head!=null)return null;for(k=0;k<b.cells.length;k++)if(b.cells[k].id==a)return b.cells[k];return null},insertCell:function(a,b,c,d,e,l){a=a.insertCell(-1);a.id=b;if(d)a.align=d;a.className=c;if(e)a.height=e;a.innerHTML=l}};
|
||||
function getWavMimeType(){var a="application/x-mplayer2",b=navigator.userAgent.toLowerCase();if(navigator.mimeTypes&&b.indexOf("windows")==-1&&(navigator.mimeTypes["audio/mpeg"].enabledPlugin||b.indexOf("opera")>=0))a="audio/mpeg";return a}
|
||||
function playSound(a){var b=document.getElementById("player");b&&b.parentNode.removeChild(b);var b=document.body.appendChild(document.createElement("div")),c=navigator.userAgent.toLowerCase();b.innerHTML=c.indexOf("safari")==-1&&c.indexOf("windows")!=-1?'<embed type="'+getWavMimeType()+'" src="'+a+'" loop="0" autostart="1" width="0" height="0">':'<div style="position: static; width: 0px; height: 0px"><embed type="'+getWavMimeType()+'" src="'+a+'" hidden="true" loop="false" autostart="true"></div>'}
|
||||
function htmlescape(a){return a.replace("&","&").replace("<","<").replace(">",">").replace('"',""")};
|
||||
|
1
src/messenger/webim/js/164/soundcheck.js
Normal file
1
src/messenger/webim/js/164/soundcheck.js
Normal file
@ -0,0 +1 @@
|
||||
Behaviour.register({"a#check-nv":function(a){a.onclick=function(){playSound(wroot+"/sounds/new_user.wav")}},"a#check-nm":function(a){a.onclick=function(){playSound(wroot+"/sounds/new_message.wav")}}});
|
@ -7,21 +7,21 @@
|
||||
*/
|
||||
Ajax.PeriodicalUpdater=Class.create();
|
||||
Class.inherit(Ajax.PeriodicalUpdater,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.frequency=this._options.frequency||2;this.updater={};this.update()},handleException:function(){this._options.handleError&&this._options.handleError("offline, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),
|
||||
1E3)},handleTimeout:function(){this._options.handleError&&this._options.handleError("timeout, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),1E3)},stopUpdate:function(){if(this.updater._options)this.updater._options.onComplete=undefined;clearTimeout(this.timer)},update:function(){if(this._options.updateParams)this._options.parameters=this._options.updateParams();this.updater=new Ajax.Request(this._options.url,this._options)},requestComplete:function(a){try{var b=Ajax.getXml(a);
|
||||
if(b)(this._options.updateContent||Ajax.emptyFunction)(b);else this._options.handleError&&this._options.handleError("reconnecting")}catch(c){}this.timer=setTimeout(this.update.bind(this),this.frequency*1E3)}});
|
||||
var HtmlGenerationUtils={popupLink:function(a,b,c,d,e,j,l){return'<a href="'+a+'"'+(l!=null?' class="'+l+'"':"")+' target="_blank" title="'+b+'" onclick="this.newWindow = window.open(\''+a+"', '"+c+"', 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width="+e+",height="+j+",resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;\">"+d+"</a>"},generateOneRowTable:function(a){return'<table class="inner"><tr>'+a+"</tr></table>"},viewOpenCell:function(a,b,c,d,e,j,l,m){j=
|
||||
2;b=b+"?thread="+c;var g="<td>";g+=e||d?HtmlGenerationUtils.popupLink(m||!d?b:b+"&viewonly=true",localized[e?0:1],"ImCenter"+c,a,640,480,null):'<a href="#">'+a+"</a>";g+="</td>";if(e){g+='<td class="icon">';g+=HtmlGenerationUtils.popupLink(b,localized[0],"ImCenter"+c,'<img src="'+webimRoot+'/images/tbliclspeak.gif" width="15" height="15" border="0" alt="'+localized[0]+'">',640,480,null);g+="</td>";j++}if(d){g+='<td class="icon">';g+=HtmlGenerationUtils.popupLink(b+"&viewonly=true",localized[1],"ImCenter"+
|
||||
c,'<img src="'+webimRoot+'/images/tbliclread.gif" width="15" height="15" border="0" alt="'+localized[1]+'">',640,480,null);g+="</td>";j++}if(l!=""){g+='</tr><tr><td class="firstmessage" colspan="'+j+'"><a href="javascript:void(0)" title="'+l+'" onclick="alert(this.title);return false;">';g+=l.length>30?l.substring(0,30)+"...":l;g+="</a></td>"}return HtmlGenerationUtils.generateOneRowTable(g)},banCell:function(a,b){return'<td class="icon">'+HtmlGenerationUtils.popupLink(webimRoot+"/operator/ban.php?"+
|
||||
1E3)},handleTimeout:function(){this._options.handleError&&this._options.handleError("timeout, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),1E3)},stopUpdate:function(){if(this.updater._options)this.updater._options.onComplete=void 0;clearTimeout(this.timer)},update:function(){if(this._options.updateParams)this._options.parameters=this._options.updateParams();this.updater=new Ajax.Request(this._options.url,this._options)},requestComplete:function(a){try{var b=Ajax.getXml(a);
|
||||
b?(this._options.updateContent||Ajax.emptyFunction)(b):this._options.handleError&&this._options.handleError("reconnecting")}catch(c){}this.timer=setTimeout(this.update.bind(this),this.frequency*1E3)}});
|
||||
var HtmlGenerationUtils={popupLink:function(a,b,c,d,e,l,j){return'<a href="'+a+'"'+(j!=null?' class="'+j+'"':"")+' target="_blank" title="'+b+'" onclick="this.newWindow = window.open(\''+a+"', '"+c+"', 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width="+e+",height="+l+",resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;\">"+d+"</a>"},generateOneRowTable:function(a){return'<table class="inner"><tr>'+a+"</tr></table>"},viewOpenCell:function(a,b,c,d,e,l,j,n){var l=
|
||||
2,b=b+"?thread="+c,g="<td>";g+=e||d?HtmlGenerationUtils.popupLink(n||!d?b:b+"&viewonly=true",localized[e?0:1],"ImCenter"+c,a,640,480,null):'<a href="#">'+a+"</a>";g+="</td>";e&&(g+='<td class="icon">',g+=HtmlGenerationUtils.popupLink(b,localized[0],"ImCenter"+c,'<img src="'+webimRoot+'/images/tbliclspeak.gif" width="15" height="15" border="0" alt="'+localized[0]+'">',640,480,null),g+="</td>",l++);d&&(g+='<td class="icon">',g+=HtmlGenerationUtils.popupLink(b+"&viewonly=true",localized[1],"ImCenter"+
|
||||
c,'<img src="'+webimRoot+'/images/tbliclread.gif" width="15" height="15" border="0" alt="'+localized[1]+'">',640,480,null),g+="</td>",l++);j!=""&&(g+='</tr><tr><td class="firstmessage" colspan="'+l+'"><a href="javascript:void(0)" title="'+j+'" onclick="alert(this.title);return false;">',g+=j.length>30?j.substring(0,30)+"...":j,g+="</a></td>");return HtmlGenerationUtils.generateOneRowTable(g)},banCell:function(a,b){return'<td class="icon">'+HtmlGenerationUtils.popupLink(webimRoot+"/operator/ban.php?"+
|
||||
(b?"id="+b:"thread="+a),localized[2],"ban"+a,'<img src="'+webimRoot+'/images/ban.gif" width="15" height="15" border="0" alt="'+localized[2]+'">',720,480,null)+"</td>"}};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+
|
||||
(this._options.showonline?"&showonline=1":"")},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,j=false,l=false,m=false,g=null,o=null,f=0;f<a.attributes.length;f++){var n=a.attributes[f];if(n.nodeName=="id")c=n.nodeValue;else if(n.nodeName=="stateid")d=n.nodeValue;else if(n.nodeName=="state")e=n.nodeValue;else if(n.nodeName=="canopen")l=true;else if(n.nodeName==
|
||||
"canview")j=true;else if(n.nodeName=="canban")m=true;else if(n.nodeName=="ban")g=n.nodeValue;else if(n.nodeName=="banid")o=n.nodeValue}f=CommonUtils.getRow("thr"+c,this.t);if(d=="closed"){f&&this.t.deleteRow(f.rowIndex);this.threadTimers[c]=null}else{n=NodeUtils.getNodeValue(a,"name");var t=NodeUtils.getNodeValue(a,"addr"),q=NodeUtils.getNodeValue(a,"time"),u=NodeUtils.getNodeValue(a,"agent"),r=NodeUtils.getNodeValue(a,"modified"),v=NodeUtils.getNodeValue(a,"message"),p="<td>"+NodeUtils.getNodeValue(a,
|
||||
"useragent")+"</td>";if(g!=null)p="<td>"+NodeUtils.getNodeValue(a,"reason")+"</td>";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,j,l,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,j,l,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<e.rowIndex}var b=$("statustd");if(b){var c=a(this.t,"twait")||a(this.t,"tprio")||a(this.t,"tchat");b.innerHTML=c?"":this._options.noclients;b.height=c?5:30}},getTimeSince:function(a){a=Math.floor(((new Date).getTime()-a-this.delta)/1E3);var b=Math.floor(a/60),c="";a%=60;if(a<10)a="0"+a;if(b>=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,j,l,m){if(e=CommonUtils.getCell(l,j,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]):"-")}}},updateThreads:function(a){var b=false,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<a.childNodes.length;c++){d=a.childNodes[c];if(d.tagName==
|
||||
"thread")if(this.updateThread(d))b=true}this.updateQueueMessages();this.updateTimers();this.setStatus(this._options.istatus?"Away":"Up to date");if(b){playSound(webimRoot+"/sounds/new_user.wav");window.focus();updaterOptions.showpopup&&alert(localized[5])}},updateOperators:function(a){var b=$("onlineoperators");if(b){for(var c=[],d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.tagName=="operator"){var j=NodeUtils.getAttrValue(e,"name");e=NodeUtils.getAttrValue(e,"away")!=null;c[c.length]=
|
||||
'<img src="'+webimRoot+"/images/op"+(e?"away":"online")+'.gif" width="12" height="12" border="0" alt="'+localized[1]+'"> '+j}}b.innerHTML=c.join(", ")}},updateContent:function(a){if(a.tagName=="update")for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.tagName=="threads")this.updateThreads(c);else c.tagName=="operators"&&this.updateOperators(c)}else a.tagName=="error"?this.setStatus(NodeUtils.getNodeValue(a,"descr")):this.setStatus("reconnecting")}});
|
||||
function togglemenu(){if($("sidebar")&&$("wcontent")&&$("togglemenu"))if($("wcontent").className=="contentnomenu"){$("sidebar").style.display="block";$("wcontent").className="contentinner";$("togglemenu").innerHTML=localized[4]}else{$("sidebar").style.display="none";$("wcontent").className="contentnomenu";$("togglemenu").innerHTML=localized[3]}}var webimRoot="";Behaviour.register({"#togglemenu":function(a){a.onclick=function(){togglemenu()}}});
|
||||
(this._options.showonline?"&showonline=1":"")},setStatus:function(a){this._options.status.innerHTML=a},handleError:function(a){this.setStatus(a)},updateThread:function(a){function b(a,b,c,d){if(a=CommonUtils.getCell(c,b,a))a.innerHTML=d}for(var c,d,e,l=!1,j=!1,n=!1,g=null,o=null,f=0;f<a.attributes.length;f++){var m=a.attributes[f];if(m.nodeName=="id")c=m.nodeValue;else if(m.nodeName=="stateid")d=m.nodeValue;else if(m.nodeName=="state")e=m.nodeValue;else if(m.nodeName=="canopen")j=!0;else if(m.nodeName==
|
||||
"canview")l=!0;else if(m.nodeName=="canban")n=!0;else if(m.nodeName=="ban")g=m.nodeValue;else if(m.nodeName=="banid")o=m.nodeValue}f=CommonUtils.getRow("thr"+c,this.t);if(d=="closed")f&&this.t.deleteRow(f.rowIndex),this.threadTimers[c]=null;else{var m=NodeUtils.getNodeValue(a,"name"),s=NodeUtils.getNodeValue(a,"addr"),q=NodeUtils.getNodeValue(a,"time"),t=NodeUtils.getNodeValue(a,"agent"),r=NodeUtils.getNodeValue(a,"modified"),u=NodeUtils.getNodeValue(a,"message"),p="<td>"+NodeUtils.getNodeValue(a,
|
||||
"useragent")+"</td>";g!=null&&(p="<td>"+NodeUtils.getNodeValue(a,"reason")+"</td>");n&&(p+=HtmlGenerationUtils.banCell(c,o));p=HtmlGenerationUtils.generateOneRowTable(p);a=CommonUtils.getRow("t"+d,this.t);n=CommonUtils.getRow("t"+d+"end",this.t);if(f!=null&&(f.rowIndex<=a.rowIndex||f.rowIndex>=n.rowIndex))this.t.deleteRow(f.rowIndex),f=this.threadTimers[c]=null;if(f==null){if(f=this.t.insertRow(a.rowIndex+1),f.className=g=="blocked"&&d!="chat"?"ban":"in"+d,f.id="thr"+c,this.threadTimers[c]=[q,r,d],
|
||||
CommonUtils.insertCell(f,"name","visitor",null,null,HtmlGenerationUtils.viewOpenCell(m,this._options.agentservl,c,l,j,g,u,d!="chat")),CommonUtils.insertCell(f,"contid","visitor","center",null,s),CommonUtils.insertCell(f,"state","visitor","center",null,e),CommonUtils.insertCell(f,"op","visitor","center",null,t),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),d=="wait"||d=="prio")return!0}else this.threadTimers[c]=[q,r,d],f.className=g=="blocked"&&d!="chat"?"ban":"in"+d,b(this.t,f,"name",HtmlGenerationUtils.viewOpenCell(m,this._options.agentservl,c,l,j,g,u,d!="chat")),b(this.t,f,"contid",s),b(this.t,f,"state",e),b(this.t,f,"op",t),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!1}},updateQueueMessages:function(){function a(a,b){var c=$(b),j=$(b+"end");
|
||||
if(c==null||j==null)return!1;return c.rowIndex+1<j.rowIndex}var b=$("statustd");if(b){var c=a(this.t,"twait")||a(this.t,"tprio")||a(this.t,"tchat");b.innerHTML=c?"":this._options.noclients;b.height=c?5:30}},getTimeSince:function(a){var a=Math.floor(((new Date).getTime()-a-this.delta)/1E3),b=Math.floor(a/60),c="";a%=60;a<10&&(a="0"+a);b>=60&&(c=Math.floor(b/60),b%=60,b<10&&(b="0"+b),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){var d=function(a,b,c,d){if(a=CommonUtils.getCell(c,b,a))a.innerHTML=d};d(this.t,c,"time",this.getTimeSince(b[0]));d(this.t,c,"wait",b[2]!="chat"?this.getTimeSince(b[1]):"-")}}},updateThreads:function(a){var b=!1,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<a.childNodes.length;c++)d=a.childNodes[c],d.tagName=="thread"&&
|
||||
this.updateThread(d)&&(b=!0);this.updateQueueMessages();this.updateTimers();this.setStatus(this._options.istatus?"Away":"Up to date");b&&(playSound(webimRoot+"/sounds/new_user.wav"),window.focus(),updaterOptions.showpopup&&alert(localized[5]))},updateOperators:function(a){var b=$("onlineoperators");if(b){for(var c=[],d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.tagName=="operator"){var l=NodeUtils.getAttrValue(e,"name"),e=NodeUtils.getAttrValue(e,"away")!=null;c[c.length]='<img src="'+
|
||||
webimRoot+"/images/op"+(e?"away":"online")+'.gif" width="12" height="12" border="0" alt="'+localized[1]+'"> '+l}}b.innerHTML=c.join(", ")}},updateContent:function(a){if(a.tagName=="update")for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];c.tagName=="threads"?this.updateThreads(c):c.tagName=="operators"&&this.updateOperators(c)}else a.tagName=="error"?this.setStatus(NodeUtils.getNodeValue(a,"descr")):this.setStatus("reconnecting")}});
|
||||
function togglemenu(){if($("sidebar")&&$("wcontent")&&$("togglemenu"))$("wcontent").className=="contentnomenu"?($("sidebar").style.display="block",$("wcontent").className="contentinner",$("togglemenu").innerHTML=localized[4]):($("sidebar").style.display="none",$("wcontent").className="contentnomenu",$("togglemenu").innerHTML=localized[3])}var webimRoot="";Behaviour.register({"#togglemenu":function(a){a.onclick=function(){togglemenu()}}});
|
||||
EventHelper.register(window,"onload",function(){webimRoot=updaterOptions.wroot;new Ajax.ThreadListUpdater({table:$("threadlist"),status:$("connstatus"),istatus:0}.extend(updaterOptions||{}));updaterOptions.havemenu||togglemenu()});
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE project [<!ENTITY buildfile SYSTEM "file:./build-user.xml">]>
|
||||
|
||||
<project basedir="." default="update" name="Obfuscator">
|
||||
<property name="closure.c" value="/usr/local/closure/compiler.jar" />
|
||||
@ -25,6 +24,10 @@
|
||||
<arg value="brws:1:common"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="brws.js"/>
|
||||
<arg value="--module"/>
|
||||
<arg value="soundcheck:1:common"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="soundcheck.js"/>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
|
12
src/messenger/webim/js/source/soundcheck.js
Normal file
12
src/messenger/webim/js/source/soundcheck.js
Normal file
@ -0,0 +1,12 @@
|
||||
Behaviour.register({
|
||||
'a#check-nv' : function(el) {
|
||||
el.onclick = function() {
|
||||
playSound(wroot + '/sounds/new_user.wav');
|
||||
};
|
||||
},
|
||||
'a#check-nm' : function(el) {
|
||||
el.onclick = function() {
|
||||
playSound(wroot + '/sounds/new_message.wav')
|
||||
};
|
||||
}
|
||||
});
|
@ -177,7 +177,10 @@ install.3.create=Create required tables.
|
||||
install.3.tables_exist=Requred tables are created.
|
||||
install.4.create=Update tables
|
||||
install.4.done=Tables structure is up to date.
|
||||
install.4.notice=Structure of your tables should be adjusted for new version of Messenger.
|
||||
install.4.notice=Structure of your tables should be adjusted for new version of Messenger.
|
||||
install.5.text=Click to check the sound: {0} and {1}
|
||||
install.5.newmessage=New Message
|
||||
install.5.newvisitor=New Visitor
|
||||
install.connection.error=Could not connect, please check server settings in config.php. Error: {0}
|
||||
install.done=Completed:
|
||||
install.err.back=Resvole problem and try again. Press <a>back</a> to return to wizard.
|
||||
|
@ -25,6 +25,18 @@ if(isset($page) && isset($page['localeLinks'])) {
|
||||
$page['title'] = getlocal("install.title");
|
||||
$page['fixedwrap'] = true;
|
||||
|
||||
function tpl_header() { global $page, $webimroot, $jsver;
|
||||
if($page['soundcheck']) {
|
||||
?>
|
||||
<script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/<?php echo $jsver ?>/common.js"></script>
|
||||
<script type="text/javascript" language="javascript"><!--
|
||||
var wroot ="<?php echo $webimroot ?>";
|
||||
//--></script>
|
||||
<script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/<?php echo $jsver ?>/soundcheck.js"></script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
function tpl_content() { global $page, $webimroot, $errors;
|
||||
?>
|
||||
<?php echo getlocal("install.message") ?>
|
||||
|
Loading…
Reference in New Issue
Block a user