Skip to content

Instantly share code, notes, and snippets.

@Equinox-
Created March 7, 2014 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Equinox-/9417540 to your computer and use it in GitHub Desktop.
Save Equinox-/9417540 to your computer and use it in GitHub Desktop.
Grabs cards from brainspace and exports them as CSV.
function grabCard() {
if (document.getElementsByClassName("q-title")[0] == undefined) {
return;
}
var data = "";
var prompt = "";
if (document.getElementsByClassName("card-question-prompt")[0] != undefined) {
prompt = "<span>" + document.getElementsByClassName("card-question-prompt")[0].innerHTML.replace(/\"/g,"'").replace(/\n/g,"") + "</span></br>";
}
data += "\"" + prompt + document.getElementsByClassName("q-title")[0].innerHTML.replace(/\"/g,"'").replace(/\n/g,"") + "\",\"" + document.getElementsByClassName("a-title")[0].innerHTML.replace(/\"/g, "'").replace(/\n/g,"") + "\"";
if (window.output == undefined) {
window.output="";
window.last="";
window.fieldout = document.createElement("textarea");
document.body.appendChild(window.fieldout);
}
if (window.last == data || window.last.indexOf(data) != -1) {
return;
}
window.last = data;
window.output+=data + "\n";
window.fieldout.innerHTML = output;
console.log(data);
BSC.Study.flipMainCard();
$(document).ajaxStop(grabCard);
grabCard();
BSC.Study.setConfidence(3);
}
grabCard();
$(document).ajaxStop(grabCard);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment