SAAS-948 - Add livechat event listeners

This commit is contained in:
Duncan Sommerville 2015-08-14 10:24:49 -04:00
parent 32100e2d9b
commit 809b743785
3 changed files with 22 additions and 11 deletions

View file

@ -17,4 +17,19 @@ function setupLiveChat() {
$(document).ready(function() {
setupLiveChat();
});
var lcLoadListener = setInterval(function() {
var ifr = document.getElementById('livechat-compact-container');
if (ifr !== undefined) {
LC_API.on_chat_state_changed = function(data) {
console.log('Chat state changed to: ' + data.state);
if (data.state == 'offline') {
$('.wrapper').css('padding-bottom', 10);
} else {
$('.wrapper').css('padding-bottom', 40);
}
};
clearInterval(lcLoadListener);
}
}, 100);
});