summaryrefslogtreecommitdiff
path: root/lib/VNDB
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2017-06-15 21:28:20 +0200
committerYorhel <git@yorhel.nl>2017-06-15 21:28:23 +0200
commit036bea03fd30a282ef49a6c16816c59a6480e196 (patch)
tree384884376fad0e3ff45c87d8b7007a190ba77aeb /lib/VNDB
parent8f368e327c38f47c8f516839bb63e4050e7ae707 (diff)
Handler::Chars: Hide instances block when hidden by spoiler settings
https://vndb.org/t950.339
Diffstat (limited to 'lib/VNDB')
-rw-r--r--lib/VNDB/Handler/Chars.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/VNDB/Handler/Chars.pm b/lib/VNDB/Handler/Chars.pm
index afc467d4..9e6a4a86 100644
--- a/lib/VNDB/Handler/Chars.pm
+++ b/lib/VNDB/Handler/Chars.pm
@@ -6,6 +6,7 @@ use warnings;
use TUWF ':html', 'uri_escape';
use Exporter 'import';
use VNDB::Func;
+use List::Util 'min';
our @EXPORT = ('charOps', 'charTable', 'charBrowseTable');
@@ -88,9 +89,11 @@ sub page {
push @$inst, $self->dbCharGet(id => $r->{main}, what => 'extended traits vns seiyuu')->[0];
}
if(@$inst) {
- div class => 'mainbox';
+ my $spoil = sub { local $_=shift; !$r->{main} ? $_->{main_spoil} : $_->{main_spoil} > $r->{main_spoil} ? $_->{main_spoil} : $r->{main_spoil} };
+ my $minspoil = min map $isspoil->($_), @$inst;
+ div class => 'mainbox '.charspoil($minspoil);
h1 'Other instances';
- $self->charTable($_, 1, $_ != $inst->[0], 0, !$r->{main} ? $_->{main_spoil} : $_->{main_spoil} > $r->{main_spoil} ? $_->{main_spoil} : $r->{main_spoil}) for @$inst;
+ $self->charTable($_, 1, $_ != $inst->[0], 0, $isspoil->($_)) for @$inst;
end;
}