1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-23 01:20:27 +00:00

Add queue's total time to panel header.

This commit is contained in:
eb041592 2018-04-04 19:40:12 +02:00
parent 54e334a2a0
commit 0faf70ad05
2 changed files with 17 additions and 4 deletions

View File

@ -84,7 +84,8 @@
<div class="panel panel-primary">
<!-- Default panel contents -->
<div class="panel-heading"><b id="panel-heading">Queue</b></div>
<div class="panel-heading"><b id="panel-heading">Queue</b>
<b id="panel-heading-info" class="text pull-right"></b></div>
<div class="panel-body">
<h1>
<span id="track-icon" onclick="clickPlay();" class="glyphicon glyphicon-play"></span>

View File

@ -222,6 +222,18 @@ function webSocketConnect() {
if(current_app !== 'queue')
break;
if (obj.totalTime > 0) {
var hours = Math.floor(obj.totalTime / 3600);
var minutes = Math.floor(obj.totalTime / 60) - hours * 60;
var seconds = obj.totalTime - hours * 3600 - minutes * 60;
$('#panel-heading-info').text('Total: ' +
(hours > 0 ? hours + '\u2009h ' + (minutes < 10 ? '0' : '') : '') +
minutes + '\u2009m ' + (seconds < 10 ? '0' : '') + seconds + '\u2009s');
} else {
$('#panel-heading-info').empty();
}
$('#salamisandwich > tbody').empty();
for (var song in obj.data) {
var minutes = Math.floor(obj.data[song].duration / 60);