Created
December 17, 2010 21:35
-
-
Save funkatron/745745 to your computer and use it in GitHub Desktop.
an almost pointless rot13 filter for Spaz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spaz.TimelineFilters.friends.addFilter('rot13', function(d) { | |
function str_rot13 (str) { | |
// http://kevin.vanzonneveld.net | |
// + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) | |
// + improved by: Ates Goral (http://magnetiq.com) | |
// + bugfixed by: Onno Marsman | |
// + improved by: Rafał Kukawski (http://blog.kukawski.pl) | |
// * example 1: str_rot13('Kevin van Zonneveld'); | |
// * returns 1: 'Xriva ina Mbaariryq' | |
// * example 2: str_rot13('Xriva ina Mbaariryq'); | |
// * returns 2: 'Kevin van Zonneveld' | |
// * example 3: str_rot13(33); | |
// * returns 3: '33' | |
return (str+'').replace(/[a-z]/gi, function(s){ | |
return String.fromCharCode(s.charCodeAt(0)+(s.toLowerCase()<'n'?13:-13)); | |
}); | |
} | |
d.text = str_rot13(d.text); | |
return d; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment