mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-12-23 01:24:22 +00:00
69 lines
8.1 KiB
XML
69 lines
8.1 KiB
XML
|
<job>
|
||
|
|
||
|
<!-- Windows Scripting Host command line wrapper for Pack.js -->
|
||
|
<!-- Run as CScript //nologo infile > outfile -->
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
function ICommon(that){if(that!=null){that.inherit=Common.prototype.inherit;that.specialize=Common.prototype.specialize}return that};ICommon.specialize=function(p,c){if(!p)p={};if(!c)c=p.constructor;if(c=={}.constructor)c=new Function("this.inherit()");c.valueOf=new Function("return this");c.valueOf.prototype=new this.valueOf;c.valueOf.prototype.specialize(p);c.prototype=new c.valueOf;c.valueOf.prototype.constructor=c.prototype.constructor=c;c.ancestor=this;c.specialize=arguments.callee;c.ancestorOf=this.ancestorOf;return c};ICommon.valueOf=new Function("return this");ICommon.valueOf.prototype={constructor:ICommon,inherit:function(){return arguments.callee.caller.ancestor.apply(this,arguments)},specialize:function(that){if(this==this.constructor.prototype&&this.constructor.specialize){return this.constructor.valueOf.prototype.specialize(that)}for(var i in that){switch(i){case"constructor":case"toString":case"valueOf":continue}if(typeof that[i]=="function"&&that[i]!=this[i]){that[i].ancestor=this[i]}this[i]=that[i]}if(that.toString!=this.toString&&that.toString!={}.toString){that.toString.ancestor=this.toString;this.toString=that.toString}return this}};function Common(){};this.Common=ICommon.specialize({constructor:Common,toString:function(){return"[common "+(this.constructor.className||"Object")+"]"},instanceOf:function(klass){return this.constructor==klass||klass.ancestorOf(this.constructor)}});Common.className="Common";Common.ancestor=null;Common.ancestorOf=function(klass){while(klass&&klass.ancestor!=this)klass=klass.ancestor;return Boolean(klass)};Common.valueOf.ancestor=ICommon;function ParseMaster(){var E=0,R=1,L=2;var G=/\(/g,S=/\$\d/,I=/^\$\d+$/,T=/(['"])\1\+(.*)\+\1\1$/,ES=/\\./g,Q=/'/,DE=/\x01[^\x01]*\x01/g;var self=this;this.add=function(e,r){if(!r)r="";var l=(_14(String(e)).match(G)||"").length+1;if(S.test(r)){if(I.test(r)){r=parseInt(r.slice(1))-1}else{var i=l;var q=Q.test(_14(r))?'"':"'";while(i)r=r.split("$"+i--).join(q+"+a[o+"+i+"]+"+q);r=new Function("a,o","return"+q+r.replace(T,"$1")+q)}}_31(e||"/^$/",r,l)};this.exec=function(s){_3.length=0;return _28(_5(s,this.escapeChar).replace(new RegExp(_1,this.ignoreCase?"gi":"g"),_29),this.escapeChar).replace(DE,"")};this.reset=function(){_1.length=0};var _3=[];var _1=[];var _30=function(){return"("+String(this[E]).slice(1,-1)+")"};_1.toString=function(){return this.join("|")};function _31(){arguments.toString=_30;_1[_1.length]=arguments}function _29(){if(!arguments[0])return"";var i=1,j=0,p;while(p=_1[j++]){if(arguments[i]){var r=p[R];switch(typeof r){case"function":return r(arguments,i);case"number":return arguments[r+i]}var d=(arguments[i].indexOf(self.escapeChar)==-1)?"":"\x01"+arguments[i]+"\x01";return d+r}else i+=p[L]}};function _5(s,e){return e?s.replace(new RegExp("\\"+e+"(.)","g"),function(m,c){_3[_3.length]=c;return e}):s};function _28(s,e){var i=0;return e?s.replace(new RegExp("\\"+e,"g"),function(){return e+(_3[i++]||"")}):s};function _14(s){return s.replace(ES,"")}};ParseMaster.prototype={constructor:ParseMaster,ignoreCase:false,escapeChar:""};function pack(_7,_0,_2,_8){var I="$1";_7+="\n";_0=Math.min(parseInt(_0),95);function _15(s){var i,p;for(i=0;(p=_6[i]);i++){s=p(s)}return s};var _25=function(p,a,c,k,e,d){while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p};var _26=function(){if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1}};var _6=[];function _4(p){_6[_6.length]=p};function _18(s){var p=new ParseMaster;p.escapeChar="\\";p.add(/'[^'\n\r]*'/,I);p.add(/"[^"\n\r]*"/,I);p.add(/\/\/[^\n\r]*[\n\r]/," ");p.add(/\/\*[^*]*\*+([^\/][^*]*\*+)*\//," ");p.add(/\s+(\/[^\/\n\r\*][^\/\n\r]*\/g?i?)/,"$2");p.add(/[^\w\x24\/'"*)\?:]\/[^\/\n\r\*][^\/\n\r]*\/g?i?/,I);if(_8)p.add(/;;;[^\n\r]+[\n\r]/);p.add(/\(;;\)/,I);p.add(/;+\s*([};])/,"$2");s=p.exec(s);p.add(/(\b|\x24)\s+(\b|\x24)/,"$2 $3");p.add(/([+\-])\s+([+\-])/,"$2 $3");p.add(/\s+/,"");return p.exec(s)};function _17(s){var p=new ParseMaster;p.add(/((\x24+)([a-zA-Z_]+))(\d*)/,function(m,o){var l=m[o+2].length;var s
|
||
|
</script>
|
||
|
<script type="text/javascript">
|
||
|
|
||
|
var VERSION = '1.0.0';
|
||
|
var AUTHOR = 'Rob Seiler'; /* seiler@elr.com.au */
|
||
|
|
||
|
/* Get command line arguments */
|
||
|
function JS_getArgs() {
|
||
|
var args = [];
|
||
|
var objArgs = WScript.Arguments;
|
||
|
if (objArgs.length > 0) {
|
||
|
for (var i = 0; i < objArgs.length; i++) {
|
||
|
args[i] = objArgs(i); /* sic - index in "()" - an object, not an array! */
|
||
|
}
|
||
|
}
|
||
|
return (args);
|
||
|
}
|
||
|
|
||
|
/* Read the input file */
|
||
|
function JS_readFile (fname) {
|
||
|
var s = '';
|
||
|
var ForReading = 1;
|
||
|
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||
|
var ts = fso.OpenTextFile(fname, ForReading);
|
||
|
while (!ts.AtEndOfStream) {
|
||
|
s += ts.ReadLine() + '\n';
|
||
|
}
|
||
|
ts.Close();
|
||
|
return(s);
|
||
|
}
|
||
|
|
||
|
/* Show help if needed - eg 0 command line arguments */
|
||
|
function JS_Help () {
|
||
|
WScript.Echo ('Compress and encode a Javascript source file using Dean Edwards "Packer"');
|
||
|
WScript.Echo (' Version : ' + VERSION);
|
||
|
WScript.Echo (' Syntax : program sourcefile [_encoding] [_fastDecode] [_specialChars]\n');
|
||
|
}
|
||
|
|
||
|
/* Main program: Get arguments; read input file; output packed string */
|
||
|
function main() {
|
||
|
var params = [];
|
||
|
params = JS_getArgs();
|
||
|
params[1] = (typeof(params[1]) == 'undefined') ? 62 : params[1]; // -dean : changed defaults
|
||
|
params[2] = (typeof(params[2]) == 'undefined') ? 1 : params[2];
|
||
|
params[3] = (typeof(params[3]) == 'undefined') ? 0 : params[3];
|
||
|
if (params[0] > '') {
|
||
|
var $script = JS_readFile(params[0]);
|
||
|
if ($script > '') {
|
||
|
$script = pack($script, params[1], params[2], params[3]); /* Returns the Dean Edwards "packed" string */
|
||
|
WScript.Echo ($script);
|
||
|
}
|
||
|
else {JS_Help();}
|
||
|
}
|
||
|
else {JS_Help();}
|
||
|
}
|
||
|
|
||
|
/* Do the job */
|
||
|
main();
|
||
|
</script>
|
||
|
|
||
|
</job>
|