]> git.wh0rd.org Git - tt-rss.git/commitdiff
allow selecting multiple headlines/articles by ctrl-click; change click handling...
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 11 Nov 2010 10:37:03 +0000 (13:37 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 11 Nov 2010 10:37:03 +0000 (13:37 +0300)
functions.php
help/3.php
tt-rss.js
viewfeed.js

index 61be7fa66133ca46bdcfe70b51e29f29579fee22..0ae97af4f1942288901c94e6056cf286d9ed986b 100644 (file)
                                        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"]) . "\"
 
                                        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\">
                                                }
                                        }
 
-//                                     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>";
 
                                        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\">";
                                        $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']);
 
                                        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>";
index 47ef3c9d7d98a47d4506532687c6acd82c5efe4c..76142417f020d9a27f0e39af771a5325426c5727 100644 (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>
index 917196ba9c445a6ca910b6b96c803610c9abce68..b97a19aa1d74ea7af5275f0a61da28209904a938 100644 (file)
--- 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
index 0551de9ae7d0c6b062059e0312479193a2368934..dbc166c734fd60623fcb1f6d56481a964ec9bba8 100644 (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;
+}