DataVaults - Auto download

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==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']});
})();