--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!--
+ jQuery UI Release!
+
+ Call task called 'deploy-release' to build a full release.
+ The release built will be stored on 'dist' dir.
+
+-->
+
+<project name="jquery-ui" default="deploy-release" basedir=".">
+
+ <taskdef resource="net/sf/antcontrib/antcontrib.properties">
+ <classpath>
+ <pathelement location="build/ant-contrib-0.6.jar"/>
+ </classpath>
+ </taskdef>
+
+ <property file="ant.properties" />
+
+ <loadfile failonerror="no" srcFile="../version.txt" property="release.version" />
+ <property name="release.filename" value="jquery.ui-${release.version}" />
+
+ <property name="dist.dir" value="dist/${release.filename}/" />
+ <property name="build.dir" value="build" />
+ <property name="ui.dir" value="../" />
+ <property name="src.dir" value="${ui.dir}/ui/" />
+
+ <property name="min.folder" value="${dist.dir}/ui/minified" />
+
+ <property name="concatenated" value="jquery.ui.all" />
+ <property name="concatenated.i18n" value="jquery.ui.i18n.all" />
+
+ <property name="core.files" value="ui.core.js, ui.draggable.js, ui.droppable.js, ui.resizable.js, ui.selectable.js, ui.sortable.js, effects.core.js" />
+
+ <property description="YUI Compressor" name="yui-jar" value="${build.dir}/yuicompressor-2.4.2.jar" />
+
+ <target name="deploy-release" depends="docs-process, concatenate, minify, copy, replace-version, prepend-header, zip" description="Release builder">
+ </target>
+
+ <target name="replace-version">
+ <replaceregexp match="@VERSION" replace="${release.version}" flags="g" byline="true">
+ <fileset dir="${dist.dir}/ui/" includes="*.js"/>
+ <fileset dir="${dist.dir}/ui/minified/" includes="*.js"/>
+ </replaceregexp>
+ <echo message="Replaced all @VERSION to ${release.version}." />
+ </target>
+
+ <target name="prepend-header">
+ <!-- TODO: refactor this ugly mess -->
+ <copy todir="${dist.dir}/headers/">
+ <fileset dir="${dist.dir}/ui/" includes="*.js" />
+ </copy>
+ <replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
+ <fileset dir="${dist.dir}/headers/" includes="*.js"/>
+ </replaceregexp>
+ <for param="file">
+ <path><fileset dir="${dist.dir}/ui/minified/" includes="*.js" /></path>
+ <sequential>
+ <propertyregex override="yes" property="target" input="@{file}" regexp=".+\\(.+)\.min\.js$" replace="\1"/>
+ <concat destfile="${dist.dir}/ui-headered/${target}.min.js">
+ <header file="${dist.dir}/headers/${target}.js" />
+ <fileset file="@{file}" />
+ </concat>
+ </sequential>
+ </for>
+ <copy todir="${dist.dir}/ui/minified">
+ <fileset dir="${dist.dir}/ui-headered/" includes="*.js" />
+ </copy>
+ <delete dir="${dist.dir}/ui-headered/" />
+ </target>
+
+ <target description="Zip the package" name="zip">
+ <zip destfile="${dist.dir}/../${release.filename}.zip">
+ <zipfileset dir="dist/" />
+ </zip>
+ </target>
+
+ <target name="concatenate">
+ <echo message="Building concatenated" />
+ <mkdir dir="${dist.dir}/ui/" />
+ <delete file="${dist.dir}/ui/${concatenated}.js" />
+
+ <concat destfile="${dist.dir}/ui/${concatenated}.js">
+ <filelist dir="${src.dir}/" files="${core.files}" />
+ <fileset dir="${src.dir}/" includes="ui.*.js, effects.*.js" excludes="${core.files}" />
+ </concat>
+ <echo message="Concatenated built." />
+
+ <mkdir dir="${dist.dir}/ui/i18n/" />
+ <delete file="${dist.dir}/ui/i18n/${concatenated.i18n}.js" />
+
+ <concat destfile="${dist.dir}/ui/i18n/${concatenated.i18n}.js" encoding="utf-8">
+ <fileset dir="${src.dir}/i18n/" includes="ui.*.js" />
+ </concat>
+ <echo message="Concatenated i18n built." />
+ </target>
+
+ <target name="minify" depends="concatenate" description="Remove all comments and whitespace, no compression, great in combination with GZip">
+ <echo message="Building minified" />
+ <delete dir="${min.folder}/" />
+ <mkdir dir="${min.folder}" />
+ <delete dir="${min.folder}/i18n/" />
+ <mkdir dir="${min.folder}/i18n/" />
+
+ <apply executable="java" parallel="false">
+ <filelist dir="${dist.dir}/ui/" files="${concatenated}.js" />
+ <fileset dir="${src.dir}/" includes="ui.*.js, effects.*.js" />
+ <arg line="-jar" />
+ <arg path="${yui-jar}" />
+ <arg value="--charset" />
+ <arg value="UTF-8" />
+ <srcfile />
+ <arg line="-o" />
+ <mapper type="glob" from="*.js" to="${min.folder}/*.min.js" />
+ <targetfile />
+ </apply>
+ <echo message="Minified built." />
+
+ <apply executable="java" parallel="false">
+ <filelist dir="${dist.dir}/ui/i18n/" files="${concatenated.i18n}.js" />
+ <fileset dir="${src.dir}/i18n/" includes="ui.*.js" />
+ <arg line="-jar" />
+ <arg path="${yui-jar}" />
+ <arg value="--charset" />
+ <arg value="UTF-8" />
+ <srcfile />
+ <arg line="-o" />
+ <mapper type="glob" from="*.js" to="${min.folder}/i18n/*.min.js" />
+ <targetfile />
+ </apply>
+ <echo message="Minified i18n built." />
+ </target>
+
+ <target description="Copy needed folders" name="copy">
+ <echo message="Copying files" />
+ <mkdir dir="${dist.dir}" />
+
+ <copy overwrite="true" todir="${dist.dir}/">
+ <fileset dir="${ui.dir}/" includes="jquery-*.js" />
+ </copy>
+
+ <copy overwrite="true" todir="${dist.dir}/ui/">
+ <fileset dir="${src.dir}/" includes="ui.*.js, effects.*.js" />
+ </copy>
+
+ <copy overwrite="true" todir="${dist.dir}/ui/i18n/" >
+ <fileset dir="${src.dir}/i18n/" />
+ </copy>
+
+ <copy overwrite="true" todir="${dist.dir}/">
+ <fileset dir="${ui.dir}/" includes="*.txt" />
+ </copy>
+
+ <copy overwrite="true" todir="${dist.dir}/demos/" >
+ <fileset dir="${ui.dir}/demos/" />
+ </copy>
+
+ <copy overwrite="true" todir="${dist.dir}/tests/" >
+ <fileset dir="${ui.dir}/tests/" />
+ </copy>
+
+ <copy overwrite="true" todir="${dist.dir}/themes/" >
+ <fileset dir="${ui.dir}/themes/" />
+ </copy>
+ <echo message="Files copied." />
+ </target>
+
+ <target name="clean">
+ <delete dir="dist" />
+ </target>
+
+ <target name="docs-download">
+ <property name="url" value="http://www.exfer.net/jquery/createjQueryXMLDocs.py?start=UI/" />
+ <get src="${url}Accordion" dest="docs-accordion.xml" />
+ <get src="${url}Datepicker" dest="docs-datepicker.xml" />
+ <get src="${url}Dialog" dest="docs-dialog.xml" />
+ <get src="${url}Draggable" dest="docs-draggable.xml" />
+ <get src="${url}Droppable" dest="docs-droppable.xml" />
+ <get src="${url}Progressbar" dest="docs-progressbar.xml" />
+ <get src="${url}Resizable" dest="docs-resizable.xml" />
+ <get src="${url}Selectable" dest="docs-selectable.xml" />
+ <get src="${url}Slider" dest="docs-slider.xml" />
+ <get src="${url}Sortable" dest="docs-sortable.xml" />
+ <get src="${url}Tabs" dest="docs-tabs.xml" />
+ </target>
+
+ <target name="docs-process" depends="docs-download">
+ <property name="docs.dir" value="${ui.dir}/demos/documentation" />
+ <delete dir="${docs.dir}" />
+ <mkdir dir="${docs.dir}" />
+ <xslt includes="docs-*.xml" destdir="${docs.dir}" style="build/style.xsl" />
+ </target>
+
+ <target name="docs-clean">
+ <delete>
+ <fileset file="*.xml" excludes="build.xml" />
+ </delete>
+ </target>
+
+</project>
--- /dev/null
+<?php
+/* 9 April 2008. version 1.1
+ *
+ * This is the php version of the Dean Edwards JavaScript's Packer,
+ * Based on :
+ *
+ * ParseMaster, version 1.0.2 (2005-08-19) Copyright 2005, Dean Edwards
+ * a multi-pattern parser.
+ * KNOWN BUG: erroneous behavior when using escapeChar with a replacement
+ * value that is a function
+ *
+ * packer, version 2.0.2 (2005-08-19) Copyright 2004-2005, Dean Edwards
+ *
+ * License: http://creativecommons.org/licenses/LGPL/2.1/
+ *
+ * Ported to PHP by Nicolas Martin.
+ *
+ * ----------------------------------------------------------------------
+ * changelog:
+ * 1.1 : correct a bug, '\0' packed then unpacked becomes '\'.
+ * ----------------------------------------------------------------------
+ *
+ * examples of usage :
+ * $myPacker = new JavaScriptPacker($script, 62, true, false);
+ * $packed = $myPacker->pack();
+ *
+ * or
+ *
+ * $myPacker = new JavaScriptPacker($script, 'Normal', true, false);
+ * $packed = $myPacker->pack();
+ *
+ * or (default values)
+ *
+ * $myPacker = new JavaScriptPacker($script);
+ * $packed = $myPacker->pack();
+ *
+ *
+ * params of the constructor :
+ * $script: the JavaScript to pack, string.
+ * $encoding: level of encoding, int or string :
+ * 0,10,62,95 or 'None', 'Numeric', 'Normal', 'High ASCII'.
+ * default: 62.
+ * $fastDecode: include the fast decoder in the packed result, boolean.
+ * default : true.
+ * $specialChars: if you are flagged your private and local variables
+ * in the script, boolean.
+ * default: false.
+ *
+ * The pack() method return the compressed JavasScript, as a string.
+ *
+ * see http://dean.edwards.name/packer/usage/ for more information.
+ *
+ * Notes :
+ * # need PHP 5 . Tested with PHP 5.1.2, 5.1.3, 5.1.4, 5.2.3
+ *
+ * # The packed result may be different than with the Dean Edwards
+ * version, but with the same length. The reason is that the PHP
+ * function usort to sort array don't necessarily preserve the
+ * original order of two equal member. The Javascript sort function
+ * in fact preserve this order (but that's not require by the
+ * ECMAScript standard). So the encoded keywords order can be
+ * different in the two results.
+ *
+ * # Be careful with the 'High ASCII' Level encoding if you use
+ * UTF-8 in your files...
+ */
+
+
+class JavaScriptPacker {
+ // constants
+ const IGNORE = '$1';
+
+ // validate parameters
+ private $_script = '';
+ private $_encoding = 62;
+ private $_fastDecode = true;
+ private $_specialChars = false;
+
+ private $LITERAL_ENCODING = array(
+ 'None' => 0,
+ 'Numeric' => 10,
+ 'Normal' => 62,
+ 'High ASCII' => 95
+ );
+
+ public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
+ {
+ $this->_script = $_script . "\n";
+ if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
+ $_encoding = $this->LITERAL_ENCODING[$_encoding];
+ $this->_encoding = min((int)$_encoding, 95);
+ $this->_fastDecode = $_fastDecode;
+ $this->_specialChars = $_specialChars;
+ }
+
+ public function pack() {
+ $this->_addParser('_basicCompression');
+ if ($this->_specialChars)
+ $this->_addParser('_encodeSpecialChars');
+ if ($this->_encoding)
+ $this->_addParser('_encodeKeywords');
+
+ // go!
+ return $this->_pack($this->_script);
+ }
+
+ // apply all parsing routines
+ private function _pack($script) {
+ for ($i = 0; isset($this->_parsers[$i]); $i++) {
+ $script = call_user_func(array(&$this,$this->_parsers[$i]), $script);
+ }
+ return $script;
+ }
+
+ // keep a list of parsing functions, they'll be executed all at once
+ private $_parsers = array();
+ private function _addParser($parser) {
+ $this->_parsers[] = $parser;
+ }
+
+ // zero encoding - just removal of white space and comments
+ private function _basicCompression($script) {
+ $parser = new ParseMaster();
+ // make safe
+ $parser->escapeChar = '\\';
+ // protect strings
+ $parser->add('/\'[^\'\\n\\r]*\'/', self::IGNORE);
+ $parser->add('/"[^"\\n\\r]*"/', self::IGNORE);
+ // remove comments
+ $parser->add('/\\/\\/[^\\n\\r]*[\\n\\r]/', ' ');
+ $parser->add('/\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\//', ' ');
+ // protect regular expressions
+ $parser->add('/\\s+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/g?i?)/', '$2'); // IGNORE
+ $parser->add('/[^\\w\\x24\\/\'"*)\\?:]\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/g?i?/', self::IGNORE);
+ // remove: ;;; doSomething();
+ if ($this->_specialChars) $parser->add('/;;;[^\\n\\r]+[\\n\\r]/');
+ // remove redundant semi-colons
+ $parser->add('/\\(;;\\)/', self::IGNORE); // protect for (;;) loops
+ $parser->add('/;+\\s*([};])/', '$2');
+ // apply the above
+ $script = $parser->exec($script);
+
+ // remove white-space
+ $parser->add('/(\\b|\\x24)\\s+(\\b|\\x24)/', '$2 $3');
+ $parser->add('/([+\\-])\\s+([+\\-])/', '$2 $3');
+ $parser->add('/\\s+/', '');
+ // done
+ return $parser->exec($script);
+ }
+
+ private function _encodeSpecialChars($script) {
+ $parser = new ParseMaster();
+ // replace: $name -> n, $$name -> na
+ $parser->add('/((\\x24+)([a-zA-Z$_]+))(\\d*)/',
+ array('fn' => '_replace_name')
+ );
+ // replace: _name -> _0, double-underscore (__name) is ignored
+ $regexp = '/\\b_[A-Za-z\\d]\\w*/';
+ // build the word list
+ $keywords = $this->_analyze($script, $regexp, '_encodePrivate');
+ // quick ref
+ $encoded = $keywords['encoded'];
+
+ $parser->add($regexp,
+ array(
+ 'fn' => '_replace_encoded',
+ 'data' => $encoded
+ )
+ );
+ return $parser->exec($script);
+ }
+
+ private function _encodeKeywords($script) {
+ // escape high-ascii values already in the script (i.e. in strings)
+ if ($this->_encoding > 62)
+ $script = $this->_escape95($script);
+ // create the parser
+ $parser = new ParseMaster();
+ $encode = $this->_getEncoder($this->_encoding);
+ // for high-ascii, don't encode single character low-ascii
+ $regexp = ($this->_encoding > 62) ? '/\\w\\w+/' : '/\\w+/';
+ // build the word list
+ $keywords = $this->_analyze($script, $regexp, $encode);
+ $encoded = $keywords['encoded'];
+
+ // encode
+ $parser->add($regexp,
+ array(
+ 'fn' => '_replace_encoded',
+ 'data' => $encoded
+ )
+ );
+ if (empty($script)) return $script;
+ else {
+ //$res = $parser->exec($script);
+ //$res = $this->_bootStrap($res, $keywords);
+ //return $res;
+ return $this->_bootStrap($parser->exec($script), $keywords);
+ }
+ }
+
+ private function _analyze($script, $regexp, $encode) {
+ // analyse
+ // retreive all words in the script
+ $all = array();
+ preg_match_all($regexp, $script, $all);
+ $_sorted = array(); // list of words sorted by frequency
+ $_encoded = array(); // dictionary of word->encoding
+ $_protected = array(); // instances of "protected" words
+ $all = $all[0]; // simulate the javascript comportement of global match
+ if (!empty($all)) {
+ $unsorted = array(); // same list, not sorted
+ $protected = array(); // "protected" words (dictionary of word->"word")
+ $value = array(); // dictionary of charCode->encoding (eg. 256->ff)
+ $this->_count = array(); // word->count
+ $i = count($all); $j = 0; //$word = null;
+ // count the occurrences - used for sorting later
+ do {
+ --$i;
+ $word = '$' . $all[$i];
+ if (!isset($this->_count[$word])) {
+ $this->_count[$word] = 0;
+ $unsorted[$j] = $word;
+ // make a dictionary of all of the protected words in this script
+ // these are words that might be mistaken for encoding
+ //if (is_string($encode) && method_exists($this, $encode))
+ $values[$j] = call_user_func(array(&$this, $encode), $j);
+ $protected['$' . $values[$j]] = $j++;
+ }
+ // increment the word counter
+ $this->_count[$word]++;
+ } while ($i > 0);
+ // prepare to sort the word list, first we must protect
+ // words that are also used as codes. we assign them a code
+ // equivalent to the word itself.
+ // e.g. if "do" falls within our encoding range
+ // then we store keywords["do"] = "do";
+ // this avoids problems when decoding
+ $i = count($unsorted);
+ do {
+ $word = $unsorted[--$i];
+ if (isset($protected[$word]) /*!= null*/) {
+ $_sorted[$protected[$word]] = substr($word, 1);
+ $_protected[$protected[$word]] = true;
+ $this->_count[$word] = 0;
+ }
+ } while ($i);
+
+ // sort the words by frequency
+ // Note: the javascript and php version of sort can be different :
+ // in php manual, usort :
+ // " If two members compare as equal,
+ // their order in the sorted array is undefined."
+ // so the final packed script is different of the Dean's javascript version
+ // but equivalent.
+ // the ECMAscript standard does not guarantee this behaviour,
+ // and thus not all browsers (e.g. Mozilla versions dating back to at
+ // least 2003) respect this.
+ usort($unsorted, array(&$this, '_sortWords'));
+ $j = 0;
+ // because there are "protected" words in the list
+ // we must add the sorted words around them
+ do {
+ if (!isset($_sorted[$i]))
+ $_sorted[$i] = substr($unsorted[$j++], 1);
+ $_encoded[$_sorted[$i]] = $values[$i];
+ } while (++$i < count($unsorted));
+ }
+ return array(
+ 'sorted' => $_sorted,
+ 'encoded' => $_encoded,
+ 'protected' => $_protected);
+ }
+
+ private $_count = array();
+ private function _sortWords($match1, $match2) {
+ return $this->_count[$match2] - $this->_count[$match1];
+ }
+
+ // build the boot function used for loading and decoding
+ private function _bootStrap($packed, $keywords) {
+ $ENCODE = $this->_safeRegExp('$encode\\($count\\)');
+
+ // $packed: the packed script
+ $packed = "'" . $this->_escape($packed) . "'";
+
+ // $ascii: base for encoding
+ $ascii = min(count($keywords['sorted']), $this->_encoding);
+ if ($ascii == 0) $ascii = 1;
+
+ // $count: number of words contained in the script
+ $count = count($keywords['sorted']);
+
+ // $keywords: list of words contained in the script
+ foreach ($keywords['protected'] as $i=>$value) {
+ $keywords['sorted'][$i] = '';
+ }
+ // convert from a string to an array
+ ksort($keywords['sorted']);
+ $keywords = "'" . implode('|',$keywords['sorted']) . "'.split('|')";
+
+ $encode = ($this->_encoding > 62) ? '_encode95' : $this->_getEncoder($ascii);
+ $encode = $this->_getJSFunction($encode);
+ $encode = preg_replace('/_encoding/','$ascii', $encode);
+ $encode = preg_replace('/arguments\\.callee/','$encode', $encode);
+ $inline = '\\$count' . ($ascii > 10 ? '.toString(\\$ascii)' : '');
+
+ // $decode: code snippet to speed up decoding
+ if ($this->_fastDecode) {
+ // create the decoder
+ $decode = $this->_getJSFunction('_decodeBody');
+ if ($this->_encoding > 62)
+ $decode = preg_replace('/\\\\w/', '[\\xa1-\\xff]', $decode);
+ // perform the encoding inline for lower ascii values
+ elseif ($ascii < 36)
+ $decode = preg_replace($ENCODE, $inline, $decode);
+ // special case: when $count==0 there are no keywords. I want to keep
+ // the basic shape of the unpacking funcion so i'll frig the code...
+ if ($count == 0)
+ $decode = preg_replace($this->_safeRegExp('($count)\\s*=\\s*1'), '$1=0', $decode, 1);
+ }
+
+ // boot function
+ $unpack = $this->_getJSFunction('_unpack');
+ if ($this->_fastDecode) {
+ // insert the decoder
+ $this->buffer = $decode;
+ $unpack = preg_replace_callback('/\\{/', array(&$this, '_insertFastDecode'), $unpack, 1);
+ }
+ $unpack = preg_replace('/"/', "'", $unpack);
+ if ($this->_encoding > 62) { // high-ascii
+ // get rid of the word-boundaries for regexp matches
+ $unpack = preg_replace('/\'\\\\\\\\b\'\s*\\+|\\+\s*\'\\\\\\\\b\'/', '', $unpack);
+ }
+ if ($ascii > 36 || $this->_encoding > 62 || $this->_fastDecode) {
+ // insert the encode function
+ $this->buffer = $encode;
+ $unpack = preg_replace_callback('/\\{/', array(&$this, '_insertFastEncode'), $unpack, 1);
+ } else {
+ // perform the encoding inline
+ $unpack = preg_replace($ENCODE, $inline, $unpack);
+ }
+ // pack the boot function too
+ $unpackPacker = new JavaScriptPacker($unpack, 0, false, true);
+ $unpack = $unpackPacker->pack();
+
+ // arguments
+ $params = array($packed, $ascii, $count, $keywords);
+ if ($this->_fastDecode) {
+ $params[] = 0;
+ $params[] = '{}';
+ }
+ $params = implode(',', $params);
+
+ // the whole thing
+ return 'eval(' . $unpack . '(' . $params . "))\n";
+ }
+
+ private $buffer;
+ private function _insertFastDecode($match) {
+ return '{' . $this->buffer . ';';
+ }
+ private function _insertFastEncode($match) {
+ return '{$encode=' . $this->buffer . ';';
+ }
+
+ // mmm.. ..which one do i need ??
+ private function _getEncoder($ascii) {
+ return $ascii > 10 ? $ascii > 36 ? $ascii > 62 ?
+ '_encode95' : '_encode62' : '_encode36' : '_encode10';
+ }
+
+ // zero encoding
+ // characters: 0123456789
+ private function _encode10($charCode) {
+ return $charCode;
+ }
+
+ // inherent base36 support
+ // characters: 0123456789abcdefghijklmnopqrstuvwxyz
+ private function _encode36($charCode) {
+ return base_convert($charCode, 10, 36);
+ }
+
+ // hitch a ride on base36 and add the upper case alpha characters
+ // characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
+ private function _encode62($charCode) {
+ $res = '';
+ if ($charCode >= $this->_encoding) {
+ $res = $this->_encode62((int)($charCode / $this->_encoding));
+ }
+ $charCode = $charCode % $this->_encoding;
+
+ if ($charCode > 35)
+ return $res . chr($charCode + 29);
+ else
+ return $res . base_convert($charCode, 10, 36);
+ }
+
+ // use high-ascii values
+ // characters: ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ
+ private function _encode95($charCode) {
+ $res = '';
+ if ($charCode >= $this->_encoding)
+ $res = $this->_encode95($charCode / $this->_encoding);
+
+ return $res . chr(($charCode % $this->_encoding) + 161);
+ }
+
+ private function _safeRegExp($string) {
+ return '/'.preg_replace('/\$/', '\\\$', $string).'/';
+ }
+
+ private function _encodePrivate($charCode) {
+ return "_" . $charCode;
+ }
+
+ // protect characters used by the parser
+ private function _escape($script) {
+ return preg_replace('/([\\\\\'])/', '\\\$1', $script);
+ }
+
+ // protect high-ascii characters already in the script
+ private function _escape95($script) {
+ return preg_replace_callback(
+ '/[\\xa1-\\xff]/',
+ array(&$this, '_escape95Bis'),
+ $script
+ );
+ }
+ private function _escape95Bis($match) {
+ return '\x'.((string)dechex(ord($match)));
+ }
+
+
+ private function _getJSFunction($aName) {
+ if (defined('self::JSFUNCTION'.$aName))
+ return constant('self::JSFUNCTION'.$aName);
+ else
+ return '';
+ }
+
+ // JavaScript Functions used.
+ // Note : In Dean's version, these functions are converted
+ // with 'String(aFunctionName);'.
+ // This internal conversion complete the original code, ex :
+ // 'while (aBool) anAction();' is converted to
+ // 'while (aBool) { anAction(); }'.
+ // The JavaScript functions below are corrected.
+
+ // unpacking function - this is the boot strap function
+ // data extracted from this packing routine is passed to
+ // this function when decoded in the target
+ // NOTE ! : without the ';' final.
+ const JSFUNCTION_unpack =
+
+'function($packed, $ascii, $count, $keywords, $encode, $decode) {
+ while ($count--) {
+ if ($keywords[$count]) {
+ $packed = $packed.replace(new RegExp(\'\\\\b\' + $encode($count) + \'\\\\b\', \'g\'), $keywords[$count]);
+ }
+ }
+ return $packed;
+}';
+/*
+'function($packed, $ascii, $count, $keywords, $encode, $decode) {
+ while ($count--)
+ if ($keywords[$count])
+ $packed = $packed.replace(new RegExp(\'\\\\b\' + $encode($count) + \'\\\\b\', \'g\'), $keywords[$count]);
+ return $packed;
+}';
+*/
+
+ // code-snippet inserted into the unpacker to speed up decoding
+ const JSFUNCTION_decodeBody =
+//_decode = function() {
+// does the browser support String.replace where the
+// replacement value is a function?
+
+' if (!\'\'.replace(/^/, String)) {
+ // decode all the values we need
+ while ($count--) {
+ $decode[$encode($count)] = $keywords[$count] || $encode($count);
+ }
+ // global replacement function
+ $keywords = [function ($encoded) {return $decode[$encoded]}];
+ // generic match
+ $encode = function () {return \'\\\\w+\'};
+ // reset the loop counter - we are now doing a global replace
+ $count = 1;
+ }
+';
+//};
+/*
+' if (!\'\'.replace(/^/, String)) {
+ // decode all the values we need
+ while ($count--) $decode[$encode($count)] = $keywords[$count] || $encode($count);
+ // global replacement function
+ $keywords = [function ($encoded) {return $decode[$encoded]}];
+ // generic match
+ $encode = function () {return\'\\\\w+\'};
+ // reset the loop counter - we are now doing a global replace
+ $count = 1;
+ }';
+*/
+
+ // zero encoding
+ // characters: 0123456789
+ const JSFUNCTION_encode10 =
+'function($charCode) {
+ return $charCode;
+}';//;';
+
+ // inherent base36 support
+ // characters: 0123456789abcdefghijklmnopqrstuvwxyz
+ const JSFUNCTION_encode36 =
+'function($charCode) {
+ return $charCode.toString(36);
+}';//;';
+
+ // hitch a ride on base36 and add the upper case alpha characters
+ // characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
+ const JSFUNCTION_encode62 =
+'function($charCode) {
+ return ($charCode < _encoding ? \'\' : arguments.callee(parseInt($charCode / _encoding))) +
+ (($charCode = $charCode % _encoding) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36));
+}';
+
+ // use high-ascii values
+ // characters: ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ
+ const JSFUNCTION_encode95 =
+'function($charCode) {
+ return ($charCode < _encoding ? \'\' : arguments.callee($charCode / _encoding)) +
+ String.fromCharCode($charCode % _encoding + 161);
+}';
+
+}
+
+
+class ParseMaster {
+ public $ignoreCase = false;
+ public $escapeChar = '';
+
+ // constants
+ const EXPRESSION = 0;
+ const REPLACEMENT = 1;
+ const LENGTH = 2;
+
+ // used to determine nesting levels
+ private $GROUPS = '/\\(/';//g
+ private $SUB_REPLACE = '/\\$\\d/';
+ private $INDEXED = '/^\\$\\d+$/';
+ private $TRIM = '/([\'"])\\1\\.(.*)\\.\\1\\1$/';
+ private $ESCAPE = '/\\\./';//g
+ private $QUOTE = '/\'/';
+ private $DELETED = '/\\x01[^\\x01]*\\x01/';//g
+
+ public function add($expression, $replacement = '') {
+ // count the number of sub-expressions
+ // - add one because each pattern is itself a sub-expression
+ $length = 1 + preg_match_all($this->GROUPS, $this->_internalEscape((string)$expression), $out);
+
+ // treat only strings $replacement
+ if (is_string($replacement)) {
+ // does the pattern deal with sub-expressions?
+ if (preg_match($this->SUB_REPLACE, $replacement)) {
+ // a simple lookup? (e.g. "$2")
+ if (preg_match($this->INDEXED, $replacement)) {
+ // store the index (used for fast retrieval of matched strings)
+ $replacement = (int)(substr($replacement, 1)) - 1;
+ } else { // a complicated lookup (e.g. "Hello $2 $1")
+ // build a function to do the lookup
+ $quote = preg_match($this->QUOTE, $this->_internalEscape($replacement))
+ ? '"' : "'";
+ $replacement = array(
+ 'fn' => '_backReferences',
+ 'data' => array(
+ 'replacement' => $replacement,
+ 'length' => $length,
+ 'quote' => $quote
+ )
+ );
+ }
+ }
+ }
+ // pass the modified arguments
+ if (!empty($expression)) $this->_add($expression, $replacement, $length);
+ else $this->_add('/^$/', $replacement, $length);
+ }
+
+ public function exec($string) {
+ // execute the global replacement
+ $this->_escaped = array();
+
+ // simulate the _patterns.toSTring of Dean
+ $regexp = '/';
+ foreach ($this->_patterns as $reg) {
+ $regexp .= '(' . substr($reg[self::EXPRESSION], 1, -1) . ')|';
+ }
+ $regexp = substr($regexp, 0, -1) . '/';
+ $regexp .= ($this->ignoreCase) ? 'i' : '';
+
+ $string = $this->_escape($string, $this->escapeChar);
+ $string = preg_replace_callback(
+ $regexp,
+ array(
+ &$this,
+ '_replacement'
+ ),
+ $string
+ );
+ $string = $this->_unescape($string, $this->escapeChar);
+
+ return preg_replace($this->DELETED, '', $string);
+ }
+
+ public function reset() {
+ // clear the patterns collection so that this object may be re-used
+ $this->_patterns = array();
+ }
+
+ // private
+ private $_escaped = array(); // escaped characters
+ private $_patterns = array(); // patterns stored by index
+
+ // create and add a new pattern to the patterns collection
+ private function _add() {
+ $arguments = func_get_args();
+ $this->_patterns[] = $arguments;
+ }
+
+ // this is the global replace function (it's quite complicated)
+ private function _replacement($arguments) {
+ if (empty($arguments)) return '';
+
+ $i = 1; $j = 0;
+ // loop through the patterns
+ while (isset($this->_patterns[$j])) {
+ $pattern = $this->_patterns[$j++];
+ // do we have a result?
+ if (isset($arguments[$i]) && ($arguments[$i] != '')) {
+ $replacement = $pattern[self::REPLACEMENT];
+
+ if (is_array($replacement) && isset($replacement['fn'])) {
+
+ if (isset($replacement['data'])) $this->buffer = $replacement['data'];
+ return call_user_func(array(&$this, $replacement['fn']), $arguments, $i);
+
+ } elseif (is_int($replacement)) {
+ return $arguments[$replacement + $i];
+
+ }
+ $delete = ($this->escapeChar == '' ||
+ strpos($arguments[$i], $this->escapeChar) === false)
+ ? '' : "\x01" . $arguments[$i] . "\x01";
+ return $delete . $replacement;
+
+ // skip over references to sub-expressions
+ } else {
+ $i += $pattern[self::LENGTH];
+ }
+ }
+ }
+
+ private function _backReferences($match, $offset) {
+ $replacement = $this->buffer['replacement'];
+ $quote = $this->buffer['quote'];
+ $i = $this->buffer['length'];
+ while ($i) {
+ $replacement = str_replace('$'.$i--, $match[$offset + $i], $replacement);
+ }
+ return $replacement;
+ }
+
+ private function _replace_name($match, $offset){
+ $length = strlen($match[$offset + 2]);
+ $start = $length - max($length - strlen($match[$offset + 3]), 0);
+ return substr($match[$offset + 1], $start, $length) . $match[$offset + 4];
+ }
+
+ private function _replace_encoded($match, $offset) {
+ return $this->buffer[$match[$offset]];
+ }
+
+
+ // php : we cannot pass additional data to preg_replace_callback,
+ // and we cannot use &$this in create_function, so let's go to lower level
+ private $buffer;
+
+ // encode escaped characters
+ private function _escape($string, $escapeChar) {
+ if ($escapeChar) {
+ $this->buffer = $escapeChar;
+ return preg_replace_callback(
+ '/\\' . $escapeChar . '(.)' .'/',
+ array(&$this, '_escapeBis'),
+ $string
+ );
+
+ } else {
+ return $string;
+ }
+ }
+ private function _escapeBis($match) {
+ $this->_escaped[] = $match[1];
+ return $this->buffer;
+ }
+
+ // decode escaped characters
+ private function _unescape($string, $escapeChar) {
+ if ($escapeChar) {
+ $regexp = '/'.'\\'.$escapeChar.'/';
+ $this->buffer = array('escapeChar'=> $escapeChar, 'i' => 0);
+ return preg_replace_callback
+ (
+ $regexp,
+ array(&$this, '_unescapeBis'),
+ $string
+ );
+
+ } else {
+ return $string;
+ }
+ }
+ private function _unescapeBis() {
+ if (isset($this->_escaped[$this->buffer['i']])
+ && $this->_escaped[$this->buffer['i']] != '')
+ {
+ $temp = $this->_escaped[$this->buffer['i']];
+ } else {
+ $temp = '';
+ }
+ $this->buffer['i']++;
+ return $this->buffer['escapeChar'] . $temp;
+ }
+
+ private function _internalEscape($string) {
+ return preg_replace($this->ESCAPE, '', $string);
+ }
+}
+?>
--- /dev/null
+<?php
+
+if ($argc >= 3) {
+ $src = $argv[1];
+ $out = $argv[2];
+} else {
+ echo 'you must specify a source file and a result filename',"\n";
+ echo 'example :', "\n", 'php pack.php myScript-src.js myPackedScript.js',"\n";
+ return;
+}
+
+require 'class.JavaScriptPacker.php';
+
+$script = file_get_contents($src);
+
+$packer = new JavaScriptPacker($script, 'Normal', true, false);
+$packed = $packer->pack();
+
+file_put_contents($out, $packed);
+?>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="html" />
+
+ <xsl:template name="ref">
+ <xsl:text>link-</xsl:text>
+ <xsl:value-of select="translate(@name, '$.|', '')"/>
+ <xsl:text>-</xsl:text>
+ <xsl:for-each select="params">
+ <xsl:value-of select="translate(@name, '<>|$.', '')" />
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="href">
+ <xsl:attribute name="href">
+ <xsl:text>#</xsl:text>
+ <xsl:call-template name="ref" />
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template name="id">
+ <xsl:attribute name="id">
+ <xsl:call-template name="ref" />
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template name="return">
+ <xsl:attribute name="title">
+ <xsl:choose>
+ <xsl:when test="@return='jQuery'">A jQuery object.</xsl:when>
+ <xsl:when test="@return='Boolean'">true or false.</xsl:when>
+ <xsl:when test="@return='Object'">A simple Javascript object..</xsl:when>
+ <xsl:when test="@return='String'">A string of characters.</xsl:when>
+ <xsl:when test="@return='Number'">A valid numeric.</xsl:when>
+ <xsl:when test="@return='String|Number'">A string of characters or a number.</xsl:when>
+ <xsl:when test="@return='Element'">The Javascript object representation of a DOM Element.</xsl:when>
+ <xsl:when test="@return='Element|Array<Element>'">One or more DOM Elements (a single one or an array).</xsl:when>
+ <xsl:when test="@return='Map'">A Javascript object that contains key/value pairs in the form of properties and values.</xsl:when>
+ <xsl:when test="@return='Array<Element>'">An Array of DOM Elements.</xsl:when>
+ <xsl:when test="@return='Array<String>'">An Array of strings.</xsl:when>
+ <xsl:when test="@return='Function'">A reference to a Javascript function.</xsl:when>
+ <xsl:when test="@return='XMLHttpRequest'">An XMLHttpRequest object (referencing a HTTP request).</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:value-of select="@return"/>
+ </xsl:template>
+
+ <xsl:template name="type">
+ <xsl:attribute name="title">
+ <xsl:choose>
+ <xsl:when test="@type='jQuery'">A jQuery object.</xsl:when>
+ <xsl:when test="@type='Boolean'">true or false.</xsl:when>
+ <xsl:when test="@type='Object'">A simple Javascript object..</xsl:when>
+ <xsl:when test="@type='String'">A string of characters.</xsl:when>
+ <xsl:when test="@type='Number'">A valid numeric.</xsl:when>
+ <xsl:when test="@type='String|Number'">A string of characters or a number.</xsl:when>
+ <xsl:when test="@type='Element'">The Javascript object representation of a DOM Element.</xsl:when>
+ <xsl:when test="@type='Element|Array<Element>'">One or more DOM Elements (a single one or an array).</xsl:when>
+ <xsl:when test="@type='Map'">A Javascript object that contains key/value pairs in the form of properties and values.</xsl:when>
+ <xsl:when test="@type='Array<Element>'">An Array of DOM Elements.</xsl:when>
+ <xsl:when test="@type='Array<String>'">An Array of strings.</xsl:when>
+ <xsl:when test="@type='Function'">A reference to a Javascript function.</xsl:when>
+ <xsl:when test="@type='XMLHttpRequest'">An XMLHttpRequest object (referencing a HTTP request).</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:value-of select="@type"/>
+ </xsl:template>
+
+ <xsl:template name="break">
+ <xsl:value-of select="." disable-output-escaping="yes" />
+ </xsl:template>
+
+ <xsl:template name="option">
+ <div class="param">
+ <div class="param-header">
+ <h3><span><xsl:value-of select="@name"/></span></h3>
+ <p class="param-type"><span><xsl:call-template name="type" /></span></p>
+ <p class="param-default">Default: <xsl:value-of select="@default"/></p>
+ </div>
+ <div class="param-details">
+ <p><xsl:value-of select="desc"/></p>
+ <!-- TODO select all examples -->
+ <xsl:for-each select="following-sibling::example[1]">
+ <h4>Code sample:</h4>
+ <p><xsl:value-of select="desc" disable-output-escaping="yes"/></p>
+ <code>
+ <xsl:value-of select="code"/>
+ </code>
+ </xsl:for-each>
+ </div>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="/*">
+ <div id="widget-docs">
+ <ul>
+ <li><a href="#docs-overview"><span>Overview</span></a></li>
+ <li><a href="#docs-options"><span>Options</span></a></li>
+ <li><a href="#docs-methods"><span>Methods</span></a></li>
+ <li><a href="#docs-theming"><span>Theming</span></a></li>
+ </ul>
+
+ <!-- TAB 1 -->
+ <div id="docs-overview">
+ <div id="docs-overview-sidebar">
+ <h4>Dependencies:</h4>
+ <ul>
+ <li><a href="#">ui.core.js</a></li>
+ <li><a href="#">ui.draggable.js <span>(Optional)</span></a></li>
+ <li><a href="#">ui.resizable.js <span>(Optional)</span></a></li>
+ </ul>
+ </div>
+ <div id="docs-overview-main">
+ <p>
+ <xsl:for-each select="//function[1]/desc">
+ <xsl:call-template name="break" />
+ </xsl:for-each>
+ </p>
+ <p>
+ <xsl:for-each select="//function[1]/longdesc">
+ <xsl:call-template name="break" />
+ </xsl:for-each>
+ </p>
+ </div>
+ </div>
+
+ <!-- TAB 2 -->
+ <div id="docs-options">
+ <p class="intro"><xsl:value-of select="//function[1]/params/desc"/></p>
+
+ <div class="docs-list-header clearfix">
+ <h2>Property options</h2>
+ <p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
+ </div>
+
+ <div class="docs-list clearfix">
+ <xsl:for-each select="//function[1]/option[not(starts-with(@type, 'function'))]">
+ <xsl:call-template name="option"/>
+ </xsl:for-each>
+ </div><!-- /property options -->
+
+ <div class="docs-list-header clearfix">
+ <h2>Event options</h2>
+ <p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
+ </div>
+
+ <div class="docs-list clearfix">
+ <xsl:for-each select="//function[1]/option[starts-with(@type, 'function')]">
+ <xsl:call-template name="option"/>
+ </xsl:for-each>
+ </div><!-- /event options -->
+ </div>
+
+ <!-- TAB 3 -->
+ <div id="docs-methods">
+ <p class="intro">A brief description of methods and their uses goes here so their use is clearly explained and any caveats can be mentioned up front.</p>
+
+ <div class="docs-list-header clearfix">
+ <h2>Methods</h2>
+ <p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
+ </div>
+
+ <div class="docs-list clearfix">
+ <xsl:for-each select="//function[position() != 1]">
+ <div class="param">
+ <div class="param-header">
+ <h3><span><xsl:value-of select="//function[1]/@name"/>( <xsl:value-of select="params[1]/@name"/>
+ <xsl:for-each select="params[position() != 1]">
+ <xsl:text>, </xsl:text><xsl:value-of select="@name"/>
+ </xsl:for-each>
+ )</span></h3>
+ <p class="param-type">Returns: <span><xsl:call-template name="return" /></span></p>
+ </div>
+ <div class="param-details">
+ <p><xsl:value-of select="desc"/></p>
+ <p><xsl:value-of select="longdesc"/></p>
+ <h4>Arguments:</h4>
+ <table class="param-args" summary="Arguments for this method" cellspacing="0">
+ <tbody>
+ <xsl:for-each select="params[position() != 1]">
+ <tr>
+ <td><xsl:value-of select="@name"/></td>
+ <td><xsl:value-of select="@type"/></td>
+ <td><xsl:value-of select="."/></td>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+
+ <h4>Code sample:</h4>
+ <xsl:for-each select="example">
+ <h5><xsl:value-of select="desc"/></h5>
+ <code>
+ <xsl:value-of select="code"/>
+ </code>
+ </xsl:for-each>
+ </div>
+ </div>
+ </xsl:for-each>
+
+ </div><!-- /methods -->
+ </div>
+
+ <!-- TAB 4 -->
+ <div id="docs-theming">
+ <p class="intro">ui.dialog uses the jQuery UI CSS styles framework for all major components, e.g. for the titlebar, the resize handle, etc., some of which are borrowed from ui.resizable.</p>
+
+ <h3>Sample code with CSS classes</h3>
+
+ <p>Use the classes highlighted in bold to customize the dialog:</p>
+
+ <!-- Remove all framework classes (those from ui.core.css and ui.theme.css) from the markup sample, and highlight all remaining widget classes in bold (<strong>).
+ We decided to omit framework classes to avoid confusion and focus the user on the classes that are necessary for customizing the widget. I've bolded a few for illustration,
+ but in the working code ALL of them should be bolded. -->
+
+ <code>
+ <div class="<strong>ui-dialog</strong>" role="dialog" aria-labelledby="ui-dialog-title-1"><br />
+   <div class="<strong>ui-dialog-titlebar</strong>"><br />
+     <span class="<strong>ui-dialog-title</strong>" id="ui-dialog-title-1">Dialog Title</span><br />
+     <a href="#" class="<strong>ui-dialog-titlebar-close</strong>" role="button" title="Close"><br />
+     <span class="<strong>ui-icon ui-icon-closethick</strong>">Close</span></a><br />
+   </div><br />
+   <div class="<strong>ui-dialog-content</strong>" style="height: 13em;"><br />
+     <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt</p><br />
+   </div><br />
+   <div class="<strong>ui-dialog-buttonpane</strong>"><br />
+     <button class="ui-state-default ui-priority-primary ui-corner-all">Primary</button><br />
+     <button class="ui-state-default ui-priority-secondary ui-corner-all">Secondary</button><br />
+     <button class="ui-state-default ui-state-disabled ui-corner-all">Disabled</button><br />
+   </div><br />
+   <div class="ui-resizable-n ui-resizable-handle"></div><br />
+   <div class="ui-resizable-s ui-resizable-handle"></div><br />
+   <div class="ui-resizable-e ui-resizable-handle"></div><br />
+   <div class="ui-resizable-w ui-resizable-handle"></div><br />
+   <div class="ui-resizable-ne ui-resizable-handle"></div><br />
+   <div class="ui-resizable-se ui-resizable-handle ui-icon ui-icon-grip-diagonal-se"></div><br />
+   <div class="ui-resizable-sw ui-resizable-handle"></div><br />
+   <div class="ui-resizable-nw ui-resizable-handle"></div><br />
+ </div>
+ </code>
+
+ <h3>See also</h3>
+ <ul>
+ <li><a href="#">UI/Resizables plugin documentation</a></li>
+ <li><a href="#">How to create a custom theme</a></li>
+ <li><a href="#">jQuery UI CSS Framework documentation</a></li>
+ <li><a href="#">ThemeRoller: Create your own custom theme</a></li>
+ </ul>
+
+ </div>
+ </div>
+ </xsl:template>
+
+</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-<!--
- jQuery UI Release!
-
- Call task called 'deploy-release' to build a full release.
- The release built will be stored on 'dist' dir.
-
--->
-
-<project name="jquery-ui" default="deploy-release" basedir=".">
-
- <taskdef resource="net/sf/antcontrib/antcontrib.properties">
- <classpath>
- <pathelement location="build/ant-contrib-0.6.jar"/>
- </classpath>
- </taskdef>
-
- <property file="ant.properties" />
-
- <loadfile failonerror="no" srcFile="../version.txt" property="release.version" />
- <property name="release.filename" value="jquery.ui-${release.version}" />
-
- <property name="dist.dir" value="dist/${release.filename}/" />
- <property name="build.dir" value="build" />
- <property name="ui.dir" value="../" />
- <property name="src.dir" value="${ui.dir}/ui/" />
-
- <property name="min.folder" value="${dist.dir}/ui/minified" />
-
- <property name="concatenated" value="jquery.ui.all" />
- <property name="concatenated.i18n" value="jquery.ui.i18n.all" />
-
- <property name="core.files" value="ui.core.js, ui.draggable.js, ui.droppable.js, ui.resizable.js, ui.selectable.js, ui.sortable.js, effects.core.js" />
-
- <property description="YUI Compressor" name="yui-jar" value="${build.dir}/yuicompressor-2.4.2.jar" />
-
- <target name="deploy-release" depends="docs-process, concatenate, minify, copy, replace-version, prepend-header, zip" description="Release builder">
- </target>
-
- <target name="replace-version">
- <replaceregexp match="@VERSION" replace="${release.version}" flags="g" byline="true">
- <fileset dir="${dist.dir}/ui/" includes="*.js"/>
- <fileset dir="${dist.dir}/ui/minified/" includes="*.js"/>
- </replaceregexp>
- <echo message="Replaced all @VERSION to ${release.version}." />
- </target>
-
- <target name="prepend-header">
- <!-- TODO: refactor this ugly mess -->
- <copy todir="${dist.dir}/headers/">
- <fileset dir="${dist.dir}/ui/" includes="*.js" />
- </copy>
- <replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
- <fileset dir="${dist.dir}/headers/" includes="*.js"/>
- </replaceregexp>
- <for param="file">
- <path><fileset dir="${dist.dir}/ui/minified/" includes="*.js" /></path>
- <sequential>
- <propertyregex override="yes" property="target" input="@{file}" regexp=".+\\(.+)\.min\.js$" replace="\1"/>
- <concat destfile="${dist.dir}/ui-headered/${target}.min.js">
- <header file="${dist.dir}/headers/${target}.js" />
- <fileset file="@{file}" />
- </concat>
- </sequential>
- </for>
- <copy todir="${dist.dir}/ui/minified">
- <fileset dir="${dist.dir}/ui-headered/" includes="*.js" />
- </copy>
- <delete dir="${dist.dir}/ui-headered/" />
- </target>
-
- <target description="Zip the package" name="zip">
- <zip destfile="${dist.dir}/../${release.filename}.zip">
- <zipfileset dir="dist/" />
- </zip>
- </target>
-
- <target name="concatenate">
- <echo message="Building concatenated" />
- <mkdir dir="${dist.dir}/ui/" />
- <delete file="${dist.dir}/ui/${concatenated}.js" />
-
- <concat destfile="${dist.dir}/ui/${concatenated}.js">
- <filelist dir="${src.dir}/" files="${core.files}" />
- <fileset dir="${src.dir}/" includes="ui.*.js, effects.*.js" excludes="${core.files}" />
- </concat>
- <echo message="Concatenated built." />
-
- <mkdir dir="${dist.dir}/ui/i18n/" />
- <delete file="${dist.dir}/ui/i18n/${concatenated.i18n}.js" />
-
- <concat destfile="${dist.dir}/ui/i18n/${concatenated.i18n}.js" encoding="utf-8">
- <fileset dir="${src.dir}/i18n/" includes="ui.*.js" />
- </concat>
- <echo message="Concatenated i18n built." />
- </target>
-
- <target name="minify" depends="concatenate" description="Remove all comments and whitespace, no compression, great in combination with GZip">
- <echo message="Building minified" />
- <delete dir="${min.folder}/" />
- <mkdir dir="${min.folder}" />
- <delete dir="${min.folder}/i18n/" />
- <mkdir dir="${min.folder}/i18n/" />
-
- <apply executable="java" parallel="false">
- <filelist dir="${dist.dir}/ui/" files="${concatenated}.js" />
- <fileset dir="${src.dir}/" includes="ui.*.js, effects.*.js" />
- <arg line="-jar" />
- <arg path="${yui-jar}" />
- <arg value="--charset" />
- <arg value="UTF-8" />
- <srcfile />
- <arg line="-o" />
- <mapper type="glob" from="*.js" to="${min.folder}/*.min.js" />
- <targetfile />
- </apply>
- <echo message="Minified built." />
-
- <apply executable="java" parallel="false">
- <filelist dir="${dist.dir}/ui/i18n/" files="${concatenated.i18n}.js" />
- <fileset dir="${src.dir}/i18n/" includes="ui.*.js" />
- <arg line="-jar" />
- <arg path="${yui-jar}" />
- <arg value="--charset" />
- <arg value="UTF-8" />
- <srcfile />
- <arg line="-o" />
- <mapper type="glob" from="*.js" to="${min.folder}/i18n/*.min.js" />
- <targetfile />
- </apply>
- <echo message="Minified i18n built." />
- </target>
-
- <target description="Copy needed folders" name="copy">
- <echo message="Copying files" />
- <mkdir dir="${dist.dir}" />
-
- <copy overwrite="true" todir="${dist.dir}/">
- <fileset dir="${ui.dir}/" includes="jquery-*.js" />
- </copy>
-
- <copy overwrite="true" todir="${dist.dir}/ui/">
- <fileset dir="${src.dir}/" includes="ui.*.js, effects.*.js" />
- </copy>
-
- <copy overwrite="true" todir="${dist.dir}/ui/i18n/" >
- <fileset dir="${src.dir}/i18n/" />
- </copy>
-
- <copy overwrite="true" todir="${dist.dir}/">
- <fileset dir="${ui.dir}/" includes="*.txt" />
- </copy>
-
- <copy overwrite="true" todir="${dist.dir}/demos/" >
- <fileset dir="${ui.dir}/demos/" />
- </copy>
-
- <copy overwrite="true" todir="${dist.dir}/tests/" >
- <fileset dir="${ui.dir}/tests/" />
- </copy>
-
- <copy overwrite="true" todir="${dist.dir}/themes/" >
- <fileset dir="${ui.dir}/themes/" />
- </copy>
- <echo message="Files copied." />
- </target>
-
- <target name="clean">
- <delete dir="dist" />
- </target>
-
- <target name="docs-download">
- <property name="url" value="http://www.exfer.net/jquery/createjQueryXMLDocs.py?start=UI/" />
- <get src="${url}Accordion" dest="docs-accordion.xml" />
- <get src="${url}Datepicker" dest="docs-datepicker.xml" />
- <get src="${url}Dialog" dest="docs-dialog.xml" />
- <get src="${url}Draggable" dest="docs-draggable.xml" />
- <get src="${url}Droppable" dest="docs-droppable.xml" />
- <get src="${url}Progressbar" dest="docs-progressbar.xml" />
- <get src="${url}Resizable" dest="docs-resizable.xml" />
- <get src="${url}Selectable" dest="docs-selectable.xml" />
- <get src="${url}Slider" dest="docs-slider.xml" />
- <get src="${url}Sortable" dest="docs-sortable.xml" />
- <get src="${url}Tabs" dest="docs-tabs.xml" />
- </target>
-
- <target name="docs-process" depends="docs-download">
- <property name="docs.dir" value="${ui.dir}/demos/documentation" />
- <delete dir="${docs.dir}" />
- <mkdir dir="${docs.dir}" />
- <xslt includes="docs-*.xml" destdir="${docs.dir}" style="build/style.xsl" />
- </target>
-
- <target name="docs-clean">
- <delete>
- <fileset file="*.xml" excludes="build.xml" />
- </delete>
- </target>
-
-</project>
+++ /dev/null
-<?php
-/* 9 April 2008. version 1.1
- *
- * This is the php version of the Dean Edwards JavaScript's Packer,
- * Based on :
- *
- * ParseMaster, version 1.0.2 (2005-08-19) Copyright 2005, Dean Edwards
- * a multi-pattern parser.
- * KNOWN BUG: erroneous behavior when using escapeChar with a replacement
- * value that is a function
- *
- * packer, version 2.0.2 (2005-08-19) Copyright 2004-2005, Dean Edwards
- *
- * License: http://creativecommons.org/licenses/LGPL/2.1/
- *
- * Ported to PHP by Nicolas Martin.
- *
- * ----------------------------------------------------------------------
- * changelog:
- * 1.1 : correct a bug, '\0' packed then unpacked becomes '\'.
- * ----------------------------------------------------------------------
- *
- * examples of usage :
- * $myPacker = new JavaScriptPacker($script, 62, true, false);
- * $packed = $myPacker->pack();
- *
- * or
- *
- * $myPacker = new JavaScriptPacker($script, 'Normal', true, false);
- * $packed = $myPacker->pack();
- *
- * or (default values)
- *
- * $myPacker = new JavaScriptPacker($script);
- * $packed = $myPacker->pack();
- *
- *
- * params of the constructor :
- * $script: the JavaScript to pack, string.
- * $encoding: level of encoding, int or string :
- * 0,10,62,95 or 'None', 'Numeric', 'Normal', 'High ASCII'.
- * default: 62.
- * $fastDecode: include the fast decoder in the packed result, boolean.
- * default : true.
- * $specialChars: if you are flagged your private and local variables
- * in the script, boolean.
- * default: false.
- *
- * The pack() method return the compressed JavasScript, as a string.
- *
- * see http://dean.edwards.name/packer/usage/ for more information.
- *
- * Notes :
- * # need PHP 5 . Tested with PHP 5.1.2, 5.1.3, 5.1.4, 5.2.3
- *
- * # The packed result may be different than with the Dean Edwards
- * version, but with the same length. The reason is that the PHP
- * function usort to sort array don't necessarily preserve the
- * original order of two equal member. The Javascript sort function
- * in fact preserve this order (but that's not require by the
- * ECMAScript standard). So the encoded keywords order can be
- * different in the two results.
- *
- * # Be careful with the 'High ASCII' Level encoding if you use
- * UTF-8 in your files...
- */
-
-
-class JavaScriptPacker {
- // constants
- const IGNORE = '$1';
-
- // validate parameters
- private $_script = '';
- private $_encoding = 62;
- private $_fastDecode = true;
- private $_specialChars = false;
-
- private $LITERAL_ENCODING = array(
- 'None' => 0,
- 'Numeric' => 10,
- 'Normal' => 62,
- 'High ASCII' => 95
- );
-
- public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
- {
- $this->_script = $_script . "\n";
- if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
- $_encoding = $this->LITERAL_ENCODING[$_encoding];
- $this->_encoding = min((int)$_encoding, 95);
- $this->_fastDecode = $_fastDecode;
- $this->_specialChars = $_specialChars;
- }
-
- public function pack() {
- $this->_addParser('_basicCompression');
- if ($this->_specialChars)
- $this->_addParser('_encodeSpecialChars');
- if ($this->_encoding)
- $this->_addParser('_encodeKeywords');
-
- // go!
- return $this->_pack($this->_script);
- }
-
- // apply all parsing routines
- private function _pack($script) {
- for ($i = 0; isset($this->_parsers[$i]); $i++) {
- $script = call_user_func(array(&$this,$this->_parsers[$i]), $script);
- }
- return $script;
- }
-
- // keep a list of parsing functions, they'll be executed all at once
- private $_parsers = array();
- private function _addParser($parser) {
- $this->_parsers[] = $parser;
- }
-
- // zero encoding - just removal of white space and comments
- private function _basicCompression($script) {
- $parser = new ParseMaster();
- // make safe
- $parser->escapeChar = '\\';
- // protect strings
- $parser->add('/\'[^\'\\n\\r]*\'/', self::IGNORE);
- $parser->add('/"[^"\\n\\r]*"/', self::IGNORE);
- // remove comments
- $parser->add('/\\/\\/[^\\n\\r]*[\\n\\r]/', ' ');
- $parser->add('/\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\//', ' ');
- // protect regular expressions
- $parser->add('/\\s+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/g?i?)/', '$2'); // IGNORE
- $parser->add('/[^\\w\\x24\\/\'"*)\\?:]\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/g?i?/', self::IGNORE);
- // remove: ;;; doSomething();
- if ($this->_specialChars) $parser->add('/;;;[^\\n\\r]+[\\n\\r]/');
- // remove redundant semi-colons
- $parser->add('/\\(;;\\)/', self::IGNORE); // protect for (;;) loops
- $parser->add('/;+\\s*([};])/', '$2');
- // apply the above
- $script = $parser->exec($script);
-
- // remove white-space
- $parser->add('/(\\b|\\x24)\\s+(\\b|\\x24)/', '$2 $3');
- $parser->add('/([+\\-])\\s+([+\\-])/', '$2 $3');
- $parser->add('/\\s+/', '');
- // done
- return $parser->exec($script);
- }
-
- private function _encodeSpecialChars($script) {
- $parser = new ParseMaster();
- // replace: $name -> n, $$name -> na
- $parser->add('/((\\x24+)([a-zA-Z$_]+))(\\d*)/',
- array('fn' => '_replace_name')
- );
- // replace: _name -> _0, double-underscore (__name) is ignored
- $regexp = '/\\b_[A-Za-z\\d]\\w*/';
- // build the word list
- $keywords = $this->_analyze($script, $regexp, '_encodePrivate');
- // quick ref
- $encoded = $keywords['encoded'];
-
- $parser->add($regexp,
- array(
- 'fn' => '_replace_encoded',
- 'data' => $encoded
- )
- );
- return $parser->exec($script);
- }
-
- private function _encodeKeywords($script) {
- // escape high-ascii values already in the script (i.e. in strings)
- if ($this->_encoding > 62)
- $script = $this->_escape95($script);
- // create the parser
- $parser = new ParseMaster();
- $encode = $this->_getEncoder($this->_encoding);
- // for high-ascii, don't encode single character low-ascii
- $regexp = ($this->_encoding > 62) ? '/\\w\\w+/' : '/\\w+/';
- // build the word list
- $keywords = $this->_analyze($script, $regexp, $encode);
- $encoded = $keywords['encoded'];
-
- // encode
- $parser->add($regexp,
- array(
- 'fn' => '_replace_encoded',
- 'data' => $encoded
- )
- );
- if (empty($script)) return $script;
- else {
- //$res = $parser->exec($script);
- //$res = $this->_bootStrap($res, $keywords);
- //return $res;
- return $this->_bootStrap($parser->exec($script), $keywords);
- }
- }
-
- private function _analyze($script, $regexp, $encode) {
- // analyse
- // retreive all words in the script
- $all = array();
- preg_match_all($regexp, $script, $all);
- $_sorted = array(); // list of words sorted by frequency
- $_encoded = array(); // dictionary of word->encoding
- $_protected = array(); // instances of "protected" words
- $all = $all[0]; // simulate the javascript comportement of global match
- if (!empty($all)) {
- $unsorted = array(); // same list, not sorted
- $protected = array(); // "protected" words (dictionary of word->"word")
- $value = array(); // dictionary of charCode->encoding (eg. 256->ff)
- $this->_count = array(); // word->count
- $i = count($all); $j = 0; //$word = null;
- // count the occurrences - used for sorting later
- do {
- --$i;
- $word = '$' . $all[$i];
- if (!isset($this->_count[$word])) {
- $this->_count[$word] = 0;
- $unsorted[$j] = $word;
- // make a dictionary of all of the protected words in this script
- // these are words that might be mistaken for encoding
- //if (is_string($encode) && method_exists($this, $encode))
- $values[$j] = call_user_func(array(&$this, $encode), $j);
- $protected['$' . $values[$j]] = $j++;
- }
- // increment the word counter
- $this->_count[$word]++;
- } while ($i > 0);
- // prepare to sort the word list, first we must protect
- // words that are also used as codes. we assign them a code
- // equivalent to the word itself.
- // e.g. if "do" falls within our encoding range
- // then we store keywords["do"] = "do";
- // this avoids problems when decoding
- $i = count($unsorted);
- do {
- $word = $unsorted[--$i];
- if (isset($protected[$word]) /*!= null*/) {
- $_sorted[$protected[$word]] = substr($word, 1);
- $_protected[$protected[$word]] = true;
- $this->_count[$word] = 0;
- }
- } while ($i);
-
- // sort the words by frequency
- // Note: the javascript and php version of sort can be different :
- // in php manual, usort :
- // " If two members compare as equal,
- // their order in the sorted array is undefined."
- // so the final packed script is different of the Dean's javascript version
- // but equivalent.
- // the ECMAscript standard does not guarantee this behaviour,
- // and thus not all browsers (e.g. Mozilla versions dating back to at
- // least 2003) respect this.
- usort($unsorted, array(&$this, '_sortWords'));
- $j = 0;
- // because there are "protected" words in the list
- // we must add the sorted words around them
- do {
- if (!isset($_sorted[$i]))
- $_sorted[$i] = substr($unsorted[$j++], 1);
- $_encoded[$_sorted[$i]] = $values[$i];
- } while (++$i < count($unsorted));
- }
- return array(
- 'sorted' => $_sorted,
- 'encoded' => $_encoded,
- 'protected' => $_protected);
- }
-
- private $_count = array();
- private function _sortWords($match1, $match2) {
- return $this->_count[$match2] - $this->_count[$match1];
- }
-
- // build the boot function used for loading and decoding
- private function _bootStrap($packed, $keywords) {
- $ENCODE = $this->_safeRegExp('$encode\\($count\\)');
-
- // $packed: the packed script
- $packed = "'" . $this->_escape($packed) . "'";
-
- // $ascii: base for encoding
- $ascii = min(count($keywords['sorted']), $this->_encoding);
- if ($ascii == 0) $ascii = 1;
-
- // $count: number of words contained in the script
- $count = count($keywords['sorted']);
-
- // $keywords: list of words contained in the script
- foreach ($keywords['protected'] as $i=>$value) {
- $keywords['sorted'][$i] = '';
- }
- // convert from a string to an array
- ksort($keywords['sorted']);
- $keywords = "'" . implode('|',$keywords['sorted']) . "'.split('|')";
-
- $encode = ($this->_encoding > 62) ? '_encode95' : $this->_getEncoder($ascii);
- $encode = $this->_getJSFunction($encode);
- $encode = preg_replace('/_encoding/','$ascii', $encode);
- $encode = preg_replace('/arguments\\.callee/','$encode', $encode);
- $inline = '\\$count' . ($ascii > 10 ? '.toString(\\$ascii)' : '');
-
- // $decode: code snippet to speed up decoding
- if ($this->_fastDecode) {
- // create the decoder
- $decode = $this->_getJSFunction('_decodeBody');
- if ($this->_encoding > 62)
- $decode = preg_replace('/\\\\w/', '[\\xa1-\\xff]', $decode);
- // perform the encoding inline for lower ascii values
- elseif ($ascii < 36)
- $decode = preg_replace($ENCODE, $inline, $decode);
- // special case: when $count==0 there are no keywords. I want to keep
- // the basic shape of the unpacking funcion so i'll frig the code...
- if ($count == 0)
- $decode = preg_replace($this->_safeRegExp('($count)\\s*=\\s*1'), '$1=0', $decode, 1);
- }
-
- // boot function
- $unpack = $this->_getJSFunction('_unpack');
- if ($this->_fastDecode) {
- // insert the decoder
- $this->buffer = $decode;
- $unpack = preg_replace_callback('/\\{/', array(&$this, '_insertFastDecode'), $unpack, 1);
- }
- $unpack = preg_replace('/"/', "'", $unpack);
- if ($this->_encoding > 62) { // high-ascii
- // get rid of the word-boundaries for regexp matches
- $unpack = preg_replace('/\'\\\\\\\\b\'\s*\\+|\\+\s*\'\\\\\\\\b\'/', '', $unpack);
- }
- if ($ascii > 36 || $this->_encoding > 62 || $this->_fastDecode) {
- // insert the encode function
- $this->buffer = $encode;
- $unpack = preg_replace_callback('/\\{/', array(&$this, '_insertFastEncode'), $unpack, 1);
- } else {
- // perform the encoding inline
- $unpack = preg_replace($ENCODE, $inline, $unpack);
- }
- // pack the boot function too
- $unpackPacker = new JavaScriptPacker($unpack, 0, false, true);
- $unpack = $unpackPacker->pack();
-
- // arguments
- $params = array($packed, $ascii, $count, $keywords);
- if ($this->_fastDecode) {
- $params[] = 0;
- $params[] = '{}';
- }
- $params = implode(',', $params);
-
- // the whole thing
- return 'eval(' . $unpack . '(' . $params . "))\n";
- }
-
- private $buffer;
- private function _insertFastDecode($match) {
- return '{' . $this->buffer . ';';
- }
- private function _insertFastEncode($match) {
- return '{$encode=' . $this->buffer . ';';
- }
-
- // mmm.. ..which one do i need ??
- private function _getEncoder($ascii) {
- return $ascii > 10 ? $ascii > 36 ? $ascii > 62 ?
- '_encode95' : '_encode62' : '_encode36' : '_encode10';
- }
-
- // zero encoding
- // characters: 0123456789
- private function _encode10($charCode) {
- return $charCode;
- }
-
- // inherent base36 support
- // characters: 0123456789abcdefghijklmnopqrstuvwxyz
- private function _encode36($charCode) {
- return base_convert($charCode, 10, 36);
- }
-
- // hitch a ride on base36 and add the upper case alpha characters
- // characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
- private function _encode62($charCode) {
- $res = '';
- if ($charCode >= $this->_encoding) {
- $res = $this->_encode62((int)($charCode / $this->_encoding));
- }
- $charCode = $charCode % $this->_encoding;
-
- if ($charCode > 35)
- return $res . chr($charCode + 29);
- else
- return $res . base_convert($charCode, 10, 36);
- }
-
- // use high-ascii values
- // characters: ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ
- private function _encode95($charCode) {
- $res = '';
- if ($charCode >= $this->_encoding)
- $res = $this->_encode95($charCode / $this->_encoding);
-
- return $res . chr(($charCode % $this->_encoding) + 161);
- }
-
- private function _safeRegExp($string) {
- return '/'.preg_replace('/\$/', '\\\$', $string).'/';
- }
-
- private function _encodePrivate($charCode) {
- return "_" . $charCode;
- }
-
- // protect characters used by the parser
- private function _escape($script) {
- return preg_replace('/([\\\\\'])/', '\\\$1', $script);
- }
-
- // protect high-ascii characters already in the script
- private function _escape95($script) {
- return preg_replace_callback(
- '/[\\xa1-\\xff]/',
- array(&$this, '_escape95Bis'),
- $script
- );
- }
- private function _escape95Bis($match) {
- return '\x'.((string)dechex(ord($match)));
- }
-
-
- private function _getJSFunction($aName) {
- if (defined('self::JSFUNCTION'.$aName))
- return constant('self::JSFUNCTION'.$aName);
- else
- return '';
- }
-
- // JavaScript Functions used.
- // Note : In Dean's version, these functions are converted
- // with 'String(aFunctionName);'.
- // This internal conversion complete the original code, ex :
- // 'while (aBool) anAction();' is converted to
- // 'while (aBool) { anAction(); }'.
- // The JavaScript functions below are corrected.
-
- // unpacking function - this is the boot strap function
- // data extracted from this packing routine is passed to
- // this function when decoded in the target
- // NOTE ! : without the ';' final.
- const JSFUNCTION_unpack =
-
-'function($packed, $ascii, $count, $keywords, $encode, $decode) {
- while ($count--) {
- if ($keywords[$count]) {
- $packed = $packed.replace(new RegExp(\'\\\\b\' + $encode($count) + \'\\\\b\', \'g\'), $keywords[$count]);
- }
- }
- return $packed;
-}';
-/*
-'function($packed, $ascii, $count, $keywords, $encode, $decode) {
- while ($count--)
- if ($keywords[$count])
- $packed = $packed.replace(new RegExp(\'\\\\b\' + $encode($count) + \'\\\\b\', \'g\'), $keywords[$count]);
- return $packed;
-}';
-*/
-
- // code-snippet inserted into the unpacker to speed up decoding
- const JSFUNCTION_decodeBody =
-//_decode = function() {
-// does the browser support String.replace where the
-// replacement value is a function?
-
-' if (!\'\'.replace(/^/, String)) {
- // decode all the values we need
- while ($count--) {
- $decode[$encode($count)] = $keywords[$count] || $encode($count);
- }
- // global replacement function
- $keywords = [function ($encoded) {return $decode[$encoded]}];
- // generic match
- $encode = function () {return \'\\\\w+\'};
- // reset the loop counter - we are now doing a global replace
- $count = 1;
- }
-';
-//};
-/*
-' if (!\'\'.replace(/^/, String)) {
- // decode all the values we need
- while ($count--) $decode[$encode($count)] = $keywords[$count] || $encode($count);
- // global replacement function
- $keywords = [function ($encoded) {return $decode[$encoded]}];
- // generic match
- $encode = function () {return\'\\\\w+\'};
- // reset the loop counter - we are now doing a global replace
- $count = 1;
- }';
-*/
-
- // zero encoding
- // characters: 0123456789
- const JSFUNCTION_encode10 =
-'function($charCode) {
- return $charCode;
-}';//;';
-
- // inherent base36 support
- // characters: 0123456789abcdefghijklmnopqrstuvwxyz
- const JSFUNCTION_encode36 =
-'function($charCode) {
- return $charCode.toString(36);
-}';//;';
-
- // hitch a ride on base36 and add the upper case alpha characters
- // characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
- const JSFUNCTION_encode62 =
-'function($charCode) {
- return ($charCode < _encoding ? \'\' : arguments.callee(parseInt($charCode / _encoding))) +
- (($charCode = $charCode % _encoding) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36));
-}';
-
- // use high-ascii values
- // characters: ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ
- const JSFUNCTION_encode95 =
-'function($charCode) {
- return ($charCode < _encoding ? \'\' : arguments.callee($charCode / _encoding)) +
- String.fromCharCode($charCode % _encoding + 161);
-}';
-
-}
-
-
-class ParseMaster {
- public $ignoreCase = false;
- public $escapeChar = '';
-
- // constants
- const EXPRESSION = 0;
- const REPLACEMENT = 1;
- const LENGTH = 2;
-
- // used to determine nesting levels
- private $GROUPS = '/\\(/';//g
- private $SUB_REPLACE = '/\\$\\d/';
- private $INDEXED = '/^\\$\\d+$/';
- private $TRIM = '/([\'"])\\1\\.(.*)\\.\\1\\1$/';
- private $ESCAPE = '/\\\./';//g
- private $QUOTE = '/\'/';
- private $DELETED = '/\\x01[^\\x01]*\\x01/';//g
-
- public function add($expression, $replacement = '') {
- // count the number of sub-expressions
- // - add one because each pattern is itself a sub-expression
- $length = 1 + preg_match_all($this->GROUPS, $this->_internalEscape((string)$expression), $out);
-
- // treat only strings $replacement
- if (is_string($replacement)) {
- // does the pattern deal with sub-expressions?
- if (preg_match($this->SUB_REPLACE, $replacement)) {
- // a simple lookup? (e.g. "$2")
- if (preg_match($this->INDEXED, $replacement)) {
- // store the index (used for fast retrieval of matched strings)
- $replacement = (int)(substr($replacement, 1)) - 1;
- } else { // a complicated lookup (e.g. "Hello $2 $1")
- // build a function to do the lookup
- $quote = preg_match($this->QUOTE, $this->_internalEscape($replacement))
- ? '"' : "'";
- $replacement = array(
- 'fn' => '_backReferences',
- 'data' => array(
- 'replacement' => $replacement,
- 'length' => $length,
- 'quote' => $quote
- )
- );
- }
- }
- }
- // pass the modified arguments
- if (!empty($expression)) $this->_add($expression, $replacement, $length);
- else $this->_add('/^$/', $replacement, $length);
- }
-
- public function exec($string) {
- // execute the global replacement
- $this->_escaped = array();
-
- // simulate the _patterns.toSTring of Dean
- $regexp = '/';
- foreach ($this->_patterns as $reg) {
- $regexp .= '(' . substr($reg[self::EXPRESSION], 1, -1) . ')|';
- }
- $regexp = substr($regexp, 0, -1) . '/';
- $regexp .= ($this->ignoreCase) ? 'i' : '';
-
- $string = $this->_escape($string, $this->escapeChar);
- $string = preg_replace_callback(
- $regexp,
- array(
- &$this,
- '_replacement'
- ),
- $string
- );
- $string = $this->_unescape($string, $this->escapeChar);
-
- return preg_replace($this->DELETED, '', $string);
- }
-
- public function reset() {
- // clear the patterns collection so that this object may be re-used
- $this->_patterns = array();
- }
-
- // private
- private $_escaped = array(); // escaped characters
- private $_patterns = array(); // patterns stored by index
-
- // create and add a new pattern to the patterns collection
- private function _add() {
- $arguments = func_get_args();
- $this->_patterns[] = $arguments;
- }
-
- // this is the global replace function (it's quite complicated)
- private function _replacement($arguments) {
- if (empty($arguments)) return '';
-
- $i = 1; $j = 0;
- // loop through the patterns
- while (isset($this->_patterns[$j])) {
- $pattern = $this->_patterns[$j++];
- // do we have a result?
- if (isset($arguments[$i]) && ($arguments[$i] != '')) {
- $replacement = $pattern[self::REPLACEMENT];
-
- if (is_array($replacement) && isset($replacement['fn'])) {
-
- if (isset($replacement['data'])) $this->buffer = $replacement['data'];
- return call_user_func(array(&$this, $replacement['fn']), $arguments, $i);
-
- } elseif (is_int($replacement)) {
- return $arguments[$replacement + $i];
-
- }
- $delete = ($this->escapeChar == '' ||
- strpos($arguments[$i], $this->escapeChar) === false)
- ? '' : "\x01" . $arguments[$i] . "\x01";
- return $delete . $replacement;
-
- // skip over references to sub-expressions
- } else {
- $i += $pattern[self::LENGTH];
- }
- }
- }
-
- private function _backReferences($match, $offset) {
- $replacement = $this->buffer['replacement'];
- $quote = $this->buffer['quote'];
- $i = $this->buffer['length'];
- while ($i) {
- $replacement = str_replace('$'.$i--, $match[$offset + $i], $replacement);
- }
- return $replacement;
- }
-
- private function _replace_name($match, $offset){
- $length = strlen($match[$offset + 2]);
- $start = $length - max($length - strlen($match[$offset + 3]), 0);
- return substr($match[$offset + 1], $start, $length) . $match[$offset + 4];
- }
-
- private function _replace_encoded($match, $offset) {
- return $this->buffer[$match[$offset]];
- }
-
-
- // php : we cannot pass additional data to preg_replace_callback,
- // and we cannot use &$this in create_function, so let's go to lower level
- private $buffer;
-
- // encode escaped characters
- private function _escape($string, $escapeChar) {
- if ($escapeChar) {
- $this->buffer = $escapeChar;
- return preg_replace_callback(
- '/\\' . $escapeChar . '(.)' .'/',
- array(&$this, '_escapeBis'),
- $string
- );
-
- } else {
- return $string;
- }
- }
- private function _escapeBis($match) {
- $this->_escaped[] = $match[1];
- return $this->buffer;
- }
-
- // decode escaped characters
- private function _unescape($string, $escapeChar) {
- if ($escapeChar) {
- $regexp = '/'.'\\'.$escapeChar.'/';
- $this->buffer = array('escapeChar'=> $escapeChar, 'i' => 0);
- return preg_replace_callback
- (
- $regexp,
- array(&$this, '_unescapeBis'),
- $string
- );
-
- } else {
- return $string;
- }
- }
- private function _unescapeBis() {
- if (isset($this->_escaped[$this->buffer['i']])
- && $this->_escaped[$this->buffer['i']] != '')
- {
- $temp = $this->_escaped[$this->buffer['i']];
- } else {
- $temp = '';
- }
- $this->buffer['i']++;
- return $this->buffer['escapeChar'] . $temp;
- }
-
- private function _internalEscape($string) {
- return preg_replace($this->ESCAPE, '', $string);
- }
-}
-?>
+++ /dev/null
-<?php
-
-if ($argc >= 3) {
- $src = $argv[1];
- $out = $argv[2];
-} else {
- echo 'you must specify a source file and a result filename',"\n";
- echo 'example :', "\n", 'php pack.php myScript-src.js myPackedScript.js',"\n";
- return;
-}
-
-require 'class.JavaScriptPacker.php';
-
-$script = file_get_contents($src);
-
-$packer = new JavaScriptPacker($script, 'Normal', true, false);
-$packed = $packer->pack();
-
-file_put_contents($out, $packed);
-?>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:output method="html" />
-
- <xsl:template name="ref">
- <xsl:text>link-</xsl:text>
- <xsl:value-of select="translate(@name, '$.|', '')"/>
- <xsl:text>-</xsl:text>
- <xsl:for-each select="params">
- <xsl:value-of select="translate(@name, '<>|$.', '')" />
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="href">
- <xsl:attribute name="href">
- <xsl:text>#</xsl:text>
- <xsl:call-template name="ref" />
- </xsl:attribute>
- </xsl:template>
-
- <xsl:template name="id">
- <xsl:attribute name="id">
- <xsl:call-template name="ref" />
- </xsl:attribute>
- </xsl:template>
-
- <xsl:template name="return">
- <xsl:attribute name="title">
- <xsl:choose>
- <xsl:when test="@return='jQuery'">A jQuery object.</xsl:when>
- <xsl:when test="@return='Boolean'">true or false.</xsl:when>
- <xsl:when test="@return='Object'">A simple Javascript object..</xsl:when>
- <xsl:when test="@return='String'">A string of characters.</xsl:when>
- <xsl:when test="@return='Number'">A valid numeric.</xsl:when>
- <xsl:when test="@return='String|Number'">A string of characters or a number.</xsl:when>
- <xsl:when test="@return='Element'">The Javascript object representation of a DOM Element.</xsl:when>
- <xsl:when test="@return='Element|Array<Element>'">One or more DOM Elements (a single one or an array).</xsl:when>
- <xsl:when test="@return='Map'">A Javascript object that contains key/value pairs in the form of properties and values.</xsl:when>
- <xsl:when test="@return='Array<Element>'">An Array of DOM Elements.</xsl:when>
- <xsl:when test="@return='Array<String>'">An Array of strings.</xsl:when>
- <xsl:when test="@return='Function'">A reference to a Javascript function.</xsl:when>
- <xsl:when test="@return='XMLHttpRequest'">An XMLHttpRequest object (referencing a HTTP request).</xsl:when>
- </xsl:choose>
- </xsl:attribute>
- <xsl:value-of select="@return"/>
- </xsl:template>
-
- <xsl:template name="type">
- <xsl:attribute name="title">
- <xsl:choose>
- <xsl:when test="@type='jQuery'">A jQuery object.</xsl:when>
- <xsl:when test="@type='Boolean'">true or false.</xsl:when>
- <xsl:when test="@type='Object'">A simple Javascript object..</xsl:when>
- <xsl:when test="@type='String'">A string of characters.</xsl:when>
- <xsl:when test="@type='Number'">A valid numeric.</xsl:when>
- <xsl:when test="@type='String|Number'">A string of characters or a number.</xsl:when>
- <xsl:when test="@type='Element'">The Javascript object representation of a DOM Element.</xsl:when>
- <xsl:when test="@type='Element|Array<Element>'">One or more DOM Elements (a single one or an array).</xsl:when>
- <xsl:when test="@type='Map'">A Javascript object that contains key/value pairs in the form of properties and values.</xsl:when>
- <xsl:when test="@type='Array<Element>'">An Array of DOM Elements.</xsl:when>
- <xsl:when test="@type='Array<String>'">An Array of strings.</xsl:when>
- <xsl:when test="@type='Function'">A reference to a Javascript function.</xsl:when>
- <xsl:when test="@type='XMLHttpRequest'">An XMLHttpRequest object (referencing a HTTP request).</xsl:when>
- </xsl:choose>
- </xsl:attribute>
- <xsl:value-of select="@type"/>
- </xsl:template>
-
- <xsl:template name="break">
- <xsl:value-of select="." disable-output-escaping="yes" />
- </xsl:template>
-
- <xsl:template name="option">
- <div class="param">
- <div class="param-header">
- <h3><span><xsl:value-of select="@name"/></span></h3>
- <p class="param-type"><span><xsl:call-template name="type" /></span></p>
- <p class="param-default">Default: <xsl:value-of select="@default"/></p>
- </div>
- <div class="param-details">
- <p><xsl:value-of select="desc"/></p>
- <!-- TODO select all examples -->
- <xsl:for-each select="following-sibling::example[1]">
- <h4>Code sample:</h4>
- <p><xsl:value-of select="desc" disable-output-escaping="yes"/></p>
- <code>
- <xsl:value-of select="code"/>
- </code>
- </xsl:for-each>
- </div>
- </div>
- </xsl:template>
-
- <xsl:template match="/*">
- <div id="widget-docs">
- <ul>
- <li><a href="#docs-overview"><span>Overview</span></a></li>
- <li><a href="#docs-options"><span>Options</span></a></li>
- <li><a href="#docs-methods"><span>Methods</span></a></li>
- <li><a href="#docs-theming"><span>Theming</span></a></li>
- </ul>
-
- <!-- TAB 1 -->
- <div id="docs-overview">
- <div id="docs-overview-sidebar">
- <h4>Dependencies:</h4>
- <ul>
- <li><a href="#">ui.core.js</a></li>
- <li><a href="#">ui.draggable.js <span>(Optional)</span></a></li>
- <li><a href="#">ui.resizable.js <span>(Optional)</span></a></li>
- </ul>
- </div>
- <div id="docs-overview-main">
- <p>
- <xsl:for-each select="//function[1]/desc">
- <xsl:call-template name="break" />
- </xsl:for-each>
- </p>
- <p>
- <xsl:for-each select="//function[1]/longdesc">
- <xsl:call-template name="break" />
- </xsl:for-each>
- </p>
- </div>
- </div>
-
- <!-- TAB 2 -->
- <div id="docs-options">
- <p class="intro"><xsl:value-of select="//function[1]/params/desc"/></p>
-
- <div class="docs-list-header clearfix">
- <h2>Property options</h2>
- <p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
- </div>
-
- <div class="docs-list clearfix">
- <xsl:for-each select="//function[1]/option[not(starts-with(@type, 'function'))]">
- <xsl:call-template name="option"/>
- </xsl:for-each>
- </div><!-- /property options -->
-
- <div class="docs-list-header clearfix">
- <h2>Event options</h2>
- <p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
- </div>
-
- <div class="docs-list clearfix">
- <xsl:for-each select="//function[1]/option[starts-with(@type, 'function')]">
- <xsl:call-template name="option"/>
- </xsl:for-each>
- </div><!-- /event options -->
- </div>
-
- <!-- TAB 3 -->
- <div id="docs-methods">
- <p class="intro">A brief description of methods and their uses goes here so their use is clearly explained and any caveats can be mentioned up front.</p>
-
- <div class="docs-list-header clearfix">
- <h2>Methods</h2>
- <p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
- </div>
-
- <div class="docs-list clearfix">
- <xsl:for-each select="//function[position() != 1]">
- <div class="param">
- <div class="param-header">
- <h3><span><xsl:value-of select="//function[1]/@name"/>( <xsl:value-of select="params[1]/@name"/>
- <xsl:for-each select="params[position() != 1]">
- <xsl:text>, </xsl:text><xsl:value-of select="@name"/>
- </xsl:for-each>
- )</span></h3>
- <p class="param-type">Returns: <span><xsl:call-template name="return" /></span></p>
- </div>
- <div class="param-details">
- <p><xsl:value-of select="desc"/></p>
- <p><xsl:value-of select="longdesc"/></p>
- <h4>Arguments:</h4>
- <table class="param-args" summary="Arguments for this method" cellspacing="0">
- <tbody>
- <xsl:for-each select="params[position() != 1]">
- <tr>
- <td><xsl:value-of select="@name"/></td>
- <td><xsl:value-of select="@type"/></td>
- <td><xsl:value-of select="."/></td>
- </tr>
- </xsl:for-each>
- </tbody>
- </table>
-
- <h4>Code sample:</h4>
- <xsl:for-each select="example">
- <h5><xsl:value-of select="desc"/></h5>
- <code>
- <xsl:value-of select="code"/>
- </code>
- </xsl:for-each>
- </div>
- </div>
- </xsl:for-each>
-
- </div><!-- /methods -->
- </div>
-
- <!-- TAB 4 -->
- <div id="docs-theming">
- <p class="intro">ui.dialog uses the jQuery UI CSS styles framework for all major components, e.g. for the titlebar, the resize handle, etc., some of which are borrowed from ui.resizable.</p>
-
- <h3>Sample code with CSS classes</h3>
-
- <p>Use the classes highlighted in bold to customize the dialog:</p>
-
- <!-- Remove all framework classes (those from ui.core.css and ui.theme.css) from the markup sample, and highlight all remaining widget classes in bold (<strong>).
- We decided to omit framework classes to avoid confusion and focus the user on the classes that are necessary for customizing the widget. I've bolded a few for illustration,
- but in the working code ALL of them should be bolded. -->
-
- <code>
- <div class="<strong>ui-dialog</strong>" role="dialog" aria-labelledby="ui-dialog-title-1"><br />
-   <div class="<strong>ui-dialog-titlebar</strong>"><br />
-     <span class="<strong>ui-dialog-title</strong>" id="ui-dialog-title-1">Dialog Title</span><br />
-     <a href="#" class="<strong>ui-dialog-titlebar-close</strong>" role="button" title="Close"><br />
-     <span class="<strong>ui-icon ui-icon-closethick</strong>">Close</span></a><br />
-   </div><br />
-   <div class="<strong>ui-dialog-content</strong>" style="height: 13em;"><br />
-     <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt</p><br />
-   </div><br />
-   <div class="<strong>ui-dialog-buttonpane</strong>"><br />
-     <button class="ui-state-default ui-priority-primary ui-corner-all">Primary</button><br />
-     <button class="ui-state-default ui-priority-secondary ui-corner-all">Secondary</button><br />
-     <button class="ui-state-default ui-state-disabled ui-corner-all">Disabled</button><br />
-   </div><br />
-   <div class="ui-resizable-n ui-resizable-handle"></div><br />
-   <div class="ui-resizable-s ui-resizable-handle"></div><br />
-   <div class="ui-resizable-e ui-resizable-handle"></div><br />
-   <div class="ui-resizable-w ui-resizable-handle"></div><br />
-   <div class="ui-resizable-ne ui-resizable-handle"></div><br />
-   <div class="ui-resizable-se ui-resizable-handle ui-icon ui-icon-grip-diagonal-se"></div><br />
-   <div class="ui-resizable-sw ui-resizable-handle"></div><br />
-   <div class="ui-resizable-nw ui-resizable-handle"></div><br />
- </div>
- </code>
-
- <h3>See also</h3>
- <ul>
- <li><a href="#">UI/Resizables plugin documentation</a></li>
- <li><a href="#">How to create a custom theme</a></li>
- <li><a href="#">jQuery UI CSS Framework documentation</a></li>
- <li><a href="#">ThemeRoller: Create your own custom theme</a></li>
- </ul>
-
- </div>
- </div>
- </xsl:template>
-
-</xsl:stylesheet>