Renamed and changed convertToMins function to work with larger values
This commit is contained in:
parent
3340fb93df
commit
21026816fe
4 changed files with 24 additions and 10 deletions
|
@ -1242,10 +1242,24 @@ const app = new Vue({
|
|||
return this.playerLCD.playbackDuration
|
||||
}
|
||||
},
|
||||
convertToMins(time) {
|
||||
let mins = Math.floor(time / 60)
|
||||
let seconds = (Math.floor(time % 60) / 100).toFixed(2)
|
||||
return `${mins}:${seconds.replace("0.", "")}`
|
||||
convertTime(time) {
|
||||
if (typeof time !== "number") {
|
||||
time = parseInt(time)
|
||||
}
|
||||
|
||||
const timeGates = {
|
||||
600: 15,
|
||||
3600: 14,
|
||||
36000: 12,
|
||||
}
|
||||
|
||||
for (let key in timeGates) {
|
||||
if (time < key) {
|
||||
return new Date(time * 1000).toISOString().substring(timeGates[key], 19)
|
||||
}
|
||||
}
|
||||
|
||||
return new Date(time * 1000).toISOString().substring(11, 19)
|
||||
},
|
||||
hashCode(str) {
|
||||
let hash = 0,
|
||||
|
|
|
@ -80,8 +80,8 @@
|
|||
<div class="song-duration"
|
||||
style="justify-content: space-between; height: 1px;"
|
||||
:style="[chrome.progresshover ? {'display': 'flex'} : {'display' : 'none'} ]">
|
||||
<p style="width: auto">{{ convertToMins(getSongProgress()) }}</p>
|
||||
<p style="width: auto">{{ convertToMins(mk.currentPlaybackDuration) }}
|
||||
<p style="width: auto">{{ convertTime(getSongProgress()) }}</p>
|
||||
<p style="width: auto">{{ convertTime(mk.currentPlaybackDuration) }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
<div class="song-progress">
|
||||
<div class="song-duration" style="justify-content: space-between; height: 1px;"
|
||||
:style="[app.chrome.progresshover ? {'display': 'flex'} : {'display' : 'none'} ]">
|
||||
<p style="width: auto">{{ app.convertToMins(app.getSongProgress()) }}</p>
|
||||
<p style="width: auto">{{ app.convertToMins(app.mk.currentPlaybackDuration) }}</p>
|
||||
<p style="width: auto">{{ app.convertTime(app.getSongProgress()) }}</p>
|
||||
<p style="width: auto">{{ app.convertTime(app.mk.currentPlaybackDuration) }}</p>
|
||||
</div>
|
||||
|
||||
<input type="range" step="0.01" min="0" :style="app.progressBarStyle()"
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
<div class="song-progress">
|
||||
<div class="song-duration" style="justify-content: space-between; height: 1px; margin-bottom: 1px;"
|
||||
:style="[app.chrome.progresshover ? {'display': 'flex'} : {'display' : 'none'} ]">
|
||||
<p style="width: auto">{{ app.convertToMins(app.getSongProgress()) }}</p>
|
||||
<p style="width: auto">{{ app.convertToMins(app.mk.currentPlaybackDuration) }}</p>
|
||||
<p style="width: auto">{{ app.convertTime(app.getSongProgress()) }}</p>
|
||||
<p style="width: auto">{{ app.convertTime(app.mk.currentPlaybackDuration) }}</p>
|
||||
</div>
|
||||
|
||||
<input type="range" step="0.01" min="0" :style="app.progressBarStyle()"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue