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

Improve prev/next selection on delete.

This commit is contained in:
Thomas Tanghus 2012-06-24 01:48:37 +02:00
parent 1e88cfd2b9
commit c973c35150

View File

@ -380,12 +380,12 @@ Contacts={
if(jsondata.status == 'success'){ if(jsondata.status == 'success'){
var newid = '', bookid; var newid = '', bookid;
var curlistitem = $('#contacts li[data-id="'+jsondata.data.id+'"]'); var curlistitem = $('#contacts li[data-id="'+jsondata.data.id+'"]');
var newlistitem = curlistitem.prev(); var newlistitem = curlistitem.prev('li');
if(newlistitem == undefined) { if(newlistitem == undefined) {
newlistitem = curlistitem.next(); newlistitem = curlistitem.next('li');
} }
curlistitem.remove(); curlistitem.remove();
if(newlistitem != undefined) { if(!$(newlistitem).is('li')) {
newid = newlistitem.data('id'); newid = newlistitem.data('id');
bookid = newlistitem.data('id'); bookid = newlistitem.data('id');
} }