Skip to content

Instantly share code, notes, and snippets.

View Sylvhub's full-sized avatar

Sylvain Laneyrie Sylvhub

View GitHub Profile
@Sylvhub
Sylvhub / getPercentDiff.js
Last active October 12, 2023 08:31 — forked from natzir/getPercentDiff.js
getPercentDiff.js
javascript:(function() { console.log("[SC Calculator by Natzir & Sylvain / @natzir9 @SylvainL]"); function processTable() { const xpath = "//table[@class='i3WFpf']"; const tables = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (let i = 0; i < tables.snapshotLength; i++) { const table = tables.snapshotItem(i); const secondHeader = table.querySelector("tr > :nth-child(2)"); if (secondHeader && secondHeader.querySelector("br")) { processTableElement(table); } } } function processTableElement(table) { let rows = table.querySelectorAll("tr"); let firstDataRow = rows[1]; if (firstDataRow && (firstDataRow.querySelector(":nth-child(4) > span > span > span") || firstDataRow.querySelector(":nth-child(7) > span > span > span"))) { return; } for (let i = 1; i < rows.length; i++) { let row = rows[i]; let clicksLa
@natzir
natzir / getPercentDiff.js
Last active July 7, 2024 20:37
getPercentDiff.js
javascript:(function()%7Bjavascript%3A!function()%7Bfunction%20e(e)%7Blet%20l%3De.querySelectorAll(%22tr%22)%2Cn%3Dl%5B1%5D%3Bif(!(n%26%26(n.querySelector(%22%3Anth-child(4)%20%3E%20span%20%3E%20span%20%3E%20span%22)%7C%7Cn.querySelector(%22%3Anth-child(7)%20%3E%20span%20%3E%20span%20%3E%20span%22))))for(let%20a%3D1%3Ba%3Cl.length%3Ba%2B%2B)%7Blet%20r%3Dl%5Ba%5D%3Br.cells%5B1%5D.getAttribute(%22data-numeric-value%22)%3Blet%20i%3Dr.cells%5B2%5D.getAttribute(%22data-numeric-value%22)%2Cc%3Dr.cells%5B3%5D.getAttribute(%22data-numeric-value%22)%3Br.cells%5B4%5D.getAttribute(%22data-numeric-value%22)%3Blet%20s%3Dr.cells%5B5%5D.getAttribute(%22data-numeric-value%22)%2Co%3Dr.cells%5B6%5D.getAttribute(%22data-numeric-value%22)%2Cd%3Di%2Cu%3Ds%2Cp%3Dt(c%2Cd)%2Ch%3Dt(o%2Cu)%2Cf%3Dr.querySelector(%22%3Anth-child(4)%20%3E%20span%20%3E%20span%22)%2Cm%3Dr.querySelector(%22%3Anth-child(7)%20%3E%20span%20%3E%20span%22)%2Cg%3Ddocument.createElement(%22span%22)%2C%24%3Ddocument.createElement(%22span%22)%3Bg.innerText%3D%60%20(