Bỏ qua đến nội dung

[sample] Sharing data between JavaScript and Python. ex)reviewer.card.id

Chờ xử lý #anki #addon #sample #sharing #data #between #javascript
https://forums.ankiweb.net/c/add-ons/11
13/5/2023

Cách tải addon [sample] Sharing data between JavaScript and Python. ex)reviewer.card.id

Bạn có thể tải addon bằng một trong hai cách sau:

Click nút Copy bên dưới để copy code vào clipboard

1469353108

Sau đó mở Anki → Tools → Add-ons → Get Add-ons → Dán code → OK

Mở trang addon trên AnkiWeb và tìm mã code ở cuối trang

Mở trên AnkiWeb

Cuộn xuống cuối trang AnkiWeb, tìm dòng có mã code 1469353108 và copy

Mô tả chi tiết

In JavaScript, there are times when you want to use some variables used in Anki. For example,) reviewer . card . id .

However, sharing data between JavaScript and Python is not as simple as you might think. There are several ways to do this, but the following method is simple.

Use the mw.web.eval function in Python to pass variables to JavaScript. If you have variables that you want to keep, use window.localStorage. If you want to get the value of a JavaScript variable, use mw.web.evalWithCallback.


Liên kết hỗ trợ