Metapost: Reading ROT13

This is a reminder to everyone that there is a ROT13 button at the top of the blog. But when that's too cumbersome to use for reading through lots and lots of comments, I have found a shortcut that works well with my current browser (so it might work for you too!).

1. Enable the Bookmark Toolbar in Firefox. 


2. Rick-click the bookmark bar and add a New Bookmark. 


3. Paste the following code into the New Bookmark and name the bookmark "ROT13".


javascript:var%20coding%20=%20%22abcdefghijklmnopqrstuvwxyzabcdefghijklmABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM%22;%20function%20rot13(t)%20{%20for%20(var%20r%20=%20%22%22,i=0;i<t.length;i++)%20{%20character%20=%20t.charAt(i);%20position%20=%20coding.indexOf(character);%20if%20(position%20>%20-1)%20character%20=%20coding.charAt(position%20+%2013);%20r%20+=%20character;%20}%20return%20r;%20}%20S=window.getSelection();%20function%20t(N)%20{%20return%20N.nodeType%20==%20N.TEXT_NODE;%20}%20function%20r(N)%20{%20if%20(t(N))%20N.data%20=%20rot13(N.data);%20}%20for%20(j=0;j<S.rangeCount;++j)%20{%20var%20g=S.getRangeAt(j),%20e=g.startContainer,%20f=g.endContainer,%20E=g.startOffset,%20F=g.endOffset,%20m=(e==f);%20if(!m||!t(e))%20{%20/*%20rot13%20each%20text%20node%20between%20e%20and%20f,%20not%20including%20e%20and%20f.%20*/%20q=document.createTreeWalker(g.commonAncestorContainer,%20NodeFilter.SHOW_ELEMENT%20|%20NodeFilter.SHOW_TEXT,%20null,%20false);%20q.currentNode=e;%20for(N=q.nextNode();%20N%20&&%20N%20!=%20f;%20N%20=%20q.nextNode())%20r(N);%20}%20if%20(t(f))%20f.splitText(F);%20if%20(!m)%20r(f);%20if%20(t(e))%20{%20r(k=e.splitText(E));%20if(m)f=k;%20e=k;}%20if%20(t(f))%20g.setEnd(f,f.data.length);%20}%20void%200

NOTE: This does work to read Disqus comments in my browser, but does not work to transform a comment that is still in the Disqus "compose" box. You will still need to compose comments in a ROT13 window, unless someone has a cleaner solution.

Credit here to Jacotus.

16 comments:

Ana Mardoll said...

Addendum: Actually, I have now found that the Firefox LEET Key addon will let you transform text that exists in the Disqus comment field.

https://addons.mozilla.org/en-US/firefox/addon/leet-key/

It's just a bit fiddly to use because you have to right-click the 1337 button at the bottom-right corner of the browser and select "Text Transformers --> ROT13" from a menu that is transparent, presumably because of my Windows 7 theme.

Brin Bellway said...

1337 button? On mine, when I highlight text and right-click the LeetKey menu is the first option. Then I hover over the "Text Transformers" sub-menu and press the "r" shortcut.

(I still used the website when composing my comment because I wasn't sure if it would take.)

Ana Mardoll said...

Oh, hey, cool! It does that too.

I *did* read the "manual" for the plug-in, but I guess there's a reason why programmers stereotypically need people like me to write things down, because I did not see anything on how to actually USE LeetKey, just a list of version changes. ;)

QXZ said...

You can also set a hotkey in leetkey to toggle the selected text. Right-click the 1337 button, choose LeetKey Settings, and in the second box there will be "Function Name"/"Key Shortcut Combination"; choose ROT13 for Function Name (it's way down the list) and then click in the Key Shortcut Combination box and press your chosen hotkey, and then click Apply down at the bottom.

I use Shift+F2. I don't remember why I picked that, but I've never had it conflict with anything.

Anonymous said...

An іmpressive shаre! I hаve juѕt forwarded this onto a coworker who hаs been ԁoing a little resеarch on this.
And he in fact oгdereԁ me ԁinner because I
found it fоr him... lol. So let me reword thіs.
... Thank YOU for the meal!! But yeah, thanx foг
spendіng time to dіsсuss this matter herе on your web site.


Here is mу blog poѕt: diet plans

Anonymous said...

Gοod info. Lucky me I сamе aсrosѕ youг site by
aсcident (stumbleupon). I have booκ maгκed
it fοr lаter!

Mу websitе: New Bingo Sites

Anonymous said...

It's very straightforward to find out any matter on web as compared to textbooks, as I found this paragraph at this web site.

Look at my page; chlamydia test

Anonymous said...

Ӏ hаvе гead so many сontent on thе tορic of the
blοgger lovers hοwеveг
thіs parаgrаph is in fact а pleasant pіece of writing, κeep it up.


Αlso visit my web-sіtе - lose weight

Anonymous said...

Hmm it appears likе уour ωebѕіtе ate mу fiгѕt commеnt (it waѕ super long) so I gueѕs I'll just sum it up what I had written and say, I'm thoroughlу еnjoying уour blog.
I aѕ well am an аѕpiring blog writeг
but I'm still new to the whole thing. Do you have any recommendations for novice blog writers? I'd certainlу aρpreсіate it.



Here is my sіtе: chlamydia test

Anonymous said...

Attraсtiνe elеment of content. I simрly ѕtumbleԁ uρon youг
web ѕіte and in accession capital to claim that I acquiгe in fact loveԁ аccount your wеblog pοѕts.

Any ωаy I will bе subscгibіng for yоur augment and even I aсhievеment
yοu get entry to conѕtantly rаpiԁly.


my wеb page - fast payday loans
my website :: fast payday loans

Anonymous said...

Greаt ԁelivеry. Sound argumentѕ.
Keep up thе good spirit.

Look аt my ρage: payday

Anonymous said...

Greеtings! Very uѕеful advice in thiѕ
particular pοst! It's the little changes that produce the biggest changes. Many thanks for sharing!

Here is my blog ... short term loans

Anonymous said...

Ӏ am ѕuгe this piece of wrіtіng
has touсhed all thе intеrnеt vieωers, itѕ гeаlly rеally fastidіous aгtісlе оn building up new wеblog.


Аlѕo visit mу web sitе - instant cash loans

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.

Post a Comment