Sourceforge Direct Links
By jk-
—
Last update Apr 1, 2007
—
Installed
1,432 times.
// ==UserScript==
// @name Sourceforge Direct Links
// @namespace http://www.digivill.net/~joykillr
// @description Direct download links on sourceforge.net. Works with SF's latest changes. Mirrors selectable by continent.
// @include http://*.sourceforge.net/project/showfiles.php*
// @include http://sourceforge.net/project/showfiles.php*
// ==/UserScript==
// v 2.7 fixed to work with js.
// Mirrors are seperated by continent, for speed purposes you can select which continents to include/exclude:
function defineMirrors() {
var MIRRORS = [
/*...North America: */ "easynews", "umn", "internap", "superb-east",
/*...South America: */ "ufpr",
/*...Europe: */ "belnet", "kent", "switch", "puzzle", "mesh", "ovh", "heanet", "surfnet",
/*...Australia: */ "optusnet",
/*...Asia: */ "nchc", "jaist",
];
return MIRRORS;
}
function randomServer(mirrors){
var mirrors = new Array();
mirrors = defineMirrors();
return mirrors[Math.floor(Math.random() * mirrors.length)];
}
var q, sfvar;
var nodes = document.evaluate("//a[contains(@href, 'http:\/\/downloads.sourceforge.net\/')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
if (nodes) {
mirrorID = randomServer();
for (q=0;q<nodes.snapshotLength;q++) {
sfvar = nodes.snapshotItem(q).href.split("downloads.sourceforge.net\/")[1].split("\?")[0];
nodes.snapshotItem(q).removeAttribute("onclick");
nodes.snapshotItem(q).href = "http:\/\/" + mirrorID + ".dl.sourceforge.net\/sourceforge\/" + sfvar;
}
}