From ab6fa1c36376df5cefaa81766a35c7728bb0b300 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 27 Aug 2013 08:43:58 +0000 Subject: [PATCH] fix #1724 (Make up/down arrow keys work in /news) --- static/js/news.js | 7 +++++++ static/js/siteDialog.0xdb.js | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/static/js/news.js b/static/js/news.js index 2a520683..25f1d007 100644 --- a/static/js/news.js +++ b/static/js/news.js @@ -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 }); diff --git a/static/js/siteDialog.0xdb.js b/static/js/siteDialog.0xdb.js index 319a6063..454a73a1 100644 --- a/static/js/siteDialog.0xdb.js +++ b/static/js/siteDialog.0xdb.js @@ -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); } });