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