// ==UserScript==
// @name           ViewVC Line Number Linkifier
// @namespace      http://arantius.com/misc/greasemonkey/
// @description    When viewing a file in ViewVC, linkify the line numbers for easy reference.
// @require        http://arantius.com/misc/greasemonkey/imports/dollarx.js
// @include        *viewvc*view=markup*
// ==/UserScript==

GM_addStyle(
	'span.line a { color: inherit; text-decoration: none; }'
);

var lines=$x('//pre/span[@class="line"]');
var a;
for (var i=0, line=null; line=lines[i]; i++) {
	a=document.createElement('a');
	a.appendChild(line.firstChild);
	a.href='#'+line.previousSibling.id;

	line.appendChild(a);
}
