forked from 0x2620/pandora
fix #1724 (Make up/down arrow keys work in /news)
This commit is contained in:
parent
dc1f4e5ae5
commit
ab6fa1c363
2 changed files with 13 additions and 0 deletions
|
@ -196,6 +196,13 @@ pandora.ui.news = function(width, height) {
|
|||
$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({
|
||||
'pandora_part.news': selectItem
|
||||
});
|
||||
|
|
|
@ -176,6 +176,12 @@ pandora.ui.siteDialog = function(section) {
|
|||
} else if (selected == 'news') {
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue