Add Blame Links to MXR

Tuesday February 19th 2008, 12:13 pm Printer Friendly Version
Filed under:Software Development, Firefox
Posted By: Matt

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.


3 Comments »

  1. Download 7 penis enlargement videos. User ratings & reviews of 55 penis enlargement pills.

    Comment by peter hill — 9/30/2008 @ 4:03 am

  2. Это не рядовой сайт, он хранит более 400 рецептов всяческих салатов, бутербродов и закусок, так именуемый “холодный стол”, приготовление какого-либо не займет у вас кучи времени.

    Comment by Никита — 11/1/2008 @ 9:57 pm

  3. Бронирование отелей, пансионатов, санаториев, гостиниц. Курорты Геленджик, Анапа, Сочи, Туапсе. Отдых на Чёрном море. Путёвки в любую гостиницу курортов Краснодарского края. Трансфер

    Comment by Marya_Umal — 11/13/2008 @ 8:48 am

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>

(required)

(required)