Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Switch to Closure Compiler, using advanced optimizations mode. Lots o…
Browse files Browse the repository at this point in the history
…f source format tweaks to allow this while preventing things from breaking due to property renaming, object flattening, etc.
  • Loading branch information
Jason Johnston committed Apr 17, 2010
1 parent beaaae3 commit f83e0b1
Show file tree
Hide file tree
Showing 21 changed files with 1,899 additions and 1,827 deletions.
14 changes: 13 additions & 1 deletion build.xml
Expand Up @@ -38,11 +38,23 @@
</target>

<target name="package-compressed" depends="package-uncompressed">
<!--<copy file="${build_dir}/script_uncompressed.js" tofile="${build_dir}/script_compressed.js" overwrite="true" />-->
<exec executable="java">
<arg line='-jar tools/compiler.jar
--js ${build_dir}/script_uncompressed.js
--js ${src_dir}/closure_preservefunctions.js
--module "script_compressed:1"
--module "temp:1"
--module_output_path_prefix ${build_dir}/
--compilation_level ADVANCED_OPTIMIZATIONS
--externs ${src_dir}/closure_externs.js' />
</exec>
<delete file="${build_dir}/temp.js" />

<!--
<exec executable="yuicompressor">
<arg line="${build_dir}/script_uncompressed.js -o ${build_dir}/script_compressed.js" />
</exec>
-->

<concat destfile="${build_dir}/PIE.htc">
<fileset file="${src_dir}/htc_open.txt" />
Expand Down
52 changes: 28 additions & 24 deletions sources/Angle.js
Expand Up @@ -3,30 +3,34 @@
* @constructor
* @param {string} val The raw CSS value for the angle. It is assumed it has been pre-validated.
*/
PIE.Angle = function( val ) {
this.val = val;
};
PIE.Angle.prototype = {
unitRE: /(deg|rad|grad|turn)$/,
PIE.Angle = (function() {
function Angle( val ) {
this.val = val;
}
Angle.prototype = {
unitRE: /(deg|rad|grad|turn)$/,

/**
* @return {string} The unit of the angle value
*/
getUnit: function() {
return this._unit || ( this._unit = this.val.match( this.unitRE )[1] );
},
/**
* @return {string} The unit of the angle value
*/
getUnit: function() {
return this._unit || ( this._unit = this.val.match( this.unitRE )[1] );
},

/**
* Get the numeric value of the angle in degrees.
* @return {number} The degrees value
*/
degrees: function() {
var deg = this._deg, u, n;
if( !deg ) {
u = this.getUnit();
n = parseFloat( this.val, 10 );
deg = this._deg = ( u === 'deg' ? n : u === 'rad' ? n / Math.PI * 180 : u === 'grad' ? n / 400 * 360 : u === 'turn' ? n * 360 : 0 );
/**
* Get the numeric value of the angle in degrees.
* @return {number} The degrees value
*/
degrees: function() {
var deg = this._deg, u, n;
if( !deg ) {
u = this.getUnit();
n = parseFloat( this.val, 10 );
deg = this._deg = ( u === 'deg' ? n : u === 'rad' ? n / Math.PI * 180 : u === 'grad' ? n / 400 * 360 : u === 'turn' ? n * 360 : 0 );
}
return deg;
}
return deg;
}
};
};

return Angle;
})();

0 comments on commit f83e0b1

Please sign in to comment.