Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there better way to get values from Deck to WebView? #6306

Closed
krmanik opened this issue May 30, 2020 · 3 comments · Fixed by #6307
Closed

Is there better way to get values from Deck to WebView? #6306

krmanik opened this issue May 30, 2020 · 3 comments · Fixed by #6307
Milestone

Comments

@krmanik
Copy link
Member

krmanik commented May 30, 2020

Reproduction Steps

I have added following codes to AnkiDroid.

card.js

view.loadUrl
AbstractFlashcardViewer.java

Added custom card layout using css and js to deck template.
Anki-Custom-Card-Layout

demo

Expected Result

Is there a better way to following values without using setTimeout .

Deck Title,
ETA,
New, Learn, Review Card Counts
Mark,
four button or three button is there 

I get values ( cards count, title, mark, eta ) but by using setTimeout function of javascript.

Actual Result

WebView should get values without using setTimeout.

Reason

It will help in card creation with custom layout.

Debug info

Refer to the support page if you are unsure where to get the "debug info".

Research

Enter an [x] character to confirm the points below:

  • [ x ] I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid
  • [ x ] I have checked the manual and the FAQ and could not find a solution to my issue
  • [ x ] I have searched for similar existing issues here and on the user forum
  • [ x ] (Optional) I have confirmed the issue is not resolved in the latest alpha release (instructions)
@krmanik
Copy link
Member Author

krmanik commented May 30, 2020

This is my idea. Make available all details about current card to WebView and then using css and js card can be redesigned with many possibilities.
card.js have following functions

showAnswer()
buttonEaseAnser1()
buttonEaseAnser2()
buttonEaseAnser3()
buttonEaseAnser4()
markCard()
CardCount()    //  have count number of new card, learn card, review card  
DeckName()   // have deck name value 
getETA()        // have value of remaining time to review the current deck

@krmanik
Copy link
Member Author

krmanik commented May 30, 2020

I have found answer using this.
https://github.com/SimonLammer/anki-persistence

Get all values to persistence value. And then use it for next.
Following value need not to be made available using setTimeout

ankiDeckName
total card count from first card
total = ankiNewCard + ankiLrnCard + ankiRevCard

@mikehardy
Copy link
Member

Fascinating, that's a great project! I want to tag @SimonLammer directly to say that the AnkiDroid project is thinking through what the best is to have an "officially sanctioned" card template or distribution method or similar that would bundle a few things that any use of advanced web technologies in the WebView would want. Persistence is such an obvious one - it's the first thing to solve.

I personally would love the wisdom of the community already working in the area

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants