Skip to content

Commit

Permalink
add repeat track feat. closes #292
Browse files Browse the repository at this point in the history
  • Loading branch information
weblancaster committed Sep 9, 2015
1 parent 9484e64 commit f2e2c4b
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 161 deletions.
9 changes: 6 additions & 3 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,6 @@ <h4 id="playerUser" class="player_user"></h4>
<span class="player_duration" id="player-duration"></span>
</div>
<div class="player_controls">
<span class="player_shuffle" ng-click="shuffle($event)">
<i class="fa fa-random thin"></i>
</span>
<span class="player_prevSong" ng-click="prevSong($event)">
<i class="fa fa-step-backward thin"></i>
</span>
Expand All @@ -172,6 +169,12 @@ <h4 id="playerUser" class="player_user"></h4>
<span class="player_nextSong" ng-click="nextSong($event)">
<i class="fa fa-step-forward thin"></i>
</span>
<span class="player_repeat" ng-click="repeat($event)">
<i class="fa fa-repeat thin"></i>
</span>
<span class="player_shuffle" ng-click="shuffle($event)">
<i class="fa fa-random thin"></i>
</span>
<span class="player_queueList" ng-click="toggleQueue($event)">
<i class="fa fa-list thin"></i>
</span>
Expand Down
7 changes: 4 additions & 3 deletions app/public/js/common/playerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ app.factory('playerService', function($rootScope, $log, $timeout, $window, $stat

$rootScope.isSongPlaying = false;
$rootScope.isPlaylistPlaying = false;
$rootScope.shuffle= false;
$rootScope.shuffle = false;
$rootScope.repeat = false;

/**
* Get a number between min index and max index
Expand Down Expand Up @@ -240,7 +241,7 @@ app.factory('playerService', function($rootScope, $log, $timeout, $window, $stat
player.playPrevSong = function() {
if ( $rootScope.shuffle ) {
shuffle();
} else {
} else if ( ! $rootScope.repeat ) {
queueService.prev();
}
this.playNewSong();
Expand All @@ -255,7 +256,7 @@ app.factory('playerService', function($rootScope, $log, $timeout, $window, $stat
player.playNextSong = function() {
if ( $rootScope.shuffle ) {
shuffle();
} else {
} else if ( ! $rootScope.repeat ) {
queueService.next();
}
this.playNewSong();
Expand Down
9 changes: 9 additions & 0 deletions app/public/js/player/playerCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ app.controller('PlayerCtrl', function ($scope, $rootScope, playerService, hotkey
}
};

$scope.repeat = function($event) {
$event.currentTarget.classList.toggle('active');
if ( $rootScope.repeat ) {
$rootScope.repeat = false;
} else {
$rootScope.repeat = true;
}
};

$scope.shuffle = function($event) {
$event.currentTarget.classList.toggle('active');
if ( $rootScope.shuffle ) {
Expand Down
Loading

0 comments on commit f2e2c4b

Please sign in to comment.