Neil wrote:
> 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
And there's also XPath iterators to get the text nodes...
function rot13tree(doc)
{
var iterator = new XPathEvaluator();
var path = iterator.evaluate("//text()", doc, null,
XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
while (var node = path.iterateNext()) {
var data = rot13(node.data);
if (data != node.data)
node.replaceData(0, data.length, data); // node.data = data
}
}