fix a bug where the selected list, if its folder had loaded late, would steal focus from the main find element

This commit is contained in:
rolux 2011-11-07 19:55:39 +00:00
parent 0452e32b79
commit 03f0b4a726
2 changed files with 18 additions and 12 deletions

View file

@ -302,27 +302,27 @@ pandora.ui.mainMenu = function() {
} }
}, },
key_control_comma: function() { key_control_comma: function() {
if (pandora.hasNoDialogOrScreen()) { if (!pandora.hasDialogOrScreen()) {
pandora.URL.push('/preferences'); pandora.URL.push('/preferences');
} }
}, },
key_control_f: function() { key_control_f: function() {
if (pandora.hasNoDialogOrScreen()) { if (!pandora.hasDialogOrScreen()) {
pandora.$ui.findInput.focusInput(true); pandora.$ui.findInput.focusInput(true);
} }
}, },
key_control_shift_w: function() { key_control_shift_w: function() {
if (pandora.hasNoDialogOrScreen() || (ui.item || ui._list)) { if (!pandora.hasDialogOrScreen() || (ui.item || ui._list)) {
pandora.UI.set({find: {conditions: [], operator: '&'}}); pandora.UI.set({find: {conditions: [], operator: '&'}});
} }
}, },
key_control_slash: function() { key_control_slash: function() {
if (pandora.hasNoDialogOrScreen()) { if (!pandora.hasDialogOrScreen()) {
pandora.URL.push('/help'); pandora.URL.push('/help');
} }
}, },
key_control_w: function() { key_control_w: function() {
if (pandora.hasNoDialogOrScreen()) { if (!pandora.hasDialogOrScreen()) {
if (ui.item) { if (ui.item) {
pandora.UI.set({item: ''}); pandora.UI.set({item: ''});
} else if (ui._list) { } else if (ui._list) {

View file

@ -719,11 +719,16 @@ pandora.getVideoPartsAndPoints = function(durations, points) {
return ret; return ret;
}; };
pandora.hasNoDialogOrScreen = function() { pandora.hasDialogOrScreen = function() {
return $('.OxDialog:visible').length == 0 return $('.OxDialog:visible').length
&& $('.OxFullscreen').length == 0 || $('.OxFullscreen').length
&& $('.OxScreen').length == 0; || $('.OxScreen').length;
} };
pandora.hasFocusedInput = function() {
var focused = Ox.Focus.focused();
return focused && Ox.UI.elements[focused].is('.OxInput');
};
pandora.isClipView = function(view, item) { pandora.isClipView = function(view, item) {
if (arguments.length == 0) { if (arguments.length == 0) {
@ -932,8 +937,9 @@ pandora.selectList = function() {
); );
pandora.$ui.folderList[folder] pandora.$ui.folderList[folder]
.options({selected: [pandora.user.ui._list]}); .options({selected: [pandora.user.ui._list]});
// Don't steal focus from home screen if (!pandora.hasDialogOrScreen() && !pandora.hasFocusedInput()) {
$('.OxScreen').length == 0 && pandora.$ui.folderList[folder].gainFocus(); pandora.$ui.folderList[folder].gainFocus();
}
} }
}); });
} }