diff options
-rw-r--r-- | data/skingen/style.css | 7 | ||||
-rw-r--r-- | lib/VNDB/Func.pm | 12 | ||||
-rw-r--r-- | static/f/script.js | 8 |
3 files changed, 23 insertions, 4 deletions
diff --git a/data/skingen/style.css b/data/skingen/style.css index 04870d77..929bca2f 100644 --- a/data/skingen/style.css +++ b/data/skingen/style.css @@ -90,6 +90,13 @@ b.todo { font-weight: normal; color: $statnok$ } height: 0; } +b.spoiler, b.spoiler a { + color: #000; + background-color: #000; + font-weight: normal; +} +b.spoiler_shown { font-weight: normal } + diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index 9abacad0..1833be37 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -98,7 +98,6 @@ sub bb2html { my $e = sub { local $_ = shift; - tr/A-Za-z/N-ZA-Mn-za-m/ if !@_ && grep /spoiler/, @open; s/&/&/g; s/>/>/g; s/</</g; @@ -113,9 +112,14 @@ sub bb2html { my $lit = $_; if($open[$#open] ne 'raw') { if ($_ eq '[raw]') { push @open, 'raw'; next } - elsif ($_ eq '[spoiler]') { push @open, 'spoiler'; next } - elsif ($_ eq '[/spoiler]') { pop @open if $open[$#open] eq 'spoiler'; next } - elsif ($_ eq '[/url]') { + elsif ($_ eq '[spoiler]') { push @open, 'spoiler'; $result .= '<b class="spoiler">'; next } + elsif ($_ eq '[/spoiler]') { + if($open[$#open] eq 'spoiler') { + $result .= '</b>'; + pop @open; + } + next; + } elsif($_ eq '[/url]') { if($open[$#open] eq 'url') { $result .= '</a>'; pop @open; diff --git a/static/f/script.js b/static/f/script.js index 6726d311..093bcb74 100644 --- a/static/f/script.js +++ b/static/f/script.js @@ -375,6 +375,14 @@ DOMLoad(function() { if(x('jt_select')) jtInit(); + // spoiler tags + l = document.getElementsByTagName('b'); + for(i=0;i<l.length;i++) + if(l[i].className == 'spoiler') { + l[i].onmouseover = function() { this.className = 'spoiler_shown' }; + l[i].onmouseout = function() { this.className = 'spoiler' }; + } + // forms.js if(x('categories')) catLoad(); |