[Idea and Feature Request] Cross platform JavaScript Addons Support

Background

I am implementing JavaScript Addons Support for AnkiDroid. But it will become AnkiDroid specific features. So, my motivation here use to make it cross platform.

Addons Type

I have created two types of addon, Note Editor and Reviewer

  • Reviewer
    Anki ecosystem uses webview for card displaying, so here JavaScript code injected to reviewer. It changes UI or display cards information JS API.

  • Note Editor
    I have used js-evaluator in AnkiDroid to execute JS code.
    For iOS there are better options to run js code like javascriptcore

Addons Hosting

The addons are hosted on npmjs.com.

Why?

It will be better to have same addons for all Anki versions. Otherwise separate addons have to implemented for each platform.

The AnkiDroid JS Addons feature is still in development so I think it will be better to have one implementations instead of three implementations.

I outlined my concerns on Add experimental support for dynamic import in Reviewer JS by hgiesel · Pull Request #7764 · ankidroid/Anki-Android · GitHub, and the situation has not changed a great deal since then I’m afraid - currently improving maintainability and bringing the clients closer together is a higher priority, and I think any further API surface increase needs a slow and careful approach.

Well done on your work in any case - some of it looks quite technically impressive, and I will be keeping an eye on how it gets used over time.

2 Likes