DataVaults - Auto download

Takes you to the actual download, auto-fills captcha, waits for timer, then auto-downloads the file.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         DataVaults - Auto download
// @version      05-18-26
// @description  Takes you to the actual download, auto-fills captcha, waits for timer, then auto-downloads the file.
// @author       WATCH_TEXHNOLYZE
// @match        https://datavaults.co/*
// @grant        none
// @namespace https://greasyfork.org/users/1122886
// ==/UserScript==

(function() {
'use strict';
function fillCaptcha() {
    const d=document.querySelector('td div[style*="background"]');
    if(!d) return;
    const s=d.querySelectorAll('span[style*="padding-left"]');
    if(!s.length) return;
    const a=[];
    s.forEach(e=>{
        const t=e.textContent.trim(),
              m=e.getAttribute('style').match(/padding-left\s*:\s*(\d+)px/);
        if(m && t.length===1) a.push({digit:t, pos:+m[1]});
    });
    a.sort((x,y)=> x.pos-y.pos);
    const c=a.map(x=>x.digit).join(''),
          i=document.querySelector('input.captcha_code[name="code"]');
    if(i&&c) i.value=c;
}
function clickIntermediate() {
    const b=document.getElementById('original');
    if(b) b.click();
}
function waitAndSubmit() {
    const b=document.getElementById('downloadbtn');
    if(!b) return;
    const t=setInterval(()=>{
        if(!b.disabled) {
            clearInterval(t);
            const f=document.querySelector('form[name="F1"]')||document.forms[0];
            if(f) f.submit();
        }
    },500);
}
function handle() {
    const i=document.querySelector('input.captcha_code[name="code"]');
    if(i) { fillCaptcha(); waitAndSubmit(); }
    else if(document.getElementById('original')) clickIntermediate();
}
handle();
new MutationObserver(handle).observe(document.body,{childList:true,subtree:true,attributes:true,attributeFilter:['style','class']});
})();