add special link to cancel current search

This commit is contained in:
Andrew Dolgov 2012-10-30 10:24:30 +04:00
parent 24be5e836f
commit 74467907c5
2 changed files with 17 additions and 1 deletions

View File

@ -59,6 +59,7 @@ class Feeds extends Handler_Protected {
// right part
$reply .= "<span class='r'>";
$reply .= "<span id='feed_title'>";
if ($feed_site_url) {
$target = "target=\"_blank\"";
@ -73,6 +74,8 @@ class Feeds extends Handler_Protected {
$reply .= $feed_title;
}
$reply .= "</span>";
$reply .= "
<a href=\"#\"
title=\"".__("View as RSS feed")."\"

View File

@ -98,6 +98,12 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
initHeadlinesMenu();
if (_search_query) {
$("feed_title").innerHTML += "<span id='cancel_search'>" +
" (<a href='#' onclick='cancelSearch()'>" + __("Cancel search") + "</a>)" +
"</span>";
}
} else {
if (headlines_count > 0 && feed_id == getActiveFeedId() && is_cat == activeFeedIsCat()) {
@ -2123,4 +2129,11 @@ function precache_headlines() {
}
}
function cancelSearch() {
try {
_search_query = "";
viewCurrentFeed();
} catch (e) {
exception_error("cancelSearch", e);
}
}