dwmkerr / crosswords-js Goto Github PK
View Code? Open in Web Editor NEWTiny, lightweight crossword control for the web.
Home Page: https://dwmkerr.github.io/crosswords-js/
License: MIT License
Tiny, lightweight crossword control for the web.
Home Page: https://dwmkerr.github.io/crosswords-js/
License: MIT License
Thanks for so handy implementation of crosswords.
May you are point me how to highlight mistakes in filled crossword?
I didn't get how to validate answers.
crosswordDefinition
doesn't contains right answers.Hi @dwmkerr and/or @pvspain - curious if this has come up so far. I'm using crosswords-js on a react application, and have noticed there can be a lag between page load and the crossword being rendered. I think that part of this is the cost of iterating through the clues, validating them, and calling document.createElement(...)
for the grid, for each cell, and for each clue.
It's very useful to have the signature of the CrosswordController
class just be a model and two elements for the grid and the clues, for getting started quickly. But it'd be useful to be able to pass fully-hydrated HTML element references in, and just have the controller attach the various event handlers/callbacks. That way, the crossword itself could be server-side rendered, cached, and loaded instantly, with the support for interactions coming after the user loads the page.
It might be possible to implement as simply as moving all the document.createElement(...)
calls to a method, and call it conditionally, based on whether the dom element looks to be ready already or not:
class CrosswordController {
constructor(crosswordModel, domGridParentElement, domCluesParentElement) {
const domElementsReady = this.checkIfDomElementsAreReady(domGridParentElement, domCluesParentElement)
if (!domElementsReady) {
this.createView()
}
}
createView() {
this.#crosswordGridView = this.#document.createElement('div');
// create cells, clues elements, add classes etc. etc.
}
}
Then it'd allow people using this library to do things like generate the HTML once when a puzzle is uploaded to a dashboard, and serve that HTML much faster to users when they use it - the structure will look the same for all users.
Hi again! A problem that crosswords-js (and some other HTML-based crossword software I've come across) has is that on iPhone, using an input field opts in to some unwanted functionality (it may also happen on Android). For example, when you tap on the current cell to switch from across to down, a popup appears offering for you to "Select" the text in the input:
Also, for users with dark mode enabled, Safari iOS automatically changes the input background to be dark, making the difference between light and dark cells almost invisible:
Both of these could be controlled for by using a div or span with a keypress listener. This is, I think, roughly what squares.io does:
squares.io:
The Guardian uses an input, but is somehow hiding it so it's not clickable. They use some kind of customised HTML tags to actually show the entered letter:
I think the squares.io approach would be easier! I'd be happy to submit a pull request making this change after #42 is in, if you'd be open to it @dwmkerr and @pvspain ?
(Side-note: the modified styling in the first couple of screenshots is taking advantages of the overridable CSS variables in #41!)
Here's a sample:
https://www.theguardian.com/crosswords/quick/16472#5-across
Features that this has, that we might implement (note that we should split the samples to have a 'vanilla' sample, then a 'guardian' sample, that changes the styles (showing you can style your crosswords how you like):
hi, the virtual keyboard does not appear when clicking on a cell on mobile device
I've tested several browsers, is this the expected behavior?
Are there any callbacks to catch what a word was typed?
Thanks.
When I run the basic example illustrated in the README, the following error appears:
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module './compile-crossword'
Require stack:
Hello ! nice project you got here guys, just I taught I share a feature that came to my mind while testing the app, copying a revealed word, sometimes when we reveal a word we don't know it and try to web search it, would be easier to quickly copy paste in search bar.
I have a Blazor Web application. How could I integrate the crossword control inside a razor component?
I'm trying to find all the javascript crossword packages to assess which is the best one to contribute to.
Is this still under active development?
🚨 You need to enable Continuous Integration on all branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial
branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.