1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-25 01:05:37 +00:00

Add gitweb smartprefix

Examples are 'gitweb shortlog elinks-0.11rc0' and 'gitweb search NEWS'.
This commit is contained in:
Jonas Fonseca 2005-12-30 01:32:31 +01:00 committed by Jonas Fonseca
parent 748bab64a7
commit b2848dd1cb
2 changed files with 23 additions and 0 deletions

View File

@ -15,6 +15,7 @@ var smartprefixes = {
// If you want to add a smartprefix for another project's CVSweb,
// just create a lambda like this. Aren't high-level languages fun?
cvs: function (x) { return cvsweb ("http://cvsweb.elinks.cz/cvsweb.cgi/", "elinks", x) },
gitweb: function (x) { return gitweb("http://pasky.or.cz/gitweb.cgi", "elinks.git", x) },
d: "http://www.dict.org/bin/Dict?Query=%s&Form=Dict1&Strategy=*&Database=*&submit=Submit+query",
debcontents: debian_contents,
debfile: debian_file,

View File

@ -55,6 +55,28 @@ function cvsweb (base, project, url)
return base + project + "/" + file
}
/* javascript:gitweb("http://pasky.or.cz/gitweb.cgi", "elinks.git", "%s"); */
function gitweb(base, project, url)
{
var parts = url.match(/^(search|summary|shortlog|log|commit|commitdiff|tree)(\s(.*))?/);
var query = '?p=' + project;
if (parts) {
query += ';a=' + parts[1];
/* If the extra arg is not for searching assume it is an ID. */
if (parts[1] == 'search' && parts[3])
query += ';s=' + escape(parts[3]);
else if (parts[3])
query += ';h=' + escape(parts[3]);
} else {
query += ';a=summary';
}
return base + query;
}
/* javascript:gmane("%s") */
function gmane (url)
{