viresh-ratnakar / exolve

Online interactive crossword software in JavaScript
MIT License
73 stars 15 forks source link

Feature request: partially pre-filled grids #11

Closed Antagony1060 closed 4 years ago

Antagony1060 commented 4 years ago

It's not uncommon – especially in puzzle magazines – for grids to have a number of pre-entered letters/words. Is this a feature you might consider adding?

If so, another useful feature would be a button to reveal annotations for completely pre-entered words. This would be especially useful for me in a particular use case – to show the current state of a grid that's gradually filled over ~6 months via a weekly clue-writing competition – but perhaps it would also benefit users writing tutorial puzzles.

viresh-ratnakar commented 4 years ago

With v0.25, this is done, please check (see the release notes at the bottom of the README)

I did not add an extra button -- "Reveal this"/"Check this" would already reveal any applicable annotations.

viresh-ratnakar commented 4 years ago

Oh, I need to fix something. If the grid does not have all solutions provided, the reveal button won't even show. I'll make it so that it will get shown/enabled appropriately in the partially filled scenario. Will update after fixing.

viresh-ratnakar commented 4 years ago

I've checked in the fixes, should work now. The "Reveal this" button will get shown if there are any clues with annotations, even if the grid solutions have not been provided. I guess this can also be used to provide hints for clues.

Antagony1060 commented 4 years ago

Thank you so much! I wouldn't have been surprised, or blamed you, if you'd said the second request was too much of an edge case. I'm so pleased right now that I almost feel bad for making further suggestions, but I think these two small changes would make it perfect:

  1. As it stands the pre-filled squares are indistinguishable from user-filled squares, so could you make them stand out somehow, like bold and an alternative dark colour, maybe?
  2. While the cursor is in a pre-filled square, could typing a letter make it move to the next square? So if a light is, say, _ M _ L _ T the user could type in 'AMULET' without having to arrow out of the pre-filled squares each time.
Antagony1060 commented 4 years ago

I must have still been half asleep earlier as I can see plainly now that the pre-filled letters are already green. Still, a bit of bolding wouldn't go amiss, I think.

viresh-ratnakar commented 4 years ago

I made some more changes and checked in v0.26.

Re: colour/bold for pre-filled: I agree that the darkgreen colour was not easily distinguishable from black. I have now changed it to blue, which makes the pre-filled entries stand out quite clearly. Blue seems additionally satisfactory to me as it is also the colour I use for hyphens and word breaks, which are also "pre-filled" entities. Note that you can use exolve-colour (https://github.com/viresh-ratnakar/exolve/blob/master/README.md#exolve-colour-exolve-color) if you want to make any square even more prominent. I did try bolding the pre-filled entries, but I did not like how that looks. If you really want to bold, you can always override the css styling for .prefill from your html file.

Re: typing in a pre-filled square should make the cursor move: Of course, not having that behaviour was a mistake. Fixed. Typing any letter will make the cursor move to the next square now.

Antagony1060 commented 4 years ago

Fantastic response again, thank you!

I'll have a play with overriding the css for bolding and see what I think.

I'll close this issue now as you've given me everything I asked for. Thanks again.

Antagony1060 commented 4 years ago

Something I just noticed while updating our ongoing grid: I add annotation templates to the unfilled clues – e.g. <a href="" target="_blank">by (wk ).</a><br>Def: | – so they're enabling the reveal button despite there being nothing to show. I wondered whether the anno text could be ignored if the light contains any zeroes, but then some setters may want to use reveal to provide hints. So could you add an ignore feature maybe, but somehow make it optional?

That said, this really is a minor issue, so please just close it again if you think it's fine as it is.

viresh-ratnakar commented 4 years ago

Hmm, why do you want to add these templates to unfilled clues -- why not add the annotations when you actually have them? I can't see the amount of work needed being that different :-).

Even with zeroes in the light, imo, there might be a case for revealing the annotation (for example, if the grid provides hints rather than solutions).

viresh-ratnakar commented 4 years ago

Ah, reading your comment all the way through now, you did point out that sometimes annotations can be used as hints.

One possibility is to allow comment lines within the puzzleText area. I can ignore anything following "//" for example.

Antagony1060 commented 4 years ago

Sorry, I should have explained why I've added the templates: basically, I don't want to be the only mod updating the ongoing grid, but I would like others to follow the same conventions. I also want to minimize the amount of work required to add new entries, so others hopefully won't feel like it's too much effort. I thought the best approach in both cases was to have anno templates already in the correct place.

So yes, I would be fine with making the templates into comments and adding uncommenting as a step in the update process. I see that as an easier step than having to copy/paste an anno template in. Thanks!

viresh-ratnakar commented 4 years ago

Done, with v0.31.

Anything beginning with a "# " is treated as a comment. Note that a space is needed after the # (or an end-of-line). The reason is that there are some legit needs for #, but all of those have # followed by a non-space character (such as in HTML colour codes, in marking cell locations). I went with # instead of // as the comment marker as // occurs in URLs, often found in the puzzle specs.

Antagony1060 commented 4 years ago

Perfect! Thank you again.

viresh-ratnakar commented 4 years ago

You should probably update to v0.32 when you get the chance: (This should hopefully fix the bug that your unfilled clues still currently get "Reveal this" enabled, because the close of the html tag for bolding them was getting mis-parsed as an anno).

Version: Exolve v0.32 October 14 2019

Antagony1060 commented 4 years ago

Done, cheers.

I did notice that yesterday and considered mentioning it, but since clicking on it didn't do anything – which was my main objective – I didn't think it was important. It also seemed consistent with the behaviour of the 'Clear this' button, which is enabled regardless of whether there is anything to clear or not.