forked from encode/django-rest-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only load the search results when the search form is submitted for the
first time
- Loading branch information
Showing
3 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,35 @@ | ||
$(function(){ | ||
function getSearchTerm() | ||
{ | ||
var sPageURL = window.location.search.substring(1); | ||
var sURLVariables = sPageURL.split('&'); | ||
for (var i = 0; i < sURLVariables.length; i++) | ||
{ | ||
var sParameterName = sURLVariables[i].split('='); | ||
if (sParameterName[0] == 'q') | ||
{ | ||
return sParameterName[1]; | ||
} | ||
} | ||
} | ||
|
||
$(function() { | ||
|
||
var initialise_search = function(){ | ||
require.config({"baseUrl":"/mkdocs/js"}); | ||
require(["search",]); | ||
} | ||
|
||
var search_term = getSearchTerm(); | ||
if(search_term){ | ||
$('#mkdocs_search_modal').modal(); | ||
} | ||
|
||
$('pre code').parent().addClass('prettyprint well'); | ||
|
||
$(document).on("submit", "#mkdocs_search_modal form", function (e) { | ||
$("#mkdocs-search-results").html("Searching...") | ||
initialise_search(); | ||
return false; | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters