Additional Card Fields [Official thread]

ijg's Avatar

ijg

22 Jan, 2020 12:00 PM

If you have a problem with the add-on add-on Additional Card Fields post in this thread. This way I get notified. If you make a new thread I might miss it.

  1. 1 Posted by Morgan on 25 Feb, 2020 01:21 PM

    Morgan's Avatar

    Hi, I need you help. I don't find how to add {{info-Ivl:}} in my template. I found no instruction on the web.

    I install the add-on but don't find how to display the information in my template.

    Can you help me ? Thanks

  2. 2 Posted by ijg on 25 Feb, 2020 08:40 PM

    ijg's Avatar

    watch the third video from the top of the manual, https://apps.ankiweb.net/docs/manual.html (the anki app in this video is slightly dated but apart from minor differences it's the same to the latest version).

    or try: https://www.youtube.com/watch?v=JTKqd4nqsK0

    If this doesn't help: Describe your problem exactly with screenshots etc. I have answered quite a lot threads. I have often had two sentence questions that might be clear to the person writing them but they are not clear at all to other people (or at least me).

  3. 3 Posted by Bruce Plumb on 25 Mar, 2020 12:51 PM

    Bruce Plumb's Avatar

    With the new version of Anki, Additional Card Fields has also adapted its format from
    {{nfo::Lapses}} to {{info-Lapses:}} but now {{#info-Lapses:}} and {{/info-Lapses:}} do not work. What do I need to change?

  4. 4 Posted by ijg on 25 Mar, 2020 12:55 PM

    ijg's Avatar

    Conditional replacement no longer works in Anki 2.1.20 or later. As far as I see there's nothing that my add-on can do about this.

    An idea for a workaround is here.

  5. 5 Posted by Bruce Plumb on 25 Mar, 2020 02:29 PM

    Bruce Plumb's Avatar

    Thanks for the reply. Too bad it doesn't work, but it is not a serious
    problem for me.
    Bruce Plumb

  6. 6 Posted by Guillem Palau-S... on 25 Mar, 2020 05:39 PM

    Guillem Palau-Salvà (contributor user)'s Avatar

    @Bruce,

    I actually use {{info-Lapses:}}. I do style it via javascript. You will need to add the id element on a div or span tag in the front/back template. Here's an example that hides the div tag if the card is not lapsed, and increases the opacity as lapses counts get higher).

    <div id="element">{{FiledName}}</div>
    
    <script>
    (function set_bg_by_lapses(){
    var lapses = parseInt('{{info-Lapses:}}');
    if (lapses== 0){
            document.getElementById("element").style.display = "none";
    } else if (lapses ==1){
        document.getElementById("element").style.backgroundColor = "rgba(255,255, 245, 0.2)";
    } else if (lapses>=2 && lapses<=4){
        document.getElementById("element").style.backgroundColor = "rgba(255,255, 245, 0.4)";
    } else if (lapses>5 && lapses<= 6){
        document.getElementById("element").style.backgroundColor = "rgba(255,255, 245, 0.7)";
    } else{
        document.getElementById("element").style.backgroundColor = "rgba(255,255, 245, 0.9)"; 
    }
    })();
    </div>
    
  7. 7 Posted by Bruce Plumb on 27 Mar, 2020 04:30 PM

    Bruce Plumb's Avatar

    The Anki Manual gives the Conditional Replacement example {{#Tags}}Tags:
    {{Tags}}{{/Tags}}

    I did the same thing with {{#info::Lapses}}Lapses:
    {{info::Lapses}}{{//info::Lapses}}

    which is not now possible with the new info-Lapses: format.

    But thanks to your help I accomplish it with the following:

    <div id="LapsesLabel"><i>Lapses:</i>&nbsp;&nbsp;&nbsp;{{info-Lapses:}}</div>

    <script>

    (function visible_by_lapses(){

    var lapses = parseInt('{{info-Lapses:}}');

    if (lapses== 0){ document.getElementById("LapsesLabel").style.display =
    "none"; }

    })();
    </script>

    Bruce Plumb

  8. 8 Posted by ijg on 27 Mar, 2020 07:52 PM

    ijg's Avatar

    @Guillem: Thanks for sharing. I linked your solution from ankiweb and reposted it with a link on github so that it's more discoverable.

Comments are closed, but you can start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac