]> git.wh0rd.org Git - tt-rss.git/commitdiff
add link to invert headline/article selection (closes #216)
authorAndrew Dolgov <fox@madoka.spb.ru>
Mon, 18 Aug 2008 06:21:35 +0000 (07:21 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Mon, 18 Aug 2008 06:21:35 +0000 (07:21 +0100)
functions.php
viewfeed.js

index e245d53fd5b1583360a4d9a29ea942ff93b9792a..3c21eda847005d7afc24e653d0a55d5f930f0b7a 100644 (file)
                                $sel_all_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, '', true)";
                                $sel_unread_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true)";
                                $sel_none_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false)";
+                               $sel_inv_link = "javascript:invertHeadlineSelection()";
 
                                $tog_unread_link = "javascript:selectionToggleUnread()";
                                $tog_marked_link = "javascript:selectionToggleMarked()";
                                $sel_unread_link = "javascript:cdmSelectArticles('unread')";
                                $sel_none_link = "javascript:cdmSelectArticles('none')";
 
+                               $sel_inv_link = "javascript:invertHeadlineSelection()";
+
                                $tog_unread_link = "javascript:selectionToggleUnread(true)";
                                $tog_marked_link = "javascript:selectionToggleMarked(true)";
                                $tog_published_link = "javascript:selectionTogglePublished(true)";
                                                ".__('Select:')."
                                                        <a href=\"$sel_all_link\">".__('All')."</a>,
                                                        <a href=\"$sel_unread_link\">".__('Unread')."</a>,
+                                                       <a href=\"$sel_inv_link\">".__('Invert')."</a>,
                                                        <a href=\"$sel_none_link\">".__('None')."</a></li>
                                                <li class=\"vsep\">&nbsp;</li>
                                                <li class=\"top\">".__('Actions...')."<ul>
index 4ee06e4610dba045b95d5fa5c3897053ef824d7d..e14911a2cb0359bb5d1d89a01bd7edc733673159 100644 (file)
@@ -1850,6 +1850,45 @@ function hideReadHeadlines() {
        } 
 }
 
+function invertHeadlineSelection() {
+       try {
+               var rows = new Array();
+               var r = false;
+               
+               if (!isCdmMode()) {             
+                       r = document.getElementsByTagName("TR");
+               } else {
+                       r = document.getElementsByTagName("DIV");
+               }
+
+               for (var i = 0; i < r.length; i++) {
+                       if (r[i].id && r[i].id.match("RROW-")) {
+                               rows.push(r[i]);
+                       }
+               }
+               
+               for (var i = 0; i < rows.length; i++) {
+                       var nc = rows[i].className;
+                       var id = rows[i].id.replace("RROW-", "");
+                       var cb = document.getElementById("RCHK-" + id);
+
+                       if (!rows[i].className.match("Selected")) {
+                               nc = nc + "Selected";
+                               cb.checked = true;
+                       } else {
+                               nc = nc.replace("Selected", "");
+                               cb.checked = false;
+                       }
+
+                       rows[i].className = nc;
+
+               }
+
+       } catch (e) {
+               exception_error("invertHeadlineSelection", e);
+       }
+}
+
 function getArticleUnderPointer() {
        return post_under_pointer;
 }