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

better this handling

parent 4825d24f
Branches
No related tags found
No related merge requests found
......@@ -26,7 +26,7 @@ djr.Backend.prototype.search = function(query, callback, ctx) {
data: {'q': query},
dataType: 'json',
type: 'GET',
context: ctx,
context: ctx || this,
success: function(data, status, jqxhr) {
callback(data.results);
}
......@@ -38,7 +38,7 @@ djr.Backend.prototype.getPlaylist = function(uuid, callback, ctx) {
$.ajax({url: '/json/playlist/get/' + uuid,
dataType: 'json',
type: 'GET',
context: ctx,
context: ctx || this,
success: function(data, status, jqxhr) {
callback(new djr.PlaylistChunk(data.songs));
}
......@@ -201,7 +201,6 @@ djr.Player.prototype.removeChunkCallback = function() {
djr.Player.prototype.search = function(query) {
var player = this;
djr.debug('djr.player.search: query=' + query + ', this=' + this);
this.backend.search(query, function(results) {
var songs = [];
$.each(results, function(idx, item) {
......@@ -212,10 +211,10 @@ djr.Player.prototype.search = function(query) {
return;
}
var chunk_id = this.playlist.addChunk(new djr.PlaylistChunk(songs));
var chunk_id = player.playlist.addChunk(new djr.PlaylistChunk(songs));
djr.debug('search: new chunk ' + chunk_id);
this.backend.getHtmlForSongs(songs, function(songs_html) {
player.backend.getHtmlForSongs(songs, function(songs_html) {
var chunk_div = 'chunk_' + chunk_id;
player.hideAllChunks();
$('#playlistDiv').append(
......@@ -229,8 +228,8 @@ djr.Player.prototype.search = function(query) {
$('#' + chunk_div + ' .album_a').click(function() {
player.search('(album:\"' + $(this).text() + '\")');
});
}, player);
}, player);
});
});
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment