Only blocking key events when they're our target keys; Patching tracklist hotkeys
This commit is contained in:
@ -3329,6 +3329,7 @@ select {
|
||||
|
||||
.action {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
cursor: pointer; }
|
||||
|
||||
@keyframes click_feedback {
|
||||
@ -4655,7 +4656,8 @@ select {
|
||||
vertical-align: bottom;
|
||||
opacity: 0.8; }
|
||||
.playback-controls .control:not(.sidebar-toggle) {
|
||||
position: relative; }
|
||||
position: relative;
|
||||
display: inline-block; }
|
||||
|
||||
@keyframes click_feedback {
|
||||
0% {
|
||||
@ -4899,6 +4901,7 @@ select {
|
||||
padding-left: 25px; }
|
||||
.output-control__item__mute.control {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 2px;
|
||||
color: #000000;
|
||||
float: left;
|
||||
@ -6399,6 +6402,7 @@ main header {
|
||||
font-size: 16px; }
|
||||
.commands__item--interactive {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
cursor: pointer; }
|
||||
|
||||
@keyframes click_feedback {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -58190,6 +58190,7 @@ var Hotkeys = function (_React$Component) {
|
||||
return;
|
||||
}
|
||||
|
||||
var prevent = false;
|
||||
switch (e.key.toLowerCase()) {
|
||||
|
||||
case " ":
|
||||
@ -58200,6 +58201,7 @@ var Hotkeys = function (_React$Component) {
|
||||
this.props.mopidyActions.play();
|
||||
this.props.uiActions.createNotification({ content: 'play_arrow', type: 'shortcut' });
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "escape":
|
||||
@ -58208,26 +58210,32 @@ var Hotkeys = function (_React$Component) {
|
||||
} else if (this.props.modal) {
|
||||
window.history.back();
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "s":
|
||||
this.props.history.push('/search');
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "c":
|
||||
this.props.history.push('/queue');
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "k":
|
||||
this.props.history.push('/kiosk-mode');
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case ",":
|
||||
window.history.back();
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case ".":
|
||||
window.history.forward();
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "l":
|
||||
@ -58243,6 +58251,7 @@ var Hotkeys = function (_React$Component) {
|
||||
}
|
||||
this.props.uiActions.createNotification({ content: 'volume_up', type: 'shortcut' });
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "q":
|
||||
@ -58258,6 +58267,7 @@ var Hotkeys = function (_React$Component) {
|
||||
}
|
||||
}
|
||||
this.props.uiActions.createNotification({ content: 'volume_down', type: 'shortcut' });
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "m":
|
||||
@ -58268,6 +58278,7 @@ var Hotkeys = function (_React$Component) {
|
||||
this.props.mopidyActions.setMute(true);
|
||||
this.props.uiActions.createNotification({ content: 'volume_off', type: 'shortcut' });
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "r":
|
||||
@ -58277,27 +58288,33 @@ var Hotkeys = function (_React$Component) {
|
||||
}
|
||||
this.props.mopidyActions.setTimePosition(new_position);
|
||||
this.props.uiActions.createNotification({ content: 'fast_rewind', type: 'shortcut' });
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "f":
|
||||
this.props.mopidyActions.setTimePosition(this.props.play_time_position + 30000);
|
||||
this.props.uiActions.createNotification({ content: 'fast_forward', type: 'shortcut' });
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "p":
|
||||
this.props.mopidyActions.previous();
|
||||
this.props.uiActions.createNotification({ content: 'skip_previous', type: 'shortcut' });
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "n":
|
||||
this.props.mopidyActions.next();
|
||||
this.props.uiActions.createNotification({ content: 'skip_next', type: 'shortcut' });
|
||||
prevent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (prevent) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
@ -62752,46 +62769,51 @@ var TrackList = function (_React$Component) {
|
||||
key: 'handleKeyDown',
|
||||
value: function handleKeyDown(e) {
|
||||
|
||||
// When we're focussed on certian elements (like form input fields), don't fire any shortcuts
|
||||
// When we're focussed on certian elements, don't fire any shortcuts
|
||||
// Typically form inputs
|
||||
var ignoreNodes = ['INPUT', 'TEXTAREA'];
|
||||
if (ignoreNodes.indexOf(e.target.nodeName) > -1) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore when there are any key modifiers. This enables us to avoid interfering
|
||||
// with browser- and OS-default functions.
|
||||
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tracks_keys = this.digestTracksKeys();
|
||||
|
||||
switch (e.keyCode) {
|
||||
case 13:
|
||||
// enter
|
||||
var prevent = false;
|
||||
switch (e.key.toLowerCase()) {
|
||||
case "enter":
|
||||
if (tracks_keys && tracks_keys.length > 0) {
|
||||
this.playTracks();
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case 46:
|
||||
// delete
|
||||
case "d":
|
||||
if (tracks_keys && tracks_keys.length > 0) {
|
||||
this.removeTracks();
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case 65:
|
||||
// a
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
// Select all our tracks
|
||||
case "a":
|
||||
var all_tracks = [];
|
||||
for (var i = 0; i < this.props.tracks.length; i++) {
|
||||
all_tracks.push(this.buildTrackKey(this.props.tracks[i], i));
|
||||
}
|
||||
this.props.uiActions.setSelectedTracks(all_tracks);
|
||||
|
||||
return false;
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (prevent) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'handleDrag',
|
||||
@ -65494,9 +65516,13 @@ function handleException(message) {
|
||||
|
||||
if (!message && data.message) {
|
||||
message = data.message;
|
||||
} else if (!message && data.error.message) {
|
||||
message = data.error.message;
|
||||
}
|
||||
if (!description && data.description) {
|
||||
description = data.description;
|
||||
} else if (!description && data.error.description) {
|
||||
description = data.error.description;
|
||||
}
|
||||
return {
|
||||
type: 'HANDLE_EXCEPTION',
|
||||
@ -68046,6 +68072,8 @@ function getMe() {
|
||||
me: response.user
|
||||
});
|
||||
}
|
||||
}, function (error) {
|
||||
dispatch(coreActions.handleException("Could not get your LastFM profile", error));
|
||||
});
|
||||
};
|
||||
}
|
||||
@ -68076,6 +68104,8 @@ function getTrack(uri) {
|
||||
}, response.track, track);
|
||||
dispatch(coreActions.trackLoaded(merged_track));
|
||||
}
|
||||
}, function (error) {
|
||||
console.info("LastFM: No results for track '" + track_name + "' by '" + artist_name + "'");
|
||||
});
|
||||
};
|
||||
}
|
||||
@ -68106,6 +68136,8 @@ function getArtist(uri, artist) {
|
||||
|
||||
dispatch(coreActions.artistLoaded(artist));
|
||||
}
|
||||
}, function (error) {
|
||||
console.info("LastFM: No results for artist '" + artist + "'");
|
||||
});
|
||||
};
|
||||
}
|
||||
@ -68145,6 +68177,8 @@ function getAlbum(uri, artist, album) {
|
||||
|
||||
dispatch(coreActions.albumLoaded(album));
|
||||
}
|
||||
}, function (error) {
|
||||
console.info("LastFM: No results for album '" + album + "'");
|
||||
});
|
||||
};
|
||||
}
|
||||
@ -69023,9 +69057,12 @@ function playAlbum(uri) {
|
||||
}
|
||||
|
||||
function playPlaylist(uri) {
|
||||
var shuffle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
|
||||
return {
|
||||
type: 'MOPIDY_PLAY_PLAYLIST',
|
||||
uri: uri
|
||||
uri: uri,
|
||||
shuffle: shuffle
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -100,7 +100,7 @@
|
||||
|
||||
// Release details
|
||||
// These are automatically injected to built HTML
|
||||
var build = "1556687496";
|
||||
var build = "1557001978";
|
||||
var version = "3.37.1";
|
||||
|
||||
// Construct the script tag
|
||||
|
||||
@ -30,6 +30,7 @@ export default class Hotkeys extends React.Component {
|
||||
return;
|
||||
}
|
||||
|
||||
let prevent = false;
|
||||
switch(e.key.toLowerCase()){
|
||||
|
||||
case " ":
|
||||
@ -40,6 +41,7 @@ export default class Hotkeys extends React.Component {
|
||||
this.props.mopidyActions.play();
|
||||
this.props.uiActions.createNotification({content: 'play_arrow', type: 'shortcut'});
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "escape":
|
||||
@ -48,26 +50,32 @@ export default class Hotkeys extends React.Component {
|
||||
} else if (this.props.modal){
|
||||
window.history.back();
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "s":
|
||||
this.props.history.push('/search');
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "c":
|
||||
this.props.history.push('/queue');
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "k":
|
||||
this.props.history.push('/kiosk-mode');
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case ",":
|
||||
window.history.back();
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case ".":
|
||||
window.history.forward();
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "l":
|
||||
@ -83,6 +91,7 @@ export default class Hotkeys extends React.Component {
|
||||
}
|
||||
this.props.uiActions.createNotification({content: 'volume_up', type: 'shortcut'});
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "q":
|
||||
@ -98,6 +107,7 @@ export default class Hotkeys extends React.Component {
|
||||
}
|
||||
}
|
||||
this.props.uiActions.createNotification({content: 'volume_down', type: 'shortcut'});
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "m":
|
||||
@ -108,6 +118,7 @@ export default class Hotkeys extends React.Component {
|
||||
this.props.mopidyActions.setMute(true);
|
||||
this.props.uiActions.createNotification({content: 'volume_off', type: 'shortcut'});
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "r":
|
||||
@ -117,27 +128,33 @@ export default class Hotkeys extends React.Component {
|
||||
}
|
||||
this.props.mopidyActions.setTimePosition(new_position);
|
||||
this.props.uiActions.createNotification({content: 'fast_rewind', type: 'shortcut'});
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "f":
|
||||
this.props.mopidyActions.setTimePosition(this.props.play_time_position + 30000);
|
||||
this.props.uiActions.createNotification({content: 'fast_forward', type: 'shortcut'});
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "p":
|
||||
this.props.mopidyActions.previous();
|
||||
this.props.uiActions.createNotification({content: 'skip_previous', type: 'shortcut'});
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case "n":
|
||||
this.props.mopidyActions.next();
|
||||
this.props.uiActions.createNotification({content: 'skip_next', type: 'shortcut'});
|
||||
prevent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (prevent){
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
render(){
|
||||
return null;
|
||||
|
||||
@ -36,43 +36,52 @@ class TrackList extends React.Component{
|
||||
|
||||
handleKeyDown(e){
|
||||
|
||||
// When we're focussed on certian elements (like form input fields), don't fire any shortcuts
|
||||
var ignoreNodes = ['INPUT', 'TEXTAREA']
|
||||
// When we're focussed on certian elements, don't fire any shortcuts
|
||||
// Typically form inputs
|
||||
let ignoreNodes = ['INPUT', 'TEXTAREA'];
|
||||
if (ignoreNodes.indexOf(e.target.nodeName) > -1){
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore when there are any key modifiers. This enables us to avoid interfering
|
||||
// with browser- and OS-default functions.
|
||||
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey){
|
||||
return;
|
||||
}
|
||||
|
||||
var tracks_keys = this.digestTracksKeys()
|
||||
|
||||
switch(e.keyCode){
|
||||
case 13: // enter
|
||||
|
||||
let prevent = false;
|
||||
switch(e.key.toLowerCase()){
|
||||
case "enter":
|
||||
if (tracks_keys && tracks_keys.length > 0){
|
||||
this.playTracks();
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case 46: // delete
|
||||
case "d":
|
||||
if (tracks_keys && tracks_keys.length > 0){
|
||||
this.removeTracks();
|
||||
}
|
||||
prevent = true;
|
||||
break;
|
||||
|
||||
case 65: // a
|
||||
if ((e.ctrlKey || e.metaKey)){
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
// Select all our tracks
|
||||
case "a":
|
||||
var all_tracks = []
|
||||
for (var i = 0; i < this.props.tracks.length; i++){
|
||||
all_tracks.push(this.buildTrackKey(this.props.tracks[i], i))
|
||||
}
|
||||
this.props.uiActions.setSelectedTracks(all_tracks)
|
||||
|
||||
return false
|
||||
}
|
||||
this.props.uiActions.setSelectedTracks(all_tracks);
|
||||
prevent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (prevent){
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
handleDrag(e,track_key){
|
||||
|
||||
@ -55,9 +55,13 @@ export function startSearch(search_type, query, only_mopidy = false){
|
||||
export function handleException(message, data = {}, description = null, show_notification = true){
|
||||
if (!message && data.message){
|
||||
message = data.message;
|
||||
} else if (!message && data.error.message){
|
||||
message = data.error.message;
|
||||
}
|
||||
if (!description && data.description){
|
||||
description = data.description;
|
||||
} else if (!description && data.error.description){
|
||||
description = data.error.description;
|
||||
}
|
||||
return {
|
||||
type: 'HANDLE_EXCEPTION',
|
||||
|
||||
@ -177,6 +177,12 @@ export function getMe(){
|
||||
me: response.user
|
||||
});
|
||||
}
|
||||
},
|
||||
error => {
|
||||
dispatch(coreActions.handleException(
|
||||
"Could not get your LastFM profile",
|
||||
error
|
||||
));
|
||||
}
|
||||
)
|
||||
}
|
||||
@ -223,6 +229,9 @@ export function getTrack(uri){
|
||||
);
|
||||
dispatch(coreActions.trackLoaded(merged_track));
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.info("LastFM: No results for track '"+track_name+"' by '"+artist_name+"'");
|
||||
}
|
||||
)
|
||||
}
|
||||
@ -254,6 +263,9 @@ export function getArtist(uri, artist, mbid = false){
|
||||
|
||||
dispatch(coreActions.artistLoaded(artist));
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.info("LastFM: No results for artist '"+artist+"'");
|
||||
}
|
||||
)
|
||||
}
|
||||
@ -294,6 +306,9 @@ export function getAlbum(uri, artist, album, mbid = false){
|
||||
|
||||
dispatch(coreActions.albumLoaded(album));
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.info("LastFM: No results for album '"+album+"'");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -129,6 +129,7 @@ $bp_shallow: 650px;
|
||||
|
||||
@mixin click_feedback($colour: rgba(255,255,255,0.5), $duration: 0.2s, $easing: ease-out){
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
@keyframes click_feedback {
|
||||
0% {
|
||||
|
||||
Reference in New Issue
Block a user