-
Notifications
You must be signed in to change notification settings - Fork 2
/
yggplus.js
31 lines (27 loc) · 854 Bytes
/
yggplus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function checkData() {
const tables = document.querySelectorAll("table.table");
if (!tables.length) {
return;
} else if (!tables[0].tBodies[0].rows.length) {
setTimeout(checkData, 100);
} else {
tables.forEach((table) => {
let th = document.createElement("th");
th.colSpan = 1;
th.innerText = "Actions";
table.tHead.rows[0].appendChild(th);
for (let row of table.tBodies[0].rows) {
let td = document.createElement("td");
const link = row.cells[1].firstChild.href;
const name = link.substr(link.lastIndexOf("/") + 1);
const id = name.substr(0, name.indexOf("-"));
td.innerHTML =
'<a href="https://www.ygg.re/engine/download_torrent?id=' +
id +
'">Télécharger</a>';
row.appendChild(td);
}
});
}
}
checkData();