You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the problem is that the order of the list in the question is different from that of the answer.
I am not an expert but only self-taught. Please don't take anything for granted when you answer me.
I write the code in my card.
front
<div id="front">{{edit:Domanda}}
{{type:Risposta}}</div>
<!====START====Insert Randomized Lists (multiple choice)==========================>
<script>
var createCookie = function(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
}
else {
expires = "";
}
document.cookie = name + "=" + value + expires + "; path=/";
}
function getCookie(c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1) {
c_end = document.cookie.length;
}
return unescape(document.cookie.substring(c_start, c_end));
}
}
return "";
}
function getRandomElms(){
var ul = document.querySelectorAll('ul.shuffle');
return ul
}
function getRandArr(elm, array){
for (var i = elm.children.length; i >= 0; i--) {
rand = Math.random() * i | 0;
array.push(rand)
}
}
function shuffleWithArr(elm, array){
elm.style.backgroundColor = "inherit"
for (var i = elm.children.length; i >= 0; i--) {
elm.appendChild(elm.children[array[i]]);
}
}
function run() {
var elms = getRandomElms()
var isFront = document.getElementById("front");
for (var i = 0; i < elms.length; i++) {
var idxArr = [];
elm = elms[i]
if (isFront) {
getRandArr(elm, idxArr);
// convert idxArr array to a JSON string to be stored
var json_str = JSON.stringify(idxArr);
// persist the idxArr order and correct answers
createCookie('idxArr' + i, json_str);
var stored_data = idxArr
} else {
// get the idxArr order
var json_data = getCookie('idxArr' + i);
// get the array back from storage
var stored_data = JSON.parse(json_data);
}
shuffleWithArr(elm, stored_data)
}
}
run();
</script>
<!====END====Insert Randomized Lists (multiple choice)==========================>
Now the Back
{{FrontSide}}
<p class="titolo">Contenuto extra:</p>
{{Extra}}
<!====START====Insert Randomized Lists (multiple choice)==========================>
<script>
var createCookie = function(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
}
else {
expires = "";
}
document.cookie = name + "=" + value + expires + "; path=/";
}
function getCookie(c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1) {
c_end = document.cookie.length;
}
return unescape(document.cookie.substring(c_start, c_end));
}
}
return "";
}
function getRandomElms(){
var ul = document.querySelectorAll('ul.shuffle');
return ul
}
function getRandArr(elm, array){
for (var i = elm.children.length; i >= 0; i--) {
rand = Math.random() * i | 0;
array.push(rand)
}
}
function shuffleWithArr(elm, array){
elm.style.backgroundColor = "inherit"
for (var i = elm.children.length; i >= 0; i--) {
elm.appendChild(elm.children[array[i]]);
}
}
function run() {
var elms = getRandomElms()
var isFront = document.getElementById("front");
for (var i = 0; i < elms.length; i++) {
var idxArr = [];
elm = elms[i]
if (isFront) {
getRandArr(elm, idxArr);
// convert idxArr array to a JSON string to be stored
var json_str = JSON.stringify(idxArr);
// persist the idxArr order and correct answers
createCookie('idxArr' + i, json_str);
var stored_data = idxArr
} else {
// get the idxArr order
var json_data = getCookie('idxArr' + i);
// get the array back from storage
var stored_data = JSON.parse(json_data);
}
shuffleWithArr(elm, stored_data)
}
}
run();
</script>
<!====END====Insert Randomized Lists (multiple choice)==========================>
and, perhaps it is useless, but I also write the content of the style sheet
Which add-on is affected?
[ Please mention the add-on in the issue title as follows: "[Add-on name] My issue" ]
Prerequisite checklist
[ Please enter an [ x ] character to confirm the points below: ]
What is the problem/feature you would like to see fixed/implemented?
[ Please be as specific as possible. Provide screenshots if you think they can help. ]
How can we reproduce the problem?
[ What were you doing when the problem occurred? ]
Expected behavior: [ What you expected to happen ]
Actual behavior: [ What actually happened ]
Reproducible?: [ Can you reliably reproduce the issue by following the steps above? ]
Version information
Anki
[Versione 2.1.49 (dc80804a)
Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
System
I followed the instructions given here step by step
https://github.com/glutanimate/anki-addons-misc/tree/master/src/editor_random_list
I have installed the add-on Cookie monster but it has few instructions and maybe I don't understand how to use it
I also fixed the problem of the RL key not working well.
https://github.com/glutanimate/anki-addons-misc/tree/master/src/editor_random_list
the problem is that the order of the list in the question is different from that of the answer.
I am not an expert but only self-taught. Please don't take anything for granted when you answer me.
I write the code in my card.
front
Now the Back
and, perhaps it is useless, but I also write the content of the style sheet
What is missing from my job to keep the same order of the list on front and back card?
The text was updated successfully, but these errors were encountered: