Add help button toggle

This commit is contained in:
Berkeley Martinez
2015-10-16 15:00:26 -07:00
parent 465a3e399c
commit fc97bc8266

View File

@ -33,7 +33,22 @@ main = (function(main) {
});
$(helpChatBtnClass).on('click', function() {
main.chat.helpChat.toggleChat(true);
// is button already pressed?
// no? open chat
// yes? close chat
var shouldChatBeOpen = !$(this).hasClass('active');
main.chat.helpChat.toggleChat(shouldChatBeOpen);
if (shouldChatBeOpen) {
$(helpChatBtnClass).addClass('active');
}
});
$('#chat-embed-help').on('gitter-chat-toggle', function(e) {
var shouldButtonBePressed = !!e.originalEvent.detail.state;
if (shouldButtonBePressed) {
return $(helpChatBtnClass).addClass('active');
}
return $(helpChatBtnClass).removeClass('active');
});
};