Closed ParkJaeseoCom closed 1 year ago
One of these should work for you:
var userJs1 = () => revealOneClozeOfAType("genuine")
This will reveal the next red cloze.
var userJs1 = () => revealOneClozeOfAType("pseudo")
This will reveal the next blue cloze.
@RisingOrange Thanks for reply. I copy that code in the front card template, but there is error with the message
"ReferenceError : Can't find variable: revealOneClozeOfAType"
Is there any adequate place to put that code in? I place that code next to the shortcut script.
Have you found a solution yet? I also have the same problem
With the help of the big shots, my problem has been solved. Please go to the website: https://forums.ankiweb.net/t/how-can-i-use-user-action-by-configuring-javascript/31144
With the help of the big shots, my problem has been solved. Please go to the website: https://forums.ankiweb.net/t/how-can-i-use-user-action-by-configuring-javascript/31144
can you please share me a code?
function revealOneClozeOfAType(clozeType) { if (!["genuine", "pseudo"].includes(clozeType)) { console.log(
clozeType has unexpected value: ${clozeType}`)
}
if (!$(`.${clozeType}-cloze[show-state="hint"]`).length) {
$('#no-more-cloze').animate({
display: "toggle",
}, 500);
return
}
var hiddenClozes = $(`.${clozeType}-cloze[show-state="hint"]`)
if (hiddenClozes.length != 0) {
revealCloze(hiddenClozes[0]);
}
}, globalThis [“userJs1”] = () => revoalOneClozeOfAType (“genuine”)`
I put like this but it didn't work
With the help of the big shots, my problem has been solved. Please go to the website: https://forums.ankiweb.net/t/how-can-i-use-user-action-by-configuring-javascript/31144
can you please share me a code?
function revealOneClozeOfAType(clozeType) { if (!["genuine", "pseudo"].includes(clozeType)) { console.log(
clozeType has unexpected value: ${clozeType}`) }if (!$(`.${clozeType}-cloze[show-state="hint"]`).length) { $('#no-more-cloze').animate({ display: "toggle", }, 500); return } var hiddenClozes = $(`.${clozeType}-cloze[show-state="hint"]`) if (hiddenClozes.length != 0) { revealCloze(hiddenClozes[0]); } }, globalThis [“userJs1”] = () => revoalOneClozeOfAType (“genuine”)`
I put like this but it didn't work
You can try this setting that I successfully set: (Replace the above code with the following code)
function revealOneClozeOfAType(clozeType) {
if (!["genuine", "pseudo"].includes(clozeType)) {
console.log(`clozeType has unexpected value: ${clozeType}`)
}
if (!$(`.${clozeType}-cloze[show-state="hint"]`).length) {
$('#no-more-cloze').animate({
display: "toggle",
}, 500);
return
}
var hiddenClozes = $(`.${clozeType}-cloze[show-state="hint"]`)
if (hiddenClozes.length != 0) {
revealCloze(hiddenClozes[0]);
}
}
globalThis["userJs1"] = () => revealOneClozeOfAType("genuine")
With the help of the big shots, my problem has been solved. Please go to the website: https://forums.ankiweb.net/t/how-can-i-use-user-action-by-configuring-javascript/31144
can you please share me a code?
function revealOneClozeOfAType(clozeType) { if (!["genuine", "pseudo"].includes(clozeType)) { console.log(
clozeType has unexpected value: ${clozeType}`) }if (!$(`.${clozeType}-cloze[show-state="hint"]`).length) { $('#no-more-cloze').animate({ display: "toggle", }, 500); return } var hiddenClozes = $(`.${clozeType}-cloze[show-state="hint"]`) if (hiddenClozes.length != 0) { revealCloze(hiddenClozes[0]); } }, globalThis [“userJs1”] = () => revoalOneClozeOfAType (“genuine”)`
I put like this but it didn't work
You can try this setting that I successfully set: (Replace the above code with the following code)
function revealOneClozeOfAType(clozeType) { if (!["genuine", "pseudo"].includes(clozeType)) { console.log(`clozeType has unexpected value: ${clozeType}`) } if (!$(`.${clozeType}-cloze[show-state="hint"]`).length) { $('#no-more-cloze').animate({ display: "toggle", }, 500); return } var hiddenClozes = $(`.${clozeType}-cloze[show-state="hint"]`) if (hiddenClozes.length != 0) { revealCloze(hiddenClozes[0]); } } globalThis["userJs1"] = () => revealOneClozeOfAType("genuine")
Thanks! It works! Have a great day!
Hi. I'm using enhanced Cloze in Mac and iOS. iOS Anki supports User Action function.
In Anki Manual, : To define a user action, you must know the function the card template provides. If you know it provides a revealNext() function for example, you can tell AnkiMobile to call it with the following code:
var userJs1 = revealNext;
I'm trying to use this function with enhanced Cloze.
I enter the code
'var userJs1 = revealOneClozeOfAType;
but it doesn't work.Is there anyone who knows how to work?