2 |
|
|
3 |
function update_selected( by ) { |
function update_selected( by ) { |
4 |
var e = $('#clear_selection'); |
var e = $('#clear_selection'); |
5 |
e.attr( 'value', parseInt( e.attr('value') ) + by ); |
var v = parseInt( e.attr('value') ); |
6 |
console.debug('selected', e.attr('value')); |
e.attr( 'value', v + by ); |
7 |
|
console.debug('selected', v); |
8 |
|
return v; |
9 |
} |
} |
10 |
|
|
11 |
function read_tag( id ) { |
function read_tag( id ) { |
17 |
console.error('element', id, 'allready exists', item); |
console.error('element', id, 'allready exists', item); |
18 |
item.addClass('in_range'); |
item.addClass('in_range'); |
19 |
} else { |
} else { |
20 |
$('#koha').append( '<div class="item in_range loading" id="item'+id+'">Loading item '+id+' from Koha</div>' ) |
var tabindex = update_selected(+1) + 1; |
21 |
|
|
22 |
|
$('#koha').append( '<div class="item in_range loading" id="item'+id+'" tabindex='+tabindex+'>Loading item '+id+' from Koha</div>' ) |
23 |
|
|
24 |
var item = $('#item'+id); |
var item = $('#item'+id); |
25 |
|
|
31 |
|
|
32 |
item.removeClass('loading'); |
item.removeClass('loading'); |
33 |
|
|
|
update_selected(+1); |
|
|
|
|
34 |
item.click( function() { |
item.click( function() { |
35 |
// remove selected item |
// remove selected item |
36 |
this.fadeOut('slow', function() { |
item.fadeOut('slow', function() { |
37 |
console.debug('remove',id); |
console.debug('remove',id); |
38 |
update_selection( -1 ); |
item.remove(); |
39 |
this.remove(); |
var selected = update_selected( -1 ); |
40 |
|
console.info('selected', selected); |
41 |
}); |
}); |
42 |
}); |
}); |
43 |
}, |
}, |
82 |
} else if ( a[0] == 'removed' ) { |
} else if ( a[0] == 'removed' ) { |
83 |
remove_tag( a[1] ); |
remove_tag( a[1] ); |
84 |
} else { |
} else { |
85 |
console.error( 'unknown', cmd, id ); |
console.error( 'unknown', a ); |
86 |
} |
} |
87 |
}; |
}; |
88 |
|
|