diff options
-rw-r--r-- | lib/VNDB/Handler/Producers.pm | 14 | ||||
-rw-r--r-- | lib/VNDB/Handler/Releases.pm | 42 | ||||
-rw-r--r-- | lib/VNDB/Handler/VNPage.pm | 28 | ||||
-rw-r--r-- | lib/VNDB/Util/CommonHTML.pm | 3 |
4 files changed, 43 insertions, 44 deletions
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm index c6d507e2..a265e8ca 100644 --- a/lib/VNDB/Handler/Producers.pm +++ b/lib/VNDB/Handler/Producers.pm @@ -33,13 +33,13 @@ sub page { if($rev) { my $prev = $rev && $rev > 1 && $self->dbProducerGet(id => $pid, rev => $rev-1, what => 'changes extended')->[0]; $self->htmlRevision('p', $prev, $p, - [ type => 'Type', serialize => sub { mt "_ptype_$_[0]" } ], - [ name => 'Name (romaji)', diff => 1 ], - [ original => 'Original name', diff => 1 ], - [ alias => 'Aliases', diff => 1 ], - [ lang => 'Language', serialize => sub { "$_[0] (".mt("_lang_$_[0]").')' } ], - [ website => 'Website', diff => 1 ], - [ desc => 'Description', diff => 1 ], + [ type => serialize => sub { mt "_ptype_$_[0]" } ], + [ name => diff => 1 ], + [ original => diff => 1 ], + [ alias => diff => 1 ], + [ lang => serialize => sub { "$_[0] (".mt("_lang_$_[0]").')' } ], + [ website => diff => 1 ], + [ desc => diff => 1 ], ); } diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm index d52aa096..d28436cf 100644 --- a/lib/VNDB/Handler/Releases.pm +++ b/lib/VNDB/Handler/Releases.pm @@ -36,34 +36,34 @@ sub page { what => 'vn extended producers platforms media changes' )->[0]; $self->htmlRevision('r', $prev, $r, - [ vn => 'Relations', join => '<br />', split => sub { + [ vn => join => '<br />', split => sub { map sprintf('<a href="/v%d" title="%s">%s</a>', $_->{vid}, $_->{original}||$_->{title}, shorten $_->{title}, 50), @{$_[0]}; } ], - [ type => 'Type', serialize => sub { mt "_rtype_$_[0]" } ], - [ patch => 'Patch', serialize => sub { $_[0] ? 'Patch' : 'Not a patch' } ], - [ freeware => 'Freeware', serialize => sub { $_[0] ? 'yes' : 'nope' } ], - [ doujin => 'Doujin', serialize => sub { $_[0] ? 'yups' : 'nope' } ], - [ title => 'Title (romaji)', diff => 1 ], - [ original => 'Original title', diff => 1 ], - [ gtin => 'JAN/UPC/EAN', serialize => sub { $_[0]||'[none]' } ], - [ catalog => 'Catalog number', serialize => sub { $_[0]||'[none]' } ], - [ languages => 'Language', join => ', ', split => sub { map mt("_lang_$_"), @{$_[0]} } ], - [ website => 'Website', ], - [ released => 'Release date', htmlize => sub { $self->{l10n}->datestr($_[0]) } ], - [ minage => 'Age rating', serialize => sub { $self->{age_ratings}{$_[0]}[0] } ], - [ notes => 'Notes', diff => 1 ], - [ platforms => 'Platforms', join => ', ', split => sub { map mt("_plat_$_"), @{$_[0]} } ], - [ media => 'Media', join => ', ', split => sub { + [ type => serialize => sub { mt "_rtype_$_[0]" } ], + [ patch => serialize => sub { $_[0] ? 'Patch' : 'Not a patch' } ], + [ freeware => serialize => sub { $_[0] ? 'yes' : 'nope' } ], + [ doujin => serialize => sub { $_[0] ? 'yups' : 'nope' } ], + [ title => diff => 1 ], + [ original => diff => 1 ], + [ gtin => serialize => sub { $_[0]||'[none]' } ], + [ catalog => serialize => sub { $_[0]||'[none]' } ], + [ languages => join => ', ', split => sub { map mt("_lang_$_"), @{$_[0]} } ], + [ 'website' ], + [ released => htmlize => sub { $self->{l10n}->datestr($_[0]) } ], + [ minage => serialize => sub { $self->{age_ratings}{$_[0]}[0] } ], + [ notes => diff => 1 ], + [ platforms => join => ', ', split => sub { map mt("_plat_$_"), @{$_[0]} } ], + [ media => join => ', ', split => sub { map { my $med = $self->{media}{$_->{medium}}; $med->[1] ? sprintf('%d %s%s', $_->{qty}, $med->[0], $_->{qty}>1?'s':'') : $med->[0] } @{$_[0]}; } ], - [ resolution => 'Resolution', serialize => sub { $self->{resolutions}[$_[0]][0] } ], - [ voiced => 'Voiced', serialize => sub { $self->{voiced}[$_[0]] } ], - [ ani_story => 'Story animation',serialize => sub { $self->{animated}[$_[0]] } ], - [ ani_ero => 'Ero animation', serialize => sub { $self->{animated}[$_[0]] } ], - [ producers => 'Producers', join => '<br />', split => sub { + [ resolution => serialize => sub { $self->{resolutions}[$_[0]][0] } ], + [ voiced => serialize => sub { $self->{voiced}[$_[0]] } ], + [ ani_story => serialize => sub { $self->{animated}[$_[0]] } ], + [ ani_ero => serialize => sub { $self->{animated}[$_[0]] } ], + [ producers => join => '<br />', split => sub { map sprintf('<a href="/p%d" title="%s">%s</a>', $_->{id}, $_->{original}||$_->{name}, shorten $_->{name}, 50), @{$_[0]}; } ], ); diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm index aa942774..51287072 100644 --- a/lib/VNDB/Handler/VNPage.pm +++ b/lib/VNDB/Handler/VNPage.pm @@ -177,41 +177,41 @@ sub _revision { )->[0]; $self->htmlRevision('v', $prev, $v, - [ title => 'Title (romaji)', diff => 1 ], - [ original => 'Original title', diff => 1 ], - [ alias => 'Alias', diff => 1 ], - [ desc => 'Description', diff => 1 ], - [ length => 'Length', serialize => sub { $self->{vn_lengths}[$_[0]][0] } ], - [ l_wp => 'Wikipedia link', htmlize => sub { + [ title => diff => 1 ], + [ original => diff => 1 ], + [ alias => diff => 1 ], + [ desc => diff => 1 ], + [ length => serialize => sub { $self->{vn_lengths}[$_[0]][0] } ], + [ l_wp => htmlize => sub { $_[0] ? sprintf '<a href="http://en.wikipedia.org/wiki/%s">%1$s</a>', xml_escape $_[0] : mt '_vndiff_nolink' }], - [ l_encubed => 'Encubed tag', htmlize => sub { + [ l_encubed => htmlize => sub { $_[0] ? sprintf '<a href="http://novelnews.net/tag/%s/">%1$s</a>', xml_escape $_[0] : mt '_vndiff_nolink' }], - [ l_renai => 'Renai.us link', htmlize => sub { + [ l_renai => htmlize => sub { $_[0] ? sprintf '<a href="http://renai.us/game/%s.shtml">%1$s</a>', xml_escape $_[0] : mt '_vndiff_nolink' }], - [ l_vnn => 'V-N.net link', htmlize => sub { + [ l_vnn => htmlize => sub { $_[0] ? sprintf '<a href="http://visual-novels.net/vn/index.php?option=com_content&task=view&id=%d">%1$d</a>', xml_escape $_[0] : mt '_vndiff_nolink' }], - [ relations => 'Relations', join => '<br />', split => sub { + [ relations => join => '<br />', split => sub { my @r = map sprintf('%s: <a href="/v%d" title="%s">%s</a>', $self->{vn_relations}[$_->{relation}][0], $_->{id}, xml_escape($_->{original}||$_->{title}), xml_escape shorten $_->{title}, 40 ), sort { $a->{id} <=> $b->{id} } @{$_[0]}; return @r ? @r : (mt '_vndiff_none'); }], - [ anime => 'Anime', join => ', ', split => sub { + [ anime => join => ', ', split => sub { my @r = map sprintf('<a href="http://anidb.net/a%d">a%1$d</a>', $_->{id}), sort { $a->{id} <=> $b->{id} } @{$_[0]}; return @r ? @r : (mt '_vndiff_none'); }], - [ screenshots => 'Screenshots', join => '<br />', split => sub { + [ screenshots => join => '<br />', split => sub { my @r = map sprintf('[%s] <a href="%s/sf/%02d/%d.jpg" rel="iv:%dx%d">%4$d</a> (%s)', $_->{rid} ? qq|<a href="/r$_->{rid}">r$_->{rid}</a>| : 'no release', $self->{url_static}, $_->{id}%100, $_->{id}, $_->{width}, $_->{height}, $_->{nsfw} ? 'NSFW' : 'Safe' ), @{$_[0]}; return @r ? @r : (mt '_vndiff_none'); }], - [ image => 'Image', htmlize => sub { + [ image => htmlize => sub { my $url = sprintf "%s/cv/%02d/%d.jpg", $self->{url_static}, $_[0]%100, $_[0]; if($_[0] > 0) { return $_[1]->{img_nsfw} && !$self->authInfo->{show_nsfw} ? "<a href=\"$url\">(NSFW)</a>" : "<img src=\"$url\" />"; @@ -219,7 +219,7 @@ sub _revision { return $_[0] < 0 ? '[processing]' : 'No image'; } }], - [ img_nsfw => 'Image NSFW', serialize => sub { $_[0] ? 'Not safe' : 'Safe' } ], + [ img_nsfw => serialize => sub { $_[0] ? 'Not safe' : 'Safe' } ], ); } diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm index 66b79494..b44d4166 100644 --- a/lib/VNDB/Util/CommonHTML.pm +++ b/lib/VNDB/Util/CommonHTML.pm @@ -319,8 +319,7 @@ sub revheader { # type, obj } sub revdiff { - my($i, $type, $old, $new, $short, $name, %o) = @_; - # TODO: remove $name, it won't be used + my($i, $type, $old, $new, $short, %o) = @_; $o{serialize} ||= $o{htmlize}; $o{diff}++ if $o{split}; |