Repeat button #77

This commit is contained in:
Josef Citrine 2016-05-16 17:24:10 +01:00
parent 04d9d46d7a
commit 2d1e7448f1
4 changed files with 23 additions and 2 deletions

View file

@ -12,6 +12,7 @@
</a>
</li>
<li ng-class="{disabled: !player.canGoNext}"><a pfm-eat-click ng-click="playNext()" class="next" href="#"><i class="icon-fast-forward"></i></a></li>
<li><a ng-class="{active: player.repeatOnce}" pfm-eat-click ng-click="toggleRepeat()" class="repeat" href="#"><i class="icon-repeat"></i></a></li>
<li class="volume">
<a pfm-eat-click ng-click="" class="volume" href="#">
<i class="icon-volume-up"></i>

View file

@ -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())

View file

@ -44,6 +44,9 @@ module.exports = angular.module('ponyfm').factory('player', [
track.progress = (self.currentSound.position / (track.duration * 1000)) * 100
onfinish: () -> $rootScope.safeApply ->
if self.repeatOnce
self.currentSound.play()
else
track.isPlaying = false
self.playNext()
@ -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)

View file

@ -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 {