FileFront Direct Download

By JoeSimmons Last update Dec 13, 2008 — Installed 335 times. Daily Installs: 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 2, 1, 0, 0, 1, 0, 1, 1, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0

There are 1 previous version of this script.

// ==UserScript==
// @name           FileFront Direct Download
// @namespace      http://userscripts.org/users/23652
// @description    Changes the disk icon's link to a direct link
// @include        http://*.filefront.com/files/*
// @include        http://*.filefront.com/file/*
// @copyright      JoeSimmons
// ==/UserScript==

var l, ifr, newhref,
lhr=location.href,
dl_icons = document.evaluate("//a[contains(@href, '#Download')]", document, null, 6, null),
dl_link = document.evaluate("//a[contains(@href, '/file/gofetch/')]", document, null, 9, null).singleNodeValue;

function open(e) {
window.open(e, 'DirectDownload');
}

function close() {
window.close();
}

if(lhr.indexOf('.filefront.com/files/')!=-1) {
for(var i=dl_icons.snapshotLength-1; i>=0; i--) {
l = dl_icons.snapshotItem(i);
newhref = l.href.replace(/\#Download$/, '#DirectDownload');
l.setAttribute('onClick', 'window.open(\''+newhref+'\', \'DDL\');return false;');
}
}

else if(lhr.indexOf('#DirectDownload')!=-1) {
window.addEventListener('load', function(){setTimeout(close,1000);}, false);
ifr = document.createElement('iframe');
ifr.setAttribute('style', 'display:none;');
ifr.src = dl_link.href;
document.body.appendChild(ifr);
}