diff options
author | Yorhel <git@yorhel.nl> | 2010-02-01 13:27:23 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2010-02-01 13:29:35 +0100 |
commit | c2df52da18ce8a772a1dd70c8ff14b7527fd4339 (patch) | |
tree | 73743dd63ebba980c22bbfb2ed952ee7cb263a95 | |
parent | 2bda6076a93e45c259148f0723fff37cd5aa56dc (diff) |
Properly copy over search string on switching with the searchtabs
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | data/script.js | 16 | ||||
-rw-r--r-- | data/style.css | 6 | ||||
-rw-r--r-- | lib/VNDB/Util/CommonHTML.pm | 19 |
4 files changed, 26 insertions, 16 deletions
@@ -11,6 +11,7 @@ git - ? - Notification system (still only used for PMs) - Removed the ?l10n= paremeter - Remove sessions that haven't been used for more than a month + - Properly copy over search string on switching with the searchtabs 2.10 - 2010-01-10 - VN score on tag pages use plain averages instead of bayesian rating diff --git a/data/script.js b/data/script.js index 437385cd..07dd1581 100644 --- a/data/script.js +++ b/data/script.js @@ -1973,6 +1973,22 @@ if(byId('lang_select')) { l[i].onclick = f; } +// search tabs +if(byId('searchtabs')) { + var f = function() { + var str = byId('q').value; + if(str.length > 1) { + if(this.href.indexOf('/g') >= 0) + this.href += '/list'; + this.href += '?q=' + encodeURIComponent(str); + } + return true; + }; + var l = byName(byId('searchtabs'), 'a'); + for(var i=0; i<l.length; i++) + l[i].onclick = f; +} + // spam protection on all forms setTimeout(function() { for(i=1; i<document.forms.length; i++) diff --git a/data/style.css b/data/style.css index 14672ccf..d70e539d 100644 --- a/data/style.css +++ b/data/style.css @@ -457,16 +457,16 @@ fieldset.search { fieldset.search .submit { padding: 0 1px; } -p.searchtabs { +p#searchtabs { height: 12px; padding-right: 70px; } -p.searchtabs a { +p#searchtabs a { padding: 2px 6px 2px 6px; margin: 0 2px; color: $maintext$!important; } -p.searchtabs a:hover, p.searchtabs a.sel { +p#searchtabs a:hover, p#searchtabs a.sel { border: 1px solid $secborder$; border-bottom: none; padding: 1px 5px 2px 5px; diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm index 924c91fd..be56e4a8 100644 --- a/lib/VNDB/Util/CommonHTML.pm +++ b/lib/VNDB/Util/CommonHTML.pm @@ -397,20 +397,13 @@ sub htmlVoteStats { sub htmlSearchBox { my($self, $sel, $v) = @_; - # escape search query for use as a query string value - (my $q = $v||'') =~ s/&/%26/g; - $q =~ s/\?/%3F/g; - $q =~ s/;/%3B/g; - $q =~ s/ /%20/g; - $q = "?q=$q" if $q; - fieldset class => 'search'; - p class => 'searchtabs'; - a href => "/v/all$q", $sel eq 'v' ? (class => 'sel') : (), mt '_searchbox_vn'; - a href => "/r$q", $sel eq 'r' ? (class => 'sel') : (), mt '_searchbox_releases'; - a href => "/p/all$q", $sel eq 'p' ? (class => 'sel') : (), mt '_searchbox_producers'; - a href => '/g'.($q?"/list$q":''), $sel eq 'g' ? (class => 'sel') : (), mt '_searchbox_tags'; - a href => "/u/all$q", $sel eq 'u' ? (class => 'sel') : (), mt '_searchbox_users'; + p id => 'searchtabs'; + a href => '/v/all', $sel eq 'v' ? (class => 'sel') : (), mt '_searchbox_vn'; + a href => '/r', $sel eq 'r' ? (class => 'sel') : (), mt '_searchbox_releases'; + a href => '/p/all', $sel eq 'p' ? (class => 'sel') : (), mt '_searchbox_producers'; + a href => '/g', $sel eq 'g' ? (class => 'sel') : (), mt '_searchbox_tags'; + a href => '/u/all', $sel eq 'u' ? (class => 'sel') : (), mt '_searchbox_users'; end; input type => 'text', name => 'q', id => 'q', class => 'text', value => $v; input type => 'submit', class => 'submit', value => mt '_searchbox_submit'; |