Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71b28a60 authored by Scott Main's avatar Scott Main Committed by Android (Google) Code Review
Browse files

Merge "docs: add check in hash-change callback to be sure we're only dealing...

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
parents 55163c88 7f527b3f
Loading
Loading
Loading
Loading
+10 −6
Original line number Original line Diff line number Diff line
@@ -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")) {
          // If the results pane is open, close it.
          if (!$("#searchResults").is(":hidden")) {
            hideResults();
            hideResults();
          }
          return;
          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();