online search in headline buffer (hotkey shift-I)

This commit is contained in:
Andrew Dolgov 2008-05-04 07:46:32 +01:00
parent 69811a7d4e
commit 7a822893ce
5 changed files with 93 additions and 27 deletions

View 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') { if (typeof localHotkeyHandler != 'undefined') {
try { try {
return localHotkeyHandler(e); return localHotkeyHandler(e);
@ -1056,38 +1069,40 @@ function selectTableRowsByIdPrefix(content_id, prefix, check_prefix, do_select,
} }
for (i = 0; i < content.rows.length; i++) { 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) { } else if (reset_others) {
selectTableRow(content.rows[i], false); selectTableRow(content.rows[i], false);
var row_id = content.rows[i].id.replace(prefix, ""); var row_id = content.rows[i].id.replace(prefix, "");
var check = document.getElementById(check_prefix + row_id); var check = document.getElementById(check_prefix + row_id);
if (check) { if (check) {
check.checked = false; 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;
}
} }
} }
} }

View File

@ -3964,7 +3964,15 @@
print "<td class=\"headlineTitle$rtl_cpart\">"; 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 ($feed_site_url) {
if (!$bottom) { if (!$bottom) {
@ -3984,8 +3992,6 @@
print " [$user_page_offset] "; print " [$user_page_offset] ";
} }
print "</span>";
if (!$bottom && !$disable_feed) { if (!$bottom && !$disable_feed) {
print " print "
<a target=\"_new\" <a target=\"_new\"
@ -3996,7 +4002,9 @@
} else if ($feed_small_icon) { } else if ($feed_small_icon) {
print "<img class=\"noborder\" alt=\"\" src=\"images/$feed_small_icon\">"; print "<img class=\"noborder\" alt=\"\" src=\"images/$feed_small_icon\">";
} }
print "</span>";
print "</td>"; print "</td>";
print "</tr></table>"; print "</tr></table>";
@ -4981,7 +4989,7 @@
print "<td class='hlContent$hlc_suffix' valign='middle'>"; 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"]; $line["title"];
if (get_pref($link, 'SHOW_CONTENT_PREVIEW')) { if (get_pref($link, 'SHOW_CONTENT_PREVIEW')) {

View File

@ -743,6 +743,12 @@ table.headlinesSubToolbar {
background-color : white; background-color : white;
} }
input#subtoolbar_search_box {
height : 10px;
font-size : 7pt;
vertical-align : middle;
}
table.headlinesSubToolbar td.headlineActions { table.headlinesSubToolbar td.headlineActions {
font-size : 9pt; font-size : 9pt;
font-family : "Lucida Grande", Tahoma, Arial, sans-serif; font-family : "Lucida Grande", Tahoma, Arial, sans-serif;

View File

@ -891,3 +891,4 @@ function rescoreCurrentFeed() {
} }
} }

View File

@ -152,6 +152,8 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
markHeadline(ids[i]); markHeadline(ids[i]);
} }
subtoolbarSearch();
} else { } else {
debug("no new headlines received"); 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);
}
}