]> git.wh0rd.org Git - tt-rss.git/commitdiff
online search in headline buffer (hotkey shift-I)
authorAndrew Dolgov <fox@madoka.spb.ru>
Sun, 4 May 2008 06:46:32 +0000 (07:46 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Sun, 4 May 2008 06:46:32 +0000 (07:46 +0100)
functions.js
functions.php
tt-rss.css
tt-rss.js
viewfeed.js

index 9ef91c59a5ea16b522a8ca056ebe265e2ec2f06c..088b986ee31f0165cc417be3feef7029b9a0abe2 100644 (file)
@@ -353,6 +353,19 @@ function hotkey_handler(e) {
                        }
                }
 
+               if (keycode == 73 && shift_key) { // shift + i
+                       if (document.getElementById("subtoolbar_search")) {
+                               if (Element.visible("subtoolbar_search")) {
+                                       Element.hide("subtoolbar_search");
+                                       Element.show("subtoolbar_ftitle");
+                                       setTimeout("Element.focus('subtoolbar_search_box')", 100);
+                               } else {
+                                       Element.show("subtoolbar_search");
+                                       Element.hide("subtoolbar_ftitle");
+                               }
+                       }
+               }
+
                if (typeof localHotkeyHandler != 'undefined') {
                        try {
                                return localHotkeyHandler(e);
@@ -1056,38 +1069,40 @@ function selectTableRowsByIdPrefix(content_id, prefix, check_prefix, do_select,
        }
 
        for (i = 0; i < content.rows.length; i++) {
-               if (!classcheck || content.rows[i].className.match(classcheck)) {
+               if (Element.visible(content.rows[i])) {
+                       if (!classcheck || content.rows[i].className.match(classcheck)) {
+               
+                               if (content.rows[i].id.match(prefix)) {
+                                       selectTableRow(content.rows[i], do_select);
+                               
+                                       var row_id = content.rows[i].id.replace(prefix, "");
+                                       var check = document.getElementById(check_prefix + row_id);
+       
+                                       if (check) {
+                                               check.checked = do_select;
+                                       }
+                               } else if (reset_others) {
+                                       selectTableRow(content.rows[i], false);
+       
+                                       var row_id = content.rows[i].id.replace(prefix, "");
+                                       var check = document.getElementById(check_prefix + row_id);
+       
+                                       if (check) {
+                                               check.checked = false;
+                                       }
        
-                       if (content.rows[i].id.match(prefix)) {
-                               selectTableRow(content.rows[i], do_select);
-                       
-                               var row_id = content.rows[i].id.replace(prefix, "");
-                               var check = document.getElementById(check_prefix + row_id);
-
-                               if (check) {
-                                       check.checked = do_select;
                                }
                        } else if (reset_others) {
                                selectTableRow(content.rows[i], false);
-
+       
                                var row_id = content.rows[i].id.replace(prefix, "");
                                var check = document.getElementById(check_prefix + row_id);
-
+       
                                if (check) {
                                        check.checked = false;
                                }
-
-                       }
-               } else if (reset_others) {
-                       selectTableRow(content.rows[i], false);
-
-                       var row_id = content.rows[i].id.replace(prefix, "");
-                       var check = document.getElementById(check_prefix + row_id);
-
-                       if (check) {
-                               check.checked = false;
+       
                        }
-
                }
        }
 }
index 449bb4e51dc193ec4609e27c95f7a872a205a3f3..7193164610914c99413c81fb4a2167ca299e1ecd 100644 (file)
 
                        print "<td class=\"headlineTitle$rtl_cpart\">";
 
-                       print "<span class=\"headlineInnerTitle\">";
+                       print "<span id=\"subtoolbar_search\" 
+                               style=\"display : none\">Search: <input 
+                               id=\"subtoolbar_search_box\"
+                               onblur=\"javascript:enableHotkeys();\" 
+                               onfocus=\"javascript:disableHotkeys();\"
+                               onchange=\"subtoolbarSearch()\"
+                               onkeyup=\"subtoolbarSearch()\" type=\"search\"></span>";
+
+                       print "<span id=\"subtoolbar_ftitle\">";
 
                        if ($feed_site_url) {
                                if (!$bottom) {
                                print " [$user_page_offset] ";
                        }
 
-                       print "</span>";
-
                        if (!$bottom && !$disable_feed) {
                                print "
                                        <a target=\"_new\" 
                        } else if ($feed_small_icon) {
                                print "<img class=\"noborder\" alt=\"\" src=\"images/$feed_small_icon\">";
                        }
-                               
+
+                       print "</span>";
+
                        print "</td>";
                        print "</tr></table>";
 
 
                                        print "<td class='hlContent$hlc_suffix' valign='middle'>";
 
-                                       print "<a href=\"javascript:view($id,$feed_id);\">" .
+                                       print "<a id=\"RTITLE-$id\" href=\"javascript:view($id,$feed_id);\">" .
                                                $line["title"];
 
                                        if (get_pref($link, 'SHOW_CONTENT_PREVIEW')) {
index e33b291a41820a4b3b214d7331da5dad59191959..e772b83b5b60a543764d8bacaff772678da41a29 100644 (file)
@@ -743,6 +743,12 @@ table.headlinesSubToolbar {
        background-color : white;
 }
 
+input#subtoolbar_search_box {
+       height : 10px;
+       font-size : 7pt;
+       vertical-align : middle;
+}
+
 table.headlinesSubToolbar td.headlineActions {
        font-size : 9pt;
        font-family : "Lucida Grande", Tahoma, Arial, sans-serif;
index 25efe8f652092d75146b10a0e025aaadca9b120c..11ce57b73492ab3a60ab9d468c9e8b2f2cedf36d 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -891,3 +891,4 @@ function rescoreCurrentFeed() {
        }
 }
 
+
index 79dbe003725bf674ec9a4252be4c892539569e62..4a192a35e5e3da105857175698ec7053c56ab4a7 100644 (file)
@@ -152,6 +152,8 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
                                                        markHeadline(ids[i]);
                                                }
 
+                                               subtoolbarSearch();
+
                                        } else {
                                                debug("no new headlines received");
                                        }
@@ -1677,4 +1679,38 @@ function cdmExpandArticle(a_id) {
 
 }
 
+function subtoolbarSearch() {
+
+       try {
+
+               var q = document.getElementById("subtoolbar_search_box");
+               
+               if (!q) return;
+
+               q = q.value.toUpperCase();
+
+               var ids = false;
+
+               if (document.getElementById("headlinesList")) {
+                       ids = getVisibleHeadlineIds();
+               } else {
+                       ids = cdmGetVisibleArticles();
+               }
 
+               for (var i = 0; i < ids.length; i++) {
+                       var title = document.getElementById("RTITLE-" + ids[i]);
+
+                       if (title) {
+                               if (!title.innerHTML.toUpperCase().match(q)) {
+                                       Element.hide(document.getElementById("RROW-" + ids[i]));
+                               } else {
+                                       Element.show(document.getElementById("RROW-" + ids[i]));
+                               }
+                       }
+               }
+
+       } catch (e) {
+               exception_error("subtoolbarSearch", e);
+       }
+
+}