when the browser has focus, make pressing space shift the focus to the player/editor/timeline and trigger play (fixes #526)

This commit is contained in:
rolux 2012-04-24 08:16:45 +00:00
parent 1dfcd9698d
commit 5b0a8ea03e

View file

@ -122,6 +122,12 @@ pandora.ui.browser = function() {
open: function() {
that.scrollToSelection();
},
openpreview: function() {
var itemView = pandora.user.ui.itemView;
if (['player', 'editor', 'timeline'].indexOf(itemView) > -1) {
pandora.$ui[itemView].gainFocus().triggerEvent('key_space');
}
},
select: function(data) {
data.ids.length && pandora.UI.set({
'item': data.ids[0]
@ -157,6 +163,18 @@ pandora.ui.browser = function() {
pandora_showsiteposters: function() {
pandora.user.ui.icons == 'posters' && that.reloadList(true);
}
})
.bindEventOnce({
load: function() {
// gain focus if we're on page load or if we've just switched
// to an item and the not-yet-garbage-collected list still has
// focus
if (Ox.Focus.focused() === null || (
pandora.$ui.list && pandora.$ui.list.hasFocus()
)) {
that.gainFocus();
}
}
});
that.css({overflowY: 'hidden'}); // this fixes a bug in firefox
pandora.enableDragAndDrop(that, false);