This file contains hidden or 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
| function smilies(e){var r,n,t,R='\x72\x65\x70\x6c\x61\x63\x65',a=""; | |
| for(r=0;r<e.length;r++)n=e.\u0063\u0068\u0061\u0072\u0043\u006f\u0064\u0065\u0041\u0074(r).\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067(4),t=n[R](/0/g,":(")[R](/1/g,":)")[R](/2/g,":P")[R](/3/g,":D"),a+=t+" "; | |
| var p1="\x76\x61\x72\x20\x7a\x3d\x27\\\n\\\n",p3="\\\n\\\n',u=\\u0052\\u0065\\u0067\\u0045\\u0078\\u0070,\\u0072,\\u006e,\\u0074,\\u0061='',\\u006f=\\u007a['\\x73\\x70\\x6c\\x69\\x74'](' ');for(\\u0072=0;\\u0072<\\u006f['\\x6c\\x65\\x6e\\x67\\x74\\x68'];\\u0072++)\\u006e=\\u006f[\\u0072],\\u0074=\\u006e[x='\\x72\\x65\\x70\\x6c\\x61\\x63\\x65'](u(':\\\\(','g'),'0')[x](u(':\\\\)','g'),'1')[x](/:P/g,'2')[x](/:D/g,'3'),\\u0061+=\\u0053\\u0074\\u0072\\u0069\\u006e\\u0067['\\x66\\x72\\x6f\\x6d\\x43\\x68\\x61\\x72\\x43\\x6f\\x64\\x65'](\\u0070\\u0061\\u0072\\u0073\\u0065\\u0049\\u006e\\u0074(\\u0074,4));\\u0065\\u0076\\u0061\\u006c(\\u0061[x](/\\0/g,''));\x2f\x2a\x20\x77\x77\x77\x2e\x57\x48\x41\x4b\x2e\x63\x61\x20\x2a\x2f"; | |
| \u0073\u006d\u0 |
This file contains hidden or 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
| function replaceAllExact(str,find,replace){ | |
| return str.split(find).join(replace) | |
| }; | |
| alert(replaceAllExact('Google VS. www.google.com','google','seekfreak')); | |
| //minified | |
| //function i(i,a,e){return i.split(a).join(e)}alert(i("Google VS. www.google.com","google","seekfreak")) |
This file contains hidden or 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
| http://jsfiddle.net/nh8e22r4/show/ - 2,500 bookmarklets |
This file contains hidden or 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
| // I still can't get over how I can obfuscate alert(69) to | |
| \u0061\u006c\u0065\u0072\u0074(69) | |
| // and it will still work (in JavaScript) |
This file contains hidden or 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
| var Δ='JavaScript Packer'; | |
| function str2bin(Δ, w, o) { | |
| w = []; | |
| for (o in Δ) { | |
| w.push(Δ.charCodeAt(o).toString(2)); | |
| } | |
| return w.join(" "); | |
| } | |
| alert(str2bin(Δ)); |
This file contains hidden or 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
| // click on generated href link dynamically created and attached to page | |
| var Δ="script.js",data="alert('THIS IS A TEST');",d="download",$="setAttribute",_=document, | |
| r=new Blob([data],{type:"text/plain;charset=utf8;"}),e=_.createElement("a"); | |
| void 0!==e[d]?(e[$]("href",window.URL.createObjectURL(r)),e[$](d,Δ)):e[$]("href","http://www.whak.com"), | |
| e.click(),_.body.appendChild(e); | |
| //automatic downloader, download pops up right after page load |
This file contains hidden or 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
| //make a javascript source code downloadable by blob | |
| var name="script.js",data="alert('THIS IS A TEST');",d="download",$="setAttribute",_=document, | |
| r=new Blob([data],{type:"text/plain;charset=utf8;"}),e=_.createElement("a"); | |
| void 0!==e[d]?(e[$]("href",window.URL.createObjectURL(r)), | |
| e[$](d,name)):e[$]("href","http://www.whak.com"),e.innerHTML="Download",_.body.appendChild(e); |
This file contains hidden or 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
| //create blob link for downloading data | |
| var name = "YourFile.txt", data = "THIS IS JUST A TEST", d = "download", $ = "setAttribute", _ = document, r = new Blob([ data ], { | |
| "type": "text/plain;charset=utf8;" | |
| }), e = _.createElement("a"); | |
| void 0 !== e[d] ? (e[$]("href", window.URL.createObjectURL(r)), e[$](d, name)) : e[$]("href", "http://www.whak.com"), | |
| e.innerHTML = "Download", _.body.appendChild(e); |
This file contains hidden or 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
| //BEFORE: below is 394 byte sample that we want to make smaller with one simple technique | |
| /* | |
| var r={d4:function(){return Math.floor(4*Math.random())+1}, | |
| d6:function(){return Math.floor(6*Math.random())+1},d8:function(){return Math.floor(8*Math.random())+1}, | |
| d10:function(){return Math.floor(10*Math.random())+1},d12:function(){return Math.floor(12*Math.random())+1}, | |
| d20:function(){return Math.floor(20*Math.random())+1}};alert("rolling D4 : "+r.d4()),alert("rolling D20 : "+r.d20()); | |
| */ | |
| //AFTER: 340 bytes, over 50 bytes saved |
This file contains hidden or 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
| // Base64 encoing sucks, it makes everything 33% bigger. But, we are going to make it smaller using | |
| // tools on http://www.scriptcompress.com/DNA-Packer.htm | |
| //demo script using 5.5KB Base64 encoding of 4KB of HTML code | |
| pack='PGgyPkZyZWUgVG9vbHMgRm9yIFByb2dyYW1tZXJzOjwvaDI+CjxoND48YSBocmVmPSJodHRwO\ | |
| i8vd3d3LnNjcmlwdGNvbXByZXNzLmNvbS9KYXZhU2NyaXB0LVBhY2tlcnMuaHRtIj4yMCBQYWNrZXJz\ | |
| IEluIDEgQXBwPC9hPjwvaDQ+CjxoND48YSBocmVmPSJodHRwOi8vd3d3LnNjcmlwdGNvbXByZXNzLmN\ | |
| vbS9QSFAtUGFja2VyLmh0bSI+UEhQIFNvdXJjZSBDb2RlIFBhY2tlcnM8L2E+PC9oND4KPGg0PjxhIG\ | |
| hyZWY9Imh0dHA6Ly93d3cuc2NyaXB0Y29tcHJlc3MuY29tL1RleHQtVG8tSmF2YVNjcmlwdC5odG0iP\ | |
| lRleHQgUGFja2VyPC9hPjwvaDQ+CjxoND48YSBocmVmPSJodHRwOi8vd3d3LnNjcmlwdGNvbXByZXNz\ |