// ==UserScript== // @name Maknyos AutoIn // @namespace http://userscripts.org/scripts/show/91629 // @version 3.7.3 // @description Auto submit to get link // @homepageURL https://greasyfork.org/scripts/97 // @author Idx // @include /^https?://maknyos.indowebster.com/*/ // @include /^https?://(.+\.)2shared.com/file/*/ // @include /^https?://(.+\.)zippyshare.com/v/*/ // @include /^https?://(|www\.)fileswap.com/*/ // @include /^https?://(|www\.)mediafire.com/*/ // @include /^https?://(|www\.)sendspace.com/file/*/ // @include /^https?://(|www\.)uptobox.com/*/ // @include /^https?://(|www\.)howfile.com/file/*/ // @include /^https?://(|www\.)uppit.com/*/ // @include /^https?://(|\w+\.)idup.in/*/ // @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/d/*/ // @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.com/*/ // // @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){ this.action.baseCleanUp(); this.action.invoked(); } return this; }, }; function Actions(){ this.invoked=null; } Actions.prototype = { find: function(domain){ this.clog('Actions:find, domain='+domain); var isMatch; var 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; 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 stoWait, itry = 0, maxtry = 100, thenwhatwrap = function(){ ('function' == typeof thenwhat ) && thenwhat(); }; if( !delay ) delay = 0; if('function' == typeof waitwhat){ var waitwrap = function(){ itry++; if( waitwhat() ){ stoWait && clearTimeout( stoWait ) thenwhatwrap(); } else{ if( itry < maxtry ) waitwrap() } }, stoWait = setTimeout(waitwrap, delay+1000); } else thenwhatwrap(); }, // 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; 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( 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'; }, 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: /maknyos\.indowebster\.com/, run: function(){ this.clog('inside indowebster'); var that = this; var waitFor, code, count, counter, countdown = g('#countdown'); var btn_free, f1form = g('form[name="F1"]'); if( f1form ){ counter = g('[id*="ountdow"]'); if( !this.isVisible(counter) ){ SimulateMouse(g('#btn_download'), "click", true); } else{ if( count = g('*', counter) ){ setTimeout(function(){ if( code = g('[name="code"]', f1form) ){ that.scrap_simplecapcay( code ); code.focus(); } }, 123); if( waitFor = parseInt( $(count).text() ) ){ this.clog("waiting for "+waitFor+' seconds'); this.waitforit(function(){ return !that.isVisible( counter ); }, function(){ SimulateMouse(g('#btn_download'), "click", true); }, waitFor * 1000); } } } } else if( btn_free = g('[name="method_free"]') ){ this.clog("commencing btn_free "); 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/, run: function(){ var dcg, selector, that, is_match_path = /mediafire\.com\/(view|download)\b/; that = this; if( !is_match_path.test(that.get_href()) ) return; that.clog('inside mediafire, '+that.get_href()); setTimeout(function(){ that.killframes() }, 123); if( dcg = g("#docControlGroup") ){ selector = './/a[contains(@target,"_blank")]'; selector = xp(selector, dcg, true); selector && that.set_href(selector.getAttribute('href')) } else { that.waitforit(function(){ return g('.download_link a'); }, function(){ SimulateMouse(g('.download_link a'), "click", true); }, 100); } } }, fileswap: { rule: /\.fileswap\.com/, run: function(){ this.clog('inside fileswap'); var tgtBtn = g('[id*="share_index_"][href*="/download/"]'); if( !tgtBtn ) tgtBtn = g('[value="DOWNLOAD ALL"]'); tgtBtn && SimulateMouse(tgtBtn, "click", true); } }, '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 adcopy = g('#adcopy_response'); var btnDownload = g('#download_link'); if( !adcopy && !btnDownload ){ this.clog('adad adcopy'); g(".down-link") && SimulateMouse(g(".down-link"), "click", true); } else{ if( !btnDownload ){ adcopy.focus(); } else{ var dd = g('#direct_download'); btnDownload = g('#download_link', dd); this.frameload(btnDownload.getAttribute('href')) } } } }, box: { rule: /app\.box\.com/, run: function(){ var 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 href, that, btnDownload; that = this; that.clog('inside solidfiles, '+that.get_href()); setTimeout(function(){ that.killframes(); that.disableWindowOpen(); }, 123); // pick selector dat relevant and exist on several browsers if( btnDownload = g('.btns>a') ) setTimeout(function(){ if( href = that.parse_handle_href( btnDownload.getAttribute("href") ) ) btnDownload.setAttribute("href", href); SimulateMouse(btnDownload, "click", true) }, 125); else this.clog('solidfiles: missing download button, page may changed'); } }, yadi: { rule: /yadi\.sk/, run: function(){ var btnDownload, that = this; that.clog('inside yadi, '+that.get_href()); if( btnDownload = g('*[data-click-action="resource.download"]') ){ var triggered = !1; // proper content ready is required, since button used some ajax on it. document.addEventListener('DOMContentLoaded', function() { if( !triggered ) setTimeout(function(){ SimulateMouse(btnDownload, "click", true) }, 125); }, false); SimulateMouse(btnDownload, "click", true); triggered = 1; } else this.clog('yadi: missing download button, page may changed'); } }, datafilehost: { rule: /datafilehost\.com/, run: function(){ var that, btnDownload; that = this; that.clog('inside datafilehost, '+that.get_href()); setTimeout(function(){ that.killframes() }, 123); // pick selector dat relevant and exist on several browsers if( btnDownload = xp('//a[contains(@href,"/get.php?") or contains(@class,"ownloa")]', null, true) ) setTimeout(function(){ if( href = that.parse_handle_href( btnDownload.getAttribute("href") ) ) btnDownload.setAttribute("href", href); SimulateMouse(btnDownload, "click", true) }, 125); else this.clog('datafilehost: missing download button, page may changed'); } }, userscloud: { rule: /userscloud\.com/, run: function(){ var that=this, FORM; that.clog('inside userscloud, '+that.get_href()); setTimeout(function(){ that.killframes() }, 123); this.waitforit(function(){ return xp('//button[contains(@id, "ownlo") and not(contains(@disabled,"disabled"))]', null, true); }, function(){ if( FORM = xp('//form[@name="F1"]', null, true) ) setTimeout(function(){ FORM.submit() }, 345); }, 100); } }, hulkload: { rule: /hulkload\.com/, run: function(){ var that = this, FORM, el, adcopy; that.clog('inside hulkload, '+that.get_href()); setTimeout(function(){ that.killframes(); var el_, els = xp('//*[contains(@id,"onsor")]', null); that.clog("els="+els.snapshotLength); if( els.snapshotLength ){ for(var i=0, iL=els.snapshotLength; i