Changed behaviour on playlist track click. Click twice to play instace of long pressing to prevent tracks from playing while scrolling the pane

This commit is contained in:
Fabio Manganiello 2018-04-12 20:07:19 +02:00
parent cf2b362947
commit 0cfd67be51

View file

@ -1,6 +1,5 @@
$(document).ready(function() { $(document).ready(function() {
var seekInterval, var seekInterval,
longPressTimeout,
curPath = [], curPath = [],
curTrackUpdateHandler, curTrackUpdateHandler,
curTrackElapsed = { curTrackElapsed = {
@ -238,18 +237,13 @@ $(document).ready(function() {
); );
}; };
var onTrackTouchDown = function(event) { var onPlaylistTrackClick = function(event) {
var $track = $(this); var $track = $(this);
longPressTimeout = setTimeout(function() {
$track.addClass('selected');
clearTimeout(longPressTimeout);
longPressTimeout = undefined;
}, 1000);
};
var onTrackTouchUp = function(event) { if (!$track.hasClass('selected')) {
var $track = $(this); $('.playlist-track').removeClass('selected');
if (longPressTimeout) { $track.addClass('selected');
} else {
execute({ execute({
type: 'request', type: 'request',
action: 'music.mpd.playid', action: 'music.mpd.playid',
@ -293,8 +287,7 @@ $(document).ready(function() {
$title.appendTo($element); $title.appendTo($element);
$time.appendTo($element); $time.appendTo($element);
$element.on('mousedown touchstart', onTrackTouchDown); $element.on('click touch',onPlaylistTrackClick);
$element.on('mouseup touchend', onTrackTouchUp);
$element.appendTo($playlistContent); $element.appendTo($playlistContent);
} }