// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://ux.getuploader.com/*/
// @match https://ux.getuploader.com/*/index/date/desc/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=getuploader.com
// @grant none
// ==/UserScript==
(function () {
var targetTables = [...document.querySelectorAll('table.table.table-small-font.table-hover')];
// targetTables returns 2 tables, one of the table has a suffix of "-clone", therefore,
// we can safely ignore it.
var targetTable = targetTables.filter(x => x.id.indexOf('-clone') < 0)[0];
// If it doesn't exist, don't run.
if (!targetTable) {
return;
}
var baseDownloadUrl = 'https://downloadx.getuploader.com';
var username = location.href.split('/')[3];
var urls = '';
var tableLinks = [...targetTable.querySelectorAll('tr td a')].filter(x => x.href.indexOf('/download/') >= 0);
for (var i = 0; i < tableLinks.length; i++) {
// Retrieve file id
urls += `${baseDownloadUrl}/g/${username}/${tableLinks[i].href.split('/').slice(-1)[0]}/${tableLinks[i].innerText}\n`;
}
function tryPasteToClipboard() {
if (navigator.clipboard === undefined) {
alert('Failed to put in clipboard! Links on devtools');
console.log("\n\n" + urls);
return;
}
navigator.clipboard.writeText(urls)
.then(() => alert('Pasted on clipboard!'))
.catch(() => {
alert('Failed to put in clipboard! Links on devtools');
console.log("\n\n" + urls);
});
}
// Create button for interaction
var btn = document.createElement('a');
btn.href = '#';
btn.classList.add('btn', 'btn-default', 'btn-xs');
btn.title = 'Get all download links';
btn.innerText = 'Get all download links';
btn.onclick = function () {
tryPasteToClipboard();
}
var btnParent = document.querySelector('.pull-left.space');
btnParent.appendChild(btn);
})();