97 lines
3.4 KiB
JavaScript
97 lines
3.4 KiB
JavaScript
var Pages = {
|
|
|
|
renderArtist: function(data){
|
|
var artist_info = $('\
|
|
<div class="artist-info">\
|
|
<div class="pic">\
|
|
<img src="'+ data.artist.pic +'" alt="'+ data.artist.name +'" width="250" />\
|
|
</div>\
|
|
<h1 class="name">'+ data.artist.name +'</h1>\
|
|
<div class="info">\
|
|
'+ data.artist.desc +'\
|
|
</div>\
|
|
</div>\
|
|
');
|
|
|
|
var albums_info = $('<div class="albums"></div>');
|
|
$.each(data.albums, function(i, album){
|
|
if (album.year != null) {
|
|
var album_info = $('\
|
|
<div class="album">\
|
|
<h2 class="name">'+ album.name +' ('+ album.year +')</h2>\
|
|
<div class="pic">\
|
|
<img src="'+ (album.pic ? album.pic : '/images/kitteh.png') +'" alt="'+ album.name +' by '+ data.artist.name +'" width="250" height="250"/>\
|
|
<div class="add-album-button-container">\
|
|
<div class="add-album button gray">Add to Now Playing</div>\
|
|
</div>\
|
|
</div>\
|
|
<div class="tracklist">\
|
|
<ul>\
|
|
</ul>\
|
|
</div>\
|
|
</div>\
|
|
<div class="kaboom"></div>\
|
|
');
|
|
|
|
$.each(album.tracks.album, function(i, track){
|
|
var track_info = $('\
|
|
<li>\
|
|
<div class="add-track button gray">+</div>\
|
|
<div class="track-container">\
|
|
<div class="fade"></div>\
|
|
<span class="index">'+ (i+1) +'</span>\
|
|
<div class="trackname" title="'+ track.name.htmlsafe() +'">'+ track.name +'</div>\
|
|
<div class="length">'+ track.duration +'</div>\
|
|
</div>\
|
|
</li>\
|
|
');
|
|
|
|
$(album_info).find('.tracklist ul').append(track_info);
|
|
});
|
|
|
|
$(albums_info).append(album_info);
|
|
}
|
|
})
|
|
|
|
$('#data-container').css('backgroundImage', 'none');
|
|
$('#data-container .inner').html('').append(artist_info).append(albums_info);
|
|
|
|
yaCounter7596904.hit(Ajax.getAnchor(), data.artist.name, Ajax.referer);
|
|
Ajax.setTitle(data.artist.name);
|
|
},
|
|
|
|
renderSearch: function(data) {
|
|
$('#data-container').css('background', 'url(/images/concrete_wall_2.png) 0 -30px repeat');
|
|
$('#data-container .inner').html(data);
|
|
|
|
$('#search-container')
|
|
.css('marginLeft', ($('#data-container').width() - 425) / 2 + 'px')
|
|
.css('marginTop', ($('#data-container').height() / 2 - 230) +'px')
|
|
.height(($('#data-container').height() - $('#search_form').height()) / 2);
|
|
|
|
setTimeout(function(){
|
|
$('#search_field').bh_autocomplete({
|
|
serviceUrl: '/artist/autocomplete', // Страница для обработки запросов автозаполнения
|
|
minChars: 2, // Минимальная длина запроса для срабатывания автозаполнения
|
|
delimiter: /(,|;)\s*/, // Разделитель для нескольких запросов, символ или регулярное выражение
|
|
maxHeight: 400, // Максимальная высота списка подсказок, в пикселях
|
|
width: 415, // Ширина списка
|
|
zIndex: 9999, // z-index списка
|
|
deferRequestBy: 500, // Задержка запроса (мсек)
|
|
onSelect: Ajax.loadArtistData
|
|
});
|
|
$('#search_field').focus();
|
|
}, 501)
|
|
|
|
yaCounter7596904.hit(Ajax.getAnchor(), 'Artist Search', Ajax.referer);
|
|
Ajax.setTitle('Artist Search');
|
|
},
|
|
|
|
renderSettings: function(data) {
|
|
$('#data-container').css('background', 'none');
|
|
$('#data-container .inner').html(data);
|
|
yaCounter7596904.hit(Ajax.getAnchor(), 'Settings', Ajax.referer);
|
|
Ajax.setTitle('Settings');
|
|
$('.settings-container .tabs .tab').first().trigger('click');
|
|
}
|
|
} |