Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
accd8fe1
Commit
accd8fe1
authored
Jul 30, 2015
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3198 from jpadilla/search
Fix weird search behavior
parents
6e3ba202
ea1a8f4a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
docs_theme/base.html
+1
-1
docs_theme/js/theme.js
+21
-21
No files found.
docs_theme/base.html
View file @
accd8fe1
...
@@ -69,7 +69,7 @@
...
@@ -69,7 +69,7 @@
</div>
</div>
<div
class=
"modal-body"
>
<div
class=
"modal-body"
>
<form
role=
"form"
>
<form
role=
"form"
autocomplete=
"off"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<input
type=
"text"
name=
"q"
class=
"form-control"
placeholder=
"Search..."
id=
"mkdocs-search-query"
>
<input
type=
"text"
name=
"q"
class=
"form-control"
placeholder=
"Search..."
id=
"mkdocs-search-query"
>
</div>
</div>
...
...
docs_theme/js/theme.js
View file @
accd8fe1
function
getSearchTerm
()
var
getSearchTerm
=
function
()
{
{
var
sPageURL
=
window
.
location
.
search
.
substring
(
1
);
var
sPageURL
=
window
.
location
.
search
.
substring
(
1
);
var
sURLVariables
=
sPageURL
.
split
(
'&'
);
var
sURLVariables
=
sPageURL
.
split
(
'&'
);
for
(
var
i
=
0
;
i
<
sURLVariables
.
length
;
i
++
)
for
(
var
i
=
0
;
i
<
sURLVariables
.
length
;
i
++
)
{
{
var
sParameterName
=
sURLVariables
[
i
].
split
(
'='
);
var
sParameterName
=
sURLVariables
[
i
].
split
(
'='
);
if
(
sParameterName
[
0
]
==
'q'
)
if
(
sParameterName
[
0
]
===
'q'
)
{
{
return
sParameterName
[
1
];
return
sParameterName
[
1
];
}
}
}
}
}
};
var
initilizeSearch
=
function
()
{
require
.
config
({
baseUrl
:
'/mkdocs/js'
});
require
([
'search'
]);
};
$
(
function
()
{
$
(
function
()
{
var
searchTerm
=
getSearchTerm
(),
$searchModal
=
$
(
'#mkdocs_search_modal'
),
$searchQuery
=
$searchModal
.
find
(
'#mkdocs-search-query'
),
$searchResults
=
$searchModal
.
find
(
'#mkdocs-search-results'
);
var
initialise_search
=
function
(){
$
(
'pre code'
).
parent
().
addClass
(
'prettyprint well'
);
require
.
config
({
"baseUrl"
:
"/mkdocs/js"
});
require
([
"search"
,]);
}
var
search_term
=
getSearchTerm
();
if
(
searchTerm
)
{
if
(
search_term
){
$searchQuery
.
val
(
searchTerm
);
$
(
'#mkdocs_search_modal'
).
modal
();
$searchResults
.
text
(
'Searching...'
);
$searchModal
.
modal
();
}
}
$
(
'pre code'
).
parent
().
addClass
(
'prettyprint well'
);
$searchModal
.
on
(
'shown'
,
function
()
{
$searchQuery
.
focus
();
$
(
document
).
on
(
"submit"
,
"#mkdocs_search_modal form"
,
function
(
e
)
{
initilizeSearch
();
$
(
"#mkdocs-search-results"
).
html
(
"Searching..."
);
initialise_search
();
return
false
;
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment