From df485d4f8e15f1f5ed47d0699124b5d8fc35ebf0 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 3 Jun 2008 16:37:46 +0100 Subject: [PATCH] new hotkey =: toggle hide read headlines --- feedlist.js | 3 +++ help/3.php | 1 + tt-rss.js | 5 +++++ viewfeed.js | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+) diff --git a/feedlist.js b/feedlist.js index 1cd784524..6ac2765d1 100644 --- a/feedlist.js +++ b/feedlist.js @@ -44,6 +44,9 @@ function viewNextFeedPage() { function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) { try { + // reset = hotkey + read_headlines_visible = true; + // if (!offset) page_offset = 0; last_requested_article = 0; diff --git a/help/3.php b/help/3.php index fa65df2cc..701214ada 100644 --- a/help/3.php +++ b/help/3.php @@ -38,6 +38,7 @@ + diff --git a/tt-rss.js b/tt-rss.js index 8ac20bfe8..a9a3b3f1b 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -1170,6 +1170,11 @@ function hotkey_handler(e) { } } } + + if (keycode == 187) { // = + hideReadHeadlines(); + return; + } } /* Prefix f */ diff --git a/viewfeed.js b/viewfeed.js index 21e9f48bf..9890ac233 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -21,6 +21,7 @@ var vgroup_last_feed = false; var post_under_pointer = false; var last_requested_article = false; +var read_headlines_visible = true; function catchup_callback() { if (xmlhttp_rpc.readyState == 4) { @@ -1792,6 +1793,46 @@ function subtoolbarSearch() { } } +function hideReadHeadlines() { + try { + + var ids = false; + var vis_ids = new Array(); + + if (document.getElementById("headlinesList")) { + ids = getVisibleHeadlineIds(); + } else { + ids = cdmGetVisibleArticles(); + } + + for (var i = 0; i < ids.length; i++) { + var row = document.getElementById("RROW-" + ids[i]); + + if (row && row.className) { + if (read_headlines_visible) { + if (row.className.match("Unread") || row.className.match("Selected")) { + Element.show(row); + vis_ids.push(ids[i]); + } else { + //Effect.Fade(row, {duration : 0.3}); + Element.hide(row); + } + } else { + Element.show(row); + vis_ids.push(ids[i]); + } + } + } + + fixHeadlinesOrder(vis_ids); + + read_headlines_visible = !read_headlines_visible; + + } catch (e) { + exception_error("hideReadHeadlines", e); + } +} + function getArticleUnderPointer() { return post_under_pointer; }
r
R
=
f a
f s
f e