Javascript/css code online compression/formatting/obfuscation using Jquery

Source: Internet
Author: User
This tool is a combination of popular auxiliary tools on the Internet, such as JavaScript obfuscation, compression, formatting, CSS compression, and CSS formatting. In order to make it easy to use, comics separates all functions and can be used offline. You do not need to call others' interfaces online for full localization. Main functions: 1. JavaScript obfuscation 2. JS compression 3. JS formatting 4. CSS compression 5. The core code of CSS formatting is as follows:
Var lCSSCoder = {format: function (s) {// format code s = s. replace (/\ s * ([\ {\} \: \; \,]) \ s */g, "$1"); s = s. replace (/; \ s *;/g, ";"); // clear the continuous semicolon s = s. replace (/\, [\ s \. \ # \ d] * {/g, "{"); s = s. replace (/([^ \ s]) \ {([^ \ s])/g, "$1 {\ n \ t $2"); s = s. replace (/([^ \ s]) \} ([^ \ n] *)/g, "$1 \ n} \ n $2"); s = s. replace (/([^ \ s]); ([^ \ s \}])/g, "$1; \ n \ t $2 "); return s;}, pack: function (s) {// Compression Code s = s. replace (/\/\*(. | \ n )*? \ * \ // G, ""); // Delete comment s = s. replace (/\ s * ([\ {\} \: \; \,]) \ s */g, "$1"); s = s. replace (/\, [\ s \. \ # \ d] * \ {/g, "{"); // fault tolerance Processing s = s. replace (/; \ s *;/g, ";"); // clear the continuous semicolon s = s. match (/^ \ s * (\ S + (\ s + \ S +) *) \ s * $ /); // remove the blank at the beginning and end of return (s = null )? "": S [1] ;}};

 

The effect is as follows:

 

Online Demo and download

Related Article

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.