am 71b28a60
: Merge "docs: add check in hash-change callback to be sure we\'re only dealing with hash-tags that are search queries. bug: 6843654" into jb-dev
* commit '71b28a600e52922a7a18b990f256b2fa104d32e8': docs: add check in hash-change callback to be sure we're only dealing with hash-tags that are search queries. bug: 6843654
This commit is contained in:
@@ -282,7 +282,6 @@ function hideResults() {
|
|||||||
$("#searchResults").slideUp();
|
$("#searchResults").slideUp();
|
||||||
$(".search .close").addClass("hide");
|
$(".search .close").addClass("hide");
|
||||||
location.hash = '';
|
location.hash = '';
|
||||||
drawOptions.setInput(document.getElementById("searchResults"));
|
|
||||||
|
|
||||||
$("#search_autocomplete").val("").blur();
|
$("#search_autocomplete").val("").blur();
|
||||||
|
|
||||||
@@ -309,7 +308,6 @@ function hideResults() {
|
|||||||
var searchControl;
|
var searchControl;
|
||||||
|
|
||||||
function loadSearchResults() {
|
function loadSearchResults() {
|
||||||
|
|
||||||
document.getElementById("search_autocomplete").style.color = "#000";
|
document.getElementById("search_autocomplete").style.color = "#000";
|
||||||
|
|
||||||
// create search control
|
// create search control
|
||||||
@@ -397,11 +395,17 @@ function hideResults() {
|
|||||||
|
|
||||||
// when an event on the browser history occurs (back, forward, load) requery hash and do search
|
// when an event on the browser history occurs (back, forward, load) requery hash and do search
|
||||||
$(window).hashchange( function(){
|
$(window).hashchange( function(){
|
||||||
var query = decodeURI(getQuery(location.hash));
|
// Exit if the hash isn't a search query or there's an error in the query
|
||||||
if (query == "undefined") {
|
if ((location.hash.indexOf("q=") == -1) || (query == "undefined")) {
|
||||||
hideResults();
|
// If the results pane is open, close it.
|
||||||
return;
|
if (!$("#searchResults").is(":hidden")) {
|
||||||
|
hideResults();
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Otherwise, we have a search to do
|
||||||
|
var query = decodeURI(getQuery(location.hash));
|
||||||
searchControl.execute(query);
|
searchControl.execute(query);
|
||||||
$('#searchResults').slideDown('slow');
|
$('#searchResults').slideDown('slow');
|
||||||
$("#search_autocomplete").focus();
|
$("#search_autocomplete").focus();
|
||||||
|
Reference in New Issue
Block a user