mirror of
https://github.com/koel/koel
synced 2025-02-16 05:18:37 +00:00
Fix #6: "Prev" control should go to beginning of song if already passed 5 seconds
This commit is contained in:
parent
daaa7ba747
commit
22e027c2ad
2 changed files with 10 additions and 11 deletions
|
@ -1,9 +1,7 @@
|
|||
<template>
|
||||
<footer id="mainFooter">
|
||||
<div class="side player-controls" id="playerControls">
|
||||
<i class="prev fa fa-step-backward control"
|
||||
:class="{ enabled: hasPrev }"
|
||||
@click.prevent="playPrev"></i>
|
||||
<i class="prev fa fa-step-backward control" @click.prevent="playPrev"></i>
|
||||
|
||||
<span class="play control" v-show="!playing" @click.prevent="resume">
|
||||
<i class="fa fa-play"></i>
|
||||
|
@ -12,9 +10,7 @@
|
|||
<i class="fa fa-pause"></i>
|
||||
</span>
|
||||
|
||||
<i class="next fa fa-step-forward control"
|
||||
:class="{ enabled: hasNext }"
|
||||
@click.prevent="playNext"></i>
|
||||
<i class="next fa fa-step-forward control" @click.prevent="playNext"></i>
|
||||
</div>
|
||||
|
||||
<div class="media-info-wrap">
|
||||
|
@ -81,8 +77,6 @@
|
|||
playing: false,
|
||||
viewingQueue: false,
|
||||
liked: false,
|
||||
hasNext: false,
|
||||
hasPrev: false,
|
||||
|
||||
prefs: preferenceStore.state,
|
||||
};
|
||||
|
@ -97,8 +91,6 @@
|
|||
*/
|
||||
song() {
|
||||
this.liked = this.song.liked;
|
||||
this.hasNext = !!this.next;
|
||||
this.hasPrev = !!this.prev;
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -413,7 +405,6 @@
|
|||
@include hasSoftGradientOnTop($colorSidebarBgr);
|
||||
|
||||
.prev, .next {
|
||||
opacity: .2;
|
||||
transition: .3s;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,14 @@ export default {
|
|||
* If the prev song is not found and the current mode is NO_REPEAT, we stop completely.
|
||||
*/
|
||||
playPrev() {
|
||||
// If the song's duration is greater than 5 seconds and we've passed 5 seconds into it
|
||||
// restart playing instead.
|
||||
if (this.player.media.currentTime > 5 && this.player.media.duration > 5) {
|
||||
this.player.seek(0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var prev = this.prevSong();
|
||||
|
||||
if (!prev && preferenceStore.get('repeatMode') === 'NO_REPEAT') {
|
||||
|
|
Loading…
Add table
Reference in a new issue