summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-08-17 13:06:05 +0200
committerYorhel <git@yorhel.nl>2015-08-17 13:16:48 +0200
commit7f81ec60b4c3fd1b6ef5aed2fe4a7f44ee21eeb1 (patch)
tree028104124553bd46ad2c4d11172da43d14a868d6 /lib
parent0fcc3797a7cef3f063ebcbc59aecfab5eb89eecb (diff)
js: Clean up misc.js
- Individual blocks don't leak variables into the parent scope anymore. Previously some blocks would re-use variables from other blocks, creating (almost invisible) dependencies between te blocks. - More consistent code for ulist-change-dropdowns, and all of them have a ref= argument now. - Use 'hidden' class instead of style.display wherever that makes sense. - Remove dead 'advselect' code. Hasn't been used since the addition of search filters. - lang_select doesn't rely on the position of the language class in className anymore (seriously that stuff is fragile...)
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/ULists.pm10
-rw-r--r--lib/VNDB/Handler/VNPage.pm4
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/VNDB/Handler/ULists.pm b/lib/VNDB/Handler/ULists.pm
index 92383e4e..3fd7d41d 100644
--- a/lib/VNDB/Handler/ULists.pm
+++ b/lib/VNDB/Handler/ULists.pm
@@ -27,14 +27,15 @@ sub vnvote {
return if !$self->authCheckCode;
my $f = $self->formValidate(
- { get => 'v', regex => qr/^(-1|([1-9]|10)(\.[0-9])?)$/ }
+ { get => 'v', regex => qr/^(-1|([1-9]|10)(\.[0-9])?)$/ },
+ { get => 'ref', required => 0, default => "/v$id" }
);
return $self->resNotFound if $f->{_err} || ($f->{v} != -1 && ($f->{v} > 10 || $f->{v} < 1));
$self->dbVoteDel($uid, $id) if $f->{v} == -1;
$self->dbVoteAdd($id, $uid, $f->{v}*10) if $f->{v} > 0;
- $self->resRedirect('/v'.$id, 'temp');
+ $self->resRedirect($f->{ref}, 'temp');
}
@@ -46,14 +47,15 @@ sub vnwish {
return if !$self->authCheckCode;
my $f = $self->formValidate(
- { get => 's', enum => [ -1, @{$self->{wishlist_status}} ] }
+ { get => 's', enum => [ -1, @{$self->{wishlist_status}} ] },
+ { get => 'ref', required => 0, default => "/v$id" }
);
return $self->resNotFound if $f->{_err};
$self->dbWishListDel($uid, $id) if $f->{s} == -1;
$self->dbWishListAdd($id, $uid, $f->{s}) if $f->{s} != -1;
- $self->resRedirect('/v'.$id, 'temp');
+ $self->resRedirect($f->{ref}, 'temp');
}
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index f4b4b6e5..1f6a553b 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -361,12 +361,12 @@ sub page {
if(!$v->{image}) {
p mt '_vnpage_noimg';
} else {
- p $v->{img_nsfw} ? (id => 'nsfw_hid', style => $self->authPref('show_nsfw') ? 'display: block' : '') : ();
+ p $v->{img_nsfw} ? (id => 'nsfw_hid', $self->authPref('show_nsfw') ? () : (class => 'hidden')) : ();
img src => imgurl(cv => $v->{image}), alt => $v->{title};
i mt '_vnpage_imgnsfw_foot' if $v->{img_nsfw};
end;
if($v->{img_nsfw}) {
- p id => 'nsfw_show', $self->authPref('show_nsfw') ? (style => 'display: none') : ();
+ p id => 'nsfw_show', $self->authPref('show_nsfw') ? (class => 'hidden') : ();
txt mt('_vnpage_imgnsfw_msg');
br; br;
a href => '#', mt '_vnpage_imgnsfw_show';