diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | lib/VNDB/Handler/VNPage.pm | 7 | ||||
-rw-r--r-- | lib/VNDB/Util/CommonHTML.pm | 4 |
3 files changed, 11 insertions, 3 deletions
@@ -1,3 +1,6 @@ +2.5 - ? + - Hide NSFW images in diff viewer (unless NSFW warnings are disabled) + 2.4 - 2009-06-07 - Release search + browser + filters - Javascript date input diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm index fac6305b..21c0e13d 100644 --- a/lib/VNDB/Handler/VNPage.pm +++ b/lib/VNDB/Handler/VNPage.pm @@ -216,7 +216,12 @@ sub _revision { return @r ? @r : ('[no screenshots]'); }], [ image => 'Image', htmlize => sub { - $_[0] > 0 ? sprintf '<img src="%s/cv/%02d/%d.jpg" />', $self->{url_static}, $_[0]%100, $_[0] : $_[0] < 0 ? '[processing]' : 'No image'; + 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\" />"; + } else { + return $_[0] < 0 ? '[processing]' : 'No image'; + } }], [ img_nsfw => 'Image NSFW', serialize => sub { $_[0] ? 'Not safe' : 'Safe' } ], ); diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm index 7421b1c0..8199cf20 100644 --- a/lib/VNDB/Util/CommonHTML.pm +++ b/lib/VNDB/Util/CommonHTML.pm @@ -317,8 +317,8 @@ sub revdiff { $o{diff}++ if $o{split}; $o{join} ||= ''; - my $ser1 = $o{serialize} ? $o{serialize}->($old->{$short}) : $old->{$short}; - my $ser2 = $o{serialize} ? $o{serialize}->($new->{$short}) : $new->{$short}; + my $ser1 = $o{serialize} ? $o{serialize}->($old->{$short}, $old) : $old->{$short}; + my $ser2 = $o{serialize} ? $o{serialize}->($new->{$short}, $new) : $new->{$short}; return if $ser1 eq $ser2; if($o{diff} && $ser1 && $ser2) { |