Trac Changeset Links from Chatzilla

Update: Chatzilla 0.9.78 breaks this script. Looks like I'll have to add some priority levels to the munger rules when I get some spare time.

Update: New version 0.2, here, allows per-channel Trac sites.

Following this tutorial, I just wrote a Chatzilla script that makes links to Trac changesets from IRC text matching /r\d{1,6}/. You enter:


and you see:

<a href="http://.../changeset/42">r42</a>

It's a bit rough (no per-channel control) but useful enough.

Under your "Auto-load scripts" directory, create a sub-directory named "trac-rev". Save the following script as trac-rev/init.js and modify the changeset URL accordingly:

CHANGESET_URL = "http://YOUR_PROJECT/changeset/%s";

function initPlugin(glob)
{ = "trac-rev";
  plugin.major = 0;
  plugin.minor = 1;
  plugin.version = plugin.major + "." + plugin.minor;
  plugin.description = "link to trac revisions";
    "trac-rev-link", /(?:\s|\W|^)(r\d{1,6})/i, mungerTracRev, 1
  display( + " v" + plugin.version + " enabled.");

function mungerTracRev(matchText, containerTag)
  var number = matchText.match(/(\d+)/i)[1];
  var anchor = document.createElementNS("",
  anchor.setAttribute("href", CHANGESET_URL.replace("%s", number));
  anchor.setAttribute("class", "chatzilla-link");