chanind / hanzi-writer

Chinese character stroke order animations and practice quizzes
https://hanziwriter.org
MIT License
3.57k stars 557 forks source link

Totally offline hanzi-writer #288

Closed BlindB0 closed 6 months ago

BlindB0 commented 1 year ago

Is the any way to make hanzi-writer totally offline? So, no https://cdn.jsdelivr.net/npm/hanzi-writer-data@2.0 at all, just read local JSON files in the same folder as hanzi-writer.html (with hanzi-writer script in it). Local webserver with JSON delivery also not possible. I try to make offline Anki deck (on android Ankidroid too) with hanzi-writer in it.

chanind commented 1 year ago

That should be possible. You just need to overwrite the charDataLoader option to return the character data, however you decide to store it. Basically if you can write a function in JS that takes in a character string and returns the JSON data for that character then you're good to go. More details on the charDataLoader option here: https://hanziwriter.org/docs.html#loading-character-data-link

DzSom02 commented 8 months ago

@BlindB0 Did you manage to make it work in AnkiDroid? I'm trying the same also and for whatever reason it's not shown in AnkiDroid

To me it seems like we should be able to add all the json files to the Anki media folder and then read it from there, hopefully just like reading a file... But I'm not very experienced with Anki...

BlindB0 commented 8 months ago

Hi @DzSom02 ! Yes, I can do it. AnkiDroid works totally offline with hanzi-writer. I can share my deck, so you can see how I made it.

DzSom02 commented 8 months ago

@BlindB0 Yes! I think that would be very appreciated! Thank you!

BlindB0 commented 8 months ago

https://file.io/bP6VsfOQWPvW Here my deck for hanzi. Archive inside you should unpack to anki media folder. I made it in desktop version and than sync it with ankidroid. But you can unpack it to ankidroid media folder on android phone. Check js code in cards for better understanding.

vherrmann commented 6 months ago

The deck https://github.com/krmanik/Anki-xiehanzi/ can be used as a reference as well.

vherrmann commented 6 months ago

Also, @BlindB0 should close this issue, since the problem has been solved.