Allow Plus sign instead of tab for faster typing
[infodrom.org/service.infodrom.org] / 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('');