1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

basic docs search

This commit is contained in:
Mark Otto 2014-12-24 02:44:38 -08:00
parent 952be04cb0
commit 73e59c26e6
8 changed files with 70 additions and 5 deletions

View file

@ -2,6 +2,12 @@
<a href="{{ site.baseurl }}/" class="navbar-brand">
Bootstrap
</a>
<div class="bs-docs-search">
<input type="text" class="form-control" id="search-input" placeholder="Search...">
<ul class="dropdown-menu bs-docs-search-results" id="search-results"></ul>
</div>
{% for group in site.data.nav %}
{% assign link = group.pages | first %}
{% assign slug = group.title | downcase | replace: ' ', '-' || page.title | downcase | replace: ' ', '-' %}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -147,6 +147,13 @@
.tooltip('show')
})
SimpleJekyllSearch.init({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('search-results'),
searchResultTemplate: '<li><a href="{url}">{title}</a></li>',
dataSource: '/search.json'
})
})
}(jQuery)

File diff suppressed because one or more lines are too long

View file

@ -623,9 +623,6 @@ body {
overflow-y: auto;
@include gradient-vertical(#29262f, #322f38);
}
.bs-docs-sidebar .navbar-brand {
margin-bottom: 15px;
}
}
.bs-docs-sidebar .navbar-brand {
@ -644,6 +641,46 @@ body {
text-decoration: none;
}
.bs-docs-search {
position: relative;
margin-left: 1.25rem;
margin-right: 1.25rem;
margin-bottom: 1.5rem;
.form-control {
height: 2.45rem;
padding-top: .4rem;
padding-bottom: .4rem;
color: rgba(255,255,255,.5);
background-color: lighten(#29262f, 10%);
border-color: lighten(#29262f, 15%);
&:focus {
border-color: rgba(255,255,255,.25);
box-shadow: 0 0 .5rem rgba(255,255,255,.25);
}
}
}
.bs-docs-search-results {
top: 108%;
right: 0;
display: block;
padding: 0;
font-size: .9rem;
overflow: hidden;
border: 0;
> li > a {
padding-left: .75rem;
padding-right: .75rem;
}
> li:first-child { padding-top: .25rem; }
> li:last-child { padding-bottom: .25rem; }
}
.bs-docs-sidenav {
display: none;
}

13
docs/search.json Normal file
View file

@ -0,0 +1,13 @@
---
# Leave it empty to compile
---
[
{% for page in site.pages %}
{
"title" : "{{ page.title | escape }}",
"url" : "{{ site.baseurl }}{{ page.url }}",
"date" : "{{ page.date }}"
} {% unless forloop.last %},{% endunless %}
{% endfor %}
]

View file

@ -2,6 +2,7 @@
"paths": {
"docsJs": [
"assets/js/vendor/holder.js",
"assets/js/vendor/jekyll-search.js",
"assets/js/vendor/ZeroClipboard.min.js",
"assets/js/src/application.js"
]