mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
Add gitweb smartprefix
Examples are 'gitweb shortlog elinks-0.11rc0' and 'gitweb search NEWS'.
This commit is contained in:
parent
748bab64a7
commit
b2848dd1cb
@ -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,
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user