Tobias L�fgren wrote:

> I decided last night to dive into the wonderful world of XUL and 
> mozilla  programming and can now present a small XUL-application 
> (based on the patch by Gervase Markham) that adds rot13 to the 
> mail/news-reader in a nice and modular way. Take a look at:
>
> http://www.pinkroom.biz/owl/minirot13/
>
> It can both decode in the reader and encode a selection in the composer.

There might be a more efficient way to do ROT13, based on the fact that 
replace can take a function as its second parameter.

function rot13char(input) {
    return String.fromCharCode(input.charCodeAt(0) + 
(input.toLowerCase() <= 'm' ? 13 : -13));
}

function rot13(input) {
    return input.replace(/[A-Za-z]/g, rot13char);
}

Oh for a String.tr("A-Za-z", "N-ZA-Mn-za-m") :-)


Reply via email to