-
Notifications
You must be signed in to change notification settings - Fork 0
How to Compress SWFObject with YUI Compressor
- Download the latest version of the YUI Compressor
- Unzip the yuicompressor-x.x.x.zip file
- Compress this file (for more info, please read the YUI Compressor documentation), e.g.:
java -jar /yuicompressorpath/yuicompressor-2.3.5/build/yuicompressor-2.3.5.jar -o /swfobjectpath/swfobject.js /swfobjectpath/src/swfobject.js
-
Download the latest version of the YUI Compressor
-
Unzip the yuicompressor-x.x.x.zip file
-
Open the uncompressed swfobject.js file in a text or code editor and remove the following conditional compiling directives and JavaScript code (line 85-92):
/@cc_on ie = true; @if (@_win32) windows = true; @elif (@_mac) mac = true; @end @/
-
Save your adjusted uncompressed swfobject.js file
-
Compress this file (for more info, please read the YUI Compressor documentation), e.g.:
java -jar /yuicompressorpath/yuicompressor-2.3.5/build/yuicompressor-2.3.5.jar -o /swfobjectpath/swfobject.js /swfobjectpath/src/swfobject.js
-
Open the compressed swfobject.js file
-
You have to re-add the Internet Explorer conditional compiling directives and the JavaScript code it embodies (this is a proprietary feature test to check e.g. whether a browser is Internet Explorer). For SWFObject 2.0 paste the following code block:
/@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@/
In between:
... i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);
And:
return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}(); ...
For *SWFObject 2.1* paste the following code block:
/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/
In between:
... q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);
And:
return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}(); ...
- Save your adjusted compressed swfobject.js file