// ==UserScript== // @name Maknyos AutoIn // @namespace http://userscripts.org/scripts/show/91629 // @version 3.9.2 // @description Auto click / submit to get link, iframes killer, load direct-link with iframe. Supported host: indowebster, 2shared, zippyshare, mediafire, sendspace, uptobox, howfile, uppit, imzupload, jumbofiles, sendmyway, tusfiles, dropbox, yadi.sk, datafilehost, userscloud, hulkload, app.box.com, dailyuploads, kumpulbagi, kb.simple-aja, moesubs, uploadrocket, my.pcloud.com, kirino.ga, seiba.ga, mylinkgen, rgho.st, upload.ee, upload.so, cloud.mail.ru, bc.vc, sh.st, adf.ly, adfoc.us // @homepageURL https://greasyfork.org/scripts/97 // @author Idx // @grant GM_log // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js // @include /^https?://(files|maknyos).indowebster.com/*/ // @include /^https?://(.+\.)2shared.com/file/*/ // @include /^https?://(.+\.)zippyshare.com/v/*/ // @include /^https?://(|www\.)mediafire.com/(download|view)/*/ // @include /^https?://(|www\.)sendspace.com/file/*/ // @include /^https?://(|www\.)uptobox.com\/\w/ // @include /^https?://(|www\.)howfile.com/file/*/ // @include /^https?://(|www\.)uppit.com/*/ // @include /^https?://(|www\.)imzupload.com/*/ // @include /^https?://(|www\.)jumbofiles.com/*/ // @include /^https?://(|www\.)sendmyway.com/*/ // @include /^https?://(|www\.)tusfiles.net/*/ // @include /^https?://(|www\.)dropbox.com/s/*/ // @include /^https?://(|www\.)solidfiles.com/*/ // @include /^https?://(|www\.)yadi.sk/*/ // @include /^https?://(|www\.)datafilehost.com/d/*/ // @include /^https?://(|www\.)userscloud.com/*/ // @include /^https?://(|www\.)hulkload.com/*/ // @include /^https?://app.box.com/s/*/ // @include /^https?://(|www\.)dailyuploads.net/*/ // @include /^https?://(|www\.)kumpulbagi.id/*/ // @include /^https?://(|www\.)kbagi.com/*/ // @include /^https?://(|www\.)kb.simple-aja.info/*/ // @include /^https?://(|www\.)moesubs.com/url/*/ // @include /^https?://kirino.ga/lak/*/ // @include /^https?://(|www\.)seiba.ga/*/ // @include /^https?://(|www\.)mylinkgen.com/*/ // @include /^https?://(|www\.)openload.co/*/ // @include /^https?://(|www\.)rgho.st/*/ // @include /^https?://(|www\.)uploadrocket.net/*/ // @include /^https?://(|www\.)upload.so/*/ // @include /^https?://(|www\.)upload.ee/files/*/ // @include /^https?://cloud.mail.ru/public/*/ // @include /^https?://drive.google.com/file/d/*/ // @include /^https?://docs.google.com/uc\?*/ // @include /^https?://bc.vc/([\w]+)(\#\w+?)?$/ // @include /^https?://sh.st/([\w]+)(\#\w+?)?$/ // @include /^https?://adf.ly/*/ // @include /^https?://adfoc.us/*/ // @include /^https?://my.pcloud.com/publink/*/ // @include /^https?://gen.lib.rus.ec/*/ // @include /^https?://libgen.io/*/ // @include /^https?://golibgen.io/*/ // @include /^https?://bookzz.org/*/ // @include /^https?://(|\w+.)bookfi.net/*/ // @downloadURL none // ==/UserScript== (function() { var gvar=function(){}; gvar.__DEBUG__ = !1; function MaknyosHelper(baseURI){ this.baseURI=baseURI; this.domain=null; this.action=new Actions(); } MaknyosHelper.prototype = { matchDomain: function(){ var domain = this.baseURI.match(/^https?:\/\/([^\/]+)\//); if(domain) this.domain=domain[1]; return this; }, matchAction: function(){ if(this.domain) this.action.find(this.domain); return this; }, invokeAction: function(){ if(this.action.invoked){ if(!this.action.noBaseClean) this.action.baseCleanUp(); this.action.invoked(); } return this; }, }; function Actions(){ this.invoked=null; this.noBaseClean=null; } Actions.prototype = { find: function(domain){ this.clog('Actions:find, domain='+domain); var isMatch, pattern; for(var key in this.patterns){ pattern = this.patterns[key]; this.clog('pattern-check: '+pattern.rule+' vs '+domain); isMatch = typeof pattern.rule === 'string' ? pattern.rule == domain : pattern.rule.test(domain); if(isMatch){ this.invoked = pattern.run; this.noBaseClean = !isUndefined(pattern.noBaseClean) && pattern.noBaseClean; return; } } }, get_href: function(){ return location.href; }, set_href: function(x){ location.href = x; }, parse_handle_href: function(x){ var cucok, href; if( "string" == typeof x ) href = x; else if( "object" == typeof x ) href = x.getAttribute("href"); if( href && /\/handle\?/.test(href) ){ href = href.replace('&', '&'); if( cucok = /\&?fl=((?:f|ht)tps?[^\&]+)/i.exec(href) ) href = decodeURIComponent(cucok[1]); else this.clog("parsing fail on href, missing param `fl=`"); } return href; }, // do waitwhat -> thenwhat waitforit: function(waitwhat, thenwhat, delay){ var ME = this, stoWait, itry = 0, maxtry = 100, thenwhatwrap = function(r){ ('function' == typeof thenwhat ) && thenwhat(r); }; if( !delay ) delay = 0; if('function' == typeof waitwhat){ var waitwrap = function(){ itry++; var r_ = null; if( r_ = waitwhat() ){ stoWait && clearTimeout( stoWait ) thenwhatwrap( r_ ); } else{ if( itry < maxtry ) stoWait = setTimeout(waitwrap, delay+1000); else{ ME.clog('waitforit failed...'); } } }, stoWait = setTimeout(waitwrap, delay+1000); } else thenwhatwrap(); }, observer_init_: function(ev){ var ME = this, params = ME.param_observe ; ME.clog('inside observer_init_..'); ME.clog(ME.param_observe); if( ev.type == params.event ){ ME.clog('ahoy this match event...'+ev.type) } }, observe: function(element, params){ var ME = this, config = {} ; if( !(params && params.callback) ){ ME.clog('missing required params'); return !1; } // create an observer instance var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; var observer = new MutationObserver(function(mutations) { var BreakException = {}; try{ mutations.forEach(function(mutation) { // var $el = $(mutation.target); // if( is_observed ) throw BreakException; if( 'function' == typeof params.callback ) params.callback( mutation.target ); }); }catch(e){ if(e!==BreakException) throw e; } }); // configuration of the observer: config = $.extend({ attributes: true, childList: true, characterData: true }, params.config); ME.clog(config); // pass in the target node, as well as the observer options observer.observe(element, config); // later, you can stop observing // observer.disconnect(); gvar.observer = observer; }, injectBodyStyle: function(stylesString){ var style = document.createElement("style"); style.appendChild( document.createTextNode(stylesString) ); document.body.appendChild(style); }, injectBodyScript: function(scriptFunc){ var script = document.createElement("script"); script.textContent = "(" + scriptFunc.toString() + ")();"; document.body.appendChild(script); }, // load url to an iframe frameload: function(url){ var body, cb_fn, idfrm = 'xMNyFrame'; var iframe = document.createElement('iframe'); if( g('#'+idfrm) ) g('#'+idfrm).removeChild(); iframe.setAttribute('id', idfrm); iframe.setAttribute('title', "iFrame of "+idfrm+"; src="+url); iframe.setAttribute('style', 'position:absolute; z-index:999999; '+(gvar.__DEBUG__ ? 'border:1px solid #000; left:0; top:0; width:100%;' : 'border:0; height:0; width:0; left:-9999; bottom:9999')); iframe.setAttribute('src', url); body = g('body'); if( gvar.__DEBUG__ ) body.insertBefore(iframe, body.firstChild); else g('body').appendChild(iframe); if( gvar.__DEBUG__ ){ if( g('#'+idfrm) ) this.clog("iframe created, src="+url); else this.clog("error while creating iframe"); } }, // resize capcay rezCapcay: function(target, dims){ if(!target) return; if(dims.length){ var styleStr=''; dims[0] && (styleStr += 'width:'+dims[0]+'px;'); dims[1] && (styleStr += 'height:'+dims[1]+'px;'); target.setAttribute('style', styleStr); } }, disableWindowOpen: function(){ if(unsafeWindow){ unsafeWindow.open = function(){}; } if(window){ window.open = function(){}; } }, // get codes of simple capcay code scrap_simplecapcay: function(el_code){ var $code = $(el_code); var codes=[], thecodes = []; var $trycode = $code.closest("td").prev(); if( $trycode.length ){ $trycode.find(">div > span").each(function(){ var $me = $(this); var pl = $me.css("paddingLeft").replace('px',''); thecodes.push({ 'id': pl, 'val': $me.text() }) }); thecodes.sort(function(a,b) { return a.id - b.id; }); for(var i=0, iL=thecodes.length; i=0;i--) o[i].parentNode.removeChild(o[i]); this.clog("killframes done"); }, killevents: function(par, type, handle){ !type && (type = 'click'); !par && (par = document); !handle && (handle = function(){}); var o = par.getElementsByTagName('*'); for(var i=o.length-1;i>=0;i--){ if ( o[i].removeEventListener ) { o[i].removeAttribute("on"+type); //W3C Standard o[i].removeEventListener( type, handle, true ); } } this.clog("killevents done"); }, isVisible: function (ele) { // this.clog("visibility-test; clientWidth="+ele.clientWidth+'; clientHeight='+ele.clientHeight+'; opacity='+ele.style.opacity+'; visibility='+ele.style.visibility+'; offsetParent='+ele.offsetParent); return true && // ele.clientWidth !== 0 && // ele.clientHeight !== 0 && ele.offsetParent !== null && ele.style.opacity !== 0 && ele.style.visibility !== 'hidden'; }, hasClass: function(cName, ele){ if(!cName || !ele) return; var clss = (ele.getAttribute('class')||'').split(' '); return (clss.indexOf(cName) != -1); }, show_alert: function(msg, force) { if(arguments.callee.counter) { arguments.callee.counter++ }else { arguments.callee.counter = 1 } if("function" == typeof GM_log){ GM_log("(" + arguments.callee.counter + ") " + (typeof msg == "object" ? ">>" : msg)); if( typeof msg == "object" ) GM_log(msg); } else console && console.log && console.log(msg); if( force == 0 ) return }, clog: function(x){ if( !gvar.__DEBUG__ ) return this.show_alert(x); } }; Actions.prototype.patterns = { indowebster: { rule: /(files|maknyos)\.indowebster\.com/, run: function(){ var that = this, dlBtn = g('#downloadBtn'), delayTime = 0, btn_free, scripts, innerScript, cucok, cokcok, fnName, el, mainWrap, aabp ; // anti-(antiabp) :: injectBodyStyle-ish aabp = function(){ var style = document.createElement("style"), css = '' +'*[id*="idb"] ~ #bodyAndFooter{display: initial!important;}' +'*[id*="idb"]{display:none!important;}' ; style.textContent = css; document.body.insertBefore(style, document.body.firstChild); that.clog('injecting anti-(antiabp)..'); }; aabp(); if( dlBtn ){ scripts = document.getElementsByTagName( 'script' ); for( var i = 0; i < scripts.length; ++i ) { innerScript = scripts[i].innerHTML; innerScript = innerScript.trim(); if( innerScript ){ if( cucok = /(\$\.post\b.+)/m.exec(innerScript)) { if( cokcok = /var\s+s\s+=\s(\d+)/.exec(innerScript) ) delayTime = parseInt(cokcok[1]); innerScript = cucok[1]; // getting fn-name if( cucok = /function\([^\)]+.\s*\{\s*(\w+)/.exec(innerScript) ) fnName = cucok[1]; // required: [fnName, delayTime] var scriptHandler = function(){ return (function(win, $){ var gvar = gvar||{}; gvar.__DEBUG__ = !1; win["__dlhit__"] = null; win["___function___"] = function(ret){ console.log('AHOYY, .......') console.log(ret); var $tgt = $("#filename"); $tgt.prepend('
DOWNLOAD
'); $("#filename").wrap(""); $tgt.parent().css('display', 'block'); setTimeout(function(){ win["iframe_preloader"](ret) }, 100); $('#downloadBtn').remove(); win["__dlhit__"] = true; }; win["iframe_preloader"] = __iframe_preloader__; win["g"] = __function_g__; setTimeout(function(){ if( win["__dlhit__"] === null ){ console.log('requesting XHR die to __dlhit__='+win["__dlhit__"]); ___innerScript___; } }, (___delaytime___+1)*1000); })(window, jQuery); }; scriptHandler = scriptHandler.toString(); scriptHandler = scriptHandler.replace(/___function___/i, fnName); scriptHandler = scriptHandler.replace(/___innerScript___/i, innerScript); scriptHandler = scriptHandler.replace(/___delaytime___/i, delayTime); scriptHandler = scriptHandler.replace(/__iframe_preloader__/i, this.frameload.toString()); scriptHandler = scriptHandler.replace(/__function_g__/i, g.toString()); this.injectBodyScript(scriptHandler); // end-it break; } } } // end:for // remove css idb: #idb scripts = document.getElementsByTagName( 'style' ); for( var i = 0; i < scripts.length; ++i ){ innerScript = scripts[i].innerHTML; if( innerScript ){ if( cucok = /\#idb/.exec(innerScript)) { scripts[i].parentNode.removeChild(scripts[i]); break; } } } // end:for } else if( btn_free = g('.block.al_c a.downloadBtn') ){ btn_free.setAttribute('data-target', btn_free.getAttribute('href')); btn_free.setAttribute('href', 'javascript:;'); btn_free.setAttribute('_target', 'self'); btn_free.onclick = function(e){ var href = this.getAttribute('data-target');; this.setAttribute('href', href); location.href = href; return true; } SimulateMouse(btn_free, "click", true); } } }, sendspace: { rule: /sendspace\.com/, run: function(){ this.clog('inside sendspace'); g('#download_button') && SimulateMouse(g('#download_button'), "click", true); } }, zippyshare: { rule: /zippyshare\.com/, run: function(){ this.clog('inside zippyshare'); var btn = btn = g("[id=dlbutton]"); // failover, just incase if( !btn ) { btn = g("[alt*=Download]"); if( btn ) btn = btn.parentNode; else btn = g("[class=download]"); if( btn ) btn = btn.parentNode; } if( btn ) { this.waitforit(function(){ return /(?:\.zippyshare\.com)?\/d\/.+/.test( btn.getAttribute("href") ); }, function(){ btn && SimulateMouse(btn, "click", true); }); } else{ this.clog('missing: download button'); } } }, mediafire: { rule: /mediafire\.com/, noBaseClean: true, run: function(){ var that = this, dcg, selector, btn, nbtn ; if( dcg = g("#docControlGroup") ){ selector = './/a[contains(@target,"_blank")]'; selector = xp(selector, dcg, true); selector && that.set_href(selector.getAttribute('href')) } else if( dcg = g('#recaptcha_widget_div') ){ var recapcay = g('.g-recaptcha', dcg), site_key = recapcay.getAttribute('data-sitekey') ; if('function' === typeof $ && site_key){ $('.g-recaptcha', dcg) .replaceWith($('
')); // recaptcha-rebuilder var scriptHandler = function(_site_key){ return (function(win, $){ if("undefined" !== typeof grecaptcha){ grecaptcha.render("maknyos-recaptcha", { sitekey: "___SITEKEY___", callback: function(){ $(".dl_startlink > a").trigger("click") } }); } else{ console.log('grecaptcha undefined'); } })(window, $); }; scriptHandler = scriptHandler.toString(); scriptHandler = scriptHandler.replace(/___SITEKEY___/, site_key); that.injectBodyScript(scriptHandler); var cssString = '' +'#form_captcha .captchaPromo:before { content: "Click to download"; font-size: 1.2em; color: #ccc; position: absolute; top: 6px; left: -20px; margin-top: -30px;}' +'.nonpro_adslayout #form_captcha .captchaPromo, .freeAccount .pro #form_captcha .captchaPromo{ background-size: 275%; background-position-y: -110px; }' ; that.injectBodyStyle(cssString); } } else { that.waitforit(function(){ return g('.download_link a'); }, function(){ btn = g('.download_link a'); nbtn = document.createElement('a'); nbtn.setAttribute('href', btn.getAttribute('href')); nbtn.setAttribute('onclick', 'location.href=this.href; return !1'); nbtn.innerHTML = btn.innerHTML; btn.parentNode.replaceChild(nbtn, btn); SimulateMouse(nbtn, "click", true); }, 100); } } }, '2shared': { rule: /\b2shared\.com/, run: function(){ this.clog('inside 2shared;'); var gotit = false, dlBtn=null, btns, that; that = this; setTimeout(function(){ btns = xp('//*[contains(@id,"dlBtn") and not(contains(@style,"display:"))]', null); if( btns.snapshotLength ){ if( btns.snapshotLength == 1 ){ gotit = true; dlBtn = btns.snapshotItem(0); } else for(var i=0, iL=btns.snapshotLength; i maxTry ){ sTryStop && clearInterval( sTryStop ); if("function" == typeof cb_pagestop) cb_pagestop() } }, 10); } }, jumbofiles: { rule: /jumbofiles\.com/, run: function(){ this.clog('inside jumbofiles, method not found'); } }, sendmyway: { rule: /sendmyway\.com/, run: function(){ this.clog('inside sendmyway'); var dd, adcopy = g('#adcopy_response'), btnDownload = g('#download_link'), btnFreeDownload = g('.btn-free.dl_btn') ; if( !adcopy && !btnDownload ){ this.clog('adad adcopy'); btnFreeDownload && SimulateMouse(btnFreeDownload, "click", true); } else{ if( !btnDownload ){ adcopy.focus(); } else{ dd = g('#direct_download'); btnDownload = g('#download_link', dd); this.frameload(btnDownload.getAttribute('href')) } } } }, box: { rule: /app\.box\.com/, run: function(){ var btnDownload, that = this; this.waitforit(function(){ return xp('//button[contains(@data-type, "download-btn")]', null, true); }, function(){ btnDownload = xp('//button[contains(@data-type, "download-btn")]', null, true); btnDownload && SimulateMouse(btnDownload, "click", true); }, 100); } }, dropbox: { rule: /dropbox\.com/, run: function(){ var btnDownload; if( btnDownload = g('*[id*=download_button]') ) setTimeout(function(){ SimulateMouse(btnDownload, "click", true); }, 123); else this.clog('dropbox: missing download button, page may changed'); } }, solidfiles: { rule: /solidfiles\.com/, run: function(){ var that = this, $bc = g('.box-content:first-child'), btnDownload ; that.clog('inside solidfiles, '+that.get_href()); setTimeout(function(){ that.killframes(); that.disableWindowOpen(); }, 123); if( btnDownload = g('[type=submit]', g('form.ng-pristine')) ){ setTimeout(function(){ SimulateMouse(btnDownload, "click", true) }, 125); } else { if( $bc.textContent.indexOf('downloading') == -1 ) this.clog('solidfiles: missing download button, page may changed'); } } }, yadi: { rule: /yadi\.sk/, run: function(){ var that = this, btnSelector = '.button_download' ; that.clog('inside yadi, '+that.get_href()); this.waitforit(function(){ return g(btnSelector); }, function(){ var btnDownload = g('.button_download'); if( btnDownload ){ // models-client json var json = g('#models-client').innerHTML, pdata = {}; if( json ){ try{ json = JSON.parse(json) }catch(e){ json = null; } } if( json ){ var data, url; for(var i=0, iL=json.length; i