New JavaScript Packer

New JavaScript Packer, Even Packs HTML Code, Improved Compression

ScriptCompress.com's JavaScript Minifier & Packer

Your JavaScript or HTML Source Code:

bytes.

Minified, Packed or Compressed Self Extracting Code:

bytes.

Packers: COMPRESS:

ENCODE: OTHER:
Base64-#2 | <script> | Doc.write | Eval | JS 2 SVG | HTML 2 SVG | DataURL-#2 | Bookmarklet-#2-#3

page often until we fix the leaks...

If you are intending to pack up HTML rather than JavaScript, here are some tips:
  1. Check off (no checkmark) "JavaScript" checkbox.
  2. Pack with WHAK algorithm (for example).
  3. Change eval(W); to document.write(W); and now it will print out & render your HTML.
  4. Now wrap it in a script tag (then it's HTML code again, but smaller) like
    <script>
    var W,H,A,K='';W=/* ...REST_OF_CODE... */;
    document.write(W);
    </script>
If you are intending to pack up plain text rather than JavaScript, here are some tips:
  1. Check off (no checkmark) "JavaScript" checkbox.
  2. Pack with WHAK algorithm.
  3. Change eval(W); to document.write('<textarea>'+W+'<\/textarea>');

We Can Beat Server Side Gzip Compression & It's Client Side!

We have been experimenting with "stand alone" & "portable" (you can simply download the one page/file, and it runs from your harddrive on any operating system) "self extracting" & "self executing" (auto running) JavaScripts that embed a multi compressed file right in your HTML page. This gives results of around half the size, but could be so much better if we didn't have to Base64 the raw compressed data for a dataURI. We are experimenting with leaving the data raw in a sandboxed textarea, so far we get issues here and there that we are working out... This is a great way of doing compression on hosting sites that do not have server side compression enabled (server side compression uses many resources, many companies opt out to avoid needing more computers).

See this link http://holybibleverse.master.com that demonstrates the packing (done here) of an almost 5MB (4.79MB) Holy Bible (complete web application, both Old and New Testaments) on a free service (from master.com which allows you to customize look & feel of the page, just like any free blog host). The packed Bible is now 1.43MB and is officially (and literally) the World's Smallest HTML5 Holy Bible App (works on cell phone or any web browser, fits on a floppy disk). JQuery files, JavaScript and all HTML code was packed (ZAP works best for leaving most room for other compressors, WHAK is 2nd best, then base2) and then compressed with Bzip & LZ-WHAK (forget exact order). Plain Gzipping the same HTML file results in a 1.38MB GZ file (using 7zip.org's tool, HTML file Zips to 1.14MB using WinRAR set with highest settings) and it will not auto run client side, so really we get almost same results (too bad we have to base64 encode a couple times, we would far beat Gzip if we could fully avoid base64) with a completely embedded web app that will be hard for someone to steal your source code! We made a self extracting EXE file (Zip and runs hte webpage to open in installed browser), it is 1.53MB, so we actually beat self extracting Zipping with tools on this page (and our self extractor is not a scary EXE file extension that most people would concider a risk, plus ours will run on any Mac, iPad, PC, tablet or cell phone, EXE files will only run on a PC)!

Now for the neat trick to make smaller using SVG images (browsers will decompress them, a way to use GZip client side)... You can now make your code write to a new opened window (instead of nerd.write, could make it write to an iframe too or other things with DataURI) and add 500 bytes of SVG XML code, then GZIP it to about 1MB. Now rename filename.gz to filename.svgz and now we actually are serving a file smaller than any web server could possibly server. Here is the 1MB HTML5 Bible on http://imgh.us/NIV-Holy-Bible.svgz (view source to see XML code and popup window JavaScript codes), notice how it's hosted on a free image hosting site. Gzipped server side would be 1.38MB, our trick gives a client side decompressing and self extracting/executing file at 1.1MB!

Once we figure out ways around having to base64 things twice (or more) in the process, we expect to bring sizes down another 10 to 30%. Some tests with wrapping pure LZMA code then compressed with another codec and then base64ed (skips one base64ing) in a sandboxed textarea have proved successful, can't wait to see how this part goes... It's funny though, often the raw code once in UTF-8 character code winds up being larger in size than the base64 version (but compressing base64 encoding doesn't yield in great results, but sometimes compresing raw already compressed code will compress more with old fashioned compression mathematics like LZW). We just have to experiment much more to find the perfect combination for HTML code, JavaScript and plain ascii text (words of the English language).

Here is a demonstration of being able to compress Base64 encoded data on www.scriptcompress.com/Base64-Encoded-JavaScript-Packer.htm
    TOOLS FOR PROGRAMMERS:
  1. 25 Encoders in 1 (advanced)
  2. JavaScript ReWriter/Parser/Error Checker
Basically how we did the version that beats self extracting zips: We started with a HTML file with external calls to several JavaScript files (including JQuery). We combined all the JavaScript, packed it, base64ed it and then made a DataURI to embed the JavaScript code in the HTML file. We then made all the HTML code (including embeded dataURL) a nerd.write routine in JavaScript, then packed it, then LZWHAK compressed, base64ed, compressed with Bzip2, base64ed again. We changed eval to document write so it would print the page out in appropiate phases.

This web based (HTML5) compression application was fully designed & programmed in NotePad! All images, CSS, JavaScript and HTML code is embeded in this one single web page (download as a portable application that will run on any computer, cell phone or tablet). It is best viewed with Google's Chrome web browser. Many hours have been devoted to making client side internet compression possible and worth while.

No comments:

Post a Comment