Skip to content

Commit

Permalink
JS API: Add: ease, id, creation and modified time
Browse files Browse the repository at this point in the history
Fixes 5587
  • Loading branch information
david-allison committed Jul 28, 2020
1 parent fe5aa07 commit 78e1f6c
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3562,6 +3562,30 @@ public int ankiGetCardInterval() {
return mCurrentCard.getIvl();
}

/** Returns the ease as a double. Default: 2.5. Minimum: 1.3 */
@JavascriptInterface
public double ankiGetCardEase() {
return ((double) mCurrentCard.getFactor()) / 1000.0;
}

/** Returns the last modified time as a Unix timestamp in seconds. Example: 1477384099 */
@JavascriptInterface
public long ankiGetCardLastModified() {
return mCurrentCard.getMod();
}

/** Returns the Unix timestamp of card creation in milliseconds. Example: 1477380543053 */
@JavascriptInterface
public long ankiGetCardCreated() {
return ankiGetCardId();
}

/** Returns the ID of the card. Example: 1477380543053 */
@JavascriptInterface
public long ankiGetCardId() {
return mCurrentCard.getId();
}

@JavascriptInterface
@Consts.CARD_QUEUE
public int ankiGetCardQueue() {
Expand Down

0 comments on commit 78e1f6c

Please sign in to comment.