viresh-ratnakar / exolve

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

Continuously monitor solutions and update the clue-box #31

Closed SinghGauravKumar closed 4 years ago

SinghGauravKumar commented 4 years ago

I modified the code slightly for my purposes, and if a particular clue is solved the clue gets permanently shaded by green. However if one unintentionally, rewrites a portion of the solved clue, making it incorrect, still the clue "appears" solved i.e. the green shade remains. Looks like "Check All" button can actually fix this, but can we call the button from time to time, so that the unintentional mistakes don't ruin it. Here is a screen-recording of what I tried to do! https://share.getcloudapp.com/BluOB6oZ

viresh-ratnakar commented 4 years ago

You can add the following JavaScript code to achieve what you need. This code overrides the updateAndSaveState() function, which gets called after every change. If you add code like this, my suggestion is to add it in a separate .js file (not in exolve-m.js or exolve.html), so that you can update the Exolve versions in your puzzles without clobbering your custom code. Just list this custom .js file after the Exolve code has been listed.

updateAndSaveState = (function() { var cached_function = updateAndSaveState; return function() { cached_function.apply(this);

// Add your code here to check and update clue "correctly solved" states.

}; })();

SinghGauravKumar commented 4 years ago

Interesting approach, but it doesn't solve the issue. I also notice that by filling grids with random letters, one can mark the clue "solved". That doesn't mean it's correct. Only calling "Check This"/"Check All" fixes this. My use case is such that I don't want to provide "Check This"/"Check All" functionality, but I do wish to notify the user that they have solved a particular clue (by shading that clue with a color). And if for some reason, they disturb the already solved clue, the shading should disappear.

viresh-ratnakar commented 4 years ago

You can look at the checkAll() code and insert an appropriately modified copy of that into the function that I described, to achieve what you want. This is not really a standard feature that I would add to Exolve, so I won't be able to write all the code for this. If you want me to review what you come up with, I'll be happy to do it.

Viresh

On Mon, Jun 15, 2020, 6:14 PM Gaurav Kumar Singh notifications@github.com wrote:

Interesting approach, but it doesn't solve the issue. I also notice that by filling grids with random letters, one can mark the clue "solved". That doesn't mean it's correct. Only calling "Check This"/"Check All" fixes this. My use case is such that I don't want to provide "Check This"/"Check All" functionality, but I do wish to notify the user that they have solved a particular clue (by shading that clue with a color). And if for some reason, they disturb the already solved clue, the shading should disappear.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/viresh-ratnakar/exolve/issues/31#issuecomment-644472195, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJQ562GZFZVE2R5P2537B3LRW3BRDANCNFSM4N6C7XLQ .