]> git.wh0rd.org Git - tt-rss.git/commitdiff
modify filterCR to call user-specified callback on CR (e.g. for search toolbar)
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 1 Oct 2006 06:33:32 +0000 (07:33 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 1 Oct 2006 06:33:32 +0000 (07:33 +0100)
backend.php
functions.js
tt-rss.js
tt-rss.php

index e9bca73460edcee6b122bc563d01e23157d6bb9c..c63b981c29c86be55e9e5f87233116050b4a909e 100644 (file)
                        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>";
                        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>";
index 896d54886ecf36182faebd3a7bc6b1b6474ecf73..64042c31a453540fcc1c2edda58656c34e6d2b43 100644 (file)
@@ -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() {
index 2bd5068df69c5dfb410e87b16f4adaffcbb6101f..0e3ddb797d362e818b202f60268b59f92ebbf0a8 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -569,3 +569,5 @@ function userSwitch() {
        var user = chooser[chooser.selectedIndex].value;
        window.location = "tt-rss.php?swu=" + user;
 }
+
+
index e1331e03407fd7514040b4e1933801fdcbe216c4..35d14715febec9535e5423ce97f12141c7f10868 100644 (file)
@@ -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">