Archive for the ‘favelets’ Category

eboran – esrevni

Saturday, June 7th, 2008

Today I wrote a quick funny script that inverses the text in all the text nodes on a page. I think it’s funny enough to release it:

function fcc_text_reverse(e){
	var j=(e.childNodes)?e.childNodes.length:0;
	for(var i=0;i<j;i++){
		var n=e.childNodes[i];
		if(n.nodeType==1){fcc_text_reverse(n);}
		else if(n.nodeType==3){
			n.nodeValue=n.nodeValue.split('').reverse().join('');
		}
	}
};
fcc_text_reverse(document.getElementsByTagName('body')[0]);

You can also use the favelet / bookmarklet — just drag Reverse text to bookmarks.

Zemanta Pixie