asi nechápu jak to správně použít... na webu to nerozebírají...
zkusil jsem:
<html>
<head>
<script>
// ==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;
}
}
</script>
</head>
<body>
<a href="http://downloads.sourceforge.net/filezilla/FileZilla_3.2.2.1_win32-setup.exe">FZ</a>
<!-- http://mesh.dl.sourceforge.net/sourceforge/filezilla/FileZilla_3.2.2.1_win32-setup.exe -->
</body>
</html>