mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-21 18:08:46 -04:00
Fix options page's numeric inputs
Rewind Time (s) Advance Time (s) Speed Change Step
This commit is contained in:
@@ -51,6 +51,9 @@ var keyCodeAliases = {
|
||||
222: '\'',
|
||||
}
|
||||
|
||||
var whiteList = ['Backspace', 'Delete', 'Tab', 'Escape', 'Enter', 'Home', 'End',
|
||||
'ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown']
|
||||
|
||||
function recordKeyPress(e) {
|
||||
if (
|
||||
(e.keyCode >= 48 && e.keyCode <= 57) // Numbers 0-9
|
||||
@@ -68,7 +71,10 @@ function recordKeyPress(e) {
|
||||
};
|
||||
|
||||
function inputFilterNumbersOnly(e) {
|
||||
var char = String.fromCharCode(e.keyCode);
|
||||
var char = e.key;
|
||||
if (whiteList.includes(char)) {
|
||||
return
|
||||
}
|
||||
if (!/[\d\.]$/.test(char) || !/^\d+(\.\d*)?$/.test(e.target.value + char)) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
Reference in New Issue
Block a user