less jank song-progress bar

This commit is contained in:
booploops 2021-12-08 19:35:11 -08:00
parent 43a50625a1
commit 4e7e28ef07
3 changed files with 374 additions and 352 deletions

View file

@ -65,7 +65,9 @@ const app = new Vue({
limit: 10 limit: 10
}, },
playerLCD: { playerLCD: {
playbackDuration: 0 playbackDuration: 0,
desiredDuration: 0,
userInteraction: false
}, },
listennow: [], listennow: [],
radio: { radio: {
@ -290,6 +292,9 @@ const app = new Vue({
}, },
progressBarStyle () { progressBarStyle () {
let val = this.playerLCD.playbackDuration let val = this.playerLCD.playbackDuration
if(this.playerLCD.desiredDuration > 0) {
val = this.playerLCD.desiredDuration
}
let min = 0 let min = 0
let max = this.mk.currentPlaybackDuration let max = this.mk.currentPlaybackDuration
let value = (val-min)/(max-min)*100 let value = (val-min)/(max-min)*100
@ -297,6 +302,13 @@ const app = new Vue({
'background': ('linear-gradient(to right, var(--keyColor) 0%, var(--keyColor) ' + value + '%, #333 ' + value + '%, #333 100%)') 'background': ('linear-gradient(to right, var(--keyColor) 0%, var(--keyColor) ' + value + '%, #333 ' + value + '%, #333 100%)')
} }
}, },
getSongProgress() {
if(this.playerLCD.userInteraction) {
return this.playerLCD.desiredDuration
} else{
return this.playerLCD.playbackDuration
}
},
hashCode(str) { hashCode(str) {
var hash = 0, i, chr; var hash = 0, i, chr;
if (str.length === 0) return hash; if (str.length === 0) return hash;

View file

@ -631,6 +631,7 @@ input[type=range].web-slider::-webkit-slider-runnable-track {
>input[type=range] { >input[type=range] {
&::-webkit-slider-thumb { &::-webkit-slider-thumb {
opacity: 1; opacity: 1;
transform: scale(1);
z-index: 1; z-index: 1;
} }
} }
@ -644,6 +645,7 @@ input[type=range].web-slider::-webkit-slider-runnable-track {
&::-webkit-slider-thumb { &::-webkit-slider-thumb {
opacity: 0; opacity: 0;
transform: scale(0.5);
-webkit-appearance: none; -webkit-appearance: none;
appearance: none; appearance: none;
width: 12px; width: 12px;
@ -651,7 +653,7 @@ input[type=range].web-slider::-webkit-slider-runnable-track {
border-radius: 100%; border-radius: 100%;
background: var(--keyColor); background: var(--keyColor);
cursor: ew-resize; cursor: ew-resize;
transition: opacity .10s var(--appleEase); transition: opacity .10s var(--appleEase), transform .10s var(--appleEase);
} }
&::-moz-range-thumb { &::-moz-range-thumb {
@ -2051,10 +2053,10 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
border: 0px; border: 0px;
color: var(--keyColor); color: var(--keyColor);
font-family: inherit; font-family: inherit;
font-weight: 500;
font-size: 16px; font-size: 16px;
border-radius: 4px; border-radius: 4px;
padding: 6px; padding: 6px;
&:hover { &:hover {
cursor: pointer; cursor: pointer;
background: rgb(200 200 200 / 10%) background: rgb(200 200 200 / 10%)

View file

@ -73,12 +73,15 @@
</div> </div>
<div class="song-progress"> <div class="song-progress">
<input type="range" step="0.01" min="0" :style="progressBarStyle()" <input type="range" step="0.01" min="0" :style="progressBarStyle()"
@change="mk.seekToTime($event.target.value)" @input="playerLCD.desiredDuration = $event.target.value;playerLCD.userInteraction = true"
:max="mk.currentPlaybackDuration" :value="playerLCD.playbackDuration"> @mouseup="mk.seekToTime($event.target.value);playerLCD.desiredDuration = 0;playerLCD.userInteraction = false"
:max="mk.currentPlaybackDuration" :value="getSongProgress()">
</div> </div>
</div> </div>
<template v-if="mk.nowPlayingItem['attributes']['playParams']"> <template v-if="mk.nowPlayingItem['attributes']['playParams']">
<div class="actions" v-if="isInLibrary(mk.nowPlayingItem['attributes']['playParams'])">❤️</div> <div class="actions" v-if="isInLibrary(mk.nowPlayingItem['attributes']['playParams'])">
❤️
</div>
<div class="actions" v-else>🖤</div> <div class="actions" v-else>🖤</div>
</template> </template>
@ -169,7 +172,8 @@
</div> </div>
</transition> </transition>
<div class="app-sidebar-footer"> <div class="app-sidebar-footer">
<input type="range" class="web-slider display--small" step="0.01" min="0" max="1" v-model="mk.volume" <input type="range" class="web-slider display--small" step="0.01" min="0" max="1"
v-model="mk.volume"
v-if="typeof mk.volume != 'undefined'"> v-if="typeof mk.volume != 'undefined'">
<button class="app-sidebar-button" style="width:100%" <button class="app-sidebar-button" style="width:100%"
@click="chrome.menuOpened = !chrome.menuOpened"> @click="chrome.menuOpened = !chrome.menuOpened">
@ -308,7 +312,8 @@
</transition> </transition>
<!-- Library - Albums --> <!-- Library - Albums -->
<transition name="wpfade" v-on:enter="getLibraryAlbumsFull()"> <transition name="wpfade" v-on:enter="getLibraryAlbumsFull()">
<%- include('pages/library-albums') %>'); %> <%- include('pages/library-albums') %>');
%>
</transition> </transition>
</div> </div>
<transition name="drawertransition"> <transition name="drawertransition">
@ -336,7 +341,9 @@
fill-rule="nonzero"/> fill-rule="nonzero"/>
</svg> </svg>
</div> </div>
<div id="captions">{{(lyricon) ? ((lyrics.length > 0 ) ? lyrics[currentLyricsLine].line.replace('lrcInstrumental','') : "") : ''}}</div> <div id="captions">{{(lyricon) ? ((lyrics.length > 0 ) ?
lyrics[currentLyricsLine].line.replace('lrcInstrumental','') : "") : ''}}
</div>
<div id="player-pip" @click="document.querySelector('video').requestPictureInPicture()" <div id="player-pip" @click="document.querySelector('video').requestPictureInPicture()"
title="Picture-in-Picture"> title="Picture-in-Picture">
<%- include("svg/fullscreen.svg") %> <%- include("svg/fullscreen.svg") %>
@ -442,7 +449,8 @@
</h3> </h3>
</template> </template>
<template v-else> <template v-else>
<h3 class="lyric-line" @click="if(lyric.startTime != 9999999) app.seekTo(lyric.startTime, false)" :start="lyric.startTime" <h3 class="lyric-line" @click="if(lyric.startTime != 9999999) app.seekTo(lyric.startTime, false)"
:start="lyric.startTime"
:end="lyric.endTime" v-bind:line-index="index.toString()"> :end="lyric.endTime" v-bind:line-index="index.toString()">
<div class="lyricWaiting"> <div class="lyricWaiting">
<div class='WaitingDot1'></div> <div class='WaitingDot1'></div>