By laughingLoki
—
Last update
Aug 21, 2007
—
Installed
1,100 times.
// ==UserScript==
// @name Up-file download timer remover
// @namespace http://up-file.com/
// @description (v1.10) Removes the download timer on up-file.com and gives you a clean page with download links
// @include http://*.up-file.com/download*
// @include http://up-file.com/download*
// @include http://*.friendlyfiles.net/*
// @include http://friendlyfiles.net/*
// ==/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:
*******************************************************************************/
// get all forms
ele = document.getElementsByTagName("form");
// iterate through all the forms
for (i = 0; i < ele.length; i++)
{
// current form and action
cForm=ele[i];
cAction=cForm.action;
// we want the form with the download link (it has "download" in the URL)
if(cAction.search("download")>=0)
{
// iterate through all of the download form's elements
for(j=0; j<cForm.elements.length; j++)
{
// current element
cElement=cForm.elements[j];
// the free form submit button is named "zu", apparently
if(cElement.name=="zu")
cForm.submit(); // we want the download link NOW
} // for j
} // if
} // for i
time=10;
// get rid of nasty timers after submitting the form
action=window.setInterval("y=0; document.getElementById('con').innerHTML=y; Glide();", time);
// get the name of the download
file=window.location.href;
file=file.substring(file.lastIndexOf("/")+1, file.length-5);
// look for links and write them to a clean page
linkDiv="<div>\n";
linkDiv+="Here are your links, good sir:<br />";
linkDivList="";
anchor=document.getElementsByTagName("a");
for(i=0; i<anchor.length; i++)
{
if(anchor[i].href.search(file)>=0 && anchor[i].href.search("report")<0)
{
cLink=anchor[i].href;
linkDivList+="<a href='"+cLink+"'>"+cLink+"</a><br />\n";
}
} // for i
linkDiv+=linkDivList;
if(linkDivList=="")
linkDiv+="<br /><br />It looks like there's no links here. I'll bet some cheeky nutter reported the files. Please disable Greasemonkey and reload the page just to be sure the file is indeed gone.<br /><br />Beware of the smutty ads on the download page, though. >___<";
linkDiv+="</div>\n";
// overwrite the HTML with just the links
replace_head("");
replace_body(linkDiv);
if(window.location.href.search("friendlyfiles")>=0)
{
replace_head("");
replace_body("<p>You have been redirected to Friendlyfiles.</p> <p>Friendlyfiles forces you to download an executable to download from their servers. That executable is malware.</p><p>Disable greasemonkey if you would like to continue to Friendlyfiles. You've been warned.</p>");
}