hanzi-writer icon indicating copy to clipboard operation
hanzi-writer copied to clipboard

Totally offline hanzi-writer

Open BlindB0 opened this issue 3 years ago • 5 comments

Is the any way to make hanzi-writer totally offline? So, no https://cdn.jsdelivr.net/npm/[email protected] 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.

BlindB0 avatar Jan 18 '23 11:01 BlindB0

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

chanind avatar Jan 18 '23 12:01 chanind

@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...

DzSom02 avatar Mar 22 '24 21:03 DzSom02

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.

BlindB0 avatar Mar 23 '24 15:03 BlindB0

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

DzSom02 avatar Mar 23 '24 15:03 DzSom02

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.

BlindB0 avatar Mar 23 '24 15:03 BlindB0

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

vherrmann avatar May 21 '24 06:05 vherrmann

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

vherrmann avatar May 21 '24 06:05 vherrmann