Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//USAGE: in your address bar, type: javascript: and paste compiled string like:
//javascript:!function(){function b(b)....
//compiled:
!function(){function b(b){for(var c=[],d=0;d<b.length;d++){var e=b.charAt(d).toLowerCase(),f=a[e];f||(f=e),c.push(f)}return c.join("")}var a={a:":atrain:",b:":btrain:",c:":ctrain:",d:":dtrain:",e:":etrain:",f:":ftrain:",g:":gtrain:",h:":html:",i:":ie:",j:":jtrain:",k:":kanyemad:",l:":ltrain:",m:":mtrain:",n:":ntrain:",o:":mysql:",p:":python:",q:":qtrain:",r:":rtrain:",s:":strain:",t:":ttrain:",u:":ubuntu:",v:":vim:",w:":wtrain:",x:":x-wing:",y:":y:",z:":ztrain:","?":":question:"},c=prompt("Type a message");alert(b(c))}();
//decompiled
(function(){
var ABC = {
"a": ":atrain:",
"b": ":btrain:",
"c": ":ctrain:",
"d": ":dtrain:",
"e": ":etrain:",
"f": ":ftrain:",
"g": ":gtrain:",
"h": ":html:",
"i": ":ie:",
"j": ":jtrain:",
"k": ":kanyemad:",
"l": ":ltrain:",
"m": ":mtrain:",
"n": ":ntrain:",
"o": ":mysql:",
"p": ":python:",
"q": ":qtrain:",
"r": ":rtrain:",
"s": ":strain:",
"t": ":ttrain:",
"u": ":ubuntu:",
"v": ":vim:",
"w": ":wtrain:",
"x": ":x-wing:",
"y": ":y:",
"z": ":ztrain:",
"?": ":question:"
};
function print(str){
var messages = [];
for (var i = 0; i < str.length; i++) {
var char = str.charAt(i).toLowerCase();
var replaced = ABC[char];
if(!replaced){
replaced = char;
}
messages.push(replaced);
}
return messages.join('');
}
var message = prompt('Type a message');
alert(print(message));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.