Skip to content

Commit

Permalink
Split the monolithic PIE.htc into separate source files per class/com…
Browse files Browse the repository at this point in the history
…ponent. Introduce simple ant-based build to concatenate and compress all the individual files into the single htc file.
  • Loading branch information
Jason Johnston committed Apr 9, 2010
1 parent 808847e commit 3e71920
Show file tree
Hide file tree
Showing 63 changed files with 2,377 additions and 2,379 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,2 +1,2 @@
.idea

build
2,335 changes: 0 additions & 2,335 deletions PIE.htc

This file was deleted.

56 changes: 56 additions & 0 deletions build.xml
@@ -0,0 +1,56 @@
<?xml version="1.0" ?>

<project name="PIE" default="package" basedir=".">

<property name="build_dir" value="./build" />
<property name="src_dir" value="./sources" />

<target name="package-uncompressed">
<mkdir dir="${build_dir}" />
<concat destfile="${build_dir}/script_uncompressed.js">
<fileset file="${src_dir}/PIE_open.js" />
<fileset file="${src_dir}/Util.js" />
<fileset file="${src_dir}/Length.js" />
<fileset file="${src_dir}/BgPosition.js" />
<fileset file="${src_dir}/Angle.js" />
<fileset file="${src_dir}/Color.js" />
<fileset file="${src_dir}/Tokenizer.js" />
<fileset file="${src_dir}/StyleBase.js" />
<fileset file="${src_dir}/BackgroundStyleInfo.js" />
<fileset file="${src_dir}/BorderStyleInfo.js" />
<fileset file="${src_dir}/BorderRadiusStyleInfo.js" />
<fileset file="${src_dir}/BorderImageStyleInfo.js" />
<fileset file="${src_dir}/BoxShadowStyleInfo.js" />
<fileset file="${src_dir}/RendererBase.js" />
<fileset file="${src_dir}/RootRenderer.js" />
<fileset file="${src_dir}/BackgroundAndBorderRenderer.js" />
<fileset file="${src_dir}/BorderImageRenderer.js" />
<fileset file="${src_dir}/BoxShadowRenderer.js" />
<fileset file="${src_dir}/PIE_close.js" />
<fileset file="${src_dir}/event_handlers.js" />
</concat>

<concat destfile="${build_dir}/PIE_uncompressed.htc">
<fileset file="${src_dir}/htc_open.txt" />
<fileset file="${build_dir}/script_uncompressed.js" />
<fileset file="${src_dir}/htc_close.txt" />
</concat>
</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="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" />
<fileset file="${build_dir}/script_compressed.js" />
<fileset file="${src_dir}/htc_close.txt" />
</concat>
</target>

<target name="package" depends="package-uncompressed,package-compressed" />

</project>
24 changes: 24 additions & 0 deletions sources/Angle.js
@@ -0,0 +1,24 @@
/**
* Wrapper for angle values; handles conversion to degrees from all allowed angle units
* @param val
*/
PIE.Angle = function( val ) {
this.val = val;
};
PIE.Angle.prototype = {
unitRE: /(deg|rad|grad|turn)$/,

getUnit: function() {
return this._unit || ( this._unit = this.val.match( this.unitRE )[1] );
},

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;
}
};

0 comments on commit 3e71920

Please sign in to comment.