--- trunk/public_html/koha.js 2009/03/29 01:29:13 81 +++ trunk/public_html/koha.js 2009/03/29 17:48:11 84 @@ -2,8 +2,10 @@ function update_selected( by ) { var e = $('#clear_selection'); - e.attr( 'value', parseInt( e.attr('value') ) + by ); - console.debug('selected', e.attr('value')); + var v = parseInt( e.attr('value') ); + e.attr( 'value', v + by ); + console.debug('selected', v); + return v; } function read_tag( id ) { @@ -15,7 +17,9 @@ console.error('element', id, 'allready exists', item); item.addClass('in_range'); } else { - $('#koha').append( '
Loading item '+id+' from Koha
' ) + var tabindex = update_selected(+1) + 1; + + $('#koha').append( '
Loading item '+id+' from Koha
' ) var item = $('#item'+id); @@ -27,14 +31,13 @@ item.removeClass('loading'); - update_selected(+1); - item.click( function() { // remove selected item - this.fadeOut('slow', function() { + item.fadeOut('slow', function() { console.debug('remove',id); - update_selection( -1 ); - this.remove(); + item.remove(); + var selected = update_selected( -1 ); + console.info('selected', selected); }); }); }, @@ -79,7 +82,7 @@ } else if ( a[0] == 'removed' ) { remove_tag( a[1] ); } else { - console.error( 'unknown', cmd, id ); + console.error( 'unknown', a ); } };