summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/script.js11
-rw-r--r--lib/VNDB/Handler/Releases.pm2
-rw-r--r--lib/VNDB/Handler/Tags.pm2
-rw-r--r--lib/VNDB/Handler/VNBrowse.pm2
-rw-r--r--lib/VNDB/Util/LayoutHTML.pm15
5 files changed, 12 insertions, 20 deletions
diff --git a/data/script.js b/data/script.js
index cde63441..8d89349e 100644
--- a/data/script.js
+++ b/data/script.js
@@ -2136,8 +2136,7 @@ function filLoad() {
f.submit();
}}),
tag('input', {type:'button', 'class':'submit', value: mt('_js_fil_reset'), onclick:function () { byId('fil').value = ''; filDeSerialize()} }),
- typeof PREFS != 'undefined' && ('filter_vn' in PREFS | 'filter_release' in PREFS) && PREF_CODE != '' ?
- tag('input', {type:'button', 'class':'submit', value: mt('_js_fil_save'), onclick:filSaveDefault }) : null,
+ byId('pref_code') ? tag('input', {type:'button', 'class':'submit', value: mt('_js_fil_save'), onclick:filSaveDefault }) : null,
tag('p', {id:'fil_savenote', 'class':'hidden'}, '')
));
filSelectCat(1);
@@ -2152,7 +2151,7 @@ function filSaveDefault() {
but.enabled = false;
setClass(byId('fil_savenote'), 'hidden', false);
var type = byId('filselect').href.match(/#r$/) ? 'release' : 'vn';
- ajax('/xml/prefs.xml?formcode='+PREF_CODE+';key=filter_'+type+';value='+byId('fil').value, function (hr) {
+ ajax('/xml/prefs.xml?formcode='+byId('pref_code').title+';key=filter_'+type+';value='+byId('fil').value, function (hr) {
setText(note, mt('_js_fil_savenote'));
but.enable = true;
});
@@ -2603,8 +2602,8 @@ function filVN() {
ontagpage ? [ mt('_vnbrowse_tags'),
[ '', ' ', tag(mt('_vnbrowse_tagnothere')) ],
] : [ mt('_vnbrowse_tags'),
- [ '', ' ', tag(mt('_js_fil_booland')) ],
- [ '', ' ', PREF_CODE != '' ? tag(mt('_vnbrowse_tagactive')) : null ],
+ [ '', ' ', tag(mt('_js_fil_booland')) ],
+ [ '', ' ', byId('pref_code') ? tag(mt('_vnbrowse_tagactive')) : null ],
filFTagInput('tag_inc', mt('_vnbrowse_taginc'), 'tag'),
filFTagInput('tag_exc', mt('_vnbrowse_tagexc'), 'tag'),
filFOptions('tagspoil', ' ', [[0, mt('_vnbrowse_spoil0')],[1, mt('_vnbrowse_spoil1')],[2, mt('_vnbrowse_spoil2')]],
@@ -2613,7 +2612,7 @@ function filVN() {
[ mt('_vnbrowse_language'), filFSelect('lang', mt('_vnbrowse_language'), 20, lang) ],
[ mt('_vnbrowse_olang'), filFSelect('olang',mt('_vnbrowse_olang'), 20, lang) ],
[ mt('_vnbrowse_platform'), filFSelect('plat', mt('_vnbrowse_platform'), 20, plat) ],
- PREF_CODE == '' ? null : [
+ !byId('pref_code') ? null : [
mt('_vnbrowse_ul'),
filFOptions('ul_notblack', mt('_vnbrowse_ul_notblack'), [[1, mt('_vnbrowse_ul_notblackmsg')]]),
filFOptions('ul_onwish', mt('_vnbrowse_ul_onwish'), [[0, mt('_vnbrowse_ul_onwishno')],[1, mt('_vnbrowse_ul_onwishyes')]]),
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 6fae5683..805329af 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -552,7 +552,7 @@ sub browse {
end;
end;
}
- $self->htmlFooter(prefs => [qw|filter_release|]);
+ $self->htmlFooter(pref_code => 1);
}
diff --git a/lib/VNDB/Handler/Tags.pm b/lib/VNDB/Handler/Tags.pm
index 1b67fadc..c8cf362a 100644
--- a/lib/VNDB/Handler/Tags.pm
+++ b/lib/VNDB/Handler/Tags.pm
@@ -127,7 +127,7 @@ sub tagpage {
$self->htmlBrowseVN($list, $f, $np, "/g$t->{id}?fil=$f->{fil};m=$f->{m}", 1) if @$list;
}
- $self->htmlFooter(prefs => ['filter_vn']);
+ $self->htmlFooter(pref_code => 1);
}
diff --git a/lib/VNDB/Handler/VNBrowse.pm b/lib/VNDB/Handler/VNBrowse.pm
index f714b93e..7af01048 100644
--- a/lib/VNDB/Handler/VNBrowse.pm
+++ b/lib/VNDB/Handler/VNBrowse.pm
@@ -100,7 +100,7 @@ sub list {
end 'form';
$self->htmlBrowseVN($list, $f, $np, "/v/$char?q=$quri;fil=$f->{fil}", $f->{fil} =~ /tag_inc-/);
- $self->htmlFooter(prefs => ['filter_vn']);
+ $self->htmlFooter(pref_code => 1);
}
diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm
index fc7ec8ad..7de7f709 100644
--- a/lib/VNDB/Util/LayoutHTML.pm
+++ b/lib/VNDB/Util/LayoutHTML.pm
@@ -133,7 +133,7 @@ sub _menu {
}
-sub htmlFooter { # %options => { prefs => [pref1,..] }
+sub htmlFooter { # %options => { pref_code => 1 }
my($self, %o) = @_;
div id => 'footer';
@@ -156,16 +156,9 @@ sub htmlFooter { # %options => { prefs => [pref1,..] }
end;
end 'div'; # /maincontent
- # insert users' preference data when required by JS
- if($o{prefs}) {
- script type => 'text/javascript';
- txt sprintf "PREF_CODE='%s';", $self->authInfo->{id} ? $self->authGetCode('/xml/prefs.xml') : '';
- txt 'PREFS={';
- # assumes the preference value doesn't contain a '
- txt join ',', map sprintf("'%s':'%s'", $_, $self->authPref($_)), @{$o{prefs}};
- txt '};';
- end;
- }
+ # Abuse an empty noscript tag for the formcode to update a preference setting, if the page requires one.
+ noscript id => 'pref_code', title => $self->authGetCode('/xml/prefs.xml'), ''
+ if $o{pref_code} && $self->authInfo->{id};
script type => 'text/javascript', src => $self->{url_static}.'/f/js/'.$self->{l10n}->language_tag().'.js?'.$self->{version}, '';
end 'body';
end 'html';