search page: avoid propagating "q" query
When you search in a page other than the main search page, the search request is communicated as a "q" query in the URL. Meanwhile, the search page generally propagates all query arguments, as a kind of store-passing facility, which means that the "q" query was passed along. Avoid adding the "q" to search results, so it doesn't get propagated so much. Closes #936
This commit is contained in:
parent
613e142447
commit
09b61f06c1
|
@ -679,11 +679,23 @@ function UncompactHtml(x) {
|
|||
}
|
||||
}
|
||||
|
||||
function StripQArg(args) {
|
||||
// Don't propagate the `q=...` argument that is used to communicate
|
||||
// to this search page
|
||||
if (!args)
|
||||
return false;
|
||||
args = args.replace(/^[?]q=[^&]*&/,"?").replace(/^[?]q=[^&]*$/,"?").replace(/&q=[^&]*/,"");
|
||||
if (args == "?")
|
||||
return false;
|
||||
else
|
||||
return args;
|
||||
}
|
||||
|
||||
function UpdateResults() {
|
||||
if (first_search_result < 0 ||
|
||||
first_search_result >= search_results.length)
|
||||
first_search_result = 0;
|
||||
var link_args = (page_query_string && ("?"+page_query_string));
|
||||
var link_args = page_query_string && StripQArg("?"+page_query_string);
|
||||
for (var i=0; i<result_links.length; i++) {
|
||||
var n = i + first_search_result;
|
||||
if (n < search_results.length) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user