      }
  
      $('pre code').parent().addClass('prettyprint well');
  
      $(document).on("submit", "#mkdocs_search_modal form", function (e) {
          $("#mkdocs-search-results").html("Searching...");
          initialise_search();
          return false;
      });
  
  });
 
</s> remove     $('pre code').parent().addClass('prettyprint well');
 </s> add   $('pre code').parent().addClass('prettyprint well'); </s> remove     var search_term = getSearchTerm();
    if(search_term){
        $('#mkdocs_search_modal').modal();
    }
 </s> add $(function() {
  var searchTerm = getSearchTerm(),
    $searchModal = $('#mkdocs_search_modal'),
    $searchQuery = $searchModal.find('#mkdocs-search-query'),
    $searchResults = $searchModal.find('#mkdocs-search-results'); </s> remove $(function() {

    var initialise_search = function(){
        require.config({"baseUrl":"/mkdocs/js"});
        require(["search",]);
    }
 </s> add var initilizeSearch = function() {
  require.config({ baseUrl: '/mkdocs/js' });
  require(['search']);
}; </s> remove }
 </s> add   }
};
  if (searchTerm) {
    $searchQuery.val(searchTerm);
    $searchResults.text('Searching...');
    $searchModal.modal();
  }
      }
  
      $('pre code').parent().addClass('prettyprint well');
  
  if (searchTerm) {
    $searchQuery.val(searchTerm);
    $searchResults.text('Searching...');
    $searchModal.modal();
  }
  if (searchTerm) {
    $searchQuery.val(searchTerm);
    $searchResults.text('Searching...');
    $searchModal.modal();
  }
  if (searchTerm) {
    $searchQuery.val(searchTerm);
    $searchResults.text('Searching...');
    $searchModal.modal();
  }
  if (searchTerm) {
    $searchQuery.val(searchTerm);
    $searchResults.text('Searching...');
    $searchModal.modal();
  }
  if (searchTerm) {
    $searchQuery.val(searchTerm);
    $searchResults.text('Searching...');
    $searchModal.modal();
  }
  
  });
keep keep keep keep replace replace replace replace replace keep keep
 Fix weird search behavior. Closes #3197 
docs_theme/js/theme.js