Merge branch 'master' into newads

This commit is contained in:
Miodec 2023-03-29 17:12:05 +02:00
commit ab957352e1
3 changed files with 18 additions and 6 deletions

View file

@ -834,9 +834,6 @@ $(document).keydown(async (event) => {
}
TestInput.recordKeypressSpacing();
TestInput.setKeypressDuration(performance.now());
setTimeout(() => {
TestInput.recordKeydownTime(event.code);
}, 0);
TestInput.setKeypressNotAfk();
//blocking firefox from going back in history with backspace
@ -950,6 +947,18 @@ $(document).keydown(async (event) => {
isBackspace = event.key === "Backspace" || event.key === "delete";
});
$("#wordsInput").keydown((event) => {
setTimeout(() => {
TestInput.recordKeydownTime(event.code);
}, 0);
});
$("#wordsInput").keyup((event) => {
setTimeout(() => {
TestInput.recordKeyupTime(event.code);
}, 0);
});
$("#wordsInput").keyup((event) => {
if (!event.originalEvent?.isTrusted || TestUI.testRestarting) {
event.preventDefault();
@ -966,7 +975,6 @@ $("#wordsInput").keyup((event) => {
);
TestInput.pushKeypressDuration(diff);
}
TestInput.recordKeyupTime(event.code);
TestInput.setKeypressDuration(now);
Monkey.stop();
});

View file

@ -239,15 +239,19 @@ export function setKeypressDuration(val: number): void {
let newKeypresDurationArray: number[] = [];
export function recordKeyupTime(key: string): void {
if (keysObj[key] === undefined) return;
const now = performance.now();
const diff = Math.abs(keysObj[key] - now);
newKeypresDurationArray.push(roundTo2(diff));
if (/(Key[A-Z])|(Digit[0-9])|Space/.test(key)) {
newKeypresDurationArray.push(roundTo2(diff));
}
delete keysObj[key];
updateOverlap();
}
export function recordKeydownTime(key: string): void {
if (keysObj[key] !== undefined) return;
keysObj[key] = performance.now();
updateOverlap();

View file

@ -311,7 +311,7 @@
"keymapShowTopRow": true,
"type": "iso",
"keys": {
"row1": ["^°", "1!", "2", "3§", "4$", "5%", "6&", "7/", "8(", "9)", "0=", "+*", "<>"],
"row1": ["^°", "1!", "2\"", "3§", "4$", "5%", "6&", "7/", "8(", "9)", "0=", "+*", "<>"],
"row2": ["üÜ", ",;", ".:", "pP", "yY", "fF", "gG", "cC", "tT", "zZ", "ß?", "\\/"],
"row3": ["aA", "oO", "eE", "iI", "uU", "hH", "dD", "rR", "nN", "sS", "lL", "-_"],
"row4": ["äÄ", "öÖ", "qQ", "jJ", "kK", "xX", "bB", "mM", "wW", "vV", "#'"],