Add Blame Links to MXR
You think you’ve put it all behind you, but one tiny script and you tumble off the wagon. Such is the fate of the Greasemonkey addict. Someone mentioned yesterday that MXR search results should include a link to CVS Blame. (Regular readers of this blog are used to ignoring me when they don’t know what I’m talking about, right?) Rumor has it that real support for this is in the works, but I went ahead and wrote a script, just because I could. After all, the hallmarks of a good Greasemonkey script are quick-and-dirty hacks and planned obsolescence, and this one emphatically has both:
// ==UserScript==
// @name Add MXR blame links
// @namespace http://justdiscourse.com
// @description Add links to CVS Blame to MXR search results
// @include http://mxr.mozilla.org/*search?string*
// ==/UserScript==
var results = document.getElementsByTagName("ul");
for (var i = 0; i < results.length; i++) {
var ul = results[i];
var anchor = ul.previousSibling.previousSibling;
var span = document.createElement("span");
var blame = document.createElement("a");
blame.href = "http://bonsai.mozilla.org/cvsblame.cgi?&file=/mozilla"
+ anchor.href.substring(anchor.href.indexOf("/source")+7);
blame.appendChild(document.createTextNode("blame annotations"));
span.appendChild(document.createTextNode(" (View "));
span.appendChild(blame);
span.appendChild(document.createTextNode(")"));
ul.parentNode.insertBefore(span, ul);
}
Click here to install (Greasemonkey required).
It’s incredibly empowering to have this kind of client-side control over your browsing experience. One of these days someone is going to do this right and it’ll take over the world.
1 Comment »
Trackback URL RSS feed for comments on this post.
Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>







Download 7 penis enlargement videos. User ratings & reviews of 55 penis enlargement pills.
Comment by peter hill — 9/30/2008 @ 4:03 am