FileFactory download slot getter

By laughingLoki Last update Jun 4, 2009 — Installed 11,234 times. Daily Installs: 30, 31, 25, 24, 28, 36, 19, 21, 29, 28, 22, 40, 20, 30, 35, 29, 24, 28, 31, 29, 25, 56, 40, 46, 22, 28, 22, 19, 17, 44, 29, 21

There are 2 previous versions of this script.

// ==UserScript==
// @name          FileFactory download slot getter
// @namespace     http://filefactory.com
// @description   (v1.10) Attempts to get a download slot on FileFactory until it gets one
// @include       http://*.filefactory.com/file/*
// @include       http://filefactory.com/file/*
// @include       http://*.filefactory.com/dlf/*
// @include       http://filefactory.com/dlf/*
// ==/UserScript==

// jQuery code provided from http://joanpiedra.com/jquery/greasemonkey/

// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);

var GM_autoDown = GM_getValue("autodown");

if( GM_autoDown == undefined ) {
    
    GM_autoDown = confirm("Is it OK to start downloads automatically without having to click?  (You will only be asked this question once per installation.)");
    
    GM_setValue("autodown", GM_autoDown);
}

// Check if jQuery's loaded
function GM_wait() {
    if(typeof unsafeWindow.jQuery == 'undefined' || GM_autoDown == undefined) {
        window.setTimeout(GM_wait,100);
    } else {
        $ = unsafeWindow.jQuery;
        main();
    }
}

GM_wait();

function main() {
    $("#freeBtn").click();
    
    // clear 1000 intervals
    for(var i = 0; i < 1000; i++) {
        clearInterval(i);
    }
    
    $("#linkContainer p").hide();
    $("#linkContainer").html($("#downloadLink").html());
    
    var sec = 30;
    
    var click = function(){
        $("#linkContainer a").html("Download ready in " + sec + " seconds.  Right click to queue in download manager.");
        $("title").html("Download ready in " + sec + " seconds.");
        sec--;
        
        if(sec == 0) {
            $("title").html("Download ready");
            clearInterval(interval);
            $("#linkContainer a").html("Download ready.  Click to download.");
            
            if( GM_autoDown ) {
                $("#linkContainer a").click();
            }
        }
    }
    
    click();
    var interval = setInterval(click, 1000);
    
    
    
    
}