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() {
if (pandora.hasNoDialogOrScreen()) {
if (!pandora.hasDialogOrScreen()) {
pandora.URL.push('/preferences');
}
},
key_control_f: function() {
if (pandora.hasNoDialogOrScreen()) {
if (!pandora.hasDialogOrScreen()) {
pandora.$ui.findInput.focusInput(true);
}
},
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: '&'}});
}
},
key_control_slash: function() {
if (pandora.hasNoDialogOrScreen()) {
if (!pandora.hasDialogOrScreen()) {
pandora.URL.push('/help');
}
},
key_control_w: function() {
if (pandora.hasNoDialogOrScreen()) {
if (!pandora.hasDialogOrScreen()) {
if (ui.item) {
pandora.UI.set({item: ''});
} else if (ui._list) {

View file

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