var aa=0; var clientId; var signal = 0 ; var flag2 = 0; var clientInfoId=0; var stompClient = null; var appid = '0po0k4'; var colour='0'; //悬浮框颜色 0—5 var model='0'; //悬浮框样式 0—2 var Offest='5'; //悬浮框位置 0—5 var flag = '1'; //是否存在悬浮框 var Invitation_position='1';//邀请框位置 0-1 var Invitation_style='0';//邀请框样式0—1 var Invitation_ifshow='0';//是否存在邀请框 var Invitation_bgImg='jsp/system/webim/img/image.png'; //邀请框背景图片 var Invitation_color='2';//邀请框颜色 var content1 = '客服'; //悬浮框文本 var Invitation_content = '欢迎来到本网站,请问有什么可以帮您?'; //邀请框文本 var Invitation_buttonconfirm = '现在咨询'; //邀请框确认按钮 var Invitation_buttoncancel = '稍后咨询'; //邀请框取消按钮 var entrance_delay='0'; //悬浮框延时 var invite_delay='0'; //邀请框延时 var skillsGroup='0'; //是否开启技能组 var skillG=''; //技能组 var seatGroupTitle=''; //技能组标题 var seatGroupBotContent=''; //技能组底部标题 var seatGroupTips=''; //技能组提示信息 var ifSkillsGroupSeat='0'; //是否显示坐席 var maxShowSkillsGroup='1'; //最大分组数 var maxSeatGroup='1'; //最大坐席数 var autoRefreshTime='30'; //自动刷新技能组坐席 var offName=''; //无人在线的名称 var leaveMsg ='您好,当前无人工坐席在线'; //留言信息 var serAgents = ""; var winObj; var loop; /////////////聊天框参数/////////////// var clientId = ''; //var appid = '0po0k4'; var companyId = '1001'; var serAgent = '';//分配的服务端坐席 var serAgentName = '';//分配的服务端坐席名称 var serAgentId = '';//分配的Id serAgentId var retMsg = ''; var welcomMsg = '欢迎您来咨询,请问有什么可以帮助您的呢?'; var nickName = ''//客户端姓名 var finessmsg = '坐席已断开和您的对话'; var ifSend ='0'; //0可发送 1不可发送 var satisfiedInvestigationMsg = '请对我们的服务做出评价' //邀请评价提示消息 var DIALOGUE_TEUNS = ''; //对话轮次 var receiveNum = 0; //接收次数 var sendNum = 0; //发送次数 var dialogueFlag = 0; var dialog_color='';//标题头部、对话框颜色、发送按钮 var angle=''; var Refresh; var chatOffest=''; //聊天框位置 var userPoint=''; //用户对话指向角颜色 (function(){var t,e,n,i,r={}.hasOwnProperty,o=[].slice;t={LF:"\n",NULL:"\x00"};n=function(){var e;function n(t,e,n){this.command=t;this.headers=e!=null?e:{};this.body=n!=null?n:""}n.prototype.toString=function(){var e,i,o,s,u;e=[this.command];o=this.headers["content-length"]===false?true:false;if(o){delete this.headers["content-length"]}u=this.headers;for(i in u){if(!r.call(u,i))continue;s=u[i];e.push(""+i+":"+s)}if(this.body&&!o){e.push("content-length:"+n.sizeOfUTF8(this.body))}e.push(t.LF+this.body);return e.join(t.LF)};n.sizeOfUTF8=function(t){if(t){return encodeURI(t).match(/%..|./g).length}else{return 0}};e=function(e){var i,r,o,s,u,a,c,f,h,l,p,d,g,b,m,v,y;s=e.search(RegExp(""+t.LF+t.LF));u=e.substring(0,s).split(t.LF);o=u.shift();a={};d=function(t){return t.replace(/^\s+|\s+$/g,"")};v=u.reverse();for(g=0,m=v.length;gy;c=p<=y?++b:--b){r=e.charAt(c);if(r===t.NULL){break}i+=r}}return new n(o,a,i)};n.unmarshall=function(n){var i;return function(){var r,o,s,u;s=n.split(RegExp(""+t.NULL+t.LF+"*"));u=[];for(r=0,o=s.length;r0){u.push(e(i))}}return u}()};n.marshall=function(e,i,r){var o;o=new n(e,i,r);return o.toString()+t.NULL};return n}();e=function(){var e;function r(t){this.ws=t;this.ws.binaryType="arraybuffer";this.counter=0;this.connected=false;this.heartbeat={outgoing:1e4,incoming:1e4};this.maxWebSocketFrameSize=16*1024;this.subscriptions={}}r.prototype.debug=function(t){var e;return typeof window!=="undefined"&&window!==null?(e=window.console)!=null?e.log(t):void 0:void 0};e=function(){if(Date.now){return Date.now()}else{return(new Date).valueOf}};r.prototype._transmit=function(t,e,i){var r;r=n.marshall(t,e,i);if(typeof this.debug==="function"){this.debug(">>> "+r)}while(true){if(r.length>this.maxWebSocketFrameSize){this.ws.send(r.substring(0,this.maxWebSocketFrameSize));r=r.substring(this.maxWebSocketFrameSize);if(typeof this.debug==="function"){this.debug("remaining = "+r.length)}}else{return this.ws.send(r)}}};r.prototype._setupHeartbeat=function(n){var r,o,s,u,a,c;if((a=n.version)!==i.VERSIONS.V1_1&&a!==i.VERSIONS.V1_2){return}c=function(){var t,e,i,r;i=n["heart-beat"].split(",");r=[];for(t=0,e=i.length;t>> PING"):void 0}}(this))}if(!(this.heartbeat.incoming===0||o===0)){s=Math.max(this.heartbeat.incoming,o);if(typeof this.debug==="function"){this.debug("check PONG every "+s+"ms")}return this.ponger=i.setInterval(s,function(t){return function(){var n;n=e()-t.serverActivity;if(n>s*2){if(typeof t.debug==="function"){t.debug("did not receive server activity for the last "+n+"ms")}return t.ws.close()}}}(this))}};r.prototype._parseConnect=function(){var t,e,n,i;t=1<=arguments.length?o.call(arguments,0):[];i={};switch(t.length){case 2:i=t[0],e=t[1];break;case 3:if(t[1]instanceof Function){i=t[0],e=t[1],n=t[2]}else{i.login=t[0],i.passcode=t[1],e=t[2]}break;case 4:i.login=t[0],i.passcode=t[1],e=t[2],n=t[3];break;default:i.login=t[0],i.passcode=t[1],e=t[2],n=t[3],i.host=t[4]}return[i,e,n]};r.prototype.connect=function(){var r,s,u,a;r=1<=arguments.length?o.call(arguments,0):[];a=this._parseConnect.apply(this,r);u=a[0],this.connectCallback=a[1],s=a[2];if(typeof this.debug==="function"){this.debug("Opening Web Socket...")}this.ws.onmessage=function(i){return function(r){var o,u,a,c,f,h,l,p,d,g,b,m;c=typeof ArrayBuffer!=="undefined"&&r.data instanceof ArrayBuffer?(o=new Uint8Array(r.data),typeof i.debug==="function"?i.debug("--- got data length: "+o.length):void 0,function(){var t,e,n;n=[];for(t=0,e=o.length;t>>0;if(!l(e))throw new TypeError;for(;++o>>0;if(!n)return-1;var r,o,i=0;for(1>>0:t>>>0;(o=e.exec(n))&&!(c<(i=o.index+o[0].length)&&(a.push(n.slice(c,o.index)),!_&&1=t));)e.lastIndex===o.index&&e.lastIndex++;return c===n.length?!s&&e.test("")||a.push(""):a.push(n.slice(c)),a.length>t?a.slice(0,t):a}):"0".split(void 0,0).length&&(s.split=function(e,t){return void 0===e&&0===t?[]:E.call(this,e,t)});var j=s.substr,S="".substr&&"b"!=="0b".substr(-1);d(s,{substr:function(e,t){return j.call(this,e<0&&(e=this.length+e)<0?0:e,t)}},S)},{}],16:[function(e,t,n){"use strict";t.exports=[e("./transport/websocket"),e("./transport/xhr-streaming"),e("./transport/xdr-streaming"),e("./transport/eventsource"),e("./transport/lib/iframe-wrap")(e("./transport/eventsource")),e("./transport/htmlfile"),e("./transport/lib/iframe-wrap")(e("./transport/htmlfile")),e("./transport/xhr-polling"),e("./transport/xdr-polling"),e("./transport/lib/iframe-wrap")(e("./transport/xhr-polling")),e("./transport/jsonp-polling")]},{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(o,f,e){(function(e){"use strict";var i=o("events").EventEmitter,t=o("inherits"),s=o("../../utils/event"),a=o("../../utils/url"),l=e.XMLHttpRequest,c=function(){};function u(e,t,n,r){c(e,t);var o=this;i.call(this),setTimeout(function(){o._start(e,t,n,r)},0)}t(u,i),u.prototype._start=function(e,t,n,r){var o=this;try{this.xhr=new l}catch(e){}if(!this.xhr)return c("no xhr"),this.emit("finish",0,"no xhr support"),void this._cleanup();t=a.addQuery(t,"t="+ +new Date),this.unloadRef=s.unloadAdd(function(){c("unload cleanup"),o._cleanup(!0)});try{this.xhr.open(e,t,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){c("xhr timeout"),o.emit("finish",0,""),o._cleanup(!1)})}catch(e){return c("exception",e),this.emit("finish",0,""),void this._cleanup(!1)}if(r&&r.noCredentials||!u.supportsCORS||(c("withCredentials"),this.xhr.withCredentials=!0),r&&r.headers)for(var i in r.headers)this.xhr.setRequestHeader(i,r.headers[i]);this.xhr.onreadystatechange=function(){if(o.xhr){var e,t,n=o.xhr;switch(c("readyState",n.readyState),n.readyState){case 3:try{t=n.status,e=n.responseText}catch(e){}c("status",t),1223===t&&(t=204),200===t&&e&&0')}catch(e){var n=s.document.createElement("iframe");return n.name=t,n}}(r);o.id=r,o.style.display="none",a.appendChild(o);try{l.value=t}catch(e){}a.submit();var i=function(e){f("completed",r,e),o.onerror&&(o.onreadystatechange=o.onerror=o.onload=null,setTimeout(function(){f("cleaning up",r),o.parentNode.removeChild(o),o=null},500),l.value="",n(e))};return o.onerror=function(){f("onerror",r),i()},o.onload=function(){f("onload",r),i()},o.onreadystatechange=function(e){f("onreadystatechange",r,o.readyState,e),"complete"===o.readyState&&i()},function(){f("aborted",r),i(new Error("Aborted"))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/random":50,"../../utils/url":52,"debug":void 0}],34:[function(r,c,e){(function(i){"use strict";var o=r("events").EventEmitter,e=r("inherits"),s=r("../../utils/event"),t=r("../../utils/browser"),a=r("../../utils/url"),l=function(){};function n(e,t,n){l(e,t);var r=this;o.call(this),setTimeout(function(){r._start(e,t,n)},0)}e(n,o),n.prototype._start=function(e,t,n){l("_start");var r=this,o=new i.XDomainRequest;t=a.addQuery(t,"t="+ +new Date),o.onerror=function(){l("onerror"),r._error()},o.ontimeout=function(){l("ontimeout"),r._error()},o.onprogress=function(){l("progress",o.responseText),r.emit("chunk",200,o.responseText)},o.onload=function(){l("load"),r.emit("finish",200,o.responseText),r._cleanup(!1)},this.xdr=o,this.unloadRef=s.unloadAdd(function(){r._cleanup(!0)});try{this.xdr.open(e,t),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(n)}catch(e){this._error()}},n.prototype._error=function(){this.emit("finish",0,""),this._cleanup(!1)},n.prototype._cleanup=function(e){if(l("cleanup",e),this.xdr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null,e)try{this.xdr.abort()}catch(e){}this.unloadRef=this.xdr=null}},n.prototype.close=function(){l("close"),this._cleanup(!0)},n.enabled=!(!i.XDomainRequest||!t.hasDomain()),c.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/event":46,"../../utils/url":52,"debug":void 0,"events":3,"inherits":54}],35:[function(e,t,n){"use strict";var r=e("inherits"),o=e("../driver/xhr");function i(e,t,n,r){o.call(this,e,t,n,r)}r(i,o),i.enabled=o.enabled&&o.supportsCORS,t.exports=i},{"../driver/xhr":17,"inherits":54}],36:[function(e,t,n){"use strict";var r=e("events").EventEmitter;function o(){var e=this;r.call(this),this.to=setTimeout(function(){e.emit("finish",200,"{}")},o.timeout)}e("inherits")(o,r),o.prototype.close=function(){clearTimeout(this.to)},o.timeout=2e3,t.exports=o},{"events":3,"inherits":54}],37:[function(e,t,n){"use strict";var r=e("inherits"),o=e("../driver/xhr");function i(e,t,n){o.call(this,e,t,n,{noCredentials:!0})}r(i,o),i.enabled=o.enabled,t.exports=i},{"../driver/xhr":17,"inherits":54}],38:[function(e,t,n){"use strict";var i=e("../utils/event"),s=e("../utils/url"),r=e("inherits"),a=e("events").EventEmitter,l=e("./driver/websocket"),c=function(){};function u(e,t,n){if(!u.enabled())throw new Error("Transport created when disabled");a.call(this),c("constructor",e);var r=this,o=s.addPath(e,"/websocket");o="https"===o.slice(0,5)?"wss"+o.slice(5):"ws"+o.slice(4),this.url=o,this.ws=new l(this.url,[],n),this.ws.onmessage=function(e){c("message event",e.data),r.emit("message",e.data)},this.unloadRef=i.unloadAdd(function(){c("unload"),r.ws.close()}),this.ws.onclose=function(e){c("close event",e.code,e.reason),r.emit("close",e.code,e.reason),r._cleanup()},this.ws.onerror=function(e){c("error event",e),r.emit("close",1006,"WebSocket connection broken"),r._cleanup()}}r(u,a),u.prototype.send=function(e){var t="["+e+"]";c("send",t),this.ws.send(t)},u.prototype.close=function(){c("close");var e=this.ws;this._cleanup(),e&&e.close()},u.prototype._cleanup=function(){c("_cleanup");var e=this.ws;e&&(e.onmessage=e.onclose=e.onerror=null),i.unloadDel(this.unloadRef),this.unloadRef=this.ws=null,this.removeAllListeners()},u.enabled=function(){return c("enabled"),!!l},u.transportName="websocket",u.roundTrips=2,t.exports=u},{"../utils/event":46,"../utils/url":52,"./driver/websocket":19,"debug":void 0,"events":3,"inherits":54}],39:[function(e,t,n){"use strict";var r=e("inherits"),o=e("./lib/ajax-based"),i=e("./xdr-streaming"),s=e("./receiver/xhr"),a=e("./sender/xdr");function l(e){if(!a.enabled)throw new Error("Transport created when disabled");o.call(this,e,"/xhr",s,a)}r(l,o),l.enabled=i.enabled,l.transportName="xdr-polling",l.roundTrips=2,t.exports=l},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,"./xdr-streaming":40,"inherits":54}],40:[function(e,t,n){"use strict";var r=e("inherits"),o=e("./lib/ajax-based"),i=e("./receiver/xhr"),s=e("./sender/xdr");function a(e){if(!s.enabled)throw new Error("Transport created when disabled");o.call(this,e,"/xhr_streaming",i,s)}r(a,o),a.enabled=function(e){return!e.cookie_needed&&!e.nullOrigin&&(s.enabled&&e.sameScheme)},a.transportName="xdr-streaming",a.roundTrips=2,t.exports=a},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,"inherits":54}],41:[function(e,t,n){"use strict";var r=e("inherits"),o=e("./lib/ajax-based"),i=e("./receiver/xhr"),s=e("./sender/xhr-cors"),a=e("./sender/xhr-local");function l(e){if(!a.enabled&&!s.enabled)throw new Error("Transport created when disabled");o.call(this,e,"/xhr",i,s)}r(l,o),l.enabled=function(e){return!e.nullOrigin&&(!(!a.enabled||!e.sameOrigin)||s.enabled)},l.transportName="xhr-polling",l.roundTrips=2,t.exports=l},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,"inherits":54}],42:[function(l,c,e){(function(e){"use strict";var t=l("inherits"),n=l("./lib/ajax-based"),r=l("./receiver/xhr"),o=l("./sender/xhr-cors"),i=l("./sender/xhr-local"),s=l("../utils/browser");function a(e){if(!i.enabled&&!o.enabled)throw new Error("Transport created when disabled");n.call(this,e,"/xhr_streaming",r,o)}t(a,n),a.enabled=function(e){return!e.nullOrigin&&(!s.isOpera()&&o.enabled)},a.transportName="xhr-streaming",a.roundTrips=2,a.needBody=!!e.document,c.exports=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/browser":44,"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,"inherits":54}],43:[function(e,t,n){(function(n){"use strict";n.crypto&&n.crypto.getRandomValues?t.exports.randomBytes=function(e){var t=new Uint8Array(e);return n.crypto.getRandomValues(t),t}:t.exports.randomBytes=function(e){for(var t=new Array(e),n=0;n