jcklie / anki-maobi

máobĭ (毛笔) is an Anki add-on to create cards with writing quizzes for Hanzi (Chinese characters)
MIT License
47 stars 7 forks source link

Make it work on Mobile #20

Closed tyalie closed 4 years ago

tyalie commented 4 years ago

Wouldn't it be awesome to have this also available on mobile apps?

I know that the add in is currently written in Python and as such unfit for mobile use, but moving to JavaScript would remove this issue.

jcklie commented 4 years ago

The writing itself is Javascript, I tried to use it on mobile Anki but it did not work for me. Also, mobile does not have a plugin system. You can try to paste the javascript into a card template and see how it works for you.

tyalie commented 4 years ago

I'll see.

tyalie commented 4 years ago

Hey. You've a better understanding of the code. What are the required files? I assume that rice.svg and field.svg must both be in the same folder as the script. Do I need any other files?

tyalie commented 4 years ago

Oke. Got it working for one card, as I wrote the script, that you generate dynamically directly into the card. Know the question is, how to make this available for each card, by storing it on generation.

jcklie commented 4 years ago

I would not use any of my code, but just directly the hanziwriter javascript. Then you can just use the field in the card you want to query for.

tyalie commented 4 years ago

Yep. I've written a small Javascript to make it work. It can be found here: https://github.com/Gansgar/Anki-Chinese/tree/anki-web

arueckle commented 4 years ago

I created a mobile fallback for maobi. Instead of the drawing canvas, it shows an input field with automatic validation. It only activates when maobi is not loaded. I use it together with the handwriting input keyboard on iOS and it works well so far. One downside is, however, that it does not show you the correct stroke order.

To use the fallback, add the code of the following snippet to the front template of the maobi card.

https://gist.github.com/arueckle/ee75416b30f5b4e7c7d5d815036ec08b

This is how it looks like on iPad:

maobi-fallback

krmanik commented 4 years ago

I have implemented it but due to character encoding it is failed to load in Ankidroid.

https://github.com/infinyte7/Anki-maobi

It is working on AnkiDesktop but due to character encoding It is not working in Ankidroid. I have tried many solutions but It is failed to load. In Anki Desktop character length is correct but in Ankidroid same character length is incorrect. Ex:- '比如' In Anki Desktop Length is 2, In Ankidroid Length is 7

So may be there is error due to character encoding in Ankidroid webview.

krmanik commented 4 years ago

Finally I have implemented it for Ankidroid check this. https://github.com/infinyte7/Anki-xiehanzi

jcklie commented 4 years ago

Thank you! I linked your repository in the readme. I will close this issue for now, we have now 2 alternatives for mobile. It would be nice though if you could choose a different name for you project, as now there are two maobi projects which are not related.

krmanik commented 4 years ago

okay, I will do that