-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1530e3f
commit 70a711f
Showing
2 changed files
with
44 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
{ | ||
"name": "YGG Plus", | ||
"version": "1.0", | ||
"version": "1.1", | ||
"description": "Add buttons to ygg torrent", | ||
"icons": { | ||
"128": "128.png" | ||
}, | ||
"content_scripts": [ { | ||
"all_frames": true, | ||
"js": [ "yggplus.js" ], | ||
"matches": [ "https://www2.yggtorrent.gg/*", "https://www.yggtorrent.gg/*", "https://www3.yggtorrent.gg/*" ] | ||
} ], | ||
}, | ||
"content_scripts": [ | ||
{ | ||
"all_frames": true, | ||
"js": [ | ||
"yggplus.js" | ||
], | ||
"matches": [ | ||
"https://yggtorrent.li/*", | ||
"https://www.yggtorrent.li/*", | ||
"https://www4.yggtorrent.li/*" | ||
] | ||
} | ||
], | ||
"manifest_version": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
const tables = document.querySelectorAll('table.table'); | ||
tables.forEach(table => { | ||
let th = document.createElement('th'); | ||
th.colSpan = 1; | ||
th.innerText = 'Actions'; | ||
table.tHead.rows[0].appendChild(th); | ||
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'); | ||
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://www2.yggtorrent.gg/engine/download_torrent?id=' + id + '">Télécharger</a>'; | ||
row.appendChild(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://www4.yggtorrent.li/engine/download_torrent?id=' + | ||
id + | ||
'">Télécharger</a>'; | ||
row.appendChild(td); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
checkData(); |