Skip to content

Instantly share code, notes, and snippets.

@SitanHuang
Last active October 28, 2020 23:21
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 SitanHuang/740ed6925e1826bc52d3becbf24aa7df to your computer and use it in GitHub Desktop.
Save SitanHuang/740ed6925e1826bc52d3becbf24aa7df to your computer and use it in GitHub Desktop.
(function () {
window._storage = {};
window._storage2 = {};
window.lastQ = null;
window.tick = function (i) {
var $exercise = $('#exercise');
var q = $('#pronoun-input, #verb-input').text().trim();
var v = $('#verb-input').text().trim();
if (q) {
if (_storage[q]&&_storage[q].trim().length) {
$('#answer-input').val(_storage[q]);
$('#check-button').click();
} else {
if (lastQ == q) {
_storage2[v]=_storage2[v].filter(x=>x.length);
x = _storage2[v][Math.round(_storage2[v].length * Math.random())];
$('#answer-input').val(x);
$('#check-button').click();
setTimeout(function () {if ($('.js-bubble.coqui-test-bubble.incorrect').length==0){_storage[q]=x;lastQ=null};tick(i)}, i);
return;
}
$('#answer-input').val(Math.random()+'');
$('#check-button').click();
setTimeout(function(){ _storage[q] = $('.js-bubble.coqui-test-bubble.incorrect span').text().trim();
if (!_storage2[v]) _storage2[v] = [];
_storage2[v].push(_storage[q]);
lastQ=q;
setTimeout(function () {tick(i)}, i);
}, 30);
return;
}
tick(i);
return;
}
/*q = $exercise.find('.ac-section:first-child').text().trim();
if (_storage[q]) {
$('#answer-input').val(_storage[q]);
$('#check-button').click();
} else {
$('#answer-input').val('a'+Math.random());
$('#check-button').click();
_storage[q] = $('.js-bubble.coqui-test-bubble.incorrect span').text().trim();
}*/
}
window.start = function (i) {
tick((i || 1000) + 50);
// i = i || 300;
// var id = setInterval(window.tick, i+50);
// setTimeout(function () {clearInterval(id)}, 4*60*1000);
}
})()
@Antonio-bli
Copy link

does this actually work

@SitanHuang
Copy link
Author

does this actually work

It's designed for one specific type of assignment. it's not meant for the public. Im using this for myself.

@Agr0ed
Copy link

Agr0ed commented Oct 28, 2020

how could i make this for personal use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment