From 2a98c69cf8899afb9a76d737527abb1dd96fa106 Mon Sep 17 00:00:00 2001 From: Remigijus Kiminas Date: Wed, 15 Dec 2021 14:43:08 +0200 Subject: [PATCH] CSRF minor fixes (#1726) * CSRF minor fixes --- .../54bcce5942dd8e6e1e1e0c29802cfbef.js | 2 +- .../54bcce5942dd8e6e1e1e0c29802cfbef.js.map | 2 +- .../7eb59706c7a02fa801134f7307266524.js | 2 +- .../7eb59706c7a02fa801134f7307266524.js.map | 2 +- .../d2012e174bb7dc98cdfd4c4a1a12008c.js | 2 +- .../d2012e174bb7dc98cdfd4c4a1a12008c.js.map | 2 +- lhc_web/design/defaulttheme/js/lh.js | 22 ++++--- lhc_web/design/defaulttheme/js/lh.min.js | 2 +- .../js/widgetv2/1.76e60b1aab09f2ea2bea.ie.js | 9 --- .../widgetv2/1.76e60b1aab09f2ea2bea.ie.js.map | 1 - .../js/widgetv2/2.90658096bc82c95d6b4b.ie.js | 2 - .../widgetv2/2.90658096bc82c95d6b4b.ie.js.map | 1 - .../js/widgetv2/3.ebd2630847bc8173025f.ie.js | 2 - .../widgetv2/3.ebd2630847bc8173025f.ie.js.map | 1 - .../js/widgetv2/4.80f011fffa0f91545942.ie.js | 2 - .../widgetv2/4.80f011fffa0f91545942.ie.js.map | 1 - .../js/widgetv2/5.1bd04e3cb154d7fc49cd.ie.js | 2 - .../widgetv2/5.1bd04e3cb154d7fc49cd.ie.js.map | 1 - .../js/widgetv2/6.5e9f23d9c05330e9214e.ie.js | 2 - .../widgetv2/6.5e9f23d9c05330e9214e.ie.js.map | 1 - .../js/widgetv2/7.24e095ac1eddde957959.ie.js | 2 - .../widgetv2/7.24e095ac1eddde957959.ie.js.map | 1 - .../defaulttheme/js/widgetv2/react.app.ie.js | 66 ------------------- .../js/widgetv2/react.app.ie.js.map | 1 - .../defaulttheme/js/widgetv2/vendor.ie.js | 0 .../lhchat/lists/open_active_chat_tab.tpl.php | 8 +-- .../tpl/lhuser/setopstatus.tpl.php | 2 + .../tpl/pagelayouts/parts/user_box.tpl.php | 12 ++-- lhc_web/modules/lhchat/dashboardwidgets.php | 6 ++ lhc_web/modules/lhfront/module.php | 6 +- lhc_web/modules/lhfront/settings.php | 11 ++++ lhc_web/modules/lhfront/switchdashboard.php | 5 ++ lhc_web/modules/lhuser/module.php | 7 +- lhc_web/modules/lhuser/setalwaysonline.php | 4 ++ lhc_web/modules/lhuser/setinactive.php | 5 ++ lhc_web/modules/lhuser/setinvisible.php | 5 ++ lhc_web/modules/lhuser/setoffline.php | 5 ++ lhc_web/modules/lhuser/setopstatus.php | 5 ++ lhc_web/modules/lhuser/setsetting.php | 5 ++ lhc_web/modules/lhuser/setsettingajax.php | 9 ++- lhc_web/modules/lhuser/setsettingajaxraw.php | 11 ++-- 41 files changed, 102 insertions(+), 135 deletions(-) delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/1.76e60b1aab09f2ea2bea.ie.js delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/1.76e60b1aab09f2ea2bea.ie.js.map delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/2.90658096bc82c95d6b4b.ie.js delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/2.90658096bc82c95d6b4b.ie.js.map delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/3.ebd2630847bc8173025f.ie.js delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/3.ebd2630847bc8173025f.ie.js.map delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/4.80f011fffa0f91545942.ie.js delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/4.80f011fffa0f91545942.ie.js.map delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/5.1bd04e3cb154d7fc49cd.ie.js delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/5.1bd04e3cb154d7fc49cd.ie.js.map delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/6.5e9f23d9c05330e9214e.ie.js delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/6.5e9f23d9c05330e9214e.ie.js.map delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/7.24e095ac1eddde957959.ie.js delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/7.24e095ac1eddde957959.ie.js.map delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/react.app.ie.js delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/react.app.ie.js.map delete mode 100644 lhc_web/design/defaulttheme/js/widgetv2/vendor.ie.js diff --git a/lhc_web/design/defaulttheme/js/js_static/54bcce5942dd8e6e1e1e0c29802cfbef.js b/lhc_web/design/defaulttheme/js/js_static/54bcce5942dd8e6e1e1e0c29802cfbef.js index b37a127f92..45ec4c3dd9 100644 --- a/lhc_web/design/defaulttheme/js/js_static/54bcce5942dd8e6e1e1e0c29802cfbef.js +++ b/lhc_web/design/defaulttheme/js/js_static/54bcce5942dd8e6e1e1e0c29802cfbef.js @@ -1,2 +1,2 @@ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,(function(e,t){"use strict";var n=[],i=Object.getPrototypeOf,a=n.slice,s=n.flat?function(e){return n.flat.call(e)}:function(e){return n.concat.apply([],e)},o=n.push,r=n.indexOf,l={},c=l.toString,d=l.hasOwnProperty,u=d.toString,h=u.call(Object),p={},f=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},m=function(e){return null!=e&&e===e.window},g=e.document,v={type:!0,src:!0,nonce:!0,noModule:!0};function y(e,t,n){var i,a,s=(n=n||g).createElement("script");if(s.text=e,t)for(i in v)(a=t[i]||t.getAttribute&&t.getAttribute(i))&&s.setAttribute(i,a);n.head.appendChild(s).parentNode.removeChild(s)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.5.1",C=function(e,t){return new C.fn.init(e,t)};function x(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!f(e)&&!m(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+O+")"+O+"*"),J=new RegExp(O+"|>"),z=new RegExp(W),V=new RegExp("^"+R+"$"),Q={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+q),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),bool:new RegExp("^(?:"+j+")$","i"),needsContext:new RegExp("^"+O+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)","i")},G=/HTML$/i,X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+O+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},ie=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ae=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},se=function(){h()},oe=be((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{H.apply(L=N.call(C.childNodes),C.childNodes),L[C.childNodes.length].nodeType}catch(t){H={apply:L.length?function(e,t){E.apply(e,N.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}function re(e,t,i,a){var s,r,c,d,u,f,v,y=t&&t.ownerDocument,C=t?t.nodeType:9;if(i=i||[],"string"!=typeof e||!e||1!==C&&9!==C&&11!==C)return i;if(!a&&(h(t),t=t||p,m)){if(11!==C&&(u=Z.exec(e)))if(s=u[1]){if(9===C){if(!(c=t.getElementById(s)))return i;if(c.id===s)return i.push(c),i}else if(y&&(c=y.getElementById(s))&&w(t,c)&&c.id===s)return i.push(c),i}else{if(u[2])return H.apply(i,t.getElementsByTagName(e)),i;if((s=u[3])&&n.getElementsByClassName&&t.getElementsByClassName)return H.apply(i,t.getElementsByClassName(s)),i}if(n.qsa&&!k[e+" "]&&(!g||!g.test(e))&&(1!==C||"object"!==t.nodeName.toLowerCase())){if(v=e,y=t,1===C&&(J.test(e)||U.test(e))){for((y=ee.test(e)&&ve(t.parentNode)||t)===t&&n.scope||((d=t.getAttribute("id"))?d=d.replace(ie,ae):t.setAttribute("id",d=b)),r=(f=o(e)).length;r--;)f[r]=(d?"#"+d:":scope")+" "+we(f[r]);v=f.join(",")}try{return H.apply(i,y.querySelectorAll(v)),i}catch(t){k(e,!0)}finally{d===b&&t.removeAttribute("id")}}}return l(e.replace(B,"$1"),t,i,a)}function le(){var e=[];return function t(n,a){return e.push(n+" ")>i.cacheLength&&delete t[e.shift()],t[n+" "]=a}}function ce(e){return e[b]=!0,e}function de(e){var t=p.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ue(e,t){for(var n=e.split("|"),a=n.length;a--;)i.attrHandle[n[a]]=t}function he(e,t){var n=t&&e,i=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function pe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function fe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function me(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&oe(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function ge(e){return ce((function(t){return t=+t,ce((function(n,i){for(var a,s=e([],n.length,t),o=s.length;o--;)n[a=s[o]]&&(n[a]=!(i[a]=n[a]))}))}))}function ve(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in n=re.support={},s=re.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!G.test(t||n&&n.nodeName||"HTML")},h=re.setDocument=function(e){var t,a,o=e?e.ownerDocument||e:C;return o!=p&&9===o.nodeType&&o.documentElement&&(f=(p=o).documentElement,m=!s(p),C!=p&&(a=p.defaultView)&&a.top!==a&&(a.addEventListener?a.addEventListener("unload",se,!1):a.attachEvent&&a.attachEvent("onunload",se)),n.scope=de((function(e){return f.appendChild(e).appendChild(p.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),n.attributes=de((function(e){return e.className="i",!e.getAttribute("className")})),n.getElementsByTagName=de((function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length})),n.getElementsByClassName=K.test(p.getElementsByClassName),n.getById=de((function(e){return f.appendChild(e).id=b,!p.getElementsByName||!p.getElementsByName(b).length})),n.getById?(i.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},i.find.ID=function(e,t){if(void 0!==t.getElementById&&m){var n=t.getElementById(e);return n?[n]:[]}}):(i.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},i.find.ID=function(e,t){if(void 0!==t.getElementById&&m){var n,i,a,s=t.getElementById(e);if(s){if((n=s.getAttributeNode("id"))&&n.value===e)return[s];for(a=t.getElementsByName(e),i=0;s=a[i++];)if((n=s.getAttributeNode("id"))&&n.value===e)return[s]}return[]}}),i.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,i=[],a=0,s=t.getElementsByTagName(e);if("*"===e){for(;n=s[a++];)1===n.nodeType&&i.push(n);return i}return s},i.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&m)return t.getElementsByClassName(e)},v=[],g=[],(n.qsa=K.test(p.querySelectorAll))&&(de((function(e){var t;f.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]="+O+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||g.push("\\["+O+"*(?:value|"+j+")"),e.querySelectorAll("[id~="+b+"-]").length||g.push("~="),(t=p.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||g.push("\\["+O+"*name"+O+"*="+O+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||g.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||g.push(".#.+[+~]"),e.querySelectorAll("\\\f"),g.push("[\\r\\n\\f]")})),de((function(e){e.innerHTML="";var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&g.push("name"+O+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&g.push(":enabled",":disabled"),f.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")}))),(n.matchesSelector=K.test(y=f.matches||f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&de((function(e){n.disconnectedMatch=y.call(e,"*"),y.call(e,"[s!='']:x"),v.push("!=",W)})),g=g.length&&new RegExp(g.join("|")),v=v.length&&new RegExp(v.join("|")),t=K.test(f.compareDocumentPosition),w=t||K.test(f.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},M=t?function(e,t){if(e===t)return u=!0,0;var i=!e.compareDocumentPosition-!t.compareDocumentPosition;return i||(1&(i=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===i?e==p||e.ownerDocument==C&&w(C,e)?-1:t==p||t.ownerDocument==C&&w(C,t)?1:d?I(d,e)-I(d,t):0:4&i?-1:1)}:function(e,t){if(e===t)return u=!0,0;var n,i=0,a=e.parentNode,s=t.parentNode,o=[e],r=[t];if(!a||!s)return e==p?-1:t==p?1:a?-1:s?1:d?I(d,e)-I(d,t):0;if(a===s)return he(e,t);for(n=e;n=n.parentNode;)o.unshift(n);for(n=t;n=n.parentNode;)r.unshift(n);for(;o[i]===r[i];)i++;return i?he(o[i],r[i]):o[i]==C?-1:r[i]==C?1:0}),p},re.matches=function(e,t){return re(e,null,null,t)},re.matchesSelector=function(e,t){if(h(e),n.matchesSelector&&m&&!k[t+" "]&&(!v||!v.test(t))&&(!g||!g.test(t)))try{var i=y.call(e,t);if(i||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(e){k(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||re.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&re.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&z.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&T(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(i){var a=re.attr(i,e);return null==a?"!="===t:!t||(a+="","="===t?a===n:"!="===t?a!==n:"^="===t?n&&0===a.indexOf(n):"*="===t?n&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,t,n){return f(t)?C.grep(e,(function(e,i){return!!t.call(e,i,e)!==n})):t.nodeType?C.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?C.grep(e,(function(e){return-1)[^>]*|#([\w-]+))$/;(C.fn.init=function(e,t,n){var i,a;if(!e)return this;if(n=n||L,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:A.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof C?t[0]:t,C.merge(this,C.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:g,!0)),M.test(i[1])&&C.isPlainObject(t))for(i in t)f(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(a=g.getElementById(i[2]))&&(this[0]=a,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):f(e)?void 0!==n.ready?n.ready(e):e(C):C.makeArray(e,this)}).prototype=C.fn,L=C(g);var E=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function N(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}C.fn.extend({has:function(e){var t=C(e,this),n=t.length;return this.filter((function(){for(var e=0;e\x20\t\r\n\f]*)/i,fe=/^$|^module$|\/(?:java|ecma)script/i;de=g.createDocumentFragment().appendChild(g.createElement("div")),(ue=g.createElement("input")).setAttribute("type","radio"),ue.setAttribute("checked","checked"),ue.setAttribute("name","t"),de.appendChild(ue),p.checkClone=de.cloneNode(!0).cloneNode(!0).lastChild.checked,de.innerHTML="",p.noCloneChecked=!!de.cloneNode(!0).lastChild.defaultValue,de.innerHTML="",p.option=!!de.lastChild;var me={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ge(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&k(e,t)?C.merge([e],n):n}function ve(e,t){for(var n=0,i=e.length;n",""]);var ye=/<|&#?\w+;/;function we(e,t,n,i,a){for(var s,o,r,l,c,d,u=t.createDocumentFragment(),h=[],p=0,f=e.length;p\s*$/g;function Ae(e,t){return k(e,"table")&&k(11!==t.nodeType?t:t.firstChild,"tr")&&C(e).children("tbody")[0]||e}function Ee(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Ne(e,t){var n,i,a,s,o,r;if(1===t.nodeType){if(G.hasData(e)&&(r=G.get(e).events))for(a in G.remove(t,"handle events"),r)for(n=0,i=r[a].length;n").attr(e.scriptAttrs||{}).prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&a("error"===e.type?404:200,e.type)}),g.head.appendChild(t[0])},abort:function(){n&&n()}}}));var Jt,zt=[],Vt=/(=)\?(?=&|$)|\?\?/;C.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||C.expando+"_"+_t.guid++;return this[e]=!0,e}}),C.ajaxPrefilter("json jsonp",(function(t,n,i){var a,s,o,r=!1!==t.jsonp&&(Vt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(t.data)&&"data");if(r||"jsonp"===t.dataTypes[0])return a=t.jsonpCallback=f(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,r?t[r]=t[r].replace(Vt,"$1"+a):!1!==t.jsonp&&(t.url+=(Tt.test(t.url)?"&":"?")+t.jsonp+"="+a),t.converters["script json"]=function(){return o||C.error(a+" was not called"),o[0]},t.dataTypes[0]="json",s=e[a],e[a]=function(){o=arguments},i.always((function(){void 0===s?C(e).removeProp(a):e[a]=s,t[a]&&(t.jsonpCallback=n.jsonpCallback,zt.push(a)),o&&f(s)&&s(o[0]),o=s=void 0})),"script"})),p.createHTMLDocument=((Jt=g.implementation.createHTMLDocument("").body).innerHTML="
",2===Jt.childNodes.length),C.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(p.createHTMLDocument?((i=(t=g.implementation.createHTMLDocument("")).createElement("base")).href=g.location.href,t.head.appendChild(i)):t=g),s=!n&&[],(a=M.exec(e))?[t.createElement(a[1])]:(a=we([e],t,s),s&&s.length&&C(s).remove(),C.merge([],a.childNodes)));var i,a,s},C.fn.load=function(e,t,n){var i,a,s,o=this,r=e.indexOf(" ");return-1").append(C.parseHTML(e)).find(i):e)})).always(n&&function(e,t){o.each((function(){n.apply(this,s||[e.responseText,t,e])}))}),this},C.expr.pseudos.animated=function(e){return C.grep(C.timers,(function(t){return e===t.elem})).length},C.offset={setOffset:function(e,t,n){var i,a,s,o,r,l,c=C.css(e,"position"),d=C(e),u={};"static"===c&&(e.style.position="relative"),r=d.offset(),s=C.css(e,"top"),l=C.css(e,"left"),("absolute"===c||"fixed"===c)&&-1<(s+l).indexOf("auto")?(o=(i=d.position()).top,a=i.left):(o=parseFloat(s)||0,a=parseFloat(l)||0),f(t)&&(t=t.call(e,n,C.extend({},r))),null!=t.top&&(u.top=t.top-r.top+o),null!=t.left&&(u.left=t.left-r.left+a),"using"in t?t.using.call(e,u):("number"==typeof u.top&&(u.top+="px"),"number"==typeof u.left&&(u.left+="px"),d.css(u))}},C.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each((function(t){C.offset.setOffset(this,e,t)}));var t,n,i=this[0];return i?i.getClientRects().length?(t=i.getBoundingClientRect(),n=i.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,i=this[0],a={top:0,left:0};if("fixed"===C.css(i,"position"))t=i.getBoundingClientRect();else{for(t=this.offset(),n=i.ownerDocument,e=i.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===C.css(e,"position");)e=e.parentNode;e&&e!==i&&1===e.nodeType&&((a=C(e).offset()).top+=C.css(e,"borderTopWidth",!0),a.left+=C.css(e,"borderLeftWidth",!0))}return{top:t.top-a.top-C.css(i,"marginTop",!0),left:t.left-a.left-C.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent;e&&"static"===C.css(e,"position");)e=e.offsetParent;return e||ie}))}}),C.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(e,t){var n="pageYOffset"===t;C.fn[e]=function(i){return B(this,(function(e,i,a){var s;if(m(e)?s=e:9===e.nodeType&&(s=e.defaultView),void 0===a)return s?s[t]:e[i];s?s.scrollTo(n?s.pageXOffset:a,n?a:s.pageYOffset):e[i]=a}),e,i,arguments.length)}})),C.each(["top","left"],(function(e,t){C.cssHooks[t]=Be(p.pixelPosition,(function(e,n){if(n)return n=Pe(e,t),Oe.test(n)?C(e).position()[t]+"px":n}))})),C.each({Height:"height",Width:"width"},(function(e,t){C.each({padding:"inner"+e,content:t,"":"outer"+e},(function(n,i){C.fn[i]=function(a,s){var o=arguments.length&&(n||"boolean"!=typeof a),r=n||(!0===a||!0===s?"margin":"border");return B(this,(function(t,n,a){var s;return m(t)?0===i.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(s=t.documentElement,Math.max(t.body["scroll"+e],s["scroll"+e],t.body["offset"+e],s["offset"+e],s["client"+e])):void 0===a?C.css(t,n,r):C.style(t,n,a,r)}),t,o?a:void 0,o)}}))})),C.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(e,t){C.fn[t]=function(e){return this.on(t,e)}})),C.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,i){return this.on(t,e,n,i)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),C.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),(function(e,t){C.fn[t]=function(e,n){return 0
',content:function(){return''+confLH.transLation.quote+""+(a?'
edit'+confLH.transLation.edit+"":"")+'
supervisor_account'+confLH.transLation.ask_help+""+(n?'
content_copy'+confLH.transLation.copy+" (Ctrl+C)":"")+(n?"":'
content_copy'+confLH.transLation.copy+' (Ctrl+C)
content_copy'+confLH.transLation.copy_group+"")+(n?"":'
language'+confLH.transLation.translate+"")}},o=$("#messagesBlock-"+e.data.chat_id+" > #msg-"+i+" > .msg-body");if(0==o.length)return;return ee.emitEvent("quoteActionRight",[s,e.data.chat_id,i]),o.popover(s).popover("show").addClass("popover-copy"),$("#copy-popover-"+e.data.chat_id).click((function(t){t.stopPropagation(),t.preventDefault(),$.getJSON(e.data.that.wwwDir+"chat/quotemessage/"+i,(function(t){t.msg&&e.data.that.insertTextToMessageArea(e.data.chat_id,t.msg),e.data.that.hidePopover()}))})),$("#ask-help-popover-"+e.data.chat_id).click((function(t){t.stopPropagation(),t.preventDefault(),$.getJSON(e.data.that.wwwDir+"chat/quotemessage/"+i,(function(t){$("#private-chat-tab-link-"+e.data.chat_id).attr("private-loaded")?($("#private-chat-tab-link-"+e.data.chat_id).attr("private-loaded",!0).click(),ee.emitEvent("groupChatPrefillMessage",[e.data.chat_id,t.msg])):($("#private-chat-tab-link-"+e.data.chat_id).attr("private-loaded",!0).click(),ee.emitEvent("privateChatStart",[e.data.chat_id,{default_message:t.msg}])),e.data.that.hidePopover()}))})),!n&&$("#translate-msg-"+e.data.chat_id).click((function(t){t.stopPropagation(),t.preventDefault(),lhc.methodCall("lhc.translation","translateMessageVisitor",{msg_id:i,chat_id:e.data.chat_id}),e.data.that.hidePopover()})),!n&&$("#copy-all-text-popover-"+e.data.chat_id).click((function(t){t.stopPropagation(),t.preventDefault(),$.getJSON(e.data.that.wwwDir+"chat/quotemessage/"+i,(function(t){var n=$("#CSChatMessage-"+e.data.chat_id),i=n.val();n.val(t.msg),n.select(),document.execCommand("copy"),n.val(i),e.data.that.hidePopover()}))})),!n&&$("#copy-group-text-popover-"+e.data.chat_id).click((function(t){t.stopPropagation(),t.preventDefault(),$.getJSON(e.data.that.wwwDir+"chat/quotemessage/"+i+"/(type)/group",(function(t){var n=$("#CSChatMessage-"+e.data.chat_id),i=n.val();n.val(t.msg),n.select(),document.execCommand("copy"),n.val(i),e.data.that.hidePopover()}))})),a&&$("#edit-popover-"+e.data.chat_id).click((function(t){t.stopPropagation(),t.preventDefault(),$.getJSON(e.data.that.wwwDir+"chat/editprevious/"+e.data.chat_id+"/"+i,(function(t){if("f"==t.error){var n=$("#CSChatMessage-"+e.data.chat_id);n.val(t.msg).attr("data-msgid",t.id).addClass("edit-mode"),$("#msg-"+t.id).addClass("edit-mode"),n.focus()}else alert(t.error)})),e.data.that.hidePopover()})),n&&$("#copy-text-popover-"+e.data.chat_id).click((function(t){t.stopPropagation(),t.preventDefault();var n=e.data.that.getSelectedTextPlain(),i=$("#CSChatMessage-"+e.data.chat_id),a=i.val();i.val(n),i.select(),document.execCommand("copy"),i.val(a),e.data.that.hidePopover()})),e.data.that.popoverShown=!0,e.data.that.popoverShownNow=!1,!1}},this.insertTextToMessageArea=function(e,t){var n=$("#CSChatMessage-"+e),i=n.val().replace(/^\s*\n/g,"");n.val((""!=i?i+"[quote]"+t+"[/quote]":"[quote]"+t+"[/quote]")+"\n").focus();var a=n[0];for(a.clientHeight,a.rows;a.scrollHeight>a.clientHeight&&!window.opera&&a.rows<30;)a.style.overflow="hidden",a.rows+=1;a.scrollHeight>a.clientHeight&&(a.style.overflow="auto")},this.mouseClicked=function(e){if(selected=e.data.that.getSelectedText(),$(".popover-copy").popover("dispose"),!selected.text.length||null!==e.data.that.selection&&e.data.that.selection.text===selected.text)e.data.that.selection=null;else{e.data.that.selection=selected;var t={placement:"right",trigger:"manual",animation:!1,html:!0,container:"#chat-id-"+e.data.chat_id,template:'',content:function(){return''+confLH.transLation.quote+""}},n=void 0!==$(this).attr("id")?"#messagesBlock-"+e.data.chat_id+" > #msg-"+$(this).attr("id").replace("msg-","")+" > .msg-body":this,i=$(n);if(0==i.length)return;ee.emitEvent("quoteAction",[t,e.data.chat_id]),i.popover(t).popover("show").addClass("popover-copy"),$("#copy-popover-"+e.data.chat_id).click((function(){lhinst.quateSelection(e.data.chat_id)})),e.data.that.popoverShown=!0,e.data.that.popoverShownNow=!0}},this.addQuateHandler=function(e){this.popoverShown=!1,$("#messagesBlock-"+e+" > .message-row:not([qt])").on("mouseup",{chat_id:e,that:this},lhinst.mouseClicked).on("contextmenu",{chat_id:e,that:this},lhinst.mouseContextMenu).attr("qt",1)},this.getSelectedTextPlain=function(){var e=this.selection.text.replace(/[\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA]/g,"");return e=(e=(e=(e=e.replace(/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.*)/gm,"")).replace(/^[0-9]{2}:[0-9]{2}:[0-9]{2}(.*)/gm,"")).replace(/^\s*\n/gm,"")).replace(/^ /gm,"")},this.quateSelection=function(e){$(".popover-copy").popover("dispose");var t=this.getSelectedTextPlain();window.textreplace=t,this.insertTextToMessageArea(e,t),this.popoverShown=!1},this.hidePopover=function(){!0===this.popoverShownNow?this.popoverShownNow=!1:!0===this.popoverShown&&(this.popoverShown=!1,$(".popover-copy").popover("dispose"))},this.addTab=function(e,t,n,i,a,s){if(!(e.find("#chat-tab-link-"+i).length>0)){var o=confLH.new_dashboard&&confLH.hide_tabs&&null!==document.getElementById("tabs-dashboard")?" d-none":"",r='';void 0===s||0==parseInt(s)?e.find("> ul").append(r):e.find("> ul > li:eq("+(s-1)+")").after(r),$("#chat-tab-link-"+i).click((function(){lhinst.previous_chat_id>0&&$("#unread-separator-"+lhinst.previous_chat_id).remove(),lhinst.previous_chat_id=i,setTimeout((function(){$("#CSChatMessage-"+i).focus()}),2);var e=$(this);setTimeout((function(){e.find(".msg-nm").remove();var t=!1;e.hasClass("has-pm")&&(t=!0,e.removeClass("has-pm")),1==t&&$("#messagesBlock-"+i).prop("scrollTop",$("#messagesBlock-"+i).prop("scrollHeight"))}),500),ee.emitEvent("chatTabClicked",[i,e])}));var l=window.location.hash.replace("#/","#"),c=this;$.get(t,(function(t){""!=t?(void 0===a||!0===a||l=="#chat-id-"+i?(e.find("> ul > li > a.active").removeClass("active"),e.find("> ul > #chat-tab-li-"+i+" > a").addClass("active"),e.find("> div.tab-content > div.active").removeClass("active"),e.find("> div.tab-content").append('
'),window.location.hash="#/chat-id-"+i):e.find("> div.tab-content").append('
'),$("#chat-id-"+i).html(t),$("#CSChatMessage-"+i).focus(),0==c.disableremember&&c.rememberTab(i),c.addQuateHandler(i),c.loadMainData(i),ee.emitEvent("chatTabLoaded",[i])):c.removeDialogTab(i,e,!0)}))}},this.rememberTab=function(e){if(localStorage)try{e=parseInt(e);var t=localStorage.getItem("achat_id"),n=new Array;if(null!==t)n=t.split(",").map(Number);-1===n.indexOf(e)&&n.push(e),localStorage.setItem("achat_id",n.join(","))}catch(e){console.log(e)}},this.forgetChat=function(e,t){if(localStorage)try{e=parseInt(e);var n=localStorage.getItem(t),i=new Array;null!==n&&(i=n.split(",").map(Number)),-1!==i.indexOf(e)&&i.splice(i.indexOf(e),1),localStorage.setItem(t,i.join(","))}catch(e){console.log(e)}},this.attachTabNavigator=function(){$("#tabs > ul.nav > li > a").click((function(){$(this).find(".msg-nm").remove(),$(this).removeClass("has-pm")}))},this.holdAction=function(e,t){if(!$("#CSChatMessage-"+e).is("[readonly]")){var n=this;$.postJSON(this.wwwDir+"chat/holdaction/"+e,(function(i){0==i.error?(1==i.hold?t.addClass("btn-outline-info"):t.removeClass("btn-outline-info"),""!=i.msg&&$("#messagesBlock-"+e).append(i.msg).scrollTop($("#messagesBlock-"+e).prop("scrollHeight")),n.syncadmincall()):alert(i.msg)}))}},this.copyContent=function(e){var t,n=document.createElement("textarea");n.value=e.attr("data-copy"),n.style.top="0",n.style.left="0",n.style.position="fixed",document.body.appendChild(n),n.focus(),n.select();try{document.execCommand("copy")}catch(e){alert("Oops, unable to copy")}document.body.removeChild(n),e.tooltip({trigger:"click",placement:"top"}),t=e.attr("data-success"),e.tooltip("hide").attr("data-original-title",t).tooltip("show"),setTimeout((function(){e.tooltip("hide")}),1e3)},this.copyMessages=function(e){var t;return $("#chat-copy-messages").select(),document.execCommand("copy"),e.tooltip({trigger:"click",placement:"top"}),t=e.attr("data-success"),e.tooltip("hide").attr("data-original-title",t).tooltip("show"),setTimeout((function(){e.tooltip("hide")}),3e3),!1},this.removeDialogTabGroup=function(e,t){ee.emitEvent("unloadGroupChat",[e]);this.smartTabFocus(t,e)},this.addGroupTab=function(e,t,n,i){if(e.find("#chat-tab-link-"+n).length>0)return e.find("> ul > li > a.active").removeClass("active"),e.find("> ul > li#chat-tab-li-"+n+" > a").addClass("active"),e.find("> div.tab-content > div.active").removeClass("active"),e.find("> div.tab-content > #chat-id-"+n).addClass("active"),void ee.emitEvent("groupChatTabClicked",[n]);var a='";e.find("> ul").append(a);window.location.hash.replace("#/","#");!0!==i?(e.find("> ul > li > a.active").removeClass("active"),e.find("> ul > #chat-tab-li-"+n+" > a").addClass("active"),e.find("> div.tab-content > div.active").removeClass("active"),e.find("> div.tab-content").append('
')):e.find("> div.tab-content").append('
'),ee.emitEvent("groupChatTabLoaded",[n]),$("#chat-tab-link-"+n).click((function(){ee.emitEvent("groupChatTabClicked",[n.replace("gc","")])}))},this.startGroupChat=function(e,t,n,i){this.addGroupTab(t,n,"gc"+e,i)},this.hideShowAction=function(e){var t=$("#messagesBlock-"+e.chat_id),n=t.prop("scrollTop")+t.height()+30>t.prop("scrollHeight"),i=$("#message-more-"+e.id);i.hasClass("hide")?(i.removeClass("hide"),0==e.hide_show?$("#hide-show-action-"+e.id).remove():$("#hide-show-action-"+e.id).text(e.hide_text)):(i.addClass("hide"),1==e.hide_show&&$("#hide-show-action-"+e.id).text(e.show_text)),n&&t.scrollTop(t.prop("scrollHeight"))},this.buttonAction=function(e,t){var n=e.closest(".message-row");$.getJSON(this.wwwDir+"chat/abstractclick/"+n.attr("id").replace("msg-","")+"/"+t,(function(e){if(e.error)alert(e.error);else if(e.replace_id&&e.html){var t=$("#messagesBlock-"+e.chat_id),n=t.prop("scrollTop")+t.height()+30>t.prop("scrollHeight");$(e.replace_id).replaceWith(e.html),lhinst.addQuateHandler(e.chat_id),n&&t.scrollTop(t.prop("scrollHeight"))}else e.modal&&lhc.revealModal({url:WWW_DIR_JAVASCRIPT+e.modal})}))},this.startChat=function(e,t,n,i,a){if(this.removeBackgroundChat(e),this.hideNotification(e),$("#sub-tabs").length>0&&$("#sub-tabs a[href='#sub-tabs-open']").tab("show"),0==this.chatUnderSynchronization(e)){var s=void 0===i||i,o=0==this.disableremember?"/(remember)/true":"";this.addTab(t,this.wwwDir+"chat/adminchat/"+e+o,n,e,s,a);var r=this;setTimeout((function(){r.syncadmininterfacestatic()}),1e3)}else t.find("> ul > li > a.active").removeClass("active"),t.find("> ul > li#chat-tab-li-"+e+" > a").addClass("active"),t.find("> div.tab-content > div.active").removeClass("active"),t.find("> div.tab-content > #chat-id-"+e).addClass("active"),window.location.hash="#/chat-id-"+e;ee.emitEvent("chatStartTab",[e,{name:n,focus:void 0===i||i,position:a}])},this.backgroundChats=[],this.startChatBackground=function(e,t,n,i){if(0==this.chatUnderSynchronization(e)){this.backgroundChats.push(parseInt(e));var a=0==this.disableremember?"/(remember)/true":"";return i||(i="background"),this.addTab(t,this.wwwDir+"chat/adminchat/"+e+a+"/(arg)/"+i,n,e,!1),ee.emitEvent("chatStartBackground",[e,{name:n}]),!0}return!1},this.protectCSFR=function(){$("a.csfr-required").click((function(){var e=$(this);e.attr("data-secured")||(e.attr("href",e.attr("href")+"/(csfr)/"+confLH.csrf_token),e.attr("data-secured",1))}))},this.setChatHash=function(e){this.hash=e},this.addSynchroChat=function(e,t){this.chatsSynchronising.push(e),this.chatsSynchronisingMsg.push(e+","+t),LHCCallbacks.addSynchroChat&&LHCCallbacks.addSynchroChat(e,t)},this.removeSynchroChat=function(e){for(var t=0;t0&&($("#lhc-send-icon").hide(),$("#lhc-mic-icon").show(),i=!0),jQuery("#CSChatMessage").bind("keyup",(function(a){try{sessionStorage&&sessionStorage.setItem("lhc_ttxt",$(this).val())}catch(e){}var s=$(this)[0];s.style.height="5px",1==i&&(""!=$(this).val()?($("#lhc-send-icon").show(),$("#lhc-mic-icon").hide(),$("#voice-control-message").hide()):($("#lhc-send-icon").hide(),$("#lhc-mic-icon").show()));var o=s.scrollHeight+3;if(o>48&&(o+=10,s.style.overflowY=o>90?"auto":"hidden"),s.style.height=o+"px",0==n.is_typing)clearTimeout(n.typing_timeout),LHCCallbacks.initTypingMonitoringUserInform?(n.typing_timeout=setTimeout((function(){ee.emitEvent("visitorTypingStopped",[{chat_id:e,hash:n.hash}])}),3e3),ee.emitEvent("visitorTyping",[{chat_id:e,hash:n.hash,status:!0,msg:$(this).val()}])):(n.is_typing=!0,$.postJSON(t+"chat/usertyping/"+e+"/"+n.hash+"/true",{msg:$(this).val()},(function(t){n.typing_timeout=setTimeout((function(){n.typingStoppedUser(e)}),3e3),LHCCallbacks.initTypingMonitoringUser&&ee.emitEvent("initVisitorTyping",[e,!0])})).fail((function(){n.typing_timeout=setTimeout((function(){n.typingStoppedUser(e)}),3e3)})));else{clearTimeout(n.typing_timeout),n.typing_timeout=setTimeout((function(){n.typingStoppedUser(e)}),3e3);var r=$(this).val();n.currentMessageText!=r&&Math.abs(n.currentMessageText.length-r.length)>6&&(n.currentMessageText=r,LHCCallbacks.initTypingMonitoringUserInform?ee.emitEvent("visitorTyping",[{chat_id:e,hash:n.hash,status:!0,msg:$(this).val()}]):$.postJSON(t+"chat/usertyping/"+e+"/"+n.hash+"/true",{msg:r},(function(t){LHCCallbacks.initTypingMonitoringUser&&ee.emitEvent("initVisitorTyping",[e,!0])})))}}))},this.typingStoppedUser=function(e){var t=this;1==t.is_typing&&(LHCCallbacks.typingStoppedUserInform?(t.is_typing=!1,ee.emitEvent("visitorTypingStopped",[{chat_id:e,hash:this.hash,status:!1}])):$.getJSON(this.wwwDir+"chat/usertyping/"+e+"/"+this.hash+"/false",{},(function(n){t.is_typing=!1,LHCCallbacks.initTypingMonitoringUser&&ee.emitEvent("initVisitorTyping",[e,!1])})).fail((function(){t.is_typing=!1})))},this.refreshFootPrint=function(e){e.addClass("disabled"),$.get(this.wwwDir+"chat/chatfootprint/"+e.attr("rel"),{},(function(t){$("#footprint-"+e.attr("rel")).html(t),e.removeClass("disabled")}))},this.makeAbstractRequest=function(e,t){return $.get(t.attr("href"),(function(t){lhinst.syncadmininterfacestatic(),LHCCallbacks.userRedirectedSurvey&&LHCCallbacks.userRedirectedSurvey(e)})),!1},this.refreshOnlineUserInfo=function(e){e.addClass("disabled"),$.get(this.wwwDir+"chat/refreshonlineinfo/"+e.attr("rel"),{},(function(t){$("#online-user-info-"+e.attr("rel")).html(t),e.removeClass("disabled")}))},this.processCollapse=function(e){if("chevron_right"==$("#chat-main-column-"+e+" .collapse-right").text()){$("#chat-right-column-"+e).hide(),$("#chat-main-column-"+e).removeClass("col-sm-7").addClass("col-sm-12"),$("#chat-main-column-"+e+" .collapse-right").text("chevron_left");try{localStorage&&localStorage.setItem("lhc_rch",1)}catch(e){}}else{$("#chat-right-column-"+e).show(),$("#chat-main-column-"+e).removeClass("col-sm-12").addClass("col-sm-7"),$("#chat-main-column-"+e+" .collapse-right").text("chevron_right");try{localStorage&&localStorage.removeItem("lhc_rch")}catch(e){}}},this.chatUnderSynchronization=function(e){for(var t=0;t0&&($("#msg-"+e.last_message_id).attr("data-op-id")==t.msop&&$("#msg-"+e.last_message_id+" > .usr-tit").text()===$("#msg-"+t.message_id+" > .usr-tit").text()||$("#msg-"+e.last_message_id).next().addClass("operator-changes")),e.last_message_id=t.message_id,"false"==t.uw&&e.isWidgetMode&&"undefined"!=typeof parent&&parent.postMessage("lhc_newopmsg","*")}else"true"!=t.status&&$("#status-chat").html(t.status);if(e.userTimeout=setTimeout(chatsyncuser,confLH.chat_message_sinterval),"t"==t.cs&&e.chatsyncuserpending(),""!=t.ott&&"f"!=t.ott){var s=$("#id-operator-typing");s.text(t.ott),s.css("visibility","visible"),e.operatorTyping=!0}else"f"==t.ott&&(e.operatorTyping=!1,$("#id-operator-typing").css("visibility","hidden"));""!=t.op&&e.executeRemoteCommands(t.op)}else $("#status-chat").html(t.status),$("#ChatMessageContainer").remove(),$("#ChatSendButtonContainer").remove(),$("#id-operator-typing").css("visibility","hidden"),e.operatorTyping=!1,void 0!==t.op&&""!=t.op&&e.executeRemoteCommands(t.op),t.closed&&1==t.closed&&(ee.emitEvent("chatClosedSyncUser",[e.chat_id]),e.isWidgetMode&&"undefined"!=typeof parent&&window.location!==window.parent.location?parent.postMessage("lhc_chat_closed"+(void 0!==t.closed_arg?":"+t.closed_arg:""),"*"):(void 0!==t.closed_arg&&e.parseCloseArgs(t.closed_arg.split(":")),e.chatClosed()))}catch(t){e.userTimeout=setTimeout(chatsyncuser,confLH.chat_message_sinterval)}e.syncroRequestSend=!1},this.parseCloseArgs=function(e){var t=e.length/2;for(i=0;i ul > #chat-tab-li-"+t).index();n||(n={});var a=1==n.up||void 0===n.up?1:-1;n.keep?e.find("> ul > li > a.active").removeClass("active"):(e.find("> ul > #chat-tab-li-"+t).remove(),e.find("#chat-id-"+t).remove());var s=e.find("> ul > li:eq("+(i-a)+")");if(void 0!==s.attr("id"))var o=s.find("> a");else if(linkTabRight=e.find("> ul > li:eq("+i+")"),linkTabRight.length>0)o=linkTabRight.find("> a");else o=s.find("> a");if(e.find("> ul > li > a.active").length)console.log("bbb");else{for(var r=!0;r;)if(o.hasClass("non-focus")){r=!0;var l=o.parent().prev();l.find(" > a").length&&(o=l.find(" > a"))}else r=!1;if(o.tab("show"),void 0!==o.attr("id")){var c=o.attr("href").replace("#chat-id-","");this.removeBackgroundChat(c),this.hideNotification(c),n.keep||ee.emitEvent("chatTabFocused",[c])}}return void 0!==o.attr("href")?o.attr("href").replace("#","#/"):"#"},this.startChatCloseTabNewWindow=function(e,t,n){return window.open(this.wwwDir+"chat/single/"+e,"chatwindow-chat-id-"+e,"menubar=1,resizable=1,width=800,height=650"),this.smartTabFocus(t,e),1==this.closeWindowOnChatCloseDelete&&window.close(),this.removeSynchroChat(e),this.syncadmininterfacestatic(),!1},this.removeDialogTab=function(e,t,n){if(0!=$("#CSChatMessage-"+e).length&&($("#CSChatMessage-"+e).unbind("keydown",(function(){})),$("#CSChatMessage-"+e).unbind("keyup",(function(){}))),this.removeSynchroChat(e),1==n){var i=this.smartTabFocus(t,e);setTimeout((function(){window.location.hash=i}),500),1==this.closeWindowOnChatCloseDelete&&window.close()}this.syncadmininterfacestatic()},this.removeActiveDialogTag=function(e){1==this.closeWindowOnChatCloseDelete&&window.close()},this.deleteChat=function(e,t,n){if(confirm(confLH.transLation.delete_confirm)){var i=this;$.postJSON(this.wwwDir+this.deletechatadmin+e,(function(a){if(1==a.error)alert(a.result);else{if(0!=$("#CSChatMessage-"+e).length&&($("#CSChatMessage-"+e).unbind("keydown",(function(){})),$("#CSChatMessage-"+e).unbind("keyup",(function(){}))),i.removeSynchroChat(e),1==n){var s=i.smartTabFocus(t,e);setTimeout((function(){window.location.hash=s}),500),1==i.closeWindowOnChatCloseDelete&&window.close()}LHCCallbacks.chatDeletedCallback&&LHCCallbacks.chatDeletedCallback(e),i.syncadmininterfacestatic()}})).fail((function(e,t,n){console.dir(e),alert("getJSON request failed! "+t+":"+n+":"+e.responseText)}))}},this.rejectPendingChat=function(e,t){var n=this;$.postJSON(this.wwwDir+this.deletechatadmin+e,{},(function(e){n.syncadmininterfacestatic()})).fail((function(e,t,n){console.dir(e),alert("getJSON request failed! "+t+":"+n+":"+e.responseText)}))},this.startChatNewWindow=function(e,t){var n=window.open(this.wwwDir+"chat/single/"+e,"chatwindow-chat-id-"+e,"menubar=1,resizable=1,width=800,height=650");if(null!==n){n.focus();var i=this;setTimeout((function(){i.syncadmininterfacestatic()}),1e3),ee.emitEvent("chatStartOpenWindow",[e])}},this.startChatNewWindowArchive=function(e,t,n){var i=window.open(this.wwwDir+"chatarchive/viewarchivedchat/"+e+"/"+t+"/(mode)/popup","chatwindow-chat-id-"+t,"menubar=1,resizable=1,width=800,height=650");null!==i&&(i.focus(),ee.emitEvent("chatStartOpenWindowArchive",[e,t]))},this.startCoBrowse=function(e){return popupWindow=window.open(this.wwwDir+"cobrowse/browse/"+e,"chatwindow-cobrowse-chat-id-"+e,"menubar=1,resizable=1,width=800,height=650"),null!==popupWindow&&popupWindow.focus(),!1},this.speechToText=function(e){0==this.speechHandler&&(this.speechHandler=new LHCSpeechToText),this.speechHandler.listen({chat_id:e})},this.startChatTransfer=function(e,t,n,i,a){var s=this;$.getJSON(this.wwwDir+this.accepttransfer+i,{},(function(i){0==$("#chat-tab-link-"+e).length?a?(s.removeSynchroChat(e),s.startChatBackground(e,t,n)):s.startChat(e,t,n):s.updateVoteStatus(e),LHCCallbacks.operatorAcceptedTransfer&&LHCCallbacks.operatorAcceptedTransfer(e)})).fail((function(){s.startChat(e,t,n)}))},this.startChatNewWindowTransfer=function(e,t,n){return $.getJSON(this.wwwDir+this.accepttransfer+n,{},(function(t){LHCCallbacks.operatorAcceptedTransfer&&LHCCallbacks.operatorAcceptedTransfer(e)})),this.startChatNewWindow(e,t)},this.startChatNewWindowTransferByTransfer=function(e,t,n){var i=this;return $.ajax({type:"GET",url:this.wwwDir+this.accepttransfer+e+"/(mode)/chat",cache:!1,dataType:"json"}).done((function(e){$("#tabs").length>0?void 0!==n&&!0===n?i.startChatBackground(e.chat_id,$("#tabs"),t):(window.focus(),i.startChat(e.chat_id,$("#tabs"),t)):i.startChatNewWindow(e.chat_id,""),LHCCallbacks.operatorAcceptedTransfer&&LHCCallbacks.operatorAcceptedTransfer(e.chat_id)})),this.syncadmininterfacestatic(),!1},this.switchLang=function(e,t){var n='';return e.append(n),e.submit(),!1},this.sendLinkToMail=function(e,t){var n=window.parent.$("#MailMessage").val();window.parent.$("#MailMessage").val((""!=n?n+"\n":n)+e),$("#embed-button-"+t).addClass("btn-success")},this.sendLinkToEditor=function(e,t,n){var i=window.parent.$("#CSChatMessage-"+e).val();window.parent.$("#CSChatMessage-"+e).val((""!=i?i+"\n":i)+t),$("#embed-button-"+n).addClass("btn-success")},this.sendLinkToGeneralEditor=function(e,t){var n=window.parent.$(".embed-into"),i=n.val();n.val((""!=i?i+"\n":i)+e),$("#embed-button-"+t).addClass("btn-success")},this.hideTransferModal=function(e){var t=this;setTimeout((function(){$("#myModal").modal("hide"),$("#tabs").length>0&&t.removeDialogTab(e,$("#tabs"),!0)}),1e3)},this.transferChat=function(e){var t=this,n=$("[name=TransferTo"+e+"]:checked").val();$.postJSON(this.wwwDir+this.trasnsferuser+e+"/"+n,{type:"user"},(function(n){"false"==n.error&&($("#transfer-block-"+n.chat_id).html(n.result),t.hideTransferModal(e))}))},this.changeOwner=function(e){var t=this,n=$("#id_new_user_id").val();$.postJSON(this.wwwDir+this.trasnsferuser+e+"/"+n,{type:"change_owner"},(function(n){"false"==n.error&&($("#transfer-block-"+n.chat_id).html(n.result),t.hideTransferModal(e))}))},this.changeDep=function(e){var t=this,n=$("#id_new_dep_id").val();$.postJSON(this.wwwDir+this.trasnsferuser+e+"/"+n,{type:"change_dep"},(function(n){"false"==n.error&&($("#transfer-block-"+n.chat_id).html(n.result),$("#myModal").modal("hide"),t.updateVoteStatus(e))}))},this.chooseSurvey=function(e){var t=$("[name=SurveyItem"+e+"]:checked").val();$.postJSON(this.wwwDir+"survey/choosesurvey/"+e+"/"+t,(function(e){"false"==e.error&&$("#survey-block-"+e.chat_id).html(e.result)}))},this.redirectContact=function(e,t){(void 0===t||confirm(t))&&$.postJSON(this.wwwDir+"chat/redirectcontact/"+e,(function(t){lhinst.syncadmininterfacestatic(),LHCCallbacks.userRedirectedContact&&LHCCallbacks.userRedirectedContact(e)}))},this.redirectToURL=function(e,t){var n=prompt(t,"");null!=n&&lhinst.addRemoteCommand(e,"lhc_chat_redirect:"+n.replace(new RegExp(":","g"),"__SPLIT__"))},this.redirectToURLOnline=function(e,t){var n=prompt(t,"");null!=n&&(lhinst.addRemoteOnlineCommand(e,"lhc_chat_redirect:"+n.replace(new RegExp(":","g"),"__SPLIT__")),lhinst.addExecutionCommand(e,"lhc_cobrowse_multi_command__lhc_chat_redirect:"+n.replace(new RegExp(":","g"),"__SPLIT__")))},this.transferChatDep=function(e){var t=this,n=$("[name=DepartamentID"+e+"]:checked").val();$.postJSON(this.wwwDir+this.trasnsferuser+e+"/"+n,{type:"dep"},(function(n){"false"==n.error&&($("#transfer-block-"+n.chat_id).html(n.result),t.hideTransferModal(e))}))},this.chatTabsOpen=function(){return window.open(this.wwwDir+"chat/chattabs/","chatwindows","menubar=1,resizable=1,width=800,height=650"),!1},this.userclosedchat=function(){LHCCallbacks.userleftchatNotification&&LHCCallbacks.userleftchatNotification(this.chat_id),$.ajax({type:"GET",url:this.wwwDir+this.userclosechaturl+this.chat_id+"/"+this.hash,cache:!1})},this.userclosedchatembed=function(){window.postMessage&&"undefined"!=typeof parent&&window.location!==window.parent.location?parent.postMessage("lhc_chat_closed_explicit","*"):0==this.chatClosed()&&window.close()},this.continueChatFromSurvey=function(e){return this.isWidgetMode&&"undefined"!=typeof parent&&window.location!==window.parent.location?$.postJSON(this.wwwDir+"survey/backtochat/"+this.chat_id+"/"+this.hash+"/"+e,(function(e){e.closed?lhinst.userclosedchatembed():parent.postMessage("lhc_continue_chat","*")})):this.chatClosed(),!1},this.explicitClose=!1,this.explicitChatCloseByUser=function(){return this.explicitClose=!0,ee.emitEvent("endedChat",[]),this.isWidgetMode&&"undefined"!=typeof parent&&window.location!==window.parent.location?parent.postMessage("lhc_chat_closed_explicit","*"):0==this.chatClosed()&&window.close(),!1},this.restoreWidget=function(e){window.postMessage&&window.opener&&(window.opener.postMessage("lhc_ch:hash:"+e,"*"),window.opener.postMessage("lhc_ch:hash_resume:"+e,"*"),window.opener.postMessage("lhc_open_restore","*"),window.close())},this.userclosedchatandbrowser=function(){LHCCallbacks.userleftchatNotification&&LHCCallbacks.userleftchatNotification(this.chat_id),$.get(this.wwwDir+this.userclosechaturl+this.chat_id+"/"+this.hash+"/(eclose)/t",(function(e){lhinst.closeWindow()}))},this.sendCannedMessage=function(e,t){if($("#id_CannedMessage-"+e).val()>0){t.addClass("secondary");var n=1e3*parseInt($("#id_CannedMessage-"+e).find(":selected").attr("data-delay")),i=this.wwwDir,a=this;if(0==a.is_typing?(a.is_typing=!0,clearTimeout(a.typing_timeout),LHCCallbacks.initTypingMonitoringAdminInform&&LHCCallbacks.initTypingMonitoringAdminInform({chat_id:e,status:!0}),$.getJSON(i+"chat/operatortyping/"+e+"/true",{},(function(i){LHCCallbacks.initTypingMonitoringAdmin&&LHCCallbacks.initTypingMonitoringAdmin(e,!0),a.typing_timeout=setTimeout((function(){a.typingStoppedOperator(e),t.removeClass("secondary")}),n>3e3?n:3e3)})).fail((function(){a.typing_timeout=setTimeout((function(){a.typingStoppedOperator(e)}),3e3)}))):(clearTimeout(a.typing_timeout),a.typing_timeout=setTimeout((function(){a.typingStoppedOperator(e)}),3e3),t.removeClass("secondary")),n>0)setTimeout((function(){var t={msg:$("#id_CannedMessage-"+e).find(":selected").attr("data-msg")};$("#CSChatMessage-"+e).val(""),$.postJSON(i+a.addmsgurl+e,t,(function(t){return LHCCallbacks.addmsgadmin&&LHCCallbacks.addmsgadmin(e),ee.emitEvent("chatAddMsgAdmin",[e]),lhinst.syncadmincall(),!0}))}),n);else{var s={msg:$("#id_CannedMessage-"+e).find(":selected").attr("data-msg")};$("#CSChatMessage-"+e).val(""),$.postJSON(this.wwwDir+this.addmsgurl+e,s,(function(t){return LHCCallbacks.addmsgadmin&&LHCCallbacks.addmsgadmin(e),ee.emitEvent("chatAddMsgAdmin",[e]),lhinst.syncadmincall(),!0}))}}return!1},this.voteAction=function(e){var t=this.chat_id;$.postJSON(this.wwwDir+"chat/voteaction/"+this.chat_id+"/"+this.hash+"/"+e.attr("data-id"),{},(function(e){"false"==e.error&&(LHCCallbacks.uservoted&&LHCCallbacks.uservoted(t),0==e.status?($(".up-vote-action").removeClass("up-voted"),$(".down-vote-action").removeClass("down-voted")):1==e.status?($(".up-vote-action").addClass("up-voted"),$(".down-vote-action").removeClass("down-voted")):2==e.status&&($(".up-vote-action").removeClass("up-voted"),$(".down-vote-action").addClass("down-voted")))}))},this.theme=null,this.checkChatStatusTimeout=null,this.chatStatus=null,this.chatsyncuserpending=function(){var e=1==this.isWidgetMode?"/(mode)/widget":"",t=null!==this.theme?"/(theme)/"+this.theme:"";clearTimeout(this.checkChatStatusTimeout);var n=this;$.getJSON(this.wwwDir+this.checkchatstatus+this.chat_id+"/"+this.hash+e+t,{},(function(e){ee.emitEvent("checkChatStatus",[n.chat_id,e]),n.chatStatus=e.status,"false"==e.error&&("false"==e.activated?("false"!=e.result&&$("#status-chat").html(e.result),""!=e.ru&&document.location.replace(e.ru),n.checkChatStatusTimeout=setTimeout(chatsyncuserpending,confLH.chat_message_sinterval)):($("#status-chat").html(e.result),e.closed&&1==e.closed&&(ee.emitEvent("chatClosedCheckStatus",[n.chat_id]),n.isWidgetMode&&"undefined"!=typeof parent&&window.location!==window.parent.location?parent.postMessage("lhc_chat_closed","*"):n.chatClosed())))})).fail((function(){setTimeout(chatsyncuserpending,confLH.chat_message_sinterval)}))},this.setTheme=function(e){this.theme=e},this.survey=null,this.setSurvey=function(e){this.survey=e},this.isBlinking=!1,this.startBlinking=function(){if(0==this.isBlinking){var e=this;(n=document.title,i="!!! "+document.title,a=function(){document.title=document.title==i?" ":i},s=function(){clearInterval(t),document.title=n,window.onmousemove=null,t=null,e.isBlinking=!1},function(){t||(t=setInterval(a,1e3),window.onmousemove=s)})(),this.isBlinking=!0}var t,n,i,a,s},this.playNewMessageSound=function(){Modernizr.audio&&null!==this.audio&&(this.audio.src=Modernizr.audio.ogg?WWW_DIR_JAVASCRIPT_FILES+"/new_message.ogg?v=3":Modernizr.audio.mp3?WWW_DIR_JAVASCRIPT_FILES+"/new_message.mp3?v=3":WWW_DIR_JAVASCRIPT_FILES+"/new_message.wav?v=3",this.audio.load()),$("textarea[name=ChatMessage]").is(":focus")||this.startBlinking()},this.playInvitationSound=function(){Modernizr.audio&&null!==this.audio&&(this.audio.src=Modernizr.audio.ogg?WWW_DIR_JAVASCRIPT_FILES+"/invitation.ogg":Modernizr.audio.mp3?WWW_DIR_JAVASCRIPT_FILES+"/invitation.mp3":WWW_DIR_JAVASCRIPT_FILES+"/invitation.wav",this.audio.load())},this.playPreloadSound=function(){Modernizr.audio&&null!==this.audio&&(this.audio.src=Modernizr.audio.ogg?WWW_DIR_JAVASCRIPT_FILES+"/silence.ogg":Modernizr.audio.mp3?WWW_DIR_JAVASCRIPT_FILES+"/silence.mp3":WWW_DIR_JAVASCRIPT_FILES+"/silence.wav",this.audio.load())},this.scrollLoading=!1,this.scrollPending=!1,this.loadPreviousMessages=function(e,t){if(0==this.scrollLoading){this.scrollLoading=!0;var n=this;$.getJSON(this.wwwDir+"chat/loadpreviousmessages/"+e.attr("chat-id")+"/"+e.attr("message-id")+"/(initial)/"+e.attr("data-initial"),(function(i){if(0==i.error){e.attr("data-initial",0);var a=$("#messagesBlock-"+e.attr("chat-original-id"));if(a.prepend(i.result),1==e.attr("auto-scroll"))e.attr("auto-scroll",0),a.scrollTop(a.prop("scrollHeight"));else if(!t){var s=document.getElementById("scroll-to-chat-"+e.attr("chat-id")+"-"+e.attr("message-id"));s&&(a[0].scrollTop=s.offsetTop)}1==i.has_messages?(e.attr("message-id",i.message_id),e.attr("chat-id",i.chat_id),n.scrollLoading=!1,1==n.scrollPending&&(n.scrollPending=!1,n.loadPreviousMessages(e,t))):(e.remove(),n.scrollLoading=!1,n.scrollPending=!1)}else n.scrollLoading=!1,n.scrollPending=!1}))}else this.scrollPending=!0},this.hidenicknamesstatus=null,this.onScrollAdmin=function(e){var t=$("#messagesBlock-"+e),n=t.prop("scrollHeight");Math.abs(n-t.prop("scrollTop")-t.prop("clientHeight"))>20?$("#scroll-button-admin-"+e).removeClass("d-none"):$("#scroll-button-admin-"+e).addClass("d-none").find("> button").text($("#scroll-button-admin-"+e+" > button").attr("data-default"))},this.scrollToTheBottomMessage=function(e){var t=$("#unread-separator-"+e);if(t.length>0)t[0].scrollIntoView(),setTimeout((function(){t.remove()}),1e3);else{var n=$("#messagesBlock-"+e);n.scrollTop(n.prop("scrollHeight"))}},this.syncadmincall=function(){this.chatsSynchronising.length>0?0==this.underMessageAdd&&0==this.syncroRequestSend?(this.syncroRequestSend=!0,$.postJSON(this.wwwDir+this.syncadmin,{"chats[]":this.chatsSynchronisingMsg},(function(e){void 0!==e.error_url&&document.location.replace(e.error_url);try{if("false"==e.error){if("false"!=e.result){var t=!1;$.each(e.result,(function(n,i){var a=$("#messagesBlock-"+i.chat_id),s=a.prop("scrollHeight"),o=Math.abs(s-a.prop("scrollTop")-a.prop("clientHeight"));a.find(".pending-storage").slice(0,i.mn).remove();var r=$("#chat-tab-link-"+i.chat_id),l=!focused;if(!r.hasClass("active"))if(r.find("span.msg-nm").length>0){var c=parseInt(r.find("span.msg-nm").attr("rel"))+i.mn;r.find("span.msg-nm").html(" ("+c+")").attr("rel",c)}else l=!0,r.append(' ('+i.mn+")"),r.addClass("has-pm");o>20&&(l=!0,$("#scroll-button-admin-"+i.chat_id+" > button").text($("#scroll-button-admin-"+i.chat_id+" > button").attr("data-new"))),1==l&&null===document.getElementById("unread-separator-"+i.chat_id)&&(i.content=i.content.replace(''+confLH.transLation.new+'0&&$("#msg-"+i.msfrom).attr("data-op-id")!=i.msop&&$("#msg-"+i.msfrom).next().addClass("operator-changes"),ee.emitEvent("eventSyncAdmin",[i,n])})),1==confLH.new_message_sound_admin_enabled&&"false"==e.uw&&1==t&&lhinst.playNewMessageSound()}if("false"!=e.result_status){var n=$("#group-chats-status").hasClass("chat-active");$.each(e.result_status,(function(e,t){var i=$("#user-is-typing-"+t.chat_id);"true"==t.tp?(0==lhinst.nodeJsMode&&i.html(t.tx),"hidden"==i.css("visibility")&&i.css("visibility","visible")):0==lhinst.nodeJsMode&&i.css("visibility","hidden"),$("#last-msg-chat-"+t.chat_id).text(t.lmsg);var a=$("#user-chat-status-"+t.chat_id),s=a.hasClass("icon-user-online");$("#chat-duration-"+t.chat_id).text(t.cdur),a.removeClass("icon-user-online icon-user-away icon-user-pageview"),$("#msg-send-status-"+t.chat_id).removeClass("icon-user-online icon-user-offline"),0==t.us?a.addClass("icon-user-online"):2==t.us?a.addClass("icon-user-away"):3==t.us&&a.addClass("icon-user-pageview"),1==n?1==s&&0!=t.us||lhinst.hidenicknamesstatus!=n&&0!=t.us?$("#ntab-chat-"+t.chat_id).hide():(0==s&&0==t.us||lhinst.hidenicknamesstatus!=n&&0==t.us)&&$("#ntab-chat-"+t.chat_id).show():lhinst.hidenicknamesstatus!=n&&$("#ntab-chat-"+t.chat_id).show();var o=$("#chat-id-"+t.chat_id+"-mds");if(o.attr("data-chat-status")==t.cs&&o.attr("data-chat-user")==t.co||lhinst.updateVoteStatus(t.chat_id),1==t.um?(o.addClass("chat-unread"),$("#msg-send-status-"+t.chat_id).addClass("icon-user-offline")):($("#msg-send-status-"+t.chat_id).addClass("icon-user-online"),o.removeClass("chat-unread")),!1!==t.lp?o.attr("title",t.lp+" s."):o.attr("title",""),void 0!==t.oad&&1==t.oad){$("#lhc_sync_operation").remove();var r=document.getElementsByTagName("head")[0],l=document.createElement("script");l.setAttribute("id","lhc_sync_operation"),l.setAttribute("type","text/javascript"),l.setAttribute("src",WWW_DIR_JAVASCRIPT+"chat/loadoperatorjs/(type)/chat/(id)/"+t.chat_id),r.appendChild(l)}}))}e.cg&&$.each(e.cg,(function(e,t){return lhinst.removeDialogTab(t,$("#tabs"),!0)})),lhinst.hidenicknamesstatus=n,clearTimeout(lhinst.userTimeout),lhinst.userTimeout=setTimeout(chatsyncadmin,confLH.chat_message_sinterval),ee.emitEvent("chatAdminSync",[e])}}catch(e){clearTimeout(lhinst.userTimeout),lhinst.userTimeout=setTimeout(chatsyncadmin,confLH.chat_message_sinterval)}lhinst.setSynchronizationRequestSend(!1),LHCCallbacks.syncadmincall&&LHCCallbacks.syncadmincall(lhinst,e)})).fail((function(){clearTimeout(lhinst.userTimeout),lhinst.userTimeout=setTimeout(chatsyncadmin,confLH.chat_message_sinterval),lhinst.setSynchronizationRequestSend(!1)}))):(clearTimeout(lhinst.userTimeout),lhinst.userTimeout=setTimeout(chatsyncadmin,confLH.chat_message_sinterval)):this.isSinchronizing=!1},this.updateVoteStatus=function(e){$.getJSON(this.wwwDir+"chat/updatechatstatus/"+e,{},(function(t){$("#main-user-info-tab-"+e).html(t.result),$("#messagesBlock-"+e+" span.vis-tit").each((function(e){var n=$(this).children();$(this).text(" "+t.nick).prepend(n)})),$("#ntab-chat-"+e).text(t.nick),ee.emitEvent("chatTabInfoReload",[e])}))},this.updateChatLastMessageID=function(e,t){this.chatsSynchronisingMsg[this.getChatIndex(e)]=e+","+t},this.requestNotificationPermission=function(){window.webkitNotifications?window.webkitNotifications.requestPermission():window.Notification?Notification.requestPermission((function(e){})):alert("Notification API in your browser is not supported.")},this.playNewChatAudio=function(e){if(clearTimeout(this.soundIsPlaying),this.soundPlayedTimes++,Modernizr.audio&&null!==this.audio&&(this.audio.src=Modernizr.audio.ogg?WWW_DIR_JAVASCRIPT_FILES+"/"+e+".ogg?v=4":Modernizr.audio.mp3?WWW_DIR_JAVASCRIPT_FILES+"/"+e+".mp3?v=4":WWW_DIR_JAVASCRIPT_FILES+"/"+e+".wav?v=4",this.audio.load(),confLH.repeat_sound>this.soundPlayedTimes)){var t=this;this.soundIsPlaying=setTimeout((function(){t.playNewChatAudio(e)}),1e3*confLH.repeat_sound_delay)}},this.focusChanged=function(e){if(1==confLH.new_message_browser_notification&&1==e&&(window.webkitNotifications||window.Notification)){var t=this;$.each(this.chatsSynchronising,(function(e,n){void 0!==t.notificationsArrayMessages[n]&&(window.webkitNotifications?t.notificationsArrayMessages[n].cancel():t.notificationsArrayMessages[n].close(),delete t.notificationsArrayMessages[n])}))}parseInt(this.chat_id)>0&&this.scheduleSync()},this.notificationsArrayMessages=[],this.showNewMessageNotification=function(e,t,n){try{if(window.Notification&&0==focused&&"granted"==window.Notification.permission){void 0!==this.notificationsArrayMessages[e]&&(this.notificationsArrayMessages[e].close(),delete this.notificationsArrayMessages[e]);var i=new Notification(n,{icon:WWW_DIR_JAVASCRIPT_FILES_NOTIFICATION+"/notification.png",body:t}),a=this;i.onclick=function(){window.focus(),i.close(),delete a.notificationsArrayMessages[e]},i.onclose=function(){void 0!==a.notificationsArrayMessages[e]&&delete a.notificationsArrayMessages[e]},this.notificationsArrayMessages[e]=i,this.scheduleNewMessageClose(i,e)}}catch(e){console.log(e)}},this.scheduleNewMessageClose=function(e,t){var n=this;setTimeout((function(){window.webkitNotifications?e.cancel():e.close(),void 0!==n.notificationsArrayMessages[t]&&delete n.notificationsArrayMessages[t]}),1e4)},this.playSoundNewAction=function(e,t,n,i,a){if(-1==this.backgroundChats.indexOf(parseInt(t))){1!=confLH.new_chat_sound_enabled||1!=confLH.sn_off&&"flash_on"!=$("#online-offline-user").text()||"active_chats"!=e&&"bot_chats"!=e&&"pending_chat"!=e&&"transfer_chat"!=e&&"unread_chat"!=e&&"pending_transfered"!=e||(this.soundPlayedTimes=0,this.playNewChatAudio("active_chats"==e?"alert":"new_chat")),$("textarea[name=ChatMessage]").is(":focus")||1!=confLH.sn_off&&"flash_on"!=$("#online-offline-user").text()||"subject_chats"!=e&&"active_chats"!=e&&"bot_chats"!=e&&"pending_chat"!=e&&"transfer_chat"!=e&&"unread_chat"!=e&&"pending_transfered"!=e||this.startBlinking(),"subject_chats"==e&&(this.soundPlayedTimes=0,this.playNewChatAudio("subject_chat"));var s=this;if(("subject_chats"==e||"active_chats"==e||"pending_chat"==e||"transfer_chat"==e||"unread_chat"==e||"bot_chats"==e||"pending_transfered"==e)&&(1==confLH.sn_off||"flash_on"==$("#online-offline-user").text())&&window.Notification&&"granted"==window.Notification.permission){var o=new Notification(n,{icon:WWW_DIR_JAVASCRIPT_FILES_NOTIFICATION+"/notification.png",body:i,requireInteraction:!0});o.onclick=function(){"subject_chats"==e||"active_chats"==e||"pending_chat"==e||"unread_chat"==e||"pending_transfered"==e||"bot_chats"==e?$("#tabs").length>0?(window.focus(),s.startChat(t,$("#tabs"),a)):s.startChatNewWindow(t,"ChatRequest"):s.startChatNewWindowTransferByTransfer(t,a),o.close()},"pending_transfered"!=e&&("undefined"!==this.notificationsArray[t]&&o.close(),this.notificationsArray[t]=o)}"transfer_chat"==e&&confLH.accept_chats?s.startChatNewWindowTransferByTransfer(t,a,!0):"transfer_chat"==e&&1==confLH.show_alert_transfer&&confirm(confLH.transLation.transfered+"\n\n"+i)&&s.startChatNewWindowTransferByTransfer(t,a),1==confLH.show_alert&&confirm(confLH.transLation.new_chat+"\n\n"+i)&&("pending_chat"==e||"unread_chat"==e||"pending_transfered"==e||"bot_chats"==e?$("#tabs").length>0?(window.focus(),s.startChat(t,$("#tabs"),a)):s.startChatNewWindow(t,"ChatRequest"):s.startChatNewWindowTransferByTransfer(t,a))}},this.syncadmininterfacestatic=function(){try{ee.emitEvent("angularLoadChatList")}catch(e){}},this.addingUserMessage=!1,this.addUserMessageQueue=[],this.addDelayedTimeout=null,this.addmsgadmin=function(e,t){$("#unread-separator-"+e).remove();var n=$("#CSChatMessage-"+e);if(!n.is("[readonly]")){var i={msg:t||n.val()};if(n.attr("meta-msg")&&(i.meta_msg=n.attr("meta-msg"),n.removeAttr("meta-msg")),""!=i.msg){!1!==this.speechHandler&&this.speechHandler.messageSend(),t||n.val("");var a=n.attr("placeholder");if(n.attr("placeholder",confLH.transLation.sending||"Sending..."),n.hasClass("edit-mode"))i.msgid=n.attr("data-msgid"),$.postJSON(this.wwwDir+"chat/updatemsg/"+e,i,(function(t){if(n.attr("placeholder",a),"f"==t.error)return n.removeClass("edit-mode"),n.removeAttr("data-msgid"),$("#msg-"+i.msgid).replaceWith(t.msg),LHCCallbacks.addmsgadmin&&LHCCallbacks.addmsgadmin(e),ee.emitEvent("chatAddMsgAdmin",[e]),lhinst.addQuateHandler(e),!0}));else{var s=this,o=$("#messagesBlock-"+e);if(t||o.append('
autorenew'+$("
").text(i.msg).html()+"
"),o.scrollTop(o.prop("scrollHeight")),0==this.addingUserMessage){this.addingUserMessage=!0;var r=!1;n.attr("subjects_ids")&&(i.subjects_ids=n.attr("subjects_ids"),n.removeAttr("subjects_ids"),r=!0),n.attr("canned_id")&&(i.canned_id=n.attr("canned_id"),n.removeAttr("canned_id")),$.postJSON(this.wwwDir+this.addmsgurl+e,i,(function(t){if(n.removeAttr("readonly").attr("placeholder",a),"false"==t.error)LHCCallbacks.addmsgadmin&&LHCCallbacks.addmsgadmin(e),ee.emitEvent("chatAddMsgAdmin",[e]),""!=t.r&&$("#messagesBlock-"+e).append(t.r).scrollTop($("#messagesBlock-"+e).prop("scrollHeight")),!0===t.hold_removed?$("#hold-action-"+e).removeClass("btn-outline-info"):!0===t.hold_added&&$("#hold-action-"+e).addClass("btn-outline-info"),1==r&&s.updateVoteStatus(e),lhinst.syncadmincall();else{void 0!==t.token&&(confLH.csrf_token=t.token),n.attr("placeholder",a).val((n.val()+" "+i.msg).trim()),$(".pending-storage").first().remove();var o='