3

Engrish Javascript

Posted in JavaScript at October 20th, 2006 /

In what I can think of as the most important JavaScript that I have ever written, I have made something which will parse the DOM and replace all of the ‘l’s with ‘r’s. This idea came about after watching Team America: World Police about 1,000 times and after Kim Jong Il gave his apology for doing some nuke testing. Back to the script:

function engrish(n) {
	if(n.nodeType == document.TEXT_NODE) {
		n.nodeValue = n.nodeValue.replace(/l/g, 'r').replace(/L/g, 'R');
	} else if(n.hasChildNodes()) {
		for(var i=0; i<n.childNodes.length; i++) {
			engrish(n.childNodes[i]);
		}
	}
}

To execute this code, simply call engrish(document.documentElement);. Using recursion, this function goes through the DOM, finds text nodes and replaces the characters.

This is fine an dandy if you put this on your site so you can quickly convert your copy to engrish; however there is something that you can do to turn any page into it’s engrish form. You can save this code as a bookmark.

If you would like an example of what the bookmark URL would be, just <a href=”javascript:function engrish(n) {if(n.nodeType == document.TEXT_NODE) {n.nodeValue = n.nodeValue.replace(/l/g, ‘r’).replace(/L/g, ‘R’);} else if(n.hasChildNodes()) {for(var i=0; iengrish-ify this page and save the link as a bookmark (you can drag that link into your bookmark toolbar in Firefox)

3 Responses to “Engrish Javascript”

  1. October 22nd, 2006 at 5:55 pm #frambooz

    Nice! Now where’s my zombification script?!

  2. October 23rd, 2006 at 6:20 am #Adam

    It’s coming. I just need some boredom time.

  3. October 23rd, 2006 at 6:27 am #JTMS

    why you bustin my balrz Hawnz BRitkz!

Leave a Reply