51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
function loadArtistData(name) {
|
|
setArchor('/artist/'+ name +'/');
|
|
$.get('/artist/'+ name +'/', function(data){
|
|
if (typeof data.error != 'undefined') {
|
|
if (data.error == 'loading') {
|
|
loadWheePage();
|
|
} else if (data.error == 404) {
|
|
load404Page();
|
|
}
|
|
return false;
|
|
}
|
|
Pages.renderArtist(data);
|
|
})
|
|
}
|
|
function loadSearchPage() {
|
|
setArchor('/search/');
|
|
$.get('/demo/search.html', function(data){
|
|
$('#data-container').html(data);
|
|
})
|
|
}
|
|
function loadWheePage() {
|
|
$.get('/demo/whee.html', function(data){
|
|
$('#data-container').html(data);
|
|
})
|
|
}
|
|
function load404Page() {
|
|
$.get('/demo/404.html', function(data){
|
|
$('#data-container').html(data);
|
|
})
|
|
}
|
|
|
|
$(function(){
|
|
$('a.data.artist').live('click', function(){
|
|
loadArtistData($(this).html());
|
|
return false;
|
|
});
|
|
$('.search').live('click', function(){
|
|
loadSearchPage();
|
|
return false;
|
|
});
|
|
$('#search_form').live('submit', function(){
|
|
$('.autocomplete-container').remove();
|
|
loadArtistData($('#search_field').val());
|
|
return false;
|
|
});
|
|
})
|
|
|
|
function setArchor(anchor) {
|
|
window.location = '#'+ anchor;
|
|
}
|