1
0
Fork 0
oldhaven/public/javascripts/beathaven/search.js

46 lines
1.0 KiB
JavaScript
Raw Normal View History

var Search = {
showSpinner: function() {
$('#search-container input').attr('disabled', 'disabled').blur();
$('#search-container img').show();
Search.hideSuggestions();
},
hideSpinner: function() {
$('#search-container input').removeAttr('disabled');
$('#search_field').focus();
$('#search-container img').hide();
},
showSuggestions: function(values) {
for (var i = 0; i < values.length; i++) {
$('.suggestions ul').append('\
<li>\
<a class="data artist">'+ values[i] +'</a>\
</li>\
');
}
$('.suggestions').show();
},
hideSuggestions: function() {
$('.suggestions ul li').remove();
$('.suggestions').hide();
}
}
$(function(){
$('.search').live('click', function(){
Ajax.loadSearchPage();
return false;
});
$('#search_form').live('submit', function(){
$('.autocomplete-container').remove();
Ajax.loadArtistData($('#search_field').val());
return false;
});
$('.suggestions a').live('click', function(){
$('#search_field').val($(this).text());
return false;
});
});