monkeytype/static
SeerLite c323efea26
Rewrite input system to use <input> content (#1325)
* Rewrite input system to use <input> content

* Tab/Escape, Backspace and Enter are always handled by
  $(document).keydown.
* The rest of characters are handled by either $("#wordsInput").on("input")
  (default) or $(document).keydown (layout emulation).
* New special handling for dead keys, compose keys and diacritics in
  general with the new regex Misc.trailingComposeChars.

input-controller.js has been updated to use the above changes:
* handleBackspace() replaced with simplified backspaceToPrevious().
  On PC, a space is immediately re-added to the end of the input to make
  use of the browser/OS's Backspace. This lets the browser handle input-
  specific things like ctrl+backspace.
* handleSpace() refactored a bit to repeat less logic when word is correct
  or incorrect.

* test-ui.js updated to highlight the Misc.trailingComposeChars
correctly, and also refactored a bit to make logic easier to follow.

* AFK checking has also been simplified, now just set with a boolean
flag (TestStats.) setKeypressNotAfk() instead of checking every key and
modifier press (so incrementKeypressMod() was removed as it wasn't used
for anything else).

* Refactor input controller

New function isCharCorrect().

* Remove caps lock backspace setting

Not supported with the input rewrite anymore because we're relying on the
browser's/OS's actual backspace effects. There's no way to emulate this
keypress.

* Refactor input controller

* Reimplement opposite shift mode

* Reimplement the layout emulator

* Fix replay events for input rewrite

Now it's more flexible for a variable amount of backspacing or letter
replacing.

* Pad input with space to handle backspace on mobile

Backspace isn't fired as an event on current mobile browsers, so I worked
around that by adding a permanent space at the start of the input and
treating its removal as a fallback to Backspace to the previous word.

* Force caret to end of input on focus

Fixes initial selection on iOS.

* Use offsetTop from the DOM instead of TestUI

I didn't wanna mess too much with what happens in test-ui.js. Basically,
on a restart after having completed a test, TestUI.activeWordTop is always
wrong for some reason. This caused swipe/instant input after a restart to
always drop the first few characters.

* Prevent pasting on the input

* Revert "Reimplement opposite shift mode"

This reverts commit 9a716ad39b004f0719b05f486465ea03060430ca.

* Use key code to check opposite shift usage

Today I learned what closure actually meant.

* Accept all whitespace as word space
2021-09-30 00:22:38 +01:00
..
.well-known
challenges fixed funbox challenges not loading correctly 2021-09-02 20:47:18 +01:00
css
fonts add JetBrains Mono font (#1886) by luehmann 2021-09-20 21:19:59 +01:00
funbox Modify layoutfluid description (#1797) 2021-09-01 16:11:06 +01:00
images reduced image size 2021-09-26 20:31:54 +01:00
js
languages updated spelling 2021-09-24 17:00:50 +01:00
quotes removed / adjusted some quotes 2021-09-24 00:38:55 +01:00
sound
themes fixed chaos theory not working 2021-09-23 14:57:58 +01:00
webfonts
ads.txt updated ads 2021-09-09 16:44:02 +01:00
index.html Rewrite input system to use <input> content (#1325) 2021-09-30 00:22:38 +01:00
privacy-policy.html Cleaned up terms and policy pages (#1825) by montydrei 2021-09-08 22:50:53 +01:00
robots.txt
security-policy.html Cleaned up terms and policy pages (#1825) by montydrei 2021-09-08 22:50:53 +01:00
terms-of-service.html Fixed a little typo (#1839) by UnrealApex 2021-09-13 13:32:05 +01:00