Forum Moderators: open

Message Too Old, No Replies

How to read / write compact Javascript

         

flashfan

3:28 am on Mar 17, 2004 (gmt 0)

10+ Year Member



We can see many compact javascripts in web page. I am wondering if there is a tool to compact / decompact javascripts. Any hint?

Thanks,

-F.

Rambo Tribble

3:46 am on Mar 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hope you wrote all your code with semicolons.
Try: JSCruncher at www.domapi.com
Script Squisher batman.getmyip.com/projects/scriptsquisher

There are others you'll find along with obfuscators in Andrew King's "Speed Up Your Site" ISBN 0-7357-1324-3

You can also create a script that uses document.write() to do it yourself.

flashfan

4:02 am on Mar 17, 2004 (gmt 0)

10+ Year Member



Thanks. I found w3compiler as well. These tools are used to compact javascript. Is there reverse tool, which convert compacted format to normal one?

DarrenSemotiuk

8:46 am on Apr 16, 2004 (gmt 0)



re. Script Squisher

Ignore the "batman.getmyip.com" link, I no longer have it located at that address.

Andrew King's "Speed Up Your Site" - Chapter 9 sample is found at the address listed below. I emailed him and got him to update the url for Script Squisher on that page, so always refer to THAT...
[websiteoptimization.com...]

re. "uncompressing" script pages

simple answer: no, of course not
more complex answer:
(1)paste the code into your favorite plain-text editor
(2)replace all ";" with ";\p" (\p for carriage return)
(3)replace all "\pfunction " with "\p\p\pfunction "
(4)replace all "{" with "\p{\p"
(5)replace all "}" with "\p}\p"

That should make the compressed code a lot more human-readable. At this point you can now try to guess what the variable names/functions are used for, add your own comments as you figure things out... But when variable names have been changed to "a" or "_z" or "I1l" or "l1ll1l1l1ll1" it's almost an exercise in futility...

Darren.

[squisher.shorturl.com...]