fix #1724 (Make up/down arrow keys work in /news)

This commit is contained in:
rolux 2013-08-27 08:43:58 +00:00
parent dc1f4e5ae5
commit ab6fa1c363
2 changed files with 13 additions and 0 deletions

View file

@ -196,6 +196,13 @@ pandora.ui.news = function(width, height) {
$text && $text.css({width: width - 512}); $text && $text.css({width: width - 512});
}; };
that.selectItem = function(direction) {
var index = Ox.getIndexById(items, pandora.user.ui.part.news) + direction;
if (index > -1 && index < items.length) {
pandora.UI.set('part.news', items[index].id);
}
};
that.bindEvent({ that.bindEvent({
'pandora_part.news': selectItem 'pandora_part.news': selectItem
}); });

View file

@ -176,6 +176,12 @@ pandora.ui.siteDialog = function(section) {
} else if (selected == 'news') { } else if (selected == 'news') {
pandora.$ui.news.resize(data); pandora.$ui.news.resize(data);
} }
},
key_down: function() {
pandora.user.ui.page == 'news' && pandora.$ui.news.selectItem(1);
},
key_up: function() {
pandora.user.ui.page == 'news' && pandora.$ui.news.selectItem(-1);
} }
}); });