Skip to content
This repository has been archived by the owner on Jan 23, 2020. It is now read-only.

Update player-bar.js #4

Merged
merged 1 commit into from
Nov 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions scripts/player-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,17 @@
const nextSong = album.songs[nextSongIndex];
player.playPause(nextSong);
});

$('button#previous').on('click', function() {
if (player.playState !== 'playing') { return; }


const currentSongIndex = album.songs.indexOf(player.currentlyPlaying);
const previousSongIndex = currentSongIndex - 1;
if (currentSongIndex == 0) { return; }

const previousSong = album.songs[previousSongIndex];
player.playPause(previousSong);
});

}