Dear all,
I hope this is the right category for my problem …
So far, I have not found a proper solution for this problem described here … despite some
longer Google research.
So I hope that someone can help me … and please be patient, maybe my explanations have
become a little bit detailled …
I have some programming experience, but not concerning web programming, and at the moment, I’d like to put my focus on learning Latin.
Learning a new language always means: practising, practising …
In order to do this, I adapted this Anki Grammar Template
… adapted means: I changed the colors, the fonts, and removed the appendices, but I
haven’t understood all the details of the javascript code … it’s beyond my knowledge
Anyway … the code was working with may adaptions, but while preparing my grammar cards,
a problem occured … I have to illustrate it a little.
Consider the Latin noun origo ( = “origin” in english) … the dictionary says
orīgo, orīginis, f
which means: a feminine noun, third declension with consonant stem.
Now I wanted to create a grammar exercise “Fill in the noun with correct declension” when
an adjective is given:
(origo) _____ alienae
In Anki, it would look like
{{c1::####SOLUTION HERE####::(origo)}} alienae
If we take a closer look at the adjectice alienus, -a, -um … it’s 1. & 2. declension …
and now, three answer are possible:
originis alienae => genitive singular
origini alienae => dative singular
origines alienae => nominative plural
To solve this, here’s what I thought of:
We define a separator, e. g. “&&”
{{c1::originis&&origini&&origines::(origo)}} alienae
And indeed … executing this piece of javascript on the backside shows me
the solution string with the answers concatenated by “&&”:
var elements = document.querySelectorAll(".cloze");
var length = document.querySelectorAll(".cloze").length;
for ( i = 0; i < length; i++ )
alert (elements[i].textContent);
So I thought of implementing my own javascript comparison … although I mentioned
above that my focus is Latin, but for this routine, I only need some basic javascript
knowledge …
But … executing this
alert (document.getElementById("typeans").innerHTML ) ;
leads to:
This is the result of the comparison … how can I access the answer I typed in at the front side?
Obviously, I need these answer to implement my own comparison - any ideas/proposals?
I thought of setting a hint field on the back side, which says: “Others solutions are possible” or
so … would be a nice feature … if I only knew about the contents of the typed answer on the
back side …
Another option is: my thought are completely wrong … if this is true, feel free to tell me
By the way: Anki is a great tool for language learning, so I’d like to learn something more about
the details … not at the moment, of course, but in the future. As far as I know, Anki uses HTML
templates … I don’t know much about this … which template engine uses Anki, and do you know
a good point to start?
And I recognised that testing the routines with javascript-alert’s is a little bit cumbersome … do
you know a simpler way? Is there a possibility to integrate this in the Eclipse IDE, for example?
With such an IDE, it is a little bit simpler to debug javascript, for example …
Thanks for your efforts, and for reading my mail … Kind regards, Frank