simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Mon Aug 21 23:08:30 BST 2023


TL;DR:
  26a3b98 Remove a comment suggesting use of localStorage for prefs
  85b00e5 js: prefer some puzzle size even if loading isn't complete
  b5367ed js: load preferences from HTML elements
  f97d11d js: allow for multiple environment blocks in HTML
  7c10584 KaiOS: set show-labels=true in preferences for Guess

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:           2023-08-21 23:08:30

commit 26a3b98f4f30de1f3faf0bb97eeeb8403864b5d3
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=26a3b98f4f30de1f3faf0bb97eeeb8403864b5d3;hp=eeec6b867af104a93a615a285a29fab91d8709d4
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Aug 21 09:47:08 2023 +0100

    Remove a comment suggesting use of localStorage for prefs
    
    Preferences in the JavaScript version _are_ stored in localStorage
    now.

 emcc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

commit 85b00e56a034713a8e34f9e10423ae14dbc810e0
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=85b00e56a034713a8e34f9e10423ae14dbc810e0;hp=26a3b98f4f30de1f3faf0bb97eeeb8403864b5d3
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Aug 21 22:03:18 2023 +0100

    js: prefer some puzzle size even if loading isn't complete
    
    The js_canvas_get_preferred_size() function was declining to suggest a
    size for the puzzle if document.readyState wasn't "complete".  I think
    my idea here was that if the document wasn't fully loaded then I
    couldn't trust the size of the containing <div>.  While this was true,
    declining to provide a size didn't help much since the puzzle still
    needed a size, and the size of the containing <div> was the best guess
    we had.
    
    Now that function always returns the size of the containing <div> if
    it exists.  This appears to mean that puzzles don't show a brief flash
    of being the wrong size on KaiOS.  That was particularly visible with
    Flood, where the wrong-size version had borders around the tiles that
    the right-size version lacked.  The containing <div> isn't used on the
    standard Web versions, so there's no change to behaviour there.

 emcclib.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit b5367ed18ac96f54595fbe6c17fe8a4a897020aa
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=b5367ed18ac96f54595fbe6c17fe8a4a897020aa;hp=85b00e56a034713a8e34f9e10423ae14dbc810e0
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Aug 21 22:45:48 2023 +0100

    js: load preferences from HTML elements
    
    It will be useful on KaiOS to be able to specify default user
    preferences that aren't the standard ones, in the same way that we
    specify some environment variables.  As with environment variables, we
    can now do this be embedding a <script> element in the HTML like this:
    
    <script class="preferences" type="text/plain">
    show-labels=true
    </script>
    
    These are loaded before the preferences from localStorage, so they just
    set defaults and can be overridden by the user (but not on KaiOS yet,
    because we still don't have dialogue boxes there).

 emcclib.js | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

commit f97d11df670597136e34f1078d9a2eb2cdbcd85b
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=f97d11df670597136e34f1078d9a2eb2cdbcd85b;hp=b5367ed18ac96f54595fbe6c17fe8a4a897020aa
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Aug 21 22:48:59 2023 +0100

    js: allow for multiple environment blocks in HTML
    
    Not that I actually need it, but it's just as easy to load multiple
    environment <script>s from the DOM as it is to load one, so we may as
    well do that.  Since only one element can have id="environment", we do
    this by matching class="environment" as well.

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

commit 7c105846b6d35cb979314f5c5fa4336d6e1a11ac
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=7c105846b6d35cb979314f5c5fa4336d6e1a11ac;hp=f97d11df670597136e34f1078d9a2eb2cdbcd85b
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Aug 21 22:50:50 2023 +0100

    KaiOS: set show-labels=true in preferences for Guess
    
    On a device with a phone keypad, driving Guess by typing numbers rather
    than using the arrow keys seems natural.  But if you're going to do
    that, showing the labels makes it a lot easier.  KaiOS doesn't have any
    way for the user to control this, so we should default to the friendlier
    state.

 kaios/apppage.pl | 9 +++++++++
 1 file changed, 9 insertions(+)



More information about the tartarus-commits mailing list