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

add a "skip" button (Next)

parent 7227d04f
No related branches found
No related tags found
No related merge requests found
...@@ -224,6 +224,17 @@ djr.Backend.prototype.nowPlaying = function(song, old_songs) { ...@@ -224,6 +224,17 @@ djr.Backend.prototype.nowPlaying = function(song, old_songs) {
}); });
}; };
/**
* Report that we skipped a song.
*
* @param {string} song SHA1 hash of the song that was skipped
djr.Backend.prototype.skipSong = function(song) {
$.ajax({url: '/json/skip',
data: {'cur': song},
type: 'POST'
});
};
/** /**
* Request N never played songs * Request N never played songs
* *
......
...@@ -43,6 +43,9 @@ djr.init = function (userid) { ...@@ -43,6 +43,9 @@ djr.init = function (userid) {
}); });
// Add onclick hooks to the playlist controls. // Add onclick hooks to the playlist controls.
$('#skipbtn').click(function() {
djr.player().skipSong();
});
$('#playlistClearBtn').click(function() { $('#playlistClearBtn').click(function() {
djr.player().clearPlaylist(); djr.player().clearPlaylist();
}); });
......
...@@ -351,6 +351,12 @@ djr.Player.prototype.play = function(song) { ...@@ -351,6 +351,12 @@ djr.Player.prototype.play = function(song) {
this.backend.nowPlaying(song, this.old_songs); this.backend.nowPlaying(song, this.old_songs);
}; };
// Skip the current song, play the next one.
djr.Player.prototype.skipSong = function() {
this.backend.skipSong(this.cur_song);
this.nextSong();
};
// Start playing the next song. // Start playing the next song.
djr.Player.prototype.nextSong = function() { djr.Player.prototype.nextSong = function() {
if (this.auto_extend && this.playlist.isLastSong(this.cur_song)) { if (this.auto_extend && this.playlist.isLastSong(this.cur_song)) {
......
...@@ -108,7 +108,8 @@ $(document).ready(function() { ...@@ -108,7 +108,8 @@ $(document).ready(function() {
<div id="metasongcontrols" class="buttonbox"> <div id="metasongcontrols" class="buttonbox">
<br/> <br/>
<a id="pllistbtn">Playlists</a> <a id="skipbtn"><b>Next</b></a>
| <a id="pllistbtn">Playlists</a>
| <a id="lyricsbtn">Lyrics</a> | <a id="lyricsbtn">Lyrics</a>
| <a id="wikibtn">Wikipedia</a> | <a id="wikibtn">Wikipedia</a>
| <a id="lastfmbtn">Song Info</a> | <a id="lastfmbtn">Song Info</a>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment