<\/div>/g,"
")),console.log("p",o,f),"html"===o&&(r=t("
"+f+"
"),u=!1,l=f,m=new RegExp("<(/w|w):[A-Za-z]"),l.match(m)&&(u=!0,l=l.replace(m,"")),m=new RegExp("<(/o|o):[A-Za-z]"),l.match(m)&&(u=!0,l=l.replace(m,"")),u&&(r=n.wordFilter(r)),r=t(r),r.contents().each(function(){return 8===this.nodeType?t(this).remove():void 0}),r.find("a, font, small, time, form, label").replaceWith(function(){return t(this).contents()}),g="div",r.find("textarea").each(function(){var e,n;return n=this.outerHTML,m=new RegExp("<"+this.tagName,"i"),e=n.replace(m,"<"+g),m=new RegExp(""+this.tagName,"i"),e=e.replace(m,""+g),t(this).replaceWith(e)}),r.find("font, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head, fieldset").remove(),n.removeAttributes(r),f=r.html()),"text3"===o?n.pasteHtmlAtCaret(f):document.execCommand("insertHTML",!1,f),!0}}}(this)),this.input.on("drop",function(n){return function(s){var i,o,a,r,l;if(s.stopPropagation(),s.preventDefault(),e.dataTransfer)i=e.dataTransfer;else{if(!s.originalEvent.dataTransfer)throw"No clipboardData support";i=s.originalEvent.dataTransfer}return r=s.clientX,l=s.clientY,o=i.files[0],o.type.match("image.*")?(a=new FileReader,a.onload=function(e){var s,i,o;return o=e.target.result,s=document.createElement("img"),s.src=o,i=function(e,i,a,h){var d,c;return n.isRetina()&&(i/=2,a/=2),o=e,s=t('
'),s=s.get(0),document.caretPositionFromPoint?(d=document.caretPositionFromPoint(r,l),c=document.createRange(),c.setStart(d.offsetNode,d.offset),c.collapse(),c.insertNode(s)):document.caretRangeFromPoint?(c=document.caretRangeFromPoint(r,l),c.insertNode(s)):console.log("could not find carat")},n.resizeImage(s.src,460,"auto",2,"image/jpeg","auto",i)},a.readAsDataURL(o)):void 0}}(this)),t(e).on("beforeunload",function(t){return function(){return t.onLeaveTemporary()}}(this)),t(e).bind("hashchange",function(t){return function(){return t.isOpen?void(t.sessionId&&t.send("chat_session_notice",{session_id:t.sessionId,message:e.location.href})):t.idleTimeout.start()}}(this)),this.isFullscreen?this.input.on({focus:this.onFocus,focusout:this.onFocusOut}):void 0},i.prototype.checkForEnter=function(t){return t.shiftKey||13!==t.keyCode?void 0:(t.preventDefault(),this.sendMessage())},i.prototype.send=function(t,e){return null==e&&(e={}),e.chat_id=this.options.chatId,this.io.send(t,e)},i.prototype.onWebSocketMessage=function(t){var e,n,s;for(e=0,n=t.length;n>e;e++)switch(s=t[e],this.log.debug("ws:onmessage",s),s.event){case"chat_error":this.log.notice(s.data),s.data&&"chat_disabled"===s.data.state&&this.destroy({remove:!0});break;case"chat_session_message":if(s.data.self_written)return;this.receiveMessage(s.data);break;case"chat_session_typing":if(s.data.self_written)return;this.onAgentTypingStart();break;case"chat_session_start":this.onConnectionEstablished(s.data);break;case"chat_session_queue":this.onQueueScreen(s.data);break;case"chat_session_closed":this.onSessionClosed(s.data);break;case"chat_session_left":this.onSessionClosed(s.data);break;case"chat_status_customer":switch(s.data.state){case"online":this.sessionId=void 0,!this.options.cssAutoload||this.cssLoaded?this.onReady():this.socketReady=!0;break;case"offline":this.onError("Zammad Chat: No agent online");break;case"chat_disabled":this.onError("Zammad Chat: Chat is disabled");break;case"no_seats_available":this.onError("Zammad Chat: Too many clients in queue. Clients in queue: "+s.data.queue);break;case"reconnect":this.onReopenSession(s.data)}}},i.prototype.onReady=function(){return this.log.debug("widget ready for use"),t("."+this.options.buttonClass).click(this.open).removeClass(this.inactiveClass),this.options.show?this.show():void 0},i.prototype.onError=function(e){return this.log.debug(e),this.addStatus(e),t("."+this.options.buttonClass).hide(),this.isOpen?(this.disableInput(),this.destroy({remove:!1})):this.destroy({remove:!0})},i.prototype.onReopenSession=function(t){var e,n,s,i,o;if(this.log.debug("old messages",t.session),this.inactiveTimeout.start(),o=sessionStorage.getItem("unfinished_message"),t.agent){for(this.onConnectionEstablished(t),i=t.session,e=0,n=i.length;n>e;e++)s=i[e],this.renderMessage({message:s.content,id:s.id,from:s.created_by_id?"agent":"customer"});o&&this.input.html(o)}return t.position&&this.onQueue(t),this.show(),this.open(),this.scrollToBottom(),o?this.input.focus():void 0},i.prototype.onInput=function(){return this.el.find(".zammad-chat-message--unread").removeClass("zammad-chat-message--unread"),sessionStorage.setItem("unfinished_message",this.input.html()),this.onTyping()},i.prototype.onFocus=function(){var n;return t(e).scrollTop(10),n=t(e).scrollTop()>0,t(e).scrollTop(0),n?this.log.notice("virtual keyboard shown"):void 0},i.prototype.onFocusOut=function(){},i.prototype.onTyping=function(){return this.isTyping&&this.isTyping>new Date((new Date).getTime()-1500)?void 0:(this.isTyping=new Date,this.send("chat_session_typing",{session_id:this.sessionId}),this.inactiveTimeout.start())},i.prototype.onSubmit=function(t){return t.preventDefault(),this.sendMessage()},i.prototype.sendMessage=function(){var t,e;return(t=this.input.html())?(this.inactiveTimeout.start(),sessionStorage.removeItem("unfinished_message"),e=this.view("message")({message:t,from:"customer",id:this._messageCount++,unreadClass:""}),this.maybeAddTimestamp(),this.el.find(".zammad-chat-message--typing").get(0)?(this.lastAddedType="typing-placeholder",this.el.find(".zammad-chat-message--typing").before(e)):(this.lastAddedType="message--customer",this.el.find(".zammad-chat-body").append(e)),this.input.html(""),this.scrollToBottom(),this.send("chat_session_message",{content:t,id:this._messageCount,session_id:this.sessionId})):void 0},i.prototype.receiveMessage=function(t){return this.inactiveTimeout.start(),this.onAgentTypingEnd(),this.maybeAddTimestamp(),this.renderMessage({message:t.message.content,id:t.id,from:"agent"}),this.scrollToBottom({showHint:!0})},i.prototype.renderMessage=function(t){return this.lastAddedType="message--"+t.from,t.unreadClass=document.hidden?" zammad-chat-message--unread":"",this.el.find(".zammad-chat-body").append(this.view("message")(t))},i.prototype.open=function(){var t;return this.isOpen?void this.log.debug("widget already open, block"):(this.isOpen=!0,this.log.debug("open widget"),this.sessionId||this.showLoader(),this.el.addClass("zammad-chat-is-open"),t=this.el.height()-this.el.find(".zammad-chat-header").outerHeight(),this.el.css("bottom",-t),this.sessionId?(this.el.css("bottom",0),this.onOpenAnimationEnd()):(this.el.animate({bottom:0},500,this.onOpenAnimationEnd),this.send("chat_session_init",{url:e.location.href})))},i.prototype.onOpenAnimationEnd=function(){return this.idleTimeout.stop(),this.isFullscreen?this.disableScrollOnRoot():void 0},i.prototype.sessionClose=function(){return this.send("chat_session_close",{session_id:this.sessionId}),this.inactiveTimeout.stop(),this.waitingListTimeout.stop(),sessionStorage.removeItem("unfinished_message"),this.onInitialQueueDelayId&&clearTimeout(this.onInitialQueueDelayId),this.setSessionId(void 0)},i.prototype.toggle=function(t){return this.isOpen?this.close(t):this.open(t)},i.prototype.close=function(t){var e;return this.isOpen?(this.initDelayId&&clearTimeout(this.initDelayId),this.sessionId?(this.log.debug("close widget"),t&&t.stopPropagation(),this.sessionClose(),this.isFullscreen&&this.enableScrollOnRoot(),e=this.el.height()-this.el.find(".zammad-chat-header").outerHeight(),this.el.animate({bottom:-e},500,this.onCloseAnimationEnd)):void this.log.debug("can't close widget without sessionId")):void this.log.debug("can't close widget, it's not open")},i.prototype.onCloseAnimationEnd=function(){return this.el.css("bottom",""),this.el.removeClass("zammad-chat-is-open"),this.showLoader(),this.el.find(".zammad-chat-welcome").removeClass("zammad-chat-is-hidden"),this.el.find(".zammad-chat-agent").addClass("zammad-chat-is-hidden"),this.el.find(".zammad-chat-agent-status").addClass("zammad-chat-is-hidden"),this.isOpen=!1,this.io.reconnect()},i.prototype.onWebSocketClose=function(){return this.isOpen?void 0:this.el?(this.el.removeClass("zammad-chat-is-shown"),this.el.removeClass("zammad-chat-is-loaded")):void 0},i.prototype.show=function(){return"offline"!==this.state?(this.el.addClass("zammad-chat-is-loaded"),this.el.addClass("zammad-chat-is-shown")):void 0},i.prototype.disableInput=function(){return this.input.prop("disabled",!0),this.el.find(".zammad-chat-send").prop("disabled",!0)},i.prototype.enableInput=function(){return this.input.prop("disabled",!1),this.el.find(".zammad-chat-send").prop("disabled",!1)},i.prototype.hideModal=function(){return this.el.find(".zammad-chat-modal").html("")},i.prototype.onQueueScreen=function(t){var e;return this.setSessionId(t.session_id),e=function(e){return function(){return e.onQueue(t),e.waitingListTimeout.start()}}(this),this.initialQueueDelay&&!this.onInitialQueueDelayId?void(this.onInitialQueueDelayId=setTimeout(e,this.initialQueueDelay)):(this.onInitialQueueDelayId&&clearTimeout(this.onInitialQueueDelayId),e())},i.prototype.onQueue=function(t){return this.log.notice("onQueue",t.position),this.inQueue=!0,this.el.find(".zammad-chat-modal").html(this.view("waiting")({position:t.position}))},i.prototype.onAgentTypingStart=function(){return this.stopTypingId&&clearTimeout(this.stopTypingId),this.stopTypingId=setTimeout(this.onAgentTypingEnd,3e3),!this.el.find(".zammad-chat-message--typing").get(0)&&(this.maybeAddTimestamp(),this.el.find(".zammad-chat-body").append(this.view("typingIndicator")()),this.isVisible(this.el.find(".zammad-chat-message--typing"),!0))?this.scrollToBottom():void 0},i.prototype.onAgentTypingEnd=function(){return this.el.find(".zammad-chat-message--typing").remove()},i.prototype.onLeaveTemporary=function(){return this.sessionId?this.send("chat_session_leave_temporary",{session_id:this.sessionId}):void 0},i.prototype.maybeAddTimestamp=function(){var t,e,n;return n=Date.now(),!this.lastTimestamp||n-this.lastTimestamp>6e4*this.showTimeEveryXMinutes?(t=this.T("Today"),e=(new Date).toTimeString().substr(0,5),"timestamp"===this.lastAddedType?(this.updateLastTimestamp(t,e),this.lastTimestamp=n):(this.el.find(".zammad-chat-body").append(this.view("timestamp")({label:t,time:e})),this.lastTimestamp=n,this.lastAddedType="timestamp",this.scrollToBottom())):void 0},i.prototype.updateLastTimestamp=function(t,e){return this.el?this.el.find(".zammad-chat-body").find(".zammad-chat-timestamp").last().replaceWith(this.view("timestamp")({label:t,time:e})):void 0},i.prototype.addStatus=function(t){return this.el?(this.maybeAddTimestamp(),this.el.find(".zammad-chat-body").append(this.view("status")({status:t})),this.scrollToBottom()):void 0},i.prototype.detectScrolledtoBottom=function(){var t;return t=this.el.find(".zammad-chat-body").scrollTop()+this.el.find(".zammad-chat-body").outerHeight(),this.scrolledToBottom=Math.abs(t-this.el.find(".zammad-chat-body").prop("scrollHeight"))<=this.scrollSnapTolerance,this.scrolledToBottom?this.el.find(".zammad-scroll-hint").addClass("is-hidden"):void 0},i.prototype.showScrollHint=function(){return this.el.find(".zammad-scroll-hint").removeClass("is-hidden"),this.el.find(".zammad-chat-body").scrollTop(this.el.find(".zammad-chat-body").scrollTop()+this.el.find(".zammad-scroll-hint").outerHeight())},i.prototype.onScrollHintClick=function(){return this.el.find(".zammad-chat-body").animate({scrollTop:this.el.find(".zammad-chat-body").prop("scrollHeight")},300)},i.prototype.scrollToBottom=function(e){var n;return n=(null!=e?e:{showHint:!1}).showHint,this.scrolledToBottom?this.el.find(".zammad-chat-body").scrollTop(t(".zammad-chat-body").prop("scrollHeight")):n?this.showScrollHint():void 0},i.prototype.destroy=function(t){return null==t&&(t={}),this.log.debug("destroy widget",t),this.setAgentOnlineState("offline"),t.remove&&this.el&&this.el.remove(),this.waitingListTimeout&&this.waitingListTimeout.stop(),this.inactiveTimeout&&this.inactiveTimeout.stop(),this.idleTimeout&&this.idleTimeout.stop(),this.io.close()},i.prototype.reconnect=function(){return this.log.notice("reconnecting"),this.disableInput(),this.lastAddedType="status",this.setAgentOnlineState("connecting"),this.addStatus(this.T("Connection lost"))},i.prototype.onConnectionReestablished=function(){return this.lastAddedType="status",this.setAgentOnlineState("online"),this.addStatus(this.T("Connection re-established"))},i.prototype.onSessionClosed=function(t){return this.addStatus(this.T("Chat closed by %s",t.realname)),this.disableInput(),this.setAgentOnlineState("offline"),this.inactiveTimeout.stop()},i.prototype.setSessionId=function(t){return this.sessionId=t,void 0===t?sessionStorage.removeItem("sessionId"):sessionStorage.setItem("sessionId",t)},i.prototype.onConnectionEstablished=function(t){return this.onInitialQueueDelayId&&clearTimeout(this.onInitialQueueDelayId),this.inQueue=!1,t.agent&&(this.agent=t.agent),t.session_id&&this.setSessionId(t.session_id),this.el.find(".zammad-chat-body").html(""),this.el.find(".zammad-chat-agent").html(this.view("agent")({agent:this.agent})),this.enableInput(),this.hideModal(),this.el.find(".zammad-chat-welcome").addClass("zammad-chat-is-hidden"),this.el.find(".zammad-chat-agent").removeClass("zammad-chat-is-hidden"),this.el.find(".zammad-chat-agent-status").removeClass("zammad-chat-is-hidden"),this.isFullscreen||this.input.focus(),this.setAgentOnlineState("online"),this.waitingListTimeout.stop(),this.idleTimeout.stop(),this.inactiveTimeout.start()},i.prototype.showCustomerTimeout=function(){var t;return this.el.find(".zammad-chat-modal").html(this.view("customer_timeout")({agent:this.agent.name,delay:this.options.inactiveTimeout})),t=function(){return location.reload()},this.el.find(".js-restart").click(t),this.sessionClose()},i.prototype.showWaitingListTimeout=function(){var t;return this.el.find(".zammad-chat-modal").html(this.view("waiting_list_timeout")({delay:this.options.watingListTimeout})),t=function(){return location.reload()},this.el.find(".js-restart").click(t),this.sessionClose()},i.prototype.showLoader=function(){return this.el.find(".zammad-chat-modal").html(this.view("loader")())},i.prototype.setAgentOnlineState=function(t){var e;return this.state=t,this.el?(e=t.charAt(0).toUpperCase()+t.slice(1),this.el.find(".zammad-chat-agent-status").attr("data-status",t).text(this.T(e))):void 0},i.prototype.detectHost=function(){var t;return t="ws://","https"===h&&(t="wss://"),this.options.host=""+t+l+"/ws"},i.prototype.loadCss=function(){var t,e,n;if(this.options.cssAutoload)return n=this.options.cssUrl,n||(n=this.options.host.replace(/^wss/i,"https").replace(/^ws/i,"http").replace(/\/ws/i,""),n+="/assets/chat/chat.css"),this.log.debug("load css from '"+n+"'"),e="@import url('"+n+"');",t=document.createElement("link"),t.onload=this.onCssLoaded,t.rel="stylesheet",t.href="data:text/css,"+escape(e),document.getElementsByTagName("head")[0].appendChild(t);
+},i.prototype.onCssLoaded=function(){return this.socketReady?this.onReady():this.cssLoaded=!0},i.prototype.startTimeoutObservers=function(){return this.idleTimeout=new o({logPrefix:"idleTimeout",debug:this.options.debug,timeout:this.options.idleTimeout,timeoutIntervallCheck:this.options.idleTimeoutIntervallCheck,callback:function(t){return function(){return t.log.debug("Idle timeout reached, hide widget",new Date),t.destroy({remove:!0})}}(this)}),this.inactiveTimeout=new o({logPrefix:"inactiveTimeout",debug:this.options.debug,timeout:this.options.inactiveTimeout,timeoutIntervallCheck:this.options.inactiveTimeoutIntervallCheck,callback:function(t){return function(){return t.log.debug("Inactive timeout reached, show timeout screen.",new Date),t.showCustomerTimeout(),t.destroy({remove:!1})}}(this)}),this.waitingListTimeout=new o({logPrefix:"waitingListTimeout",debug:this.options.debug,timeout:this.options.waitingListTimeout,timeoutIntervallCheck:this.options.waitingListTimeoutIntervallCheck,callback:function(t){return function(){return t.log.debug("Waiting list timeout reached, show timeout screen.",new Date),t.showWaitingListTimeout(),t.destroy({remove:!1})}}(this)})},i.prototype.disableScrollOnRoot=function(){return this.rootScrollOffset=this.scrollRoot.scrollTop(),this.scrollRoot.css({overflow:"hidden",position:"fixed"})},i.prototype.enableScrollOnRoot=function(){return this.scrollRoot.scrollTop(this.rootScrollOffset),this.scrollRoot.css({overflow:"",position:""})},i.prototype.isVisible=function(n,s,i,o){var a,r,l,h,d,c,u,p,m,g,f,v,y,b,w,T,C,z,S,k,I,A,_,x,E,O;if(!(n.length<1))if(r=t(e),a=n.length>1?n.eq(0):n,z=a.get(0),O=r.width(),E=r.height(),o=o?o:"both",p=i===!0?z.offsetWidth*z.offsetHeight:!0,"function"==typeof z.getBoundingClientRect){if(C=z.getBoundingClientRect(),S=C.top>=0&&C.top
0&&C.bottom<=E,b=C.left>=0&&C.left0&&C.right<=O,k=s?S||u:S&&u,y=s?b||T:b&&T,"both"===o)return p&&k&&y;if("vertical"===o)return p&&k;if("horizontal"===o)return p&&y}else{if(x=r.scrollTop(),I=x+E,A=r.scrollLeft(),_=A+O,w=a.offset(),c=w.top,l=c+a.height(),h=w.left,d=h+a.width(),v=s===!0?l:c,m=s===!0?c:l,g=s===!0?d:h,f=s===!0?h:d,"both"===o)return!!p&&I>=m&&v>=x&&_>=f&&g>=A;if("vertical"===o)return!!p&&I>=m&&v>=x;if("horizontal"===o)return!!p&&_>=f&&g>=A}},i.prototype.isRetina=function(){var t;return e.matchMedia?(t=e.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)"),t&&t.matches||e.devicePixelRatio>1):!1},i.prototype.resizeImage=function(t,e,n,s,i,o,a,r){var l;return null==e&&(e="auto"),null==n&&(n="auto"),null==s&&(s=1),null==r&&(r=!0),l=new Image,l.onload=function(){var t,r,h,d,c,u,p;return c=l.width,d=l.height,console.log("ImageService","current size",c,d),"auto"===n&&"auto"===e&&(e=c,n=d),"auto"===n&&(h=c/e,n=d/h),"auto"===e&&(h=c/n,e=d/h),p=!1,c>e||d>n?(p=!0,e*=s,n*=s):(e=c,n=d),t=document.createElement("canvas"),t.width=e,t.height=n,r=t.getContext("2d"),r.drawImage(l,0,0,e,n),"auto"===o&&(o=200>e&&200>n?1:400>e&&400>n?.9:600>e&&600>n?.8:900>e&&900>n?.7:.6),u=t.toDataURL(i,o),p?(console.log("ImageService","resize",e/s,n/s,o,.75*u.length/1024/1024,"in mb"),void a(u,e/s,n/s,!0)):(console.log("ImageService","no resize",e,n,o,.75*u.length/1024/1024,"in mb"),a(u,e,n,!1))},l.src=t},i.prototype.pasteHtmlAtCaret=function(t){var n,s,i,o,a,r;if(r=void 0,a=void 0,e.getSelection){if(r=e.getSelection(),r.getRangeAt&&r.rangeCount){for(a=r.getRangeAt(0),a.deleteContents(),n=document.createElement("div"),n.innerHTML=t,s=document.createDocumentFragment(o,i);o=n.firstChild;)i=s.appendChild(o);if(a.insertNode(s),i)return a=a.cloneRange(),a.setStartAfter(i),a.collapse(!0),r.removeAllRanges(),r.addRange(a)}}else if(document.selection&&"Control"!==document.selection.type)return document.selection.createRange().pasteHTML(t)},i.prototype.wordFilter=function(e){var n,s,i;return n=e.html(),n=n.replace(//gi,""),n=n.replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,""),n=n.replace(/<(\/?)s>/gi,"<$1strike>"),n=n.replace(/ /gi," "),e.html(n),t("p",e).each(function(){var e,n;return n=t(this).attr("style"),e=/mso-list:\w+ \w+([0-9]+)/.exec(n),e?t(this).data("_listLevel",parseInt(e[1],10)):void 0}),s=0,i=null,t("p",e).each(function(){var e,n,o,a,r,l,h,d,c,u;if(e=t(this).data("_listLevel"),void 0!==e){if(u=t(this).text(),a="",/^\s*\w+\./.test(u)&&(r=/([0-9])\./.exec(u),r?(c=parseInt(r[1],10),a=null!=(l=c>1)?l:'
':"
"}):a="
"),e>s&&(0===s?(t(this).before(a),i=t(this).prev()):i=t(a).appendTo(i)),s>e)for(n=o=h=n,d=s-e;d>=h?d>=o:o>=d;n=d>=h?++o:--o)i=i.parent();return t("span:first",this).remove(),i.append(""+t(this).html()+""),t(this).remove(),s=e}return s=0}),t("[style]",e).removeAttr("style"),t("[align]",e).removeAttr("align"),t("span",e).replaceWith(function(){return t(this).contents()}),t("span:empty",e).remove(),t("[class^='Mso']",e).removeAttr("class"),t("p:empty",e).remove(),e},i.prototype.removeAttribute=function(e){var n,s,i,o,a;if(e){for(n=t(e),a=e.attributes,i=0,o=a.length;o>i;i++)s=a[i],s&&s.name&&e.removeAttribute(s.name);return n.removeAttr("style").removeAttr("class").removeAttr("lang").removeAttr("type").removeAttr("align").removeAttr("id").removeAttr("wrap").removeAttr("title")}},i.prototype.removeAttributes=function(t,e){return null==e&&(e=!0),e&&t.each(function(t){return function(e,n){return t.removeAttribute(n)}}(this)),t.find("*").each(function(t){return function(e,n){return t.removeAttribute(n)}}(this)),t},i}(n),e.ZammadChat=a}(window.jQuery,window),window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.chat=function(t){t||(t={});var e,n=[],s=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){n.push('")}).call(this)}.call(t),t.safe=i,t.escape=o,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.customer_timeout=function(t){t||(t={});var e,n=[],s=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){n.push('\n '),this.agent?(n.push("\n "),n.push(this.T("Since you didn't respond in the last %s minutes your conversation with
%s got closed.",this.delay,this.agent)),n.push("\n ")):(n.push("\n "),n.push(this.T("Since you didn't respond in the last %s minutes your conversation got closed.",this.delay)),n.push("\n ")),n.push('\n
\n
"),n.push(this.T("Start new conversation")),n.push("
\n
")}).call(this)}.call(t),t.safe=i,t.escape=o,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.loader=function(t){t||(t={});var e,n=[],s=t.safe,i=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){n.push('\n \n \n \n\n'),n.push(this.T("Connecting")),n.push("")}).call(this)}.call(t),t.safe=s,t.escape=i,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.message=function(t){t||(t={});var e,n=[],s=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){n.push('\n "),n.push(this.message),n.push("\n
")}).call(this)}.call(t),t.safe=i,t.escape=o,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.status=function(t){t||(t={});var e,n=[],s=t.safe,i=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){n.push('\n
\n '),n.push(this.status),n.push("\n
\n
")}).call(this)}.call(t),t.safe=s,t.escape=i,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.timestamp=function(t){t||(t={});var e,n=[],s=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){n.push(''),n.push(s(this.label)),n.push(" "),n.push(s(this.time)),n.push("
")}).call(this)}.call(t),t.safe=i,t.escape=o,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.typingIndicator=function(t){t||(t={});var e,n=[],s=t.safe,i=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){n.push('\n \n \n \n \n \n \n \n
')}).call(this)}.call(t),t.safe=s,t.escape=i,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.waiting=function(t){t||(t={});var e,n=[],s=t.safe,i=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){n.push('\n \n \n \n \n \n '),n.push(this.T("All colleagues are busy.")),n.push("
\n "),n.push(this.T("You are on waiting list position %s.",this.position)),n.push("\n
")}).call(this)}.call(t),t.safe=s,t.escape=i,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.waiting_list_timeout=function(t){t||(t={});var e,n=[],s=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){n.push('\n '),n.push(this.T("We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!")),n.push('\n
\n
"),n.push(this.T("Start new conversation")),n.push("
\n
")}).call(this)}.call(t),t.safe=i,t.escape=o,n.join("")};
\ No newline at end of file
diff --git a/public/assets/chat/chat.scss b/public/assets/chat/chat.scss
index 1cec7cef1..579ebce53 100644
--- a/public/assets/chat/chat.scss
+++ b/public/assets/chat/chat.scss
@@ -329,7 +329,7 @@
.zammad-chat-controls {
overflow: hidden;
display: none;
- align-items: flex-start;
+ align-items: flex-end;
border-top: 1px solid hsl(0,0%,93%);
padding: 0;
margin: 0;
@@ -349,21 +349,19 @@
margin: 0;
padding: 1em 2em;
float: left;
- width: auto;
- height: auto;
max-height: 6em;
- min-height: 1.4em !important;
+ min-height: 1.4em;
font-family: inherit;
line-height: 1.4em;
font-size: inherit;
appearance: none;
- border: none !important;
+ border: none;
background: none;
- box-shadow: none !important;
+ box-shadow: none ;
box-sizing: content-box;
outline: none;
- resize: none;
flex: 1;
+ overflow: auto;
}
.zammad-chat-input::-webkit-input-placeholder {
@@ -378,7 +376,7 @@
background: hsl(203,67%,53%);
color: white;
padding: 0.5em 1.2em;
- margin: 0.5em 1em 0.5em;
+ margin: 0.63em 1em;
cursor: pointer;
border: none;
border-radius: 1.5em;
diff --git a/public/assets/chat/gulpfile.js b/public/assets/chat/gulpfile.js
index 60372ab40..b73b6e9ea 100644
--- a/public/assets/chat/gulpfile.js
+++ b/public/assets/chat/gulpfile.js
@@ -29,9 +29,7 @@ gulp.task('js', function(){
.pipe(plumber())
.pipe(coffee({bare: true}).on('error', gutil.log));
- var autoGrow = gulp.src('jquery.autoGrow.js');
-
- return merge(templates, js, autoGrow)
+ return merge(templates, js)
.pipe(concat('chat.js'))
.pipe(gulp.dest('./'))
.pipe(uglify())
diff --git a/public/assets/chat/jquery.autoGrow.js b/public/assets/chat/jquery.autoGrow.js
deleted file mode 100644
index cda824c42..000000000
--- a/public/assets/chat/jquery.autoGrow.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/*!
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Jevin O. Sewaruth
- * ----------------------------------------------------------------------------
- *
- * Autogrow Textarea Plugin Version v3.0
- * http://www.technoreply.com/autogrow-textarea-plugin-3-0
- *
- * THIS PLUGIN IS DELIVERD ON A PAY WHAT YOU WHANT BASIS. IF THE PLUGIN WAS USEFUL TO YOU, PLEASE CONSIDER BUYING THE PLUGIN HERE :
- * https://sites.fastspring.com/technoreply/instant/autogrowtextareaplugin
- *
- * Date: October 15, 2012
- *
- * Zammad modification:
- * - remove overflow:hidden when maximum height is reached
- * - mirror box-sizing
- *
- */
-
-jQuery.fn.autoGrow = function(options) {
- return this.each(function() {
- var settings = jQuery.extend({
- extraLine: true,
- }, options);
-
- var createMirror = function(textarea) {
- jQuery(textarea).after('');
- return jQuery(textarea).next('.autogrow-textarea-mirror')[0];
- }
-
- var sendContentToMirror = function (textarea) {
- mirror.innerHTML = String(textarea.value)
- .replace(/&/g, '&')
- .replace(/"/g, '"')
- .replace(/'/g, ''')
- .replace(//g, '>')
- .replace(/ /g, ' ')
- .replace(/\n/g, '
') +
- (settings.extraLine? '.
.' : '')
- ;
-
- if (jQuery(textarea).height() != jQuery(mirror).height()) {
- jQuery(textarea).height(jQuery(mirror).height());
-
- var overflow = jQuery(mirror).height() > maxHeight ? '' : 'hidden';
- jQuery(textarea).css('overflow', overflow);
- }
- }
-
- var growTextarea = function () {
- sendContentToMirror(this);
- }
-
- // Create a mirror
- var mirror = createMirror(this);
-
- // Store max-height
- var maxHeight = parseInt(jQuery(this).css('max-height'), 10);
-
- // Style the mirror
- mirror.style.display = 'none';
- mirror.style.wordWrap = 'break-word';
- mirror.style.whiteSpace = 'normal';
- mirror.style.padding = jQuery(this).css('paddingTop') + ' ' +
- jQuery(this).css('paddingRight') + ' ' +
- jQuery(this).css('paddingBottom') + ' ' +
- jQuery(this).css('paddingLeft');
-
- mirror.style.width = jQuery(this).css('width');
- mirror.style.fontFamily = jQuery(this).css('font-family');
- mirror.style.fontSize = jQuery(this).css('font-size');
- mirror.style.lineHeight = jQuery(this).css('line-height');
- mirror.style.letterSpacing = jQuery(this).css('letter-spacing');
- mirror.style.boxSizing = jQuery(this).css('boxSizing');
-
- // Style the textarea
- this.style.overflow = "hidden";
- this.style.minHeight = this.rows+"em";
-
- // Bind the textarea's event
- this.onkeyup = growTextarea;
- this.onfocus = growTextarea;
-
- // Fire the event for text already present
- sendContentToMirror(this);
-
- });
-};
\ No newline at end of file
diff --git a/public/assets/chat/views/chat.eco b/public/assets/chat/views/chat.eco
index 6d73cc626..2860d193e 100644
--- a/public/assets/chat/views/chat.eco
+++ b/public/assets/chat/views/chat.eco
@@ -21,7 +21,7 @@