diff options
author | Yorhel <git@yorhel.nl> | 2011-04-08 19:46:52 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2011-04-08 19:46:52 +0200 |
commit | 000834947b9d7658639d4565c655a39cd3d68545 (patch) | |
tree | ba8bc7bd820193b8590fc0746e3e5615881d3332 /lib | |
parent | 9304d1032723d3c2b9f3dad4d239f12c8c7268fa (diff) |
Toggle [spoiler] tag visibility with global setting rather than mouse-over
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNDB/Handler/Chars.pm | 2 | ||||
-rw-r--r-- | lib/VNDBUtil.pm | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/VNDB/Handler/Chars.pm b/lib/VNDB/Handler/Chars.pm index dfa289be..9308cecf 100644 --- a/lib/VNDB/Handler/Chars.pm +++ b/lib/VNDB/Handler/Chars.pm @@ -233,7 +233,7 @@ sub charTable { td class => 'chardesc', colspan => 2; h2 mt '_charp_description'; p; - lit bb2html $r->{desc}; + lit bb2html $r->{desc}, 0, 1; end; end; end; diff --git a/lib/VNDBUtil.pm b/lib/VNDBUtil.pm index a0469a1c..76290013 100644 --- a/lib/VNDBUtil.pm +++ b/lib/VNDBUtil.pm @@ -27,8 +27,7 @@ sub shorten { # v+, v+.+ # http://../ sub bb2html { - my $raw = shift; - my $maxlength = shift; + my($raw, $maxlength, $charspoil) = @_; $raw =~ s/\r//g; return '' if !$raw && $raw ne "0"; @@ -76,7 +75,8 @@ sub bb2html { next; } elsif($tag eq '[spoiler]') { push @open, 'spoiler'; - $result .= '<b class="spoiler">'; + $result .= !$charspoil ? '<b class="spoiler">' + : '<b class="grayedout charspoil charspoil_-1"><hidden by spoiler settings></b><span class="charspoil charspoil_2 hidden">'; next; } elsif($tag eq '[quote]') { push @open, 'quote'; @@ -89,7 +89,7 @@ sub bb2html { $rmnewline = 1; next; } elsif($tag eq '[/spoiler]' && $open[$#open] eq 'spoiler') { - $result .= '</b>'; + $result .= !$charspoil ? '</b>' : '</span>'; pop @open; next; } elsif($tag eq '[/quote]' && $open[$#open] eq 'quote') { |