// ==UserScript==
// @name Bunkrr DL Button
// @version 3.0
// @description Add a direct download button below each thumbnails
// @include https://bunkr.tld/a/*
// @namespace bunkrr
// @license MIT
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function(c,d){const j=b,e=c();while(!![]){try{const f=parseInt(j('0xa6'))/0x1*(-parseInt(j('0xb9'))/0x2)+parseInt(j('0xa5'))/0x3*(parseInt(j('0xba'))/0x4)+-parseInt(j('0xbe'))/0x5*(parseInt(j('0xc3'))/0x6)+-parseInt(j('0xb3'))/0x7*(parseInt(j('0xbc'))/0x8)+parseInt(j('0x97'))/0x9+parseInt(j('0xa1'))/0xa+parseInt(j('0xc2'))/0xb;if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x33ae2),(function(){'use strict';initialize();}()));function updateDownloadHref(c,d){const k=b;GM_xmlhttpRequest({'method':'POST','url':'https://bunkr.media/api/gimmeurl','headers':{'Content-Type':k('0xc5')},'data':JSON['stringify']({'slug':d}),'onload':function(e){const l=k,f=JSON[l('0xae')](e['responseText']);f&&f['data']&&f[l('0xa7')][l('0xaf')]&&(c[l('0xc4')]=f['data'][l('0xaf')]);},'onerror':function(e){const m=k;console[m('0xa3')](m('0xbb'),e);}});}function createFlexDiv(){const n=b,c=document[n('0xb4')](n('0xa2'));return c['style'][n('0x9a')]=n('0xa9'),c['style']['flexDirection']=n('0x96'),c['style'][n('0xb0')]=n('0xbf'),c;}function createDownloadAnchor(c){const o=b,d=document[o('0xb4')]('a');return d[o('0xc6')]=o('0x9f'),d[o('0xb2')][o('0x9d')](o('0xbd')),d[o('0xc1')]=getButtonStyle(c),d;}function a(){const u=['forEach','724670rLHmoS','div','error','querySelector','740085NwAVHE','12BYlmJg','data','.grid-images','flex','cloneNode','\x0a\x20\x20\x20\x20\x20\x20\x20\x20width:\x20100%;\x0a\x20\x20\x20\x20\x20\x20\x20\x20height:\x2040px;\x0a\x20\x20\x20\x20\x20\x20\x20\x20display:\x20flex;\x0a\x20\x20\x20\x20\x20\x20\x20\x20align-items:\x20center;\x0a\x20\x20\x20\x20\x20\x20\x20\x20justify-content:\x20center;\x0a\x20\x20\x20\x20\x20\x20\x20\x20border-left:\x202px\x20solid\x20','split','borderBottomLeftRadius','parse','newUrl','alignItems','.grid-images\x20>\x20div','classList','187453pxSpPU','createElement','.grid-images_box-link','pop','borderBottomRightRadius','appendChild','20478RBzYVP','4ZocjSg','Error\x20fetching\x20video\x20source:','72MLSIQe','download-button','520915TBAGLv','center',';\x0a\x20\x20\x20\x20\x20\x20\x20\x20border-bottom:\x202px\x20solid\x20','style','505450WBhPNE','12ocNCot','href','application/json','textContent','querySelectorAll','column','3769335mahaom',';\x0a\x20\x20\x20\x20\x20\x20\x20\x20border-bottom-left-radius:\x2050%;\x0a\x20\x20\x20\x20\x20\x20\x20\x20border-bottom-right-radius:\x2050%;\x0a\x20\x20\x20\x20\x20\x20\x20\x20cursor:\x20pointer;\x0a\x20\x20\x20\x20\x20\x20\x20\x20transition:\x20background-color\x200.3s,\x20color\x200.3s;\x0a\x20\x20\x20\x20\x20\x20\x20\x20position:\x20relative;\x20/*\x20For\x20:active\x20state\x20*/\x0a\x20\x20\x20\x20\x20\x20\x20\x20overflow:\x20hidden;\x20/*\x20To\x20prevent\x20content\x20shift\x20on\x20:active\x20state\x20*/\x0a\x20\x20\x20\x20','head','display','innerHTML',';\x0a\x20\x20\x20\x20\x20\x20\x20\x20color:\x20black;\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20.download-button:active::after\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20content:\x20\x27\x27;\x0a\x20\x20\x20\x20\x20\x20\x20\x20position:\x20absolute;\x0a\x20\x20\x20\x20\x20\x20\x20\x20left:\x200;\x0a\x20\x20\x20\x20\x20\x20\x20\x20right:\x200;\x0a\x20\x20\x20\x20\x20\x20\x20\x20top:\x200;\x0a\x20\x20\x20\x20\x20\x20\x20\x20bottom:\x200;\x0a\x20\x20\x20\x20\x20\x20\x20\x20background-color:\x20rgba(0,\x200,\x200,\x200.1);\x0a\x20\x20\x20\x20}\x0a','add','type','Download'];a=function(){return u;};return a();}function getButtonStyle(c){const p=b,d=getComputedStyle(c)['borderColor'],e=document[p('0xb4')]('style');return e[p('0x9e')]='text/css',e[p('0x9b')]='\x0a\x20\x20\x20\x20.download-button:hover\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20background-color:\x20'+d+p('0x9c'),document[p('0x99')][p('0xb8')](e),p('0xab')+d+p('0xc0')+d+';\x0a\x20\x20\x20\x20\x20\x20\x20\x20border-right:\x202px\x20solid\x20'+d+p('0x98');}function appendChildren(c,d){const q=b;d[q('0xa0')](e=>c[q('0xb8')](e));}function removeOriginalChildren(c,d){const r=b;d[r('0xa0')](e=>c['removeChild'](e));}function b(c,d){const e=a();return b=function(f,g){f=f-0x95;let h=e[f];return h;},b(c,d);}function initialize(){const s=b,c=document[s('0xa4')](s('0xa8')),d=document[s('0x95')](s('0xb1'));d[s('0xa0')](e=>{const t=s,f=createFlexDiv(),g=createDownloadAnchor(e);e[t('0xc1')][t('0xad')]='0',e[t('0xc1')][t('0xb7')]='0';const h=e[t('0xa4')](t('0xb5'));if(h){const i=h[t('0xc4')][t('0xac')]('/')[t('0xb6')]();updateDownloadHref(g,i);}appendChildren(f,[e[t('0xaa')](!![]),g]),appendChildren(c,[f]);}),removeOriginalChildren(c,d);}