fix table html & more rigorous formatSeconds variable use
This commit is contained in:
@@ -132,12 +132,12 @@
|
|||||||
muted = false;
|
muted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatSeconds(seconds) {
|
function formatSeconds(totalSeconds) {
|
||||||
if (isNaN(seconds)) return 'No Data';
|
if (isNaN(totalSeconds)) return 'No Data';
|
||||||
var sec_num = parseInt(seconds, 10);
|
totalSeconds = parseInt(totalSeconds, 10);
|
||||||
var hours = Math.floor(sec_num / 3600);
|
var hours = Math.floor(totalSeconds / 3600);
|
||||||
var minutes = Math.floor(sec_num / 60) % 60;
|
var minutes = Math.floor(totalSeconds / 60) % 60;
|
||||||
var seconds = sec_num % 60;
|
var seconds = totalSeconds % 60;
|
||||||
|
|
||||||
return [hours, minutes, seconds]
|
return [hours, minutes, seconds]
|
||||||
.map((v) => (v < 10 ? '0' + v : v))
|
.map((v) => (v < 10 ? '0' + v : v))
|
||||||
|
|||||||
@@ -30,24 +30,26 @@
|
|||||||
|
|
||||||
<div id="table-container">
|
<div id="table-container">
|
||||||
<table>
|
<table>
|
||||||
<tr><th>Timestamp</th><th>Artist</th><th>Title</th></tr>
|
<tbody>
|
||||||
{#each $currentStream.tracks as track, i}
|
<tr><th>Timestamp</th><th>Artist</th><th>Title</th></tr>
|
||||||
<tr class:current={i == $currentSongIndex}>
|
{#each $currentStream.tracks as track, i}
|
||||||
<td class="timestamp-field"
|
<tr class:current={i == $currentSongIndex}>
|
||||||
><div class="timestamp-field-flex">
|
<td class="timestamp-field"
|
||||||
{formatTrackTime(track[0])}
|
><div class="timestamp-field-flex">
|
||||||
<button
|
{formatTrackTime(track[0])}
|
||||||
on:click={() => jumpToTrack(track[0])}
|
<button
|
||||||
class="material-icons"
|
on:click={() => jumpToTrack(track[0])}
|
||||||
style="padding: 4px 6px; margin-top: -4px; margin-bottom: -4px; margin-right: -6px"
|
class="material-icons"
|
||||||
>fast_forward</button
|
style="padding: 4px 6px; margin-top: -4px; margin-bottom: -4px; margin-right: -6px"
|
||||||
>
|
>fast_forward</button
|
||||||
</div>
|
>
|
||||||
</td>
|
</div>
|
||||||
<td class="artist-field">{track[1]}</td>
|
</td>
|
||||||
<td class="track-field">{track[2]}</td>
|
<td class="artist-field">{track[1]}</td>
|
||||||
</tr>
|
<td class="track-field">{track[2]}</td>
|
||||||
{/each}
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user