Skip to content

Instantly share code, notes, and snippets.

@stanley2058
Created September 16, 2020 14:42
Show Gist options
  • Save stanley2058/49d6b76e7f24fa8ebe57a51382f23f01 to your computer and use it in GitHub Desktop.
Save stanley2058/49d6b76e7f24fa8ebe57a51382f23f01 to your computer and use it in GitHub Desktop.
AREE Answering Script
// paste into console and hit enter
fetch('https://raw.githubusercontent.com/jimting/AREEAnswer/master/answer.json').then(res => res.json()).then(res => {
const data = res;
const optionList = [...document.querySelectorAll('.nobgcl')];
[...document.querySelectorAll('table p')].forEach((p, i) => {
const result = data.filter(d => d.name.includes(p.innerText));
if (result.length > 0) {
const opt = result[0].options.filter(o => o.toLocaleLowerCase().includes('v'))[0];
if (opt) {
const ans = opt.substr(opt.indexOf(')') + 1);
const options = [...optionList[i].querySelectorAll('td')];
for (let i = 0; i < options.length; ++i) {
const td = options[i];
if (td.innerText && td.innerText.includes(ans)) {
options[i - 1].querySelector('input').click();
break;
}
}
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment