1
0
Fork 0
oldhaven/public/js/beathaven/pages.js

97 lines
3.4 KiB
JavaScript
Raw Normal View History

2011-06-14 16:05:12 +00:00
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">\
2011-06-16 02:51:20 +00:00
<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>\
2011-06-16 00:19:40 +00:00
<div class="kaboom"></div>\
2011-06-14 16:05:12 +00:00
');
$.each(album.tracks.album, function(i, track){
var track_info = $('\
<li>\
<div class="add-track button gray">+</div>\
<div class="track-container">\
2011-06-26 07:56:07 +00:00
<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>\
');
2011-06-14 16:05:12 +00:00
$(album_info).find('.tracklist ul').append(track_info);
});
2011-06-14 16:05:12 +00:00
$(albums_info).append(album_info);
}
2011-06-14 16:05:12 +00:00
})
$('#data-container').css('backgroundImage', 'none');
2011-06-16 00:19:40 +00:00
$('#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(){
2011-06-22 22:56:32 +00:00
$('#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');
2011-06-21 20:44:19 +00:00
},
renderSettings: function(data) {
2011-06-22 04:52:56 +00:00
$('#data-container').css('background', 'none');
2011-06-21 20:44:19 +00:00
$('#data-container .inner').html(data);
yaCounter7596904.hit(Ajax.getAnchor(), 'Settings', Ajax.referer);
Ajax.setTitle('Settings');
2011-06-21 23:29:18 +00:00
$('.settings-container .tabs .tab').first().trigger('click');
2011-06-14 16:05:12 +00:00
}
2011-06-15 23:06:46 +00:00
}