Script analysis, compression, obfuscation tool JSA new release, compression efficiency improve about 10%_javascript skills

Source: Internet
Author: User
Tags eval
SA 1.0 Alpha release, increased compression efficiency of approximately 10%
Compression algorithm improvements:

The implementation of its own text compression algorithm

* Increased compression ratio and decompression efficiency.

Optimization of syntax compression

* Combined continuous VAR declaration,
* removed the excess var declaration,
* Removed the extra large brackets ({,}),
* Removed the extra semicolon (;).

UI improvements:

* Automatic code recognition
* Support file drag and drop
* Support java1.4.2+ when the jar is open as Java, double-click to run, but if the jar is open in a way that is modified (such as WinRAR), use the following method:
Cmd>java-jar Xx.jar
* Format
Comments can only be between the statements, inserted in the middle of the statement may be lost, in the format of the bug bar.
* Compression parameter setting
Operation-> Settings:
Perform syntax compression: Replaces local variables and removes redundant syntax.
Perform text compression: Place the foot in this article, replace the compression. Execution can be restored by eval (decompression function ()).
Compatible with IE5, NS3: Older browsers support regular expressions first, and whether they need to be compatible (with a slightly more complex decompression function).
Conditional settings for text compression: Set when text compression is used, with two, ratio requirements, and size requirements; Because eval requires extra overhead, text compression is used only if the ratio of text compression is less than the specified value and the file size is greater than the specified value.


ANT Task

* Default encoding: The default encoding of the JRE may vary depending on the machine, so it is recommended to manually specify the encoding method (eg:charset= "Utf-8"/charset= "GBK")
* Jsicompile tasks: Compiling jsi (compression, preload compilation, custom startup file)
* jscompress Compression script

ANT Task Example
Jsicompiler Sample (third party script that handles JSI and its integration)
XML code
Copy Code code as follows:


<target name= "compress" depends= "init" >
<jsicompile destdir= "ant/temp/scripts" rebuildboot= "true" charset= "Utf-8" >
<fileset dir= "Web/scripts" >
<include name= "*/**/*.*"/>
<include name= "*.*"/>
<exclude name= "preload/**"/>
</fileset>

<preloadgroup path= "Code-decorator.js" >
<fileset dir= "Web/scripts" >
<include name= ' js/io/__$package.js '/>
<include name= ' js/io/request.js '/>
<include name= ' js/io/writer.js '/>
<include name= ' js/xml/__$package.js '/>
<include name= ' js/xml/template.js '/>
<include name= ' js/xml/tag.js '/>
<include name= ' js/util/__$package.js '/>
<include name= ' js/util/collections.js '/>
<include name= ' org/xidea/syntax/__$package.js '/>
<include name= ' org/xidea/syntax/syntax-parser.js '/>
<include name= ' org/xidea/decorator/__$package.js '/>
<include name= ' org/xidea/decorator/code.js '/>
</fileset>
</preloadgroup>
</jsicompile>
</target>

Jscompress sample (Compress normal script)
XML code
<target name= "test-compress" > <jscompress destdir= "ANT/TEMP/SCRIPT3" > <fileset dir= "web/scripts" > <include name= "js/**/*.js"/&G T <include name= "*.js"/> </fileset> </jscompress> </target> </text area>
[ CTRL + A All SELECT Note: If you need to introduce external JS need to refresh to perform]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.