simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Wed Oct 26 22:02:01 BST 2022


TL;DR:
  e6faebe js: Remove keypress handler
  5fae5ca js: Be more subtle about cancelling keydown events
  7354790 js: Use String.replace() in place of .replaceAll()
  6f5debe js: Make update_pixel_ratio more backward-compatible

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer:      Ben Harris <bjh21 at bjh21.me.uk>
Date:           2022-10-26 22:02:01

commit e6faebeb9a1856c9ea7140eb650b48ada0adc923
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=e6faebeb9a1856c9ea7140eb650b48ada0adc923;hp=43c89dd5e118cf244b8eb978b13fecfe2240e9e7
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Tue Oct 25 10:24:15 2022 +0100

    js: Remove keypress handler
    
    At least in modern browsers (and I suspect in all browsers), cancelling
    a keydown event ensures that the subsequent keypress event doesn't fire.
    See <https://w3c.github.io/uievents/#keys-cancelable-keys>.
    
    So there's no point in having a handler on keypress events that just
    tries to cancel them as well.  Removing the handler doesn't do much now,
    but it opens the possibility of being a bit more selective about which
    keydown events we cancel.

 emccpre.js | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

commit 5fae5ca0db6a263d385c05cb6cfef5e3e3b18630
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=5fae5ca0db6a263d385c05cb6cfef5e3e3b18630;hp=e6faebeb9a1856c9ea7140eb650b48ada0adc923
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Tue Oct 25 20:38:37 2022 +0100

    js: Be more subtle about cancelling keydown events
    
    Now we only cancel a keydown event if the C keyboard handler recognises
    the key and passes it on to the midend.  This doesn't necessarily mean
    that the midend has actually done anything with it, of course.  Still,
    this is enough to allow F12 to open the developer tools even when the
    input focus is on the puzzle.  It also allows for tabbing out of the
    puzzle into the links below it.

 emcc.c     |  7 +++++--
 emccpre.js | 16 ++++++++--------
 2 files changed, 13 insertions(+), 10 deletions(-)

commit 7354790ca40aa648f8ce6a6f0e568b9971a6a42c
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=7354790ca40aa648f8ce6a6f0e568b9971a6a42c;hp=5fae5ca0db6a263d385c05cb6cfef5e3e3b18630
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Oct 26 01:32:52 2022 +0100

    js: Use String.replace() in place of .replaceAll()
    
    The latter turns out to be a little too new for KaiOS 2.5, but
    .replace() will do global replacements if fed a RegExp.

 emcclib.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

commit 6f5debe417dbcb4b17be00fa4790b80ed887158c
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=6f5debe417dbcb4b17be00fa4790b80ed887158c;hp=7354790ca40aa648f8ce6a6f0e568b9971a6a42c
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Oct 26 21:17:21 2022 +0100

    js: Make update_pixel_ratio more backward-compatible
    
    Despite my stylistic downgrades, it still used two features not present
    in Firefox 48, and hence KaiOS 2.5: passing options to addEventListener,
    and calling addEventListener on a MediaQueryList at all.  Now it uses
    the older addListener method and explicitly removes each listener as
    soon as it's called.

 emccpre.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)



More information about the tartarus-commits mailing list