Commit 3c11cb65 authored by Diego Sampaio's avatar Diego Sampaio

Change livechat widget state on popout

parent 5e19d577
......@@ -6,16 +6,6 @@
var hookQueue = [];
var ready = false;
var closeWidget = function() {
widget.dataset.state = 'closed';
widget.style.height = '30px';
};
var openWidget = function() {
widget.dataset.state = 'opened';
widget.style.height = '300px';
};
// hooks
var callHook = function(action, params) {
if (!ready) {
......@@ -29,6 +19,18 @@
iframe.contentWindow.postMessage(data, '*');
};
var closeWidget = function() {
widget.dataset.state = 'closed';
widget.style.height = '30px';
callHook('widgetClosed');
};
var openWidget = function() {
widget.dataset.state = 'opened';
widget.style.height = '300px';
callHook('widgetOpened');
};
var api = {
ready: function() {
ready = true;
......@@ -42,10 +44,8 @@
toggleWindow: function(/*forceClose*/) {
if (widget.dataset.state === 'closed') {
openWidget();
callHook('widgetOpened');
} else {
closeWidget();
callHook('widgetClosed');
}
},
openPopout: function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment