1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-11-29 11:24:11 +01:00

Don't add duplicate contacts in the list when en-/disable an address book.

This commit is contained in:
Thomas Tanghus 2012-06-29 23:17:32 +02:00
parent 02b935f4a9
commit 5af39ebf0a

View File

@ -1621,19 +1621,21 @@ Contacts={
var contactlist = $('#contacts ul[data-id="'+b+'"]');
for(var c in book.contacts) {
if(book.contacts[c].id == undefined) { continue; }
var contact = Contacts.UI.Card.createEntry(book.contacts[c]);
if(c == self.batchnum-5) {
contact.bind('inview', function(event, isInView, visiblePartX, visiblePartY) {
$(this).unbind(event);
var bookid = $(this).data('bookid');
var numsiblings = $('.contacts li[data-bookid="'+bookid+'"]').length;
if (isInView && numsiblings >= self.batchnum) {
console.log('This would be a good time to load more contacts.');
Contacts.UI.Contacts.update(id, bookid, $('#contacts li[data-bookid="'+bookid+'"]').length);
}
});
if($('#contacts li[data-id="'+book.contacts[c]['id']+'"][data-id="'+book.contacts[c]['bookid']+'"]').length == 0) {
var contact = Contacts.UI.Card.createEntry(book.contacts[c]);
if(c == self.batchnum-5) {
contact.bind('inview', function(event, isInView, visiblePartX, visiblePartY) {
$(this).unbind(event);
var bookid = $(this).data('bookid');
var numsiblings = $('.contacts li[data-bookid="'+bookid+'"]').length;
if (isInView && numsiblings >= self.batchnum) {
console.log('This would be a good time to load more contacts.');
Contacts.UI.Contacts.update(id, bookid, $('#contacts li[data-bookid="'+bookid+'"]').length);
}
});
}
contactlist.append(contact);
}
contactlist.append(contact);
}
});
if($('#contacts h3').length > 1) {