compass/doc-src/content/search.haml

28 lines
772 B
Plaintext
Raw Normal View History

---
title: Search | Compass Documentation
crumb: Search
body_id: search
---
- content_for(:javascripts) do
%script(type="text/javascript" src="/docs/javascripts/search-data.js")
:javascript
$(function(){
$('input').keypress(function(){
search(this.value, displayResults);
});
})
function displayResults(items) {
if (items.length > 0) {
var html = ""
for (var i = 0; i < items.length; i++) {
html += '<li><a href="'+items[i].url+'">'+items[i].title+'</a></li>';
}
$('ol#results').html(html)
} else {
$('ol#results').html("<li class='none'>Nothing found.</li>");
}
}
%input{:type => "text", :placeholder=>"Search"}
%ol#results
%li.none Please enter a search term.