Active playlists artist and track titles, drag control, play from tracklist
This commit is contained in:
@@ -59,16 +59,24 @@ Player = (function() {
|
||||
}
|
||||
initial_count = $('.playlist-tracks li').length;
|
||||
$('.playlist-tracks').append('\
|
||||
<li id="i' + Math.round(Math.random() * 999999) + '" data-artist="' + artist.trim() + '" data-album="' + album.trim() + '" data-track="' + track.trim() + '" data-length="' + length + '">\
|
||||
<li id="i' + Math.round(Math.random() * 999999) + '" data-id="" data-artist="' + artist.trim() + '" data-album="' + album.trim() + '" data-track="' + track.trim() + '" data-length="' + length + '">\
|
||||
<div class="item">\
|
||||
<div class="fade"></div>\
|
||||
<span class="title" title="' + artist.htmlsafe() + " — " + track.htmlsafe() + '">' + artist + ' — ' + track + '</span>\
|
||||
<div class="dragbox"></div>\
|
||||
<span class="title">\
|
||||
<span class="data artist" title="Open ' + artist.htmlsafe() + '\'s page">' + artist + '</span>\
|
||||
—\
|
||||
<span class="playtrack" title="Play ' + track.htmlsafe() + ' by ' + artist.htmlsafe() + '">' + track + '</span>\
|
||||
</span>\
|
||||
<span class="duration">' + length + '</span>\
|
||||
<div class="remove">remove</div>\
|
||||
</div>\
|
||||
</li>');
|
||||
$('.playlist').html($('.playlist-tracks')).scrollbar();
|
||||
$('.playlist-tracks').sortable();
|
||||
$('.playlist').html($('.playlist-tracks')).scrollbar;
|
||||
$('.playlist-tracks').sortable({
|
||||
axis: 'y',
|
||||
handle: '.dragbox'
|
||||
});
|
||||
if (autoplay) {
|
||||
return _player.setTrack($('.playlist-tracks li').last().attr('id').split('i')[1]);
|
||||
} else if (initial_count === 0 && !_player.hasTrack()) {
|
||||
@@ -231,8 +239,8 @@ $('.playlist-tracks li .remove').live('click', function() {
|
||||
$li.remove();
|
||||
return false;
|
||||
});
|
||||
$('.playlist-tracks li').live('dblclick', function() {
|
||||
_player.setTrack($(this).attr('id').split('i')[1]);
|
||||
$('.playlist-tracks li .title .playtrack').live('click', function() {
|
||||
_player.setTrack($(this).parent().parent().parent().attr('id').split('i')[1]);
|
||||
return false;
|
||||
});
|
||||
$('.add-album').live('click', function() {
|
||||
@@ -265,7 +273,7 @@ $('.tracklist li').live('mouseover mouseout', function(e) {
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('.tracklist li').live('dblclick', function(e) {
|
||||
$('.tracklist li').live('click', function(e) {
|
||||
var album, artist, length, track_name;
|
||||
artist = $('.artist-info .name').html();
|
||||
album = $(this).parent().parent().parent().find('h2.name').text().replace(/\s\([\d]{4}\)$/, '');
|
||||
|
||||
@@ -70,4 +70,8 @@ $('#search_form').live('submit', function() {
|
||||
$('.suggestions a').live('click', function() {
|
||||
$('#search_field').val($(this).text());
|
||||
return false;
|
||||
});
|
||||
$('.data.artist').live('click', function() {
|
||||
_ajax.go('/artist/' + $(this).text().replace(' ', '+') + '/');
|
||||
return false;
|
||||
});
|
||||
Reference in New Issue
Block a user