Some small changes

in
Subscribe to Some small changes 2 posts, 2 voices



HedayatVK User
FirefoxX11

Hi! I propose 2 changes to the script:
1. Add http://sourceforge.net/projects/* to the included links so that the main download link in the summary page is rewritten too.

2. Add a list of mirrors and select one of them randomly by defualt.

I've changed the script for myself as follows:

// ==UserScript==
// @name Direct links on Sourceforge download pages
// @namespace http://www.amdmi3.ru/with_hv_fixes
// @include http://sourceforge.net/projects/*/files/*
// @include http://sourceforge.net/projects/*
// @include http://www.sourceforge.net/projects/*/files/*
// @include https://sourceforge.net/projects/*/files/*
// @include https://www.sourceforge.net/projects/*/files/*
// ==/UserScript==

(function()
{
// Selecting a random mirror
var mirrors = new Array("biznetnetworks", "cdnetworks-kr-1",
"cdnetworks-kr-2", "cdnetworks-us-1", "cdnetworks-us-2", "dfn",
"fastbull", "freefr", "garr", "heanet", "hivelocity", "ignum",
"internap", "internode", "iweb", "jaist", "kent", "mesh", "nchc",
"ncu", "nfsi", "ovh", "puzzle", "softlayer", "sunet", "superb-east",
"superb-west", "surfnet", "switch", "transact", "ufpr", "voxel",
"waix");
var mirror = mirrors[Math.floor(Math.random() * mirrors.length)];

for(var i = 0; i < document.links.length; i++) {
var elem = document.links[i];

if (elem.href.match(/\/projects\/([^\/]+)\/files\/(.+)\/download/i)) {
elem.href="
}
}
})();

 
AMDmi3 Script's Author
FirefoxX11

Thanks for suggestions! I've merged the first change, but I think I'll stick with a single mirror - selecting mirrors randomly kinda defeats the purpose of this script and will also require keeping the mirror list up to date.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel