2015-07-30 04:25:21 +03:00
|
|
|
var getSearchTerm = function() {
|
|
|
|
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];
|
2015-04-24 00:18:35 +03:00
|
|
|
}
|
2015-07-30 04:25:21 +03:00
|
|
|
}
|
|
|
|
};
|
2015-04-24 00:18:35 +03:00
|
|
|
|
2015-07-30 04:25:21 +03:00
|
|
|
$(function() {
|
|
|
|
var searchTerm = getSearchTerm(),
|
|
|
|
$searchModal = $('#mkdocs_search_modal'),
|
|
|
|
$searchQuery = $searchModal.find('#mkdocs-search-query'),
|
|
|
|
$searchResults = $searchModal.find('#mkdocs-search-results');
|
2014-12-10 14:33:30 +03:00
|
|
|
|
2015-07-30 04:25:21 +03:00
|
|
|
$('pre code').parent().addClass('prettyprint well');
|
2014-12-10 14:33:30 +03:00
|
|
|
|
2015-07-30 04:25:21 +03:00
|
|
|
if (searchTerm) {
|
|
|
|
$searchQuery.val(searchTerm);
|
|
|
|
$searchResults.text('Searching...');
|
|
|
|
$searchModal.modal();
|
|
|
|
}
|
2015-04-24 00:18:35 +03:00
|
|
|
|
2015-07-30 04:25:21 +03:00
|
|
|
$searchModal.on('shown', function() {
|
|
|
|
$searchQuery.focus();
|
|
|
|
});
|
2014-12-10 14:33:30 +03:00
|
|
|
});
|