Skip to content

Instantly share code, notes, and snippets.

@thuongnn
Created July 30, 2019 13:28
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 thuongnn/0e88170ee4496a9030ad2bdf6a9cbdc6 to your computer and use it in GitHub Desktop.
Save thuongnn/0e88170ee4496a9030ad2bdf6a9cbdc6 to your computer and use it in GitHub Desktop.
let credits = 0, count = 0, total = 0.0;
document.getElementsByClassName('table table-hover')[0].getElementsByTagName('tbody')[0].childNodes.forEach(tr => {
let x8 = tr.childNodes[8] ? tr.childNodes[8].firstChild ? tr.childNodes[8].firstChild.firstChild : null : null,
x7 = tr.childNodes[7] ? tr.childNodes[7].firstChild ? tr.childNodes[7].firstChild.firstChild : null : null,
x3 = tr.childNodes[3] ? tr.childNodes[3].firstChild : null,
x6 = tr.childNodes[6] ? tr.childNodes[6].firstChild : null;
if (x6 !== null && x7 !== null && x8.textContent === "Passed") {
count++;
console.log("[A" + count + "]: Name: " + x3.textContent + " | Credit: " + x6.textContent + " | Point: " + x7.textContent + " | Status: \x1b[32m" + x8.textContent);
credits += Number(x6.textContent);
total += Number(x7.textContent) * Number(x6.textContent);
}
});
console.log("%c ✔ Credits:\x1b[34m " + credits, "color:white;background:green;");
console.log("%c ✔ Points :\x1b[34m " + (total / credits).toFixed(2), "color:white;background:green;");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment