Source for "Files-upload download timer remover"

By laughingLoki
Has 6 other scripts.


// ==UserScript==
// @name          Files-upload download timer remover
// @namespace     http://files-upload.com
// @description   (v1.00) Removes the download timer on files-upload.com and gives you a clean page with download links
// @include       http://*.files-upload.com/files/*
// @include       http://files-upload.com/files/*
// ==/UserScript==

/*******************************************************************************
functions to edit the page:
*******************************************************************************/

function hide(id)
{
    if(document.getElementById(id))
        document.getElementById(id).style.display="none";
}

function show(id)
{
    if(document.getElementById(id))
        document.getElementById(id).style.display="";
}


function replace(id, val)
{
    if(document.getElementById(id))
        document.getElementById(id).innerHTML=val;
}

function append(id, val)
{
    if(document.getElementById(id))
        document.getElementById(id).innerHTML+=val;
}

function prepend(id, val)
{
    if(document.getElementById(id))
    {
        element=document.getElementById(id);
        element.innerHTML=val+element.innerHTML;
    }
}

function hard_refresh()
{
    window.location.href=window.location.href;
}

function replace_body(content)
{
    document.getElementsByTagName("body")[0].innerHTML=content;
}

function append_body(content)
{
    document.getElementsByTagName("body")[0].innerHTML+=content;
}

function prepend_body(content)
{
    body=document.getElementsByTagName("body")[0];
    body.innerHTML=content+body.innerHTML;
}


function replace_head(content)
{
    document.getElementsByTagName("head")[0].innerHTML=content;
}

function append_head(content)
{
    document.getElementsByTagName("head")[0].innerHTML+=content;
}

function prepend_head(content)
{
    head=document.getElementsByTagName("head")[0];
    head.innerHTML=content+head.innerHTML;
}

function search_page(tag, content)
{
    element=document.getElementsByTagName(tag);
    for(i=0; i<element.length; i++)
    {
        contents=element[i].innerHTML;
        if(contents.search(content)>=0)
            return true;
    }
    
    return false;
}


function getElementsByClassName(class)
{
    arr=new Array();
    i=0;

    element=document.getElementsByTagName("*");
    for(i=0; i<element.length; i++)
    {
        if(element.class==class)
        {  
            arr[i]=element;
            i++;
        }
    }
    
    return arr;
}


/*******************************************************************************
script follows:
*******************************************************************************/


function go()
{
    link="";
    ele=document.getElementsByTagName("a");
    for(i=0; i<ele.length; i++)
    {
        current=ele[i];
        if(current.innerHTML=="Download link")
            link=current.href;
    }
    
    replace_head("");
    if(link=="")
        replace_body("It looks like some cheeky nutter reported the file.  Please disable greasemonkey to see if the file is indeed removed.");
    else
        replace_body("<p>Here is your link, good sir:</p><p><a href=\""+link+"\">"+link+"</a></p>");
}

replace("counter", 1);
window.setTimeout(go, 1500);