Skip to content

Commit 3c08e4f

Browse files
committed
Merge pull request #352 from Soundnode/repeat-feat
add repeat track feat. closes #292
2 parents 9484e64 + f2e2c4b commit 3c08e4f

File tree

4 files changed

+178
-161
lines changed

4 files changed

+178
-161
lines changed

app/index.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ <h4 id="playerUser" class="player_user"></h4>
159159
<span class="player_duration" id="player-duration"></span>
160160
</div>
161161
<div class="player_controls">
162-
<span class="player_shuffle" ng-click="shuffle($event)">
163-
<i class="fa fa-random thin"></i>
164-
</span>
165162
<span class="player_prevSong" ng-click="prevSong($event)">
166163
<i class="fa fa-step-backward thin"></i>
167164
</span>
@@ -172,6 +169,12 @@ <h4 id="playerUser" class="player_user"></h4>
172169
<span class="player_nextSong" ng-click="nextSong($event)">
173170
<i class="fa fa-step-forward thin"></i>
174171
</span>
172+
<span class="player_repeat" ng-click="repeat($event)">
173+
<i class="fa fa-repeat thin"></i>
174+
</span>
175+
<span class="player_shuffle" ng-click="shuffle($event)">
176+
<i class="fa fa-random thin"></i>
177+
</span>
175178
<span class="player_queueList" ng-click="toggleQueue($event)">
176179
<i class="fa fa-list thin"></i>
177180
</span>

app/public/js/common/playerService.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ app.factory('playerService', function($rootScope, $log, $timeout, $window, $stat
2727

2828
$rootScope.isSongPlaying = false;
2929
$rootScope.isPlaylistPlaying = false;
30-
$rootScope.shuffle= false;
30+
$rootScope.shuffle = false;
31+
$rootScope.repeat = false;
3132

3233
/**
3334
* Get a number between min index and max index
@@ -240,7 +241,7 @@ app.factory('playerService', function($rootScope, $log, $timeout, $window, $stat
240241
player.playPrevSong = function() {
241242
if ( $rootScope.shuffle ) {
242243
shuffle();
243-
} else {
244+
} else if ( ! $rootScope.repeat ) {
244245
queueService.prev();
245246
}
246247
this.playNewSong();
@@ -255,7 +256,7 @@ app.factory('playerService', function($rootScope, $log, $timeout, $window, $stat
255256
player.playNextSong = function() {
256257
if ( $rootScope.shuffle ) {
257258
shuffle();
258-
} else {
259+
} else if ( ! $rootScope.repeat ) {
259260
queueService.next();
260261
}
261262
this.playNewSong();

app/public/js/player/playerCtrl.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ app.controller('PlayerCtrl', function ($scope, $rootScope, playerService, hotkey
6060
}
6161
};
6262

63+
$scope.repeat = function($event) {
64+
$event.currentTarget.classList.toggle('active');
65+
if ( $rootScope.repeat ) {
66+
$rootScope.repeat = false;
67+
} else {
68+
$rootScope.repeat = true;
69+
}
70+
};
71+
6372
$scope.shuffle = function($event) {
6473
$event.currentTarget.classList.toggle('active');
6574
if ( $rootScope.shuffle ) {

0 commit comments

Comments
 (0)