Skip to content

Instantly share code, notes, and snippets.

@zisra
Created March 2, 2024 14:17
Show Gist options
  • Save zisra/7b6bd479a1d96e11fd595f5ee4d3c789 to your computer and use it in GitHub Desktop.
Save zisra/7b6bd479a1d96e11fd595f5ee4d3c789 to your computer and use it in GitHub Desktop.
const rows = document.querySelectorAll('#dataGridRight table tbody tr.listCell');
const result = [];
rows.forEach(row => {
const cells = row.querySelectorAll('td');
const title = cells[0].textContent.trim();
if(!cells[2]) return;
const weight = parseInt(cells[2].textContent) / 100;
result.push({ title, weight });
});
copy(result);
const table = document.querySelector("#dataGrid > table");
const rows = Array.from(table.querySelectorAll("tr .listRowHeight"))
const finalData = rows.map(row=>{
const data = Array.from(row.querySelectorAll("td")).map(item=>item.innerText);
let [from, total] = data[8].split("/").map(i=>parseInt(i.trim()));
if(!from){
[from, total] = data[9].split("/").map(i=>parseInt(i.trim()));
}
return {
name: data[1],
category: data[4],
score: from,
totalScore: total,
}
});
copy(finalData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment