Reputation: 5410
We all work hard when it comes to javascript and unfortunately there is no way to just hide the js in the browsers, but nevertheless we don't want other people to immediately be able to copy what we have accomplished in hours of work. When I look at Facebook script tags, its just a spaghetti-load of single letter variables and functions that no one could decipher in a jiffy. Is there something like a program of script that just "anonymizes" / "deciphers" / "encodes" my js so noone can really immediately see whats going on?
Example (be it far from perfect and full of errors):
function convertTimeToString(time) {
var seconds = 0;
var minutes = 0;
if(time % 60 >= 10) {
seconds = time % 60;
else {
seconds = "0" + time % 60;
}
minutes = Math.floor(time/60);
return minutes + ":" + seconds;
}
becomes something like this
function s(t){var a=0;var b=0;if(t%60>=10){a=t%60;}else{a="0"+t%60;}b=Math.floor(t%60);return b+":"+a;}
I guess you see the difference, it would take a good js coder a bit more time to make sense out of what this script is actually doing. Any ideas how to do it automatically?
Upvotes: 0
Views: 77
Reputation: 1443
Try JSMin for a start:
JSMin does not obfuscate, but it does uglify.
Upvotes: 0