summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-12-27 10:57:33 +0100
committerYorhel <git@yorhel.nl>2008-12-27 10:57:33 +0100
commit6713e044e0b1a0a9dbb61da7a2ce6f252dc95f12 (patch)
tree3c371eb3cd920316fdcb502e7a66a4e875847954
parent89a7b892aafe5e4138d62bf37c877d186d7dfcc8 (diff)
[spoiler] tag produces mouseover-style spoilers instead of ROT13
-rw-r--r--data/skingen/style.css7
-rw-r--r--lib/VNDB/Func.pm12
-rw-r--r--static/f/script.js8
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/&/&amp;/g;
s/>/&gt;/g;
s/</&lt;/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();