summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-03-21 17:20:04 +0100
committerYorhel <git@yorhel.nl>2009-03-21 17:20:04 +0100
commit662c12a73d1f1ec1a77b1c5199894db7ed6f9e28 (patch)
treea8059387e368e2d7e7f4f2a95af94db0283a5378 /lib
parent79687d7aa222e1ea8d6401d2aaa81c95e58c5b85 (diff)
Remember tag spoiler preference and use it as default
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/Tags.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/VNDB/Handler/Tags.pm b/lib/VNDB/Handler/Tags.pm
index bd00a7d0..63a98ed0 100644
--- a/lib/VNDB/Handler/Tags.pm
+++ b/lib/VNDB/Handler/Tags.pm
@@ -31,9 +31,11 @@ sub tagpage {
{ name => 's', required => 0, default => 'score', enum => [ qw|score title rel pop| ] },
{ name => 'o', required => 0, default => 'd', enum => [ 'a','d' ] },
{ name => 'p', required => 0, default => 1, template => 'int' },
- { name => 'm', required => 0, default => 1, enum => [qw|0 1 2|] },
+ { name => 'm', required => 0, default => -1, enum => [qw|0 1 2|] },
);
return 404 if $f->{_err};
+ my $tagspoil = $self->reqCookie('tagspoil');
+ $f->{m} = defined $tagspoil ? $tagspoil : 1 if $f->{m} == -1;
my($list, $np) = $t->{meta} || $t->{state} != 2 ? ([],0) : $self->dbTagVNs(
tag => $tag,
@@ -171,9 +173,9 @@ sub _vnlist {
div class => 'mainbox';
h1 'Visual novels';
p class => 'browseopts';
- a href => "/g$t->{id}?m=0", $f->{m} == 0 ? (class => 'optselected') : (), 'Hide spoilers';
- a href => "/g$t->{id}?m=1", $f->{m} == 1 ? (class => 'optselected') : (), 'Show minor spoilers';
- a href => "/g$t->{id}?m=2", $f->{m} == 2 ? (class => 'optselected') : (), 'Show major spoilers';
+ a href => "/g$t->{id}?m=0", $f->{m} == 0 ? (class => 'optselected') : (), onclick => "setCookie('tagspoil', 0);return true;", 'Hide spoilers';
+ a href => "/g$t->{id}?m=1", $f->{m} == 1 ? (class => 'optselected') : (), onclick => "setCookie('tagspoil', 1);return true;", 'Show minor spoilers';
+ a href => "/g$t->{id}?m=2", $f->{m} == 2 ? (class => 'optselected') : (), onclick => "setCookie('tagspoil', 2);return true;", 'Show major spoilers';
end;
if(!@$list) {
p "\n\nThis tag has not been linked to any visual novels yet, or they were hidden because of the spoiler settings.";