Skip to content
Snippets Groups Projects
Commit 9bbbd471 authored by ale's avatar ale
Browse files

add an icon/action for "more like this" search on each song

parent 8dfafd5c
No related branches found
No related tags found
No related merge requests found
......@@ -192,6 +192,17 @@ djr.Player.prototype.autoExtendCurrentPlaylist = function(callback) {
});
};
// Extend the current playlist with the results of a MoreLikeThis
// search based on a single selected song.
djr.Player.prototype.moreLikeThis = function(sha1) {
var player = this;
var songs = [sha1];
this.backend.moreLikeThese(songs, function(results) {
player.createChunk(results, 'like that');
});
};
djr.Player.prototype.createChunk = function(songs, chunk_title) {
// Create the new chunk, with unique songs.
var chunk = this.playlist.createUniqueChunk(songs, chunk_title);
......@@ -263,6 +274,10 @@ djr.Player.prototype.setChunkHtml = function(chunk, chunk_id, songs_html) {
var sha1 = $(this).parent().parent().attr('id').substr(5);
player.removeSong(sha1);
});
chunk_div.find('.chunk_inner .ctlbox .ctl_love').click(function() {
var sha1 = $(this).parent().parent().attr('id').substr(5);
player.moreLikeThis(sha1);
});
};
// Start playing a specific song.
......
{% macro render_song(mp3) -%}
<div class="song" id="song_{{ mp3.sha1 }}">
<div class="ctlbox" style="display:none;">
<a id="song_{{ mp3.sha1 }}_mlt" class="ctl_btn ctl_love"></a>
<a id="song_{{ mp3.sha1 }}_remove" class="ctl_btn ctl_remove"></a>
</div>
<a id="play_{{ mp3.sha1 }}" class="song_a">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment