Skip to content

[need small help] template doesn't flip card when in nightmode + how to detect platform using js #6886

@thiswillbeyourgithub

Description

@thiswillbeyourgithub

Hi,

I hope it's okay for me to ask this here, I'm running into an issue with ankidroid and couldn't find the answer. I hope that by asking it here, it will be visible to others, should they run into the same issue.

I'll be short and to the point : I'm doing a pretty sophisticated template in js, but I'm really new to it.

I have this in my cloze front template :

if (navigator.userAgent.indexOf("obile") >= 0 || navigator.userAgent.indexOf("roid") >= 0 )  {
	var isOnMobile = "T";
}
if (autoFlip == "T") {
	if (isOnMobile == "F") { pycmd("ans"); }
	if (isOnMobile == "T") { showAnswer(); }
}

This idea is that if it passes some test, the card will not show the front but automatically flip and show the answer. The behavior doesn't seem to work when in nightmode in ankidroid but works perfectly in daymode.

  1. Could you give me some clues as to why it doesn't work?

  2. Do you have a recommendation as to the proper way to detect mobile versions? Your wiki and github is very well written but I don't find a lot of information about AnkiMobile

  3. Any recommendation as to where I can find information about what should and should work in js across all platforms? I saw in the official manual that they don't really offer support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions