allow selecting multiple headlines/articles by ctrl-click; change click handling on CDM article content

This commit is contained in:
Andrew Dolgov 2010-11-11 13:37:03 +03:00
parent 73d1378f62
commit 1ede58149d
4 changed files with 105 additions and 29 deletions

View File

@ -5262,14 +5262,9 @@
print "<td class='hlMarkedPic'>$marked_pic</td>";
print "<td class='hlMarkedPic'>$published_pic</td>";
# if ($line["feed_title"]) {
# print "<td class='hlContent'>$content_link</td>";
# print "<td class='hlFeed'>
# <a href=\"javascript:viewfeed($feed_id, '', false)\">".
# truncate_string($line["feed_title"],30)."</a>&nbsp;</td>";
# } else {
print "<td onclick='view($id)' class='hlContent$hlc_suffix' valign='middle' id='HLC-$id'>";
print "<td onclick='return hlClicked(event,$id)'
title=\"".__("Click to select, ctrl-click selects multiple")."\"
class='hlContent$hlc_suffix' valign='middle' id='HLC-$id'>";
print "<a id=\"RTITLE-$id\"
href=\"" . htmlspecialchars($line["link"]) . "\"
@ -5286,9 +5281,6 @@
print $labels_str;
# <a href=\"javascript:viewfeed($feed_id, '', false)\">".
# $line["feed_title"]."</a>
if (!get_pref($link, 'VFEED_GROUP_BY_FEED')) {
if (@$line["feed_title"]) {
print "<span class=\"hlFeed\">
@ -5298,14 +5290,12 @@
}
}
// print "<img id='HLL-$id' class='hlLoading'
// src='images/indicator_tiny.gif' style='display : none'>";
print "</td>";
# }
print "<td class=\"hlUpdated\" onclick='view($id)'><nobr>$updated_fmt&nbsp;</nobr></td>";
print "<td class=\"hlUpdated\"
onclick='return hlClicked(event,$id)'><nobr>$updated_fmt&nbsp;
</nobr></td>";
print "<td class='hlMarkedPic'>$score_pic</td>";
@ -5396,8 +5386,8 @@
print "</div>";
print "<div class=\"cdmContent\" $content_hidden
title=\"".__("Click to select article")."\"
onclick=\"toggleSelected($id);\"
title=\"".__("Click to select, ctrl-click selects multiple")."\"
onclick=\"return cdmClicked(event, $id);\"
id=\"CICD-$id\">";
print "<div class=\"cdmContentInner\">";
@ -5445,6 +5435,8 @@
$article_content = sanitize_rss($link, $line["content_preview"],
false, false, $feed_site_url);
if (!$article_content) $article_content = "&nbsp;";
print "<div id=\"POSTNOTE-$id\">";
if ($line['note']) {
print format_article_note($id, $line['note']);
@ -5500,7 +5492,7 @@
print "<img src=\"images/digest_checkbox.png\"
style=\"cursor : pointer\" style=\"cursor : pointer\"
onclick=\"cdmDismissArticle($id)\"
onclick=\"dismissArticle($id)\"
alt='Dismiss' title='".__('Dismiss article')."'>";
print "</div>";

View File

@ -17,7 +17,8 @@
<tr><td class='n'>S</td><td><?php echo __("Toggle published") ?></td></tr>
<tr><td class='n'>u</td><td><?php echo __("Toggle unread") ?></td></tr>
<tr><td class='n'>T</td><td><?php echo __("Edit tags") ?></td></tr>
<tr><td class='n'>D</td><td><?php echo __("In combined mode, dismiss selected articles") ?></td></tr>
<tr><td class='n'>D</td><td><?php echo __("Dismiss selected articles") ?></td></tr>
<tr><td class='n'>X</td><td><?php echo __("Dismiss read articles") ?></td></tr>
<tr><td class='n'>o</td><td><?php echo __("Open article in new window") ?></td></tr>
<tr><td class='n'>c n/c p</td><td><?php echo __("Mark articles below/above active one as read") ?></td></tr>
<tr><td class='n'>N/P</td><td><?php echo __("Scroll article content") ?></td></tr>

View File

@ -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

View File

@ -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;
}