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

@ -11,13 +11,9 @@ $(document).ready(function() {
// savePanelSpace: true
//});
if($('#livechat-compact-container:not(:visible)')) {
$('.wrapper').css('padding-bottom', 10);
}
//this statement tells the browser to fade out any success message after 5 seconds
setTimeout(function(){$(".success").fadeOut("slow", function(){$(this).empty()});}, 5000);
if ($('.usability_hint:visible')) {
if ($('.usability_hint').is(':visible')) {
$(".wrapper").css("padding-top", USABILITY_HINT_PADDING); // Account for usability hint
}
});
@ -208,6 +204,6 @@ function getUsabilityHint() {
$(document).mouseup(function (e) {
var mb = $("#menu-btn"), w = $(window).width();
if (!mb.is(e.target) && mb.has(e.target).length === 0 && w <= 970) {
$('#nav .responsive-menu').slideUp();
$('#nav').find('.responsive-menu').slideUp();
}
});

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);
});