mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-20 04:18:19 -07:00
Go to previous track on double click
This commit is contained in:
parent
1a6e0973f3
commit
989c99521f
@ -157,12 +157,15 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
elem.querySelector('.previousTrackButton').addEventListener('click', function () {
|
elem.querySelector('.previousTrackButton').addEventListener('click', function (e) {
|
||||||
if (currentPlayer) {
|
if (currentPlayer) {
|
||||||
if (currentPlayer.id === 'htmlaudioplayer' && (currentPlayer._currentTime <= 5 || !playbackManager.previousTrack(currentPlayer))) {
|
if (currentPlayer.id === 'htmlaudioplayer' && (currentPlayer._currentTime <= 5 || !playbackManager.previousTrack(currentPlayer))) {
|
||||||
|
// Cancel this event if doubleclick is fired
|
||||||
|
if (e.originalEvent.detail > 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
playbackManager.seekPercent(0, currentPlayer);
|
playbackManager.seekPercent(0, currentPlayer);
|
||||||
// This is done automatically by playbackManager, however, setting this here
|
// This is done automatically by playbackManager, however, setting this here gives instant visual feedback
|
||||||
// gives instant visual feedback
|
|
||||||
positionSlider.value = 0;
|
positionSlider.value = 0;
|
||||||
} else {
|
} else {
|
||||||
playbackManager.previousTrack(currentPlayer);
|
playbackManager.previousTrack(currentPlayer);
|
||||||
@ -170,6 +173,12 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
elem.querySelector('.previousTrackButton').addEventListener('dblclick', function () {
|
||||||
|
if (currentPlayer) {
|
||||||
|
playbackManager.previousTrack(currentPlayer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
elem.querySelector('.btnShuffle').addEventListener('click', function () {
|
elem.querySelector('.btnShuffle').addEventListener('click', function () {
|
||||||
if (currentPlayer) {
|
if (currentPlayer) {
|
||||||
if (playbackManager.getPlaylistShuffleMode(currentPlayer) === 'Sorted') {
|
if (playbackManager.getPlaylistShuffleMode(currentPlayer) === 'Sorted') {
|
||||||
|
@ -2,7 +2,6 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
|
|||||||
'use strict';
|
'use strict';
|
||||||
var showMuteButton = true;
|
var showMuteButton = true;
|
||||||
var showVolumeSlider = true;
|
var showVolumeSlider = true;
|
||||||
var shuffleButton;
|
|
||||||
|
|
||||||
function showAudioMenu(context, player, button, item) {
|
function showAudioMenu(context, player, button, item) {
|
||||||
var currentIndex = playbackManager.getAudioStreamIndex(player);
|
var currentIndex = playbackManager.getAudioStreamIndex(player);
|
||||||
@ -704,19 +703,27 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
context.querySelector('.btnPreviousTrack').addEventListener('click', function () {
|
context.querySelector('.btnPreviousTrack').addEventListener('click', function (e) {
|
||||||
console.log(currentPlayer);
|
|
||||||
if (currentPlayer) {
|
if (currentPlayer) {
|
||||||
if (currentPlayer.id === 'htmlaudioplayer' && (currentPlayer._currentTime <= 5 || !playbackManager.previousTrack(currentPlayer))) {
|
if (currentPlayer.id === 'htmlaudioplayer' && (currentPlayer._currentTime <= 5 || !playbackManager.previousTrack(currentPlayer))) {
|
||||||
|
// Cancel this event if doubleclick is fired
|
||||||
|
if (e.originalEvent.detail > 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
playbackManager.seekPercent(0, currentPlayer);
|
playbackManager.seekPercent(0, currentPlayer);
|
||||||
// This is done automatically by playbackManager. However, setting this here
|
// This is done automatically by playbackManager. However, setting this here gives instant visual feedback
|
||||||
// gives instant visual feedback
|
|
||||||
positionSlider.value = 0;
|
positionSlider.value = 0;
|
||||||
} else {
|
} else {
|
||||||
playbackManager.previousTrack(currentPlayer);
|
playbackManager.previousTrack(currentPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
context.querySelector('.btnPreviousTrack').addEventListener('dblclick', function () {
|
||||||
|
if (currentPlayer) {
|
||||||
|
playbackManager.previousTrack(currentPlayer);
|
||||||
|
}
|
||||||
|
});
|
||||||
positionSlider.addEventListener('change', function () {
|
positionSlider.addEventListener('change', function () {
|
||||||
var value = this.value;
|
var value = this.value;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user