Allow Plus sign instead of tab for faster typing
authorJoey Schulze <joey@infodrom.org>
Sun, 8 Sep 2019 20:04:20 +0000 (22:04 +0200)
committerJoey Schulze <joey@infodrom.org>
Sun, 8 Sep 2019 20:06:26 +0000 (22:06 +0200)
src/InfoCon/sprit/list.wml

index dd03ff0..a75522a 100644 (file)
@@ -111,8 +111,24 @@ $(function(){
            });
        }
     });
+    $('#price_liter').keydown(on_plus(function(){$('#liter').focus();}));
+    $('#liter').keydown(on_plus(function(){$('#price').focus();}));
+    $('#price').keydown(on_plus(function(){$('#km').focus();}));
+    $('#km').keydown(on_plus(function(){$('#km_total').focus();}));
+    $('#km_total').keydown(on_plus(function(){log_save();}));
 });
 var sprit_machine = <?=intval($_POST['machine'])?>;
+function on_plus(callback)
+{
+    return function(e){
+       // Plus sign
+       if (e.keyCode == 107) {
+           callback();
+           return false;
+       }
+
+    };
+}
 function log_new()
 {
     $('#details input').not('input[type="submit"]').val('');