2 function toc_count_update(type_cat) {
3 var selector = '#toc-count-'+type_cat.replace(/\./g,'-');
6 console.error(selector, 'not found');
9 var old_val = parseInt( e.text() );
10 var new_val = parseInt( type_cat_count[type_cat] );
12 if ( old_val != new_val ) {
14 console.debug( selector, 'old', old_val, 'new', new_val);
16 var cat = type_cat.split('-')[0];
17 var val = type_cat_count['_toc_count'][cat] += new_val - old_val;
18 console.log(cat, val);
19 $('#toc-count-'+cat).text(val);
24 function year_show(year) {
26 console.debug('show', year);
27 for(var type_cat in years[year]) {
28 //console.log('year_show', type_cat, type_cat_count[ type_cat ], years[year][type_cat] );
29 if ( ( type_cat_count[ type_cat ] += parseInt(years[year][type_cat]) ) > 0 ) {
30 $('a[name="'+type_cat+'"]').show();
31 console.debug(type_cat, 'show');
33 toc_count_update(type_cat);
37 function year_hide(year) {
39 console.debug('hide', year);
40 for(var type_cat in years[year]) {
41 //console.log('year_hide', type_cat, type_cat_count[ type_cat ], years[year][type_cat] );
42 if ( ( type_cat_count[ type_cat ] -= parseInt(years[year][type_cat]) ) == 0 ) {
43 $('a[name="'+type_cat+'"]').hide();
44 console.debug(type_cat, 'hide');
46 toc_count_update(type_cat);
50 function toggle_year(year, el) {
58 function all_years( turn_on ) {
59 $('input[name=year_selection]').each( function(i,el) {
63 year_show( el.value );
68 year_hide( el.value );
74 $(document).ready( function() {
75 console.info('ready');
77 $('input[name=year_selection]').each( function(i, el) {
79 console.debug( 'on load', year, el.checked );
80 if (! el.checked) year_hide(year);