Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
282b77ee
Commit
282b77ee
authored
6 years ago
by
XhmikosR
Browse files
Options
Download
Email Patches
Plain Diff
docs search: take into account the current URL.
parent
a16ffc7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
site/_includes/docs-sidebar.html
+1
-1
site/_includes/docs-sidebar.html
site/docs/4.1/assets/js/src/search.js
+16
-3
site/docs/4.1/assets/js/src/search.js
with
17 additions
and
4 deletions
+17
-4
site/_includes/docs-sidebar.html
+
1
-
1
View file @
282b77ee
<form
class=
"bd-search d-flex align-items-center"
>
<form
class=
"bd-search d-flex align-items-center"
>
<input
type=
"search"
class=
"form-control"
id=
"search-input"
placeholder=
"Search..."
aria-label=
"Search for..."
autocomplete=
"off"
data-siteurl=
"{{ site.url }}"
data-docs-version=
"{{ site.docs_version }}"
>
<input
type=
"search"
class=
"form-control"
id=
"search-input"
placeholder=
"Search..."
aria-label=
"Search for..."
autocomplete=
"off"
data-docs-version=
"{{ site.docs_version }}"
>
<button
class=
"btn btn-link bd-search-docs-toggle d-md-none p-0 ml-3"
type=
"button"
data-toggle=
"collapse"
data-target=
"#bd-docs-nav"
aria-controls=
"bd-docs-nav"
aria-expanded=
"false"
aria-label=
"Toggle docs navigation"
>
<button
class=
"btn btn-link bd-search-docs-toggle d-md-none p-0 ml-3"
type=
"button"
data-toggle=
"collapse"
data-target=
"#bd-docs-nav"
aria-controls=
"bd-docs-nav"
aria-expanded=
"false"
aria-label=
"Toggle docs navigation"
>
{%- include icons/menu.svg width="30" height="30" -%}
{%- include icons/menu.svg width="30" height="30" -%}
</button>
</button>
...
...
This diff is collapsed.
Click to expand it.
site/docs/4.1/assets/js/src/search.js
+
16
-
3
View file @
282b77ee
...
@@ -12,6 +12,19 @@
...
@@ -12,6 +12,19 @@
var
inputElement
=
document
.
getElementById
(
'
search-input
'
)
var
inputElement
=
document
.
getElementById
(
'
search-input
'
)
var
siteDocsVersion
=
inputElement
.
getAttribute
(
'
data-docs-version
'
)
var
siteDocsVersion
=
inputElement
.
getAttribute
(
'
data-docs-version
'
)
function
getOrigin
()
{
var
location
=
window
.
location
var
origin
=
location
.
origin
if
(
!
origin
)
{
var
port
=
location
.
port
?
'
:
'
+
location
.
port
:
''
origin
=
location
.
protocol
+
'
//
'
+
location
.
hostname
+
port
}
return
origin
}
window
.
docsearch
({
window
.
docsearch
({
apiKey
:
'
5990ad008512000bba2cf951ccf0332f
'
,
apiKey
:
'
5990ad008512000bba2cf951ccf0332f
'
,
indexName
:
'
bootstrap
'
,
indexName
:
'
bootstrap
'
,
...
@@ -27,11 +40,11 @@
...
@@ -27,11 +40,11 @@
},
},
transformData
:
function
(
hits
)
{
transformData
:
function
(
hits
)
{
return
hits
.
map
(
function
(
hit
)
{
return
hits
.
map
(
function
(
hit
)
{
// When in production, return the result as is,
var
siteurl
=
getOrigin
()
// otherwise remove our url from it.
var
siteurl
=
inputElement
.
getAttribute
(
'
data-siteurl
'
)
var
urlRE
=
/^https
?
:
\/\/
getbootstrap
\.
com/
var
urlRE
=
/^https
?
:
\/\/
getbootstrap
\.
com/
// When in production, return the result as is,
// otherwise remove our url from it.
hit
.
url
=
siteurl
.
match
(
urlRE
)
?
hit
.
url
:
hit
.
url
.
replace
(
urlRE
,
''
)
hit
.
url
=
siteurl
.
match
(
urlRE
)
?
hit
.
url
:
hit
.
url
.
replace
(
urlRE
,
''
)
return
hit
return
hit
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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