Fixes #2881: Chat button is no longer optional in no jQuery version. Thanks to @ma-jahn ❤️

This commit is contained in:
Thorsten Eckel 2020-01-13 10:58:16 +01:00
parent 3bd3eeb163
commit 44806e79e5
3 changed files with 28 additions and 15 deletions

View file

@ -467,7 +467,9 @@ do(window) ->
@renderBase()
# disable open button
document.querySelector(".#{ @options.buttonClass }").classList.add @inactiveClass
btn = document.querySelector(".#{ @options.buttonClass }")
if btn
btn.classList.add @inactiveClass
@setAgentOnlineState 'online'
@ -770,7 +772,10 @@ do(window) ->
onError: (message) =>
@log.debug message
@addStatus(message)
document.querySelector(".#{ @options.buttonClass }").classList.add('zammad-chat-is-hidden')
btn = document.querySelector(".#{ @options.buttonClass }")
if btn
btn.classList.add('zammad-chat-is-hidden')
if @isOpen
@disableInput()
@destroy(remove: false)

View file

@ -1,7 +1,7 @@
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["agent"] = function (__obj) {
window.zammadChatTemplates["agent"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@ -739,10 +739,14 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
};
ZammadChat.prototype.render = function() {
var btn;
if (!this.el || !document.querySelector('.zammad-chat')) {
this.renderBase();
}
document.querySelector("." + this.options.buttonClass).classList.add(this.inactiveClass);
btn = document.querySelector("." + this.options.buttonClass);
if (btn) {
btn.classList.add(this.inactiveClass);
}
this.setAgentOnlineState('online');
this.log.debug('widget rendered');
this.startTimeoutObservers();
@ -1088,9 +1092,13 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
};
ZammadChat.prototype.onError = function(message) {
var btn;
this.log.debug(message);
this.addStatus(message);
document.querySelector("." + this.options.buttonClass).classList.add('zammad-chat-is-hidden');
btn = document.querySelector("." + this.options.buttonClass);
if (btn) {
btn.classList.add('zammad-chat-is-hidden');
}
if (this.isOpen) {
this.disableInput();
return this.destroy({
@ -1953,7 +1961,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["chat"] = function (__obj) {
window.zammadChatTemplates["chat"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@ -2044,7 +2052,7 @@ window.zammadChatTemplates["chat"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["customer_timeout"] = function (__obj) {
window.zammadChatTemplates["customer_timeout"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@ -2117,7 +2125,7 @@ window.zammadChatTemplates["customer_timeout"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["loader"] = function (__obj) {
window.zammadChatTemplates["loader"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@ -2172,7 +2180,7 @@ window.zammadChatTemplates["loader"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["message"] = function (__obj) {
window.zammadChatTemplates["message"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@ -2239,7 +2247,7 @@ window.zammadChatTemplates["message"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["status"] = function (__obj) {
window.zammadChatTemplates["status"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@ -2294,7 +2302,7 @@ window.zammadChatTemplates["status"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["timestamp"] = function (__obj) {
window.zammadChatTemplates["timestamp"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@ -2353,7 +2361,7 @@ window.zammadChatTemplates["timestamp"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["typingIndicator"] = function (__obj) {
window.zammadChatTemplates["typingIndicator"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@ -2404,7 +2412,7 @@ window.zammadChatTemplates["typingIndicator"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["waiting"] = function (__obj) {
window.zammadChatTemplates["waiting"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
@ -2463,7 +2471,7 @@ window.zammadChatTemplates["waiting"] = function (__obj) {
if (!window.zammadChatTemplates) {
window.zammadChatTemplates = {};
}
window.zammadChatTemplates["waiting_list_timeout"] = function (__obj) {
window.zammadChatTemplates["waiting_list_timeout"] = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;

File diff suppressed because one or more lines are too long