]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Fixed on enter key not showing category dropdown.
authorWill Budicm <redacted>
Thu, 24 Dec 2020 19:24:59 +0000 (06:24 +1100)
committerWill Budicm <redacted>
Thu, 24 Dec 2020 19:24:59 +0000 (06:24 +1100)
htdocs/cgi-bin/wsrc/main.js

index 910e8c3bbdb9551e7222007b27eff949da178ea6..214989a42876664162bfc2693425e41ff5fd039a 100644 (file)
@@ -43,6 +43,13 @@ function onBodyLoad(toggle, locale, tz, today, expires, rs_cur, log_limit) {
         _show_all = false;//toggle type switch
         showAll();
     }
+
+    $(function() {        
+        $( "#rs_keys, #rs_keys2" ).autocomplete({
+            source: AUTOWORDS
+            });
+    });
+
     $('#ed').datetimepicker({
         dateFormat: 'yy-mm-dd',
         timeFormat: 'HH:mm:ss',
@@ -262,7 +269,7 @@ function onBodyLoad(toggle, locale, tz, today, expires, rs_cur, log_limit) {
         lbl = lbl + "&nbsp;".repeat(16-lbl.length);
         $("#lcat_x").html(lbl);
         $("#xc").val(ci);
-        $("#cat_desc").show();
+        $("#cat_desc").show();        
     }).mouseenter(function(e){
         var pr = $(event.target).parent(); pr = pr.attr('id');
         if(pr){
@@ -282,17 +289,32 @@ function onBodyLoad(toggle, locale, tz, today, expires, rs_cur, log_limit) {
             }
           }
         ]
-      });
+    });
+    //Following is needed as the dropdown registers somewhere in lib. to show on when enter key is hit.
+    $.fn.enterKey = function (fnc) {
+        return this.each(function () {
+            $(this).keypress(function (ev) {
+                var keycode = (ev.keyCode ? ev.keyCode : ev.which);
+                if (keycode == 13) {
+                    fnc.call(this, ev);
+                    ev.preventDefault();
+                }
+            })
+        })
+    }
+    $("#rs_keys").enterKey(function (ev) {});
+
 
+    $('#rs_keys').bind('keypress', function(event) {
+        if(event.which === 13) {
+          $(this).next().focus();
+        }
+      });
 
+    
     setPageSessionTimer(expires);
 
 
-    $(function() {        
-        $( "#rs_keys, #rs_keys2" ).autocomplete({
-            source: AUTOWORDS
-            });
-    });
     var CHK_PREV;
     
     $("#frm_log td").mouseover(function(e){