mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-01-31 03:16:42 +01:00
Repeat button #77
This commit is contained in:
parent
04d9d46d7a
commit
2d1e7448f1
4 changed files with 23 additions and 2 deletions
|
@ -12,6 +12,7 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</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 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">
|
<li class="volume">
|
||||||
<a pfm-eat-click ng-click="" class="volume" href="#">
|
<a pfm-eat-click ng-click="" class="volume" href="#">
|
||||||
<i class="icon-volume-up"></i>
|
<i class="icon-volume-up"></i>
|
||||||
|
|
|
@ -39,6 +39,9 @@ module.exports = angular.module('ponyfm').directive 'pfmPlayer', () ->
|
||||||
$scope.playPrev = () ->
|
$scope.playPrev = () ->
|
||||||
$scope.player.playPrev()
|
$scope.player.playPrev()
|
||||||
|
|
||||||
|
$scope.toggleRepeat = () ->
|
||||||
|
$scope.player.toggleRepeat()
|
||||||
|
|
||||||
$scope.seek = (e) ->
|
$scope.seek = (e) ->
|
||||||
$transport = $ '.transport'
|
$transport = $ '.transport'
|
||||||
percent = ((e.pageX - $transport.offset().left) / $transport.width())
|
percent = ((e.pageX - $transport.offset().left) / $transport.width())
|
||||||
|
|
|
@ -44,8 +44,11 @@ module.exports = angular.module('ponyfm').factory('player', [
|
||||||
track.progress = (self.currentSound.position / (track.duration * 1000)) * 100
|
track.progress = (self.currentSound.position / (track.duration * 1000)) * 100
|
||||||
|
|
||||||
onfinish: () -> $rootScope.safeApply ->
|
onfinish: () -> $rootScope.safeApply ->
|
||||||
track.isPlaying = false
|
if self.repeatOnce
|
||||||
self.playNext()
|
self.currentSound.play()
|
||||||
|
else
|
||||||
|
track.isPlaying = false
|
||||||
|
self.playNext()
|
||||||
|
|
||||||
onstop: () -> $rootScope.safeApply ->
|
onstop: () -> $rootScope.safeApply ->
|
||||||
track.isPlaying = false
|
track.isPlaying = false
|
||||||
|
@ -79,6 +82,7 @@ module.exports = angular.module('ponyfm').factory('player', [
|
||||||
readyDef: readyDef.promise()
|
readyDef: readyDef.promise()
|
||||||
canGoPrev: false
|
canGoPrev: false
|
||||||
canGoNext: false
|
canGoNext: false
|
||||||
|
repeatOnce: false
|
||||||
|
|
||||||
playPause: () ->
|
playPause: () ->
|
||||||
return if !self.ready
|
return if !self.ready
|
||||||
|
@ -120,6 +124,9 @@ module.exports = angular.module('ponyfm').factory('player', [
|
||||||
play self.playlist[self.playlistIndex]
|
play self.playlist[self.playlistIndex]
|
||||||
updateCanGo()
|
updateCanGo()
|
||||||
|
|
||||||
|
toggleRepeat: () ->
|
||||||
|
self.repeatOnce = !self.repeatOnce
|
||||||
|
|
||||||
seek: (progress) ->
|
seek: (progress) ->
|
||||||
return if !self.currentSound
|
return if !self.currentSound
|
||||||
self.currentSound.setPosition(progress)
|
self.currentSound.setPosition(progress)
|
||||||
|
|
10
resources/assets/styles/components/player.less
vendored
10
resources/assets/styles/components/player.less
vendored
|
@ -161,6 +161,16 @@ body.is-logged {
|
||||||
background: darken(#eee, 10%);
|
background: darken(#eee, 10%);
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background: darken(#eee, 20%) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
> a.active {
|
||||||
|
text-decoration: none;
|
||||||
|
background: darken(#eee, 10%);
|
||||||
|
color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.disabled {
|
&.disabled {
|
||||||
|
|
Loading…
Reference in a new issue