I was bored, so I came up with a little javascript which sits on your web page and lets you make links like this:

<a href="e2:monkeys">monkeys</a>

Convenient, eh? You can see it in action at http://sado.pitas.com/. (I wanted to make it convert [node_title] to links, but JS doesn't seem to do that without inordinate effort.)

This is pretty simple to use. Simply place the provided source at the very very bottom of your page, right by the </body> tag. If you don't like that slightly non-standard approach (or if it doesn't work for you!), just remove the call to e2izer(); at the bottom, move the script tag to the <HEAD> tag, and put onLoad="e2izer();" in your <BODY> tag.

This is of course a nasty hack, so I'd place a <NOSCRIPT> tag very prominently at the front of your page if you use this. I did. And, of course, it requires that the page finish loading before it does anything much. You could fix this by putting it on a timer and recalling e2izer every so often till the page _is_ loaded, but that's just stacking the kludginess.

I hope that answers all your questions - if you've got more, of course, /msg s_alanet.

CHANGELOG

  • According to DyRE, e2izer doesn't work on either Mozilla 0.9.6 or Opera 6. I have updated the code slightly to conform to the W3C Level 2 DOM specifications (ie, removing dependence on the protocol property). This should fix the problem. Should. UPDATE: DyRE has confirmed that this problem has been resolved. Thanks, DyRE!

The Source

<script language="javascript">
// <!-- Copyright s_alanet 2001 All Rights Reserved
// This may be freely distributed and modified!
// A simple script to rewrite links of the form e2:<node name>
// into nice links to E2!

function e2ize(node) {
	window.status = "Redirecting to '" + unescape(node) + "' on E2...";
	location = "http://www.everything2.com/?node=" + node;
}

function e2izer() {
   for (var i = 0; i < document.links.length; i++) {
      if(document.links[i].href.substr(0,3) == "e2:") {
		window.status = "E2-ing link " + (i+1) + " of " + document.links.length + "...";
		theUrl = document.links[i].href.substr(3);
		document.links[i].href = "javascript:void(0); e2ize('" + escape(theUrl) + "');";
		document.links[i].text = theUrl;
		document.links[i].onMouseOver = "window.status='" + theUrl + " on e2.';";
      }
   }
   document.title += " (e2ized) ";
   window.status = "E2izer v1.01 written by s_alanet.";
}

e2izer(); //-->
</script>

Log in or registerto write something here or to contact authors.