DataVaults - Auto download

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

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

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