diff options
author | Andrew Dolgov <[email protected]> | 2006-10-01 07:33:32 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2006-10-01 07:33:32 +0100 |
commit | 6e6504bc029415d347712da5a0ca4ed39e394cf3 (patch) | |
tree | 7af71bfbe6df2d7a1a8a62d63a1be5b220c9e786 | |
parent | 5f0429a233168c6b1e8b9d75a5f0d590d1ebfba2 (diff) |
modify filterCR to call user-specified callback on CR (e.g. for search toolbar)
-rw-r--r-- | backend.php | 4 | ||||
-rw-r--r-- | functions.js | 26 | ||||
-rw-r--r-- | tt-rss.js | 2 | ||||
-rw-r--r-- | tt-rss.php | 2 |
4 files changed, 22 insertions, 12 deletions
diff --git a/backend.php b/backend.php index e9bca7346..c63b981c2 100644 --- a/backend.php +++ b/backend.php @@ -2511,7 +2511,7 @@ print "<table width='100%'><tr><td>Search:</td><td>"; print "<input name=\"query\" class=\"iedit\" - onkeypress=\"return filterCR(event)\" + onkeypress=\"return filterCR(event, search)\" onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\" value=\"\"> </td></tr>"; @@ -2647,7 +2647,7 @@ print "<table width='100%'>"; print "<tr><td>Match:</td> - <td><input onkeypress=\"return filterCR(event)\" + <td><input onkeypress=\"return filterCR(event, qaddFilter)\" onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\" name=\"reg_exp\" class=\"iedit\">"; print "</td><td>"; diff --git a/functions.js b/functions.js index 896d54886..64042c31a 100644 --- a/functions.js +++ b/functions.js @@ -1189,10 +1189,12 @@ function infobox_submit_callback() { if (xmlhttp.readyState == 4) { closeInfoBox(); - // called from prefs, reload tab - if (active_tab) { - selectTab(active_tab, false); - } + try { + // called from prefs, reload tab + if (active_tab) { + selectTab(active_tab, false); + } + } catch (e) { } notify(xmlhttp.responseText); @@ -1266,7 +1268,7 @@ function qafAdd() { return false; } -function filterCR(e) +function filterCR(e, f) { var key; @@ -1275,10 +1277,16 @@ function filterCR(e) else key = e.which; //firefox - if(key == 13) - return false; - else - return true; + if (key == 13) { + if (typeof f != 'undefined') { + f(); + return false; + } else { + return false; + } + } else { + return true; + } } function getMainContext() { @@ -569,3 +569,5 @@ function userSwitch() { var user = chooser[chooser.selectedIndex].value; window.location = "tt-rss.php?swu=" + user; } + + diff --git a/tt-rss.php b/tt-rss.php index e1331e034..35d14715f 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -154,7 +154,7 @@ window.onload = init; <?php if (get_pref($link, 'ENABLE_SEARCH_TOOLBAR')) { ?> <input name="query" - onKeyPress="return filterCR(event)" + onKeyPress="return filterCR(event, viewCurrentFeed)" onblur="javascript:enableHotkeys();" onfocus="javascript:disableHotkeys();"> <input class="button" type="submit" onclick="return viewCurrentFeed(0)" value="Search"> |