From d3a55e5b1521e45c6e273092e504e6bc1cbcf08c Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Tue, 7 Oct 2014 10:27:06 +0200 Subject: [PATCH] Hide the header bar when no conversation was selected --- js/script.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/js/script.js b/js/script.js index 5a31e81..42a2d37 100644 --- a/js/script.js +++ b/js/script.js @@ -27,6 +27,9 @@ $.urlParam = function(name){ var refreshConversation = function() { // if no conversation selected, then don't fetch page if (curPhoneNumber == null) { + if ($('#app-content-header').is(':visible')) { + $('#app-content-header').hide(); + } return; } @@ -41,6 +44,10 @@ var refreshConversation = function() { $('.msg-endtag').before(conversationBuf); $('#app-content-wrapper').scrollTop(1E10); } + + if ($('#app-content-header').is(':hidden')) { + $('#app-content-header').show(); + } } ); }; @@ -61,6 +68,10 @@ function fetchConversation(phoneNumber) { $('#ocsms-phone-label').html(jsondata['contactName']); $('#ocsms-phone-opt-number').html(phoneNumber); } + + if ($('#app-content-header').is(':hidden')) { + $('#app-content-header').show(); + } $('#app-content-wrapper').html(conversationBuf); $('#app-content-wrapper').scrollTop(1E10); @@ -178,6 +189,13 @@ function changeSelectedConversation(item) { } } } + // Don't show message headers if no conversation selected + else { + if ($('#app-content-header').is(':visible')) { + $('#app-content-header').hide(); + } + } + }); setInterval(refreshConversation, 10000); });