UploadrAr Auto Downloader

Automatically clicks download links for UploadrAr

Versione datata 26/03/2022. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         UploadrAr Auto Downloader
// @description  Automatically clicks download links for UploadrAr
// @author       Magic <[email protected]>
// @license      MIT
// @namespace    https://github.com/magicoflolis/userscriptrepo/tree/master/UploadrAr
// @homepageURL  https://github.com/magicoflolis/userscriptrepo/tree/master/UploadrAr
// @supportURL   https://github.com/magicoflolis/userscriptrepo/issues/new
// @icon         https://uploadrar.com/uploadrar_style/images/favicon.png
// @match        https://uploadrar.com/*
// @exclude      https://uploadrar.com/?op=*
// @exclude      https://uploadrar.com/make_money.html
// @exclude      https://uploadrar.com/pages/*
// @version      1.1
// @grant        none
// ==/UserScript==

// Options
let Version = "free", // free (default) / premium
fullAutoDownload = true, // true (default) / false
afterDelay = 0; // 0 (default) / any #

// Userscript Code
(() => {
  try {
    const delay = (ms) => {
      return new Promise(resolve => setTimeout(resolve, ms));
    },
    qs = async element => {
      while (document.querySelector(element) === null) {
        await new Promise(resolve => requestAnimationFrame(resolve));
      }
      return (afterDelay !== 0) ? delay(afterDelay).then(() => document.querySelector(element)) : document.querySelector(element);
    };
    let firstSel,secondSel;
    (Version !== "free") ? (
      firstSel = "input.xfs-premium-download",
      secondSel = "input.mngez-premium-download"
      ) : (
        firstSel = "input.xfs-free-download",
        secondSel = "input.mngez-free-download"
        )
    if(fullAutoDownload) {
      qs(firstSel).then(btn => {
        btn.click();
      });
      qs(secondSel).then(btn => {
        btn.click();
      });
    } else {
      qs(secondSel).then(btn => {
        btn.click();
      });
    };
    qs("span#direct_link > a").then(link => {
      window.open(link.href, "_blank");
    });
  } catch (e) {
    console.log("[%cUAD%c] %cERROR","color: rgb(29, 155, 240);","","color: rgb(249, 24, 128);",e)
  }
})();