From 1ede58149d1fc7929a1daa8c37ee843398dc8e99 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Nov 2010 13:37:03 +0300 Subject: [PATCH] allow selecting multiple headlines/articles by ctrl-click; change click handling on CDM article content --- functions.php | 32 +++++++----------- help/3.php | 3 +- tt-rss.js | 9 +++--- viewfeed.js | 90 ++++++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 105 insertions(+), 29 deletions(-) diff --git a/functions.php b/functions.php index 61be7fa6..0ae97af4 100644 --- a/functions.php +++ b/functions.php @@ -5262,14 +5262,9 @@ print "$marked_pic"; print "$published_pic"; -# if ($line["feed_title"]) { -# print "$content_link"; -# print " -# ". -# truncate_string($line["feed_title"],30)." "; -# } else { - - print ""; + print ""; print "". -# $line["feed_title"]." - if (!get_pref($link, 'VFEED_GROUP_BY_FEED')) { if (@$line["feed_title"]) { print " @@ -5298,14 +5290,12 @@ } } -// print ""; - print ""; -# } - - print "$updated_fmt "; + + print "$updated_fmt  + "; print "$score_pic"; @@ -5396,8 +5386,8 @@ print ""; print "
"; print "
"; @@ -5445,6 +5435,8 @@ $article_content = sanitize_rss($link, $line["content_preview"], false, false, $feed_site_url); + if (!$article_content) $article_content = " "; + print "
"; if ($line['note']) { print format_article_note($id, $line['note']); @@ -5500,7 +5492,7 @@ print "Dismiss"; print "
"; diff --git a/help/3.php b/help/3.php index 47ef3c9d..76142417 100644 --- a/help/3.php +++ b/help/3.php @@ -17,7 +17,8 @@ S u T - D + D + X o c n/c p N/P diff --git a/tt-rss.js b/tt-rss.js index 917196ba..b97a19aa 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -953,10 +953,11 @@ function hotkey_handler(e) { } if (keycode == 68 && shift_key) { // shift-D - if (isCdmMode()) { - //cdmDismissArticle(active_post_id); - cdmDismissSelectedArticles(); - } + dismissSelectedArticles(); + } + + if (keycode == 88 && shift_key) { // shift-X + dismissReadArticles(); } if (keycode == 78 || keycode == 40) { // n, down diff --git a/viewfeed.js b/viewfeed.js index 0551de9a..dbc166c7 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -2386,7 +2386,7 @@ function emailArticleDo() { } } -function cdmDismissArticle(id) { +function dismissArticle(id) { try { var elem = $("RROW-" + id); @@ -2395,11 +2395,11 @@ function cdmDismissArticle(id) { new Effect.Fade(elem, {duration : 0.5}); } catch (e) { - exception_error("cdmDismissArticle", e); + exception_error("dismissArticle", e); } } -function cdmDismissSelectedArticles() { +function dismissSelectedArticles() { try { var ids = getSelectedArticleIds2(); @@ -2413,6 +2413,88 @@ function cdmDismissSelectedArticles() { selectionToggleUnread(false); } catch (e) { - exception_error("cdmDismissArticle", e); + exception_error("dismissSelectedArticles", e); } } + +function dismissReadArticles() { + try { + + var ids = getVisibleArticleIds(); + + for (var i = 0; i < ids.length; i++) { + var elem = $("RROW-" + ids[i]); + + if (elem.className && !elem.className.match("Unread") && + !elem.className.match("Selected")) { + + new Effect.Fade(elem, {duration : 0.5}); + } + } + + } catch (e) { + exception_error("dismissSelectedArticles", e); + } +} + +function getVisibleArticleIds() { + try { + if (isCdmMode()) { + return cdmGetVisibleArticles(); + } else { + return getVisibleHeadlineIds(); + } + } catch (e) { + exception_error("getVisibleArticleIds"); + } +} + +function cdmClicked(event, id) { + try { + var shift_key = event.shiftKey; + + if (!event.ctrlKey) { + cdmSelectArticles("none"); + toggleSelected(id); + + var elem = $("RROW-" + id); + + if (elem) + elem.className = elem.className.replace("Unread", ""); + + var query = "?op=rpc&subop=catchupSelected" + + "&cmode=0&ids=" + param_escape(id); + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + handle_rpc_reply(transport); + } }); + + } else { + toggleSelected(id); + } + + } catch (e) { + exception_error("cdmClicked"); + } + + return false; +} + +function hlClicked(event, id) { + try { + var shift_key = event.shiftKey; + + if (!event.ctrlKey) { + view(id); + } else { + toggleSelected(id); + } + + } catch (e) { + exception_error("hlClicked"); + } + + return false; +} -- 2.39.5