Jimbly / regex-crossword

Implementation of a RegExp crossword.
287 stars 27 forks source link

Make Rules Editable #16

Closed boothby closed 3 years ago

boothby commented 3 years ago

It would be nice to use the interface not just to solve puzzles, but to create them as well. This takes the first step towards that, by making the rules editable by double-clicking.

Jimbly commented 3 years ago

Good idea, but probably want this behind a flag or something (document.location.indexOf('edit')!==-1 or something), so regular visitors don't end up editing things by accident, but then could start adding other editing features (probably encoding into the URL for saving/sharing or something would make sense).

Jimbly commented 3 years ago

Looking good! Gave it a quick try, and a couple things:

Jimbly commented 3 years ago

18 just merged into master fixes the 6 -> mid issue, hopefully doesn't conflict too much with your changes =)

boothby commented 3 years ago

easy merge; good to go :)

Jimbly commented 3 years ago

the Reset button doesn't work because it appears to always load the default board's user data (board name not set at that point in code upon load, I'm guessing)

The Reset button works now, but the page still seems to always be loading the default board's user data (e.g. if you're playing on link from the shared url) - just need loadData moved after setting name, I'm guessing.

Also, this code doesn't go through any transpiling or anything, and arrow-style functions (=>) and Array.from are "new" and don't work on older browsers, so please stick to vanilla JavaScript there ^_^.

boothby commented 3 years ago

Drat, it's been 15 years since I used this language professionally and I'm re-learning it through stack exchange... I'll patch those things up. I've already fixed the reloading issue in a branch where I'm working on a puzzle picker, that'll be easy to pull in (as you say, loadData is getting called to soon).

Alternately, should I de-modernize that branch and stuff it all into this PR?

https://github.com/boothby/regex-crossword/tree/puzzle_picker

Jimbly commented 3 years ago

Ah, no worries! Ya know, if you don't use JS regularly, just make it work, I'll do a quick fixup/demodernize after merging it - it's all finicky stuff, but will take me way less time to just do it than comment on it, and it's not really important, if you don't mind me hacking things up a bit =). If it takes more than a minute or two, I can run it through Babel or something later.

I'm fine with pulling all your stuff into one PR, if you think you'll finish it - don't want to lose what's here if you think you might lose steam before finishing though ^_^.

boothby commented 3 years ago

Thanks for your patience! It's always fun to tinker on little games, and contributing is my way of saying thanks for making something fun :)

And I must say, I admire your dedication to making it work for older browsers. Keep it up!

Jimbly commented 3 years ago

Lookin' good! Only issue I see is it's crashing on the very first load if you don't have a puzzle selected

Uncaught TypeError: Cannot read property 'name' of undefined
    at HTMLDocument.init (crossword.js:301)

Could probably also move the "original puzzle" link into the original_solution span to be slightly cleaner when viewing other puzzles too.

Nice additional puzzle, and good name for it =)