X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=html.pl;h=10c6392d60c46dacead3ad07a5c1aa66888a723b;hb=c928efda112ef1c5f1a05f01d62066362d803a40;hp=26d1433b93b596b712a8c54317875dde71f65b23;hpb=1c601b56dc680ce70e93b649f82feec4fa446075;p=koha-bibliografija diff --git a/html.pl b/html.pl index 26d1433..10c6392 100755 --- a/html.pl +++ b/html.pl @@ -426,17 +426,23 @@ foreach my $row ( sort { $a->{full_name} cmp $b->{full_name} } @authors ) { my $path = "html/$row->{authid}"; open(my $fh, '>:encoding(utf-8)', "$path.new"); print $fh html_title($row->{full_name}, "bibliografija"); - print $fh qq|

$row->{full_name} - bibliografija

|; + print $fh qq|

$row->{full_name} - bibliografija

\n|; my $years = count_author_years( $row->{authid} ); - print $fh qq|Godine:|; + print $fh qq|Godine:\n|; my $type_cat_count = {}; foreach my $year ( sort { $b <=> $a } keys %$years ) { - print $fh qq| \n|; + print $fh qq| \n|; foreach my $type_cat ( keys %{ $years->{$year} } ) { $type_cat_count->{ $type_cat } += $years->{$year}->{$type_cat}; } } + + print $fh qq| + + + |; + print $fh qq||; print $fh q| @@ -446,27 +452,62 @@ var years = |, encode_json($years), q|; var type_cat_count = |, encode_json($type_cat_count), q|; +function year_show(year) { + $('.y'+year).show(); + console.debug('show', year); + for(var type_cat in years[year]) { + if ( ( type_cat_count[ type_cat ] += years[year][type_cat] ) == years[year][type_cat]) { + $('a[name="'+type_cat+'"]').show(); + console.debug(type_cat, 'show'); + } + } +} + +function year_hide(year) { + $('.y'+year).hide(); + console.debug('hide', year); + for(var type_cat in years[year]) { + if ( ( type_cat_count[ type_cat ] -= years[year][type_cat] ) == 0 ) { + $('a[name="'+type_cat+'"]').hide(); + console.debug(type_cat, 'hide'); + } + } +} + function toggle_year(year, el) { if ( el.checked ) { - $('.y'+year).show(); - console.debug('show', year, el.checked); - for(var type_cat in years[year]) { - if ( ( type_cat_count[ type_cat ] += years[year][type_cat] ) == years[year][type_cat]) { - $('a[name="'+type_cat+'"]').show(); - console.debug(type_cat, 'show'); - } - } + year_show(year); } else { - $('.y'+year).hide(); - console.debug('hide', year, el.checked); - for(var type_cat in years[year]) { - if ( ( type_cat_count[ type_cat ] -= years[year][type_cat] ) == 0 ) { - $('a[name="'+type_cat+'"]').hide(); - console.debug(type_cat, 'hide'); + year_hide(year); + } +} + +function all_years( turn_on ) { + $('input[name=year_selection]').each( function(i,el) { + if ( turn_on ) { + if ( ! el.checked ) { + el.checked = true; + year_show( el.value ); + } + } else { + if ( el.checked ) { + el.checked = false; + year_hide( el.value ); } } - } + } ); } + +$(document).ready( function() { + console.info('ready'); + + $('input[name=year_selection]').each( function(i, el) { + var year = el.value; + console.debug( 'on load', year, el.checked ); + if (! el.checked) year_hide(year); + }); + +}); |;