diff --git a/public/templates/directives/player.html b/public/templates/directives/player.html index ad6d20b1..0ca8aaa4 100644 --- a/public/templates/directives/player.html +++ b/public/templates/directives/player.html @@ -12,6 +12,7 @@
  • +
  • diff --git a/resources/assets/scripts/app/directives/player.coffee b/resources/assets/scripts/app/directives/player.coffee index dc1fd45b..996d47a2 100644 --- a/resources/assets/scripts/app/directives/player.coffee +++ b/resources/assets/scripts/app/directives/player.coffee @@ -39,6 +39,9 @@ module.exports = angular.module('ponyfm').directive 'pfmPlayer', () -> $scope.playPrev = () -> $scope.player.playPrev() + $scope.toggleRepeat = () -> + $scope.player.toggleRepeat() + $scope.seek = (e) -> $transport = $ '.transport' percent = ((e.pageX - $transport.offset().left) / $transport.width()) diff --git a/resources/assets/scripts/app/services/player.coffee b/resources/assets/scripts/app/services/player.coffee index 20d25070..7b6f0c58 100644 --- a/resources/assets/scripts/app/services/player.coffee +++ b/resources/assets/scripts/app/services/player.coffee @@ -44,8 +44,11 @@ module.exports = angular.module('ponyfm').factory('player', [ track.progress = (self.currentSound.position / (track.duration * 1000)) * 100 onfinish: () -> $rootScope.safeApply -> - track.isPlaying = false - self.playNext() + if self.repeatOnce + self.currentSound.play() + else + track.isPlaying = false + self.playNext() onstop: () -> $rootScope.safeApply -> track.isPlaying = false @@ -79,6 +82,7 @@ module.exports = angular.module('ponyfm').factory('player', [ readyDef: readyDef.promise() canGoPrev: false canGoNext: false + repeatOnce: false playPause: () -> return if !self.ready @@ -120,6 +124,9 @@ module.exports = angular.module('ponyfm').factory('player', [ play self.playlist[self.playlistIndex] updateCanGo() + toggleRepeat: () -> + self.repeatOnce = !self.repeatOnce + seek: (progress) -> return if !self.currentSound self.currentSound.setPosition(progress) diff --git a/resources/assets/styles/components/player.less b/resources/assets/styles/components/player.less index f1b78f5a..7ea7a61a 100644 --- a/resources/assets/styles/components/player.less +++ b/resources/assets/styles/components/player.less @@ -161,6 +161,16 @@ body.is-logged { background: darken(#eee, 10%); color: #000; } + + &:active { + background: darken(#eee, 20%) !important; + } + } + + > a.active { + text-decoration: none; + background: darken(#eee, 10%); + color: #000; } &.disabled {