Skip to content

Commit

Permalink
Feat: add goto playing track button in queue view #200
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Oct 20, 2020
1 parent 7959556 commit e0fb32c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions htdocs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ <h2 id="currentTitle" data-href='{"cmd": "clickTitle", "options": []}'></h2>
<input data-placeholder-phrase="Search queue" type="text" class="form-control border-secondary" id="searchqueuestr"/>
</div>
</form>
<div class="btn-group mr-2">
<button data-title-phrase="Goto playing song" type="button" class="btn btn-secondary material-icons" data-href='{"cmd": "gotoPlayingSong", "options": []}'>playlist_play</button>
</div>
<div id="QueueCurrentPaginationTop" class="btn-group mr-2 hide">
<button data-title-phrase="Previous page" data-href='{"cmd": "gotoPage", "options": ["prev"]}' type="button" class="btn btn-group-prepend btn-secondary">&laquo;</button>
<div class="btn-group">
Expand Down
7 changes: 7 additions & 0 deletions htdocs/js/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,10 @@ function delQueueSong(mode, start, end) {
sendAPI("MPD_API_QUEUE_RM_TRACK", { "track": start});
}
}

//eslint-disable-next-line no-unused-vars
function gotoPlayingSong() {
let page = lastState.songPos < settings.maxElementsPerPage ? 0 : Math.floor(lastState.songPos / settings.maxElementsPerPage) * settings.maxElementsPerPage;
console.log(page);
gotoPage(page);
}

0 comments on commit e0fb32c

Please sign in to comment.