add keyboard shortcuts for quicker input
This commit is contained in:
parent
c389d3b619
commit
71acad3b4f
@ -1,4 +1,11 @@
|
|||||||
$.fn.frequencyInput = function() {
|
$.fn.frequencyInput = function() {
|
||||||
|
var suffixes = {
|
||||||
|
"K": 3,
|
||||||
|
"M": 6,
|
||||||
|
"G": 9,
|
||||||
|
"T": 12
|
||||||
|
};
|
||||||
|
|
||||||
this.each(function(){
|
this.each(function(){
|
||||||
var $group = $(this);
|
var $group = $(this);
|
||||||
var currentExponent = 0;
|
var currentExponent = 0;
|
||||||
@ -11,6 +18,14 @@ $.fn.frequencyInput = function() {
|
|||||||
currentExponent = newExponent;
|
currentExponent = newExponent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$input.on('keydown', function(e) {
|
||||||
|
var c = String.fromCharCode(e.which);
|
||||||
|
if (c in suffixes) {
|
||||||
|
currentExponent = suffixes[c];
|
||||||
|
$exponent.val(suffixes[c]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$exponent = $group.find('select.frequency-exponent');
|
$exponent = $group.find('select.frequency-exponent');
|
||||||
$exponent.on('change', setExponent);
|
$exponent.on('change', setExponent);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user