From cad282b73f48b696e078c38abde3e3ec1bea691f Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Tue, 26 Jun 2012 18:14:59 +0200 Subject: [PATCH] Added some error checking. --- apps/contacts/js/contacts.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js index 204fe18a52d..64b7af850ea 100644 --- a/apps/contacts/js/contacts.js +++ b/apps/contacts/js/contacts.js @@ -258,6 +258,9 @@ Contacts={ newid = id; bookid = bookid?bookid:$('#contacts li[data-id="'+newid+'"]').data('bookid'); } + if(!bookid) { + bookid = $('#contacts h3').first().data('id'); + } var localLoadContact = function(newid, bookid) { if($('.contacts li').length > 0) { $('#contacts li[data-id="'+newid+'"]').addClass('active'); @@ -315,7 +318,6 @@ Contacts={ }, add:function(n, fn, aid, isnew){ // add a new contact aid = aid?aid:$('#contacts h3.active').first().data('id'); - console.log('add() aid: ' + aid); var localAddcontact = function(n, fn, aid, isnew) { $.post(OC.filePath('contacts', 'ajax', 'addcontact.php'), { n: n, fn: fn, aid: aid, isnew: isnew }, function(jsondata) { @@ -1567,6 +1569,8 @@ Contacts={ scroll: true, scrollSensitivity: 100, opacity: 0.7, helper: 'clone' }); + } else { + $('#contacts h3').first().addClass('active'); } }); Contacts.UI.Card.update(id); -- 2.39.5