copy_selection_link.js
· 503 B · JavaScript
Raw
(() => {
// Finds all links inside table cells that have the 'sel' class
const links = Array.from(document.querySelectorAll('.sel a[href^="/download/"]'))
.map(a => a.href);
if (links.length > 0) {
const output = links.join('\n');
copy(output);
console.log(`✅ ${links.length} links copied!`);
console.table(links);
} else {
console.warn("No links found in selected rows. Try running: console.log(document.querySelectorAll('.sel')) to check the class name.");
}
})();
| 1 | (() => { |
| 2 | // Finds all links inside table cells that have the 'sel' class |
| 3 | const links = Array.from(document.querySelectorAll('.sel a[href^="/download/"]')) |
| 4 | .map(a => a.href); |
| 5 | |
| 6 | if (links.length > 0) { |
| 7 | const output = links.join('\n'); |
| 8 | copy(output); |
| 9 | console.log(`✅ ${links.length} links copied!`); |
| 10 | console.table(links); |
| 11 | } else { |
| 12 | console.warn("No links found in selected rows. Try running: console.log(document.querySelectorAll('.sel')) to check the class name."); |
| 13 | } |
| 14 | })(); |