├── .gitignore ├── .gitmodules ├── AUTHORS.txt ├── README.md ├── bower.json ├── build.properties ├── build.xml ├── jquery.xpath.js ├── jquery.xpath.min.js ├── package.json ├── res ├── assemble.js ├── assemble.php ├── build │ ├── COPYING.js │ └── compiler │ │ ├── cJSCompiler.php │ │ └── js.php └── license │ ├── GPL-LICENSE.txt │ └── MIT-LICENSE.txt ├── src ├── .files ├── .htaccess ├── adapters │ ├── L2DOMAdapter.js │ ├── L2HTMLDOMAdapter.js │ ├── MSHTMLDOMAdapter.js │ ├── MSXMLDOMAdapter.js │ └── classes │ │ ├── Attr.js │ │ └── LXDOMAdapter.js ├── jquery-xpath.js └── jquery.xpath.js └── test ├── lib └── jquery.min.js └── test.html /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/xpath.js"] 2 | path = src/xpath.js 3 | url = https://github.com/ilinsky/xpath.js.git 4 | -------------------------------------------------------------------------------- /AUTHORS.txt: -------------------------------------------------------------------------------- 1 | Sergey Ilinsky http://www.ilinsky.com -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jQuery XPath plugin 2 | ============= 3 | 4 | This plugin is a fully featured XPath 2.0 query language implementation which can be used to query both HTML and XML documents in all web browsers. 5 | It uses the DOM-agnostic XPath 2.0 engine [xpath.js](https://github.com/ilinsky/xpath.js) originally developed for [Ample SDK UI Framework](https://github.com/clientside/amplesdk). 6 | 7 | Usage 8 | ----------------- 9 | 10 | Download and include ` jquery.xpath.js ` or ` jquery.xpath.min.js ` file on your page. 11 | Please be aware that the 'min' version does not have the detailed error messages that the ` jquery.xpath.js ` has but has been efficiently minimised to reduce its file size. 12 | 13 | ```html 14 | 15 | ``` 16 | 17 | API Reference 18 | ----------------- 19 | 20 | jQuery XPath plugin comes with two easy to use entrance points: 21 | 22 | 1. ` $(context).xpath(expression, resolver) ` 23 | 2. ` $.xpath(context, expression, resolver) ` 24 | 25 | In both cases the `resolver` function type parameter is optional and is only needed when the expression contains prefixes. 26 | In cases where the expression does not touch the document, the node type `context` parameter is not required. 27 | 28 | Below are the sample queries. 29 | 30 | ### Running queries with context ### 31 | 32 | ```js 33 | $(document).xpath("*"); // Returns {Element} html (direct child of context item - document) 34 | $(document).xpath("//head << //body"); // Returns {Boolean} true (head is preceding body) 35 | $(document).xpath("//*[parent::html][last()]") // Returns {Element} body (last child of html) 36 | $(document.body).xpath("count(ancestor::node())"); // Returns {Number} 2 (2 ancestor nodes) 37 | $(document.body).xpath("preceding-sibling::element()"); // Returns {Element} head (prev sibling) 38 | $(document.documentElement).xpath("body | head"); // Returns {Element} head and body (ordered) 39 | $(document.documentElement).xpath("body, head"); // Returns {Element} body and head (not ordered) 40 | ``` 41 | 42 | ### Running queries that do not require context ### 43 | 44 | ```js 45 | $().xpath("0.1+0.2"); // Returns {Number} 0.3 (Note: in JavaScript it returns 0.30000000000000004) 46 | $().xpath("xs:date('2012-12-12')-xs:yearMonthDuration('P1Y1M')"); // Returns {String} '2011-11-12' 47 | $().xpath("2 to 5"); // Returns {Number} 2, 3, 4 and 5 48 | $().xpath("for $var in (1, 2, 3) return $var * 3"); // Returns {Number} 3, 6 and 9 49 | $().xpath("round-half-to-even(35540, -2)"); // Returns {Number} 35500 50 | $().xpath("translate('bar','abc','ABC')"); // Returns {String} BAr 51 | $().xpath("matches('helloworld', 'hello world', 'x')"); // Returns {Boolean} true 52 | $().xpath("xs:double('-INF') castable as xs:decimal)"); // Returns {Boolean} false 53 | $().xpath("1e2 instance of xs:double"); // Returns {Boolean} true 54 | $().xpath("1.5 cast as xs:integer"); // Returns {Number} 1 55 | ``` 56 | 57 | ### Running queries with prefixes ### 58 | 59 | ```js 60 | $(document).xpath("//my:body", function(prefix) { 61 | if (prefix == "my") 62 | return "http://www.w3.org/1999/xhtml"; 63 | }); // Returns {Element} body ('my' prefix resolved to XHTML namespace) 64 | ``` 65 | 66 | Error reporting 67 | ----------------- 68 | Unlike browser's native XPath 1.0 processing which have very poor error reporting, the jQuery XPath plugin reports syntax and evaluation errors with a great level of detail. 69 | Provided that XPath expressions are not easy, it is extremely helpful to have good level of feedback from the processor. 70 | 71 | Below are examples of the detailed error reporting. 72 | 73 | ### Syntax errors ### 74 | ```js 75 | $().xpath("1 to "); // Throws "Error: Expected second operand in range expression" 76 | $().xpath("$*"); // Throws "Error: Illegal use of wildcard in var expression variable name" 77 | $(document).xpath("self::document()"); // Throws "Error: Unknown 'document' kind test" 78 | ``` 79 | 80 | ### Evaluation errors ### 81 | 82 | ```js 83 | $().xpath("1+'2'") // Throws "Error: Arithmetic operator is not defined for provided arguments" 84 | $().xpath("self::node()"); // Throws "Error: In an axis step, the context item is not a node." 85 | $().xpath("max((1,'2'))"); // Throws "Error: Input to max() contains a mix of not comparable values" 86 | ``` 87 | 88 | ### XPath 2.0 trace() function ### 89 | 90 | ``` trace ``` is a very helpful XPath 2.0 function, that will let you print the result of the sub-expression 91 | during its evaluation right into the browser console log. 92 | Function ``` trace ``` requires 2 arguments: first - any type, second - string, it prints its arguments to the console and returns the first argument to the evaluator. 93 | 94 | ```js 95 | $().xpath("for $a in (1, 2), $b in (3 to 4) return trace($b, 'b: ') - $a"); // See browser console 96 | ``` 97 | 98 | Bear in mind that the items reported will either have a type of nodes, or internal XML Schema data types ;) 99 | 100 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-xpath", 3 | "description": "jQuery plugin for querying XML and HTML documents with XPath 2.0", 4 | "version": "0.3.1", 5 | "homepage": "https://github.com/ilinsky/jquery-xpath", 6 | "authors": [ 7 | "Sergey Ilinsky " 8 | ], 9 | "license": "MIT", 10 | "keywords": [ 11 | "jquery", 12 | "xpath", 13 | "xpath2" 14 | ], 15 | "main": "jquery.xpath.min.js", 16 | "ignore": [ 17 | "build", 18 | "res", 19 | "src", 20 | "test", 21 | "build.*" 22 | ], 23 | "dependencies": { 24 | "jquery": ">=1.0.0" 25 | } 26 | } -------------------------------------------------------------------------------- /build.properties: -------------------------------------------------------------------------------- 1 | # Project name and version 2 | project.name =jQuery XPath plugin 3 | project.version =0.3.1 4 | 5 | # Location to your PHP instalation 6 | executable.php =/Applications/MAMP/bin/php/php5.3.29/bin/php 7 | build.dir =./build -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 52 | 61 | 100 | 147 | 156 | 165 | 177 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 191 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 208 | 210 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | -------------------------------------------------------------------------------- /jquery.xpath.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery XPath plugin v0.3.1 3 | * https://github.com/ilinsky/jquery-xpath 4 | * Copyright 2015, Sergey Ilinsky 5 | * Dual licensed under the MIT and GPL licenses. 6 | * 7 | * Includes xpath.js - XPath 2.0 implementation in JavaScript 8 | * https://github.com/ilinsky/xpath.js 9 | * Copyright 2015, Sergey Ilinsky 10 | * Dual licensed under the MIT and GPL licenses. 11 | * 12 | */ 13 | (function(p,a,c,k,e,d){for(k=a[d[1]]-1;k>=0;k--)c+=e[d[435]][d[254]](a[d[175]](k)-1);a=c[d[48]](' ');for(k=a[d[1]]-1;k>=0;k--)p=p[d[38]](e[d[421]](k%10+(e[d[435]][d[254]](122-e[d[409]][d[216]](k/10))),'g'),a[k]);e[d[408]]('_','$',p)(d,d[0])})("8y by=6x7x4358x,O=6x7x4348x,bh=6x7x4318x,bj=6x7x4328x,K=6x7x4338x,br=6x7x4218x,U=6x7x4208x,b3=6x7x4088x,bd=6x7x4098x,W=6x7x4108x,bB=6x7x4078x,bE=6x7x4068x,dc=6x7x4038x,db=6x7x4048x,fP=6x7x4058x,fD=6x7x1688x,eW=6x7x4118x,eV=6x7x4128x,eX=6x7x4188x,eP=(9z2w{3y by9x7x3458x?9z(jO){3y by(jO)7x3458x2w}:9z(jO){3y by(jO)7x388x(/^\\s+|\\s+$/g,'')}})2w,cE=(9z2w{3y K9x7x458x?9z(r,jY){3y r7x458x(jY)}:9z(r,jY){8z(8y fC=0,fJ=r7x18x;fC>|[!<>]=|(?![0-9-])[\\w-]+:\\*|\\s+|./g);0y(j){8y f6=0;8z(8y fC=0,fJ=j7x18x;fC0};bb9x7x148x=9z2w{3y 5x7x788x5v5x7x18x};9z T2w1w;T9x7x368x=9z(g0){3y g03w7wg07x278x};T9x7x288x=9z(g0,iz){3y g0[iz]};T9x7x1178x=9z(g0,h2){3y g06wh2};T9x7x628x=9z(g0,h2){3y g07x628x(h2)};T9x7x558x=9z(g0,iE){3y g07x558x(iE)};T9x7x1218x=9z(g0,iq){3y g07x1218x(iq)};T9x7x988x=9z(g0,iA,iu){3y g07x988x(iA,iu)};9z V(hw,jY,hn,gv){5x7x538x=hw;5x7x268x=jY;5x7x518x=hn4w1w;5x7x498x=1w;5x7x248x=gv4w2y T;8y gw=2y U,fS=gw7x4138x2w;5x7x708x=2y cS(gw7x4148x2w,gw7x4158x2w+1,gw7x4388x2w,gw7x4398x2w,gw7x1948x2w,gw7x4648x2w+gw7x4658x2w/1000,-fS);5x7x48x=2y cT(0,bd7x408x(~~(fS/60)),bd7x408x(fS%60),0,fS>0)};V9x7x268x=2x;V9x7x768x=0;V9x7x948x=0;V9x7x518x=2x;V9x7x498x=2x;V9x7x708x=2x;V9x7x48x=2x;V9x7x538x=2x;V9x7x1398x=9z(iz,j2){0y(!5x7x498x7x1418x(iz))5x7x498x[iz]=0w;5x7x498x[iz]7x108x(5x7x518x[iz]);5x7x518x[iz]=j2};V9x7x1368x=9z(iz){0y(5x7x498x7x1418x(iz)){5x7x518x[iz]=5x7x498x[iz]7x1778x2w;0y(!5x7x498x[iz]7x18x){6z 5x7x498x[iz];0y(5y 5x7x518x[iz]6w_[167])6z 5x7x518x[iz]}}};9z bw2w{5x7x1118x=1w;5x7x1728x=1w;5x7x1098x=1w;5x7x1078x=1w;5x7x1338x=1w};bw9x7x838x=2x;bw9x7x1118x=2x;bw9x7x1728x=2x;bw9x7x1098x=2x;bw9x7x878x=2x;bw9x7x1078x=2x;bw9x7x1748x=ix+_[223];bw9x7x1338x=2x;bw9x7x1148x=2x;bw9x7x1408x=2x;8y hP=/^(?:\\{([^\\}]+)\\})?(.+)$/;bw9x7x4638x=9z(jN,dU){8y j=jN7x258x(hP);0y(j)0y(j[1]9wiy)5x7x1118x[jN]=dU};bw9x7x1068x=9z(jN){8y j=jN7x258x(hP);0y(j)3y j[1]6wiy?el[br.$2]:5x7x1118x[jN]};bw9x7x4628x=9z(jN,dU){5x7x1728x[jN]=dU};bw9x7x4598x=9z(jN,dU){8y j=jN7x258x(hP);0y(j)0y(j[1]9wix)5x7x1098x[jN]=dU};bw9x7x1788x=9z(jN){8y j=jN7x258x(hP);0y(j)3y j[1]6wix?fm[br.$2]:5x7x1098x[jN]};bw9x7x4608x=9z(jN,dU){5x7x1078x[jN]=dU};bw9x7x2518x=9z(jN){3y 5x7x1078x[jN]};bw9x7x4618x=9z(jN,dU){5x7x1338x[jN]=dU};bw9x7x738x=9z(iE){8y hj=5x7x1148x,eF=hj3whj7x558x?hj7x558x:hj,iA;0y(eF 1y b33w(iA=eF7x218x(hj,iE)))3y iA;0y(iE6w'fn')3y ix;0y(iE6w'xs')3y iy;0y(iE6w_[291])3y iv;0y(iE6w_[82])3y iw;4y 2y X(_[308])};bw7x4668x=9z(jY){0y(5y jY6w_[118])jY=2y bO(jY);7z 0y(5y jY6w_[271])jY=(dc(jY)4w!db(jY))?2y cV(jY):dl(by(jY));7z jY=2y cl(by(jY));3y jY};bw7x2208x=9z(jY){0y(jY 1y bO)jY=jY7x28x2w;7z 0y(eZ(jY))jY=jY7x28x2w;7z jY=jY7x318x2w;3y jY};8y fm=1w,fo=1w,el=1w,fn=1w;9z eL(iz,k,dU){fm[iz]=dU;fo[iz]=k};9z eK(iz,dU){el[iz]=dU};9z b0(_d,hw){8y gV=2y bb(_d),gE=dR(gV,hw);0y(!gV7x148x2w)4y 2y X(_[12]);0y(!gE)4y 2y X(_[12]);5x7x1298x=gE};b09x7x1298x=2x;b09x7x88x=9z(gu){3y 5x7x1298x7x88x(gu)};9z bz2w1w;bz9x7x2448x=9z(jP,jQ){4y \"Not implemented\"};bz9x7x508x=9z(jP,jQ){4y \"Not implemented\"};9z cQ2w1w;cQ7x3248x=1;cQ7x3128x=2;cQ7x2128x=3;cQ7x3418x=4;cQ7x2888x=5;cQ7x3448x=6;cQ7x3178x=7;cQ7x3508x=8;cQ7x3078x=9;cQ7x3188x=10;cQ7x3028x=11;cQ7x3058x=12;cQ7x2848x=13;cQ7x2858x=14;cQ7x2908x=15;cQ7x3048x=16;cQ7x3218x=17;cQ7x3238x=18;cQ7x3148x=19;cQ7x2998x=20;cQ7x3298x=21;cQ7x3308x=22;cQ7x2198x=23;cQ7x1868x=24;cQ7x3328x=25;cQ7x2098x=26;cQ7x2138x=27;cQ7x4678x=28;cQ7x2048x=29;cQ7x2808x=30;cQ7x2828x=31;cQ7x2788x=32;cQ7x2778x=33;cQ7x2738x=34;cQ7x2758x=35;cQ7x2768x=36;cQ7x2838x=37;cQ7x3528x=38;cQ7x3388x=39;cQ7x3258x=40;cQ7x3338x=41;cQ7x3478x=42;cQ7x4738x=43;cQ7x4748x=44;cQ7x4728x=45;cQ7x4718x=46;cQ7x4688x=47;cQ7x2798x=48;cQ7x4698x=49;cQ7x3268x=50;cQ7x3398x=51;cQ7x2958x=-1;cQ7x3108x=-2;9z Y2w{5x7x168x=0w};Y9x7x168x=2x;9z dR(gV,hw){8y gN;0y(gV7x148x2w4w!(gN=dQ(gV,hw)))3y;8y gE=2y Y;gE7x168x7x108x(gN);9y(gV7x58x2w6w','){gV7x138x2w;0y(gV7x148x2w4w!(gN=dQ(gV,hw)))4y 2y X(_[12]);gE7x168x7x108x(gN)}3y gE};Y9x7x88x=9z(gu){8y hq=0w;8z(8y fC=0,fJ=5x7x168x7x18x;fC':'gt','<':'lt','5v':'ge','4v':'le'};9z dN(gE,gu){8y gT=d3(gE7x328x7x88x(gu),gu);0y(!gT7x18x)3y 2x;dV(gu,gT,'?');8y hl=d3(gE7x638x7x88x(gu),gu);0y(!hl7x18x)3y 2x;dV(gu,hl,'?');8y jZ=gT[0],j1=hl[0];0y(jZ 1y cs)jZ=cl7x38x(jZ);0y(j1 1y cs)j1=cl7x38x(j1);0y(jZ 1y bM)jZ=cl7x38x(jZ);0y(j1 1y bM)j1=cl7x38x(j1);3y eh[gE7x528x](jZ,j1,gu)};8y eh=1w;eh['eq']=9z(gT,hl,gu){8y iC='';0y(eZ(gT)){0y(eZ(hl))iC=_[130]}7z 0y(gT 1y bO){0y(hl 1y bO)iC=_[199]}7z 0y(gT 1y cl){0y(hl 1y cl)3y fn7x1308x7x218x(gu,fm7x508x7x218x(gu,gT,hl),2y c7(0))}7z 0y(gT 1y cR){0y(hl 1y cR)iC=_[255]}7z 0y(gT 1y cm){0y(hl 1y cm)iC=_[250]}7z 0y(gT 1y cS){0y(hl 1y cS)iC=_[258]}7z 0y(gT 1y cW){0y(hl 1y cW)iC=_[256]}7z 0y(gT 1y c3){0y(hl 1y c3)iC=_[252]}7z 0y(gT 1y c2){0y(hl 1y c2)iC=_[253]}7z 0y(gT 1y c1){0y(hl 1y c1)iC=_[260]}7z 0y(gT 1y c0){0y(hl 1y c0)iC=_[261]}7z 0y(gT 1y cZ){0y(hl 1y cZ)iC=_[268]}7z 0y(gT 1y cj){0y(hl 1y cj)iC=_[246]}7z 0y(gT 1y c4){0y(hl 1y c4)iC=_[182]}7z 0y(gT 1y bN){0y(hl 1y bN)iC=_[183]}0y(iC)3y fn[iC]7x218x(gu,gT,hl);4y 2y X(_[9])};eh['ne']=9z(gT,hl,gu){3y 2y bO(!eh['eq'](gT,hl,gu)7x28x2w)};eh['gt']=9z(gT,hl,gu){8y iC='';0y(eZ(gT)){0y(eZ(hl))iC=_[97]}7z 0y(gT 1y bO){0y(hl 1y bO)iC=_[152]}7z 0y(gT 1y cl){0y(hl 1y cl)3y fn7x978x7x218x(gu,fm7x508x7x218x(gu,gT,hl),2y c7(0))}7z 0y(gT 1y cR){0y(hl 1y cR)iC=_[145]}7z 0y(gT 1y cm){0y(hl 1y cm)iC=_[148]}7z 0y(gT 1y cS){0y(hl 1y cS)iC=_[151]}7z 0y(gT 1y ct){0y(hl 1y ct)iC=_[153]}7z 0y(gT 1y cT){0y(hl 1y cT)iC=_[155]}0y(iC)3y fn[iC]7x218x(gu,gT,hl);4y 2y X(_[9])};eh['lt']=9z(gT,hl,gu){8y iC='';0y(eZ(gT)){0y(eZ(hl))iC=_[99]}7z 0y(gT 1y bO){0y(hl 1y bO)iC=_[146]}7z 0y(gT 1y cl){0y(hl 1y cl)3y fn7x998x7x218x(gu,fm7x508x7x218x(gu,gT,hl),2y c7(0))}7z 0y(gT 1y cR){0y(hl 1y cR)iC=_[150]}7z 0y(gT 1y cm){0y(hl 1y cm)iC=_[144]}7z 0y(gT 1y cS){0y(hl 1y cS)iC=_[156]}7z 0y(gT 1y ct){0y(hl 1y ct)iC=_[159]}7z 0y(gT 1y cT){0y(hl 1y cT)iC=_[154]}0y(iC)3y fn[iC]7x218x(gu,gT,hl);4y 2y X(_[9])};eh['ge']=9z(gT,hl,gu){8y iC='';0y(eZ(gT)){0y(eZ(hl))iC=_[99]}7z 0y(gT 1y bO){0y(hl 1y bO)iC=_[146]}7z 0y(gT 1y cl){0y(hl 1y cl)3y fn7x978x7x218x(gu,fm7x508x7x218x(gu,gT,hl),2y c7(-1))}7z 0y(gT 1y cR){0y(hl 1y cR)iC=_[150]}7z 0y(gT 1y cm){0y(hl 1y cm)iC=_[144]}7z 0y(gT 1y cS){0y(hl 1y cS)iC=_[156]}7z 0y(gT 1y ct){0y(hl 1y ct)iC=_[159]}7z 0y(gT 1y cT){0y(hl 1y cT)iC=_[154]}0y(iC)3y 2y bO(!fn[iC]7x218x(gu,gT,hl)7x28x2w);4y 2y X(_[9])};eh['le']=9z(gT,hl,gu){8y iC='';0y(eZ(gT)){0y(eZ(hl))iC=_[97]}7z 0y(gT 1y bO){0y(hl 1y bO)iC=_[152]}7z 0y(gT 1y cl){0y(hl 1y cl)3y fn7x998x7x218x(gu,fm7x508x7x218x(gu,gT,hl),2y c7(1))}7z 0y(gT 1y cR){0y(hl 1y cR)iC=_[145]}7z 0y(gT 1y cm){0y(hl 1y cm)iC=_[148]}7z 0y(gT 1y cS){0y(hl 1y cS)iC=_[151]}7z 0y(gT 1y ct){0y(hl 1y ct)iC=_[153]}7z 0y(gT 1y cT){0y(hl 1y cT)iC=_[155]}0y(iC)3y 2y bO(!fn[iC]7x218x(gu,gT,hl)7x28x2w);4y 2y X(_[9])};9z dM(gE,gu){8y gT=gE7x328x7x88x(gu);0y(!gT7x18x)3y 2x;dV(gu,gT,'?');dW(gu,gT,cz);8y hl=gE7x638x7x88x(gu);0y(!hl7x18x)3y 2x;dV(gu,hl,'?');dW(gu,hl,cz);3y eg[gE7x528x](gT[0],hl[0],gu)};8y eg=1w;eg['is']=9z(gT,hl,gu){3y fn7x2878x7x218x(gu,gT,hl)};eg['>>']=9z(gT,hl,gu){3y fn7x2408x7x218x(gu,gT,hl)};eg['<<']=9z(gT,hl,gu){3y fn7x2418x7x218x(gu,gT,hl)};8y ei={'=':dL,'9w':dL,'<':dL,'4v':dL,'>':dL,'5v':dL,'eq':dN,'ne':dN,'lt':dN,'le':dN,'gt':dN,'ge':dN,'is':dM,'>>':dM,'<<':dM};9z I(gE){5x7x328x=gE;5x7x168x=0w};I9x7x328x=2x;I9x7x168x=2x;8y ed=1w;ed['+']=9z(gT,hl,gu){8y iC='',F=1x;0y(eZ(gT)){0y(eZ(hl))iC=_[115]}7z 0y(gT 1y cR){0y(hl 1y ct)iC=_[161];7z 0y(hl 1y cT)iC=_[162]}7z 0y(gT 1y ct){0y(hl 1y cR){iC=_[161];F=3x}7z 0y(hl 1y cS){iC=_[170];F=3x}7z 0y(hl 1y ct)iC=_[269]}7z 0y(gT 1y cT){0y(hl 1y cR){iC=_[162];F=3x}7z 0y(hl 1y cm){iC=_[134];F=3x}7z 0y(hl 1y cS){iC=_[165];F=3x}7z 0y(hl 1y cT)iC=_[262]}7z 0y(gT 1y cm){0y(hl 1y cT)iC=_[134]}7z 0y(gT 1y cS){0y(hl 1y ct)iC=_[170];7z 0y(hl 1y cT)iC=_[165]}0y(iC)3y fn[iC]7x218x(gu,F?hl:gT,F?gT:hl);4y 2y X(_[9])};ed['-']=9z(gT,hl,gu){8y iC='';0y(eZ(gT)){0y(eZ(hl))iC=_[120]}7z 0y(gT 1y cR){0y(hl 1y cR)iC=_[232];7z 0y(hl 1y ct)iC=_[226];7z 0y(hl 1y cT)iC=_[227]}7z 0y(gT 1y cm){0y(hl 1y cm)iC=_[233];7z 0y(hl 1y cT)iC=_[228]}7z 0y(gT 1y cS){0y(hl 1y cS)iC=_[248];7z 0y(hl 1y ct)iC=_[234];7z 0y(hl 1y cT)iC=_[235]}7z 0y(gT 1y ct){0y(hl 1y ct)iC=_[270]}7z 0y(gT 1y cT){0y(hl 1y cT)iC=_[263]}0y(iC)3y fn[iC]7x218x(gu,gT,hl);4y 2y X(_[9])};9z cC(gV,hw){8y gE;0y(gV7x148x2w4w!(gE=dg(gV,hw)))3y;0y(!(gV7x58x2w0z ed))3y gE;8y gf=2y I(gE),iC;9y((iC=gV7x58x2w)0z ed){gV7x138x2w;0y(gV7x148x2w4w!(gE=dg(gV,hw)))4y 2y X(_[12]);gf7x168x7x108x([iC,gE])}3y gf};I9x7x88x=9z(gu){8y gT=d3(5x7x328x7x88x(gu),gu);0y(!gT7x18x)3y 0w;dV(gu,gT,'?');8y jZ=gT[0];0y(jZ 1y cs)jZ=cV7x38x(jZ);8z(8y fC=0,fJ=5x7x168x7x18x,hl,j1;fCfT)4y 2y X(_[46]);7z 0y(fq1)4y 2y X(_[9])}7z 0y(ig6w'+'){0y(fJ<1)4y 2y X(_[9])}7z 0y(ig9w'*'){0y(fJ9w1)4y 2y X(_[9])}};9z b7(gE){5x7x328x=gE;5x7x168x=0w};b79x7x328x=2x;b79x7x168x=2x;9z da(gV,hw){8y gE,iC;0y(gV7x148x2w4w!(gE=d9(gV,hw)))3y;0y(!((iC=gV7x58x2w)6w_[125]4wiC6w_[137]))3y gE;8y gM=2y b7(gE);9y((iC=gV7x58x2w)6w_[125]4wiC6w_[137]){gV7x138x2w;0y(gV7x148x2w4w!(gE=d9(gV,hw)))4y 2y X(_[12]);gM7x168x7x108x([iC,gE])}3y gM};b79x7x88x=9z(gu){8y hq=5x7x328x7x88x(gu);8z(8y fC=0,fJ=5x7x168x7x18x,gN;fC1)3y [2y bO(1x)];7z 0y(!hr7x18x)3y [2y bO(iB6w'?')];7y{gO7x38x(d3(hr,gu)[0])}3z(e){0y(e7x678x6w_[100])4y e;0y(e7x678x6w_[46])4y 2y X(_[372]);3y [2y bO(1x)]}3y [2y bO(3x)]};9z P(gE,hD){5x7x358x=gE;5x7x398x=hD};P9x7x358x=2x;P9x7x398x=2x;9z dJ(gV,hw){8y gE,hD;0y(gV7x148x2w4w!(gE=eR(gV,hw)))3y;0y(!(gV7x58x2w6w_[3]3wgV7x58x(1)6w_[166]))3y gE;gV7x138x(2);0y(gV7x148x2w4w!(hD=eJ(gV,hw)))4y 2y X(_[12]);3y 2y P(gE,hD)};P9x7x88x=9z(gu){8y hr=5x7x358x7x88x(gu);dV(gu,hr,5x7x398x7x598x);0y(!hr7x18x)3y 0w;3y [5x7x398x7x648x7x38x(d3(hr,gu)[0],gu)]};9z cAtomibD(iE,iu,iA){5x7x308x=iE;5x7x208x=iu;5x7x178x=iA};cAtomibD9x7x308x=2x;cAtomibD9x7x208x=2x;cAtomibD9x7x178x=2x;9z cF(gV,hw){8y j=gV7x58x2w7x258x(hM);0y(j){0y(j[1]6w'*'4wj[2]6w'*')4y 2y X(_[12]);gV7x138x2w;3y 2y cAtomibD(j[1]4w2x,j[2],j[1]?hw7x738x(j[1]):2x)}};cAtomibD9x7x378x=9z(jY,gu){8y jN=(5x7x178x?'{'+5x7x178x+'}':'')+5x7x208x,bD=5x7x178x6wiy?el[5x7x208x]:gu7x538x7x1068x(jN);0y(bD)3y jY 1y bD;4y 2y X(_[100])};cAtomibD9x7x38x=9z(jY,gu){8y jN=(5x7x178x?'{'+5x7x178x+'}':'')+5x7x208x,bD=5x7x178x6wiy?el[5x7x208x]:gu7x538x7x1068x(jN);0y(bD)3y bD7x38x(jY);4y 2y X(_[100])};9z b8(hy){5x7x378x=hy};b89x7x378x=2x;9z dd(gV,hw){0y(gV7x148x2w)3y;8y gE;0y(gV7x58x2w6w_[26]3wgV7x58x(1)6w'('){gV7x138x(2);0y(gV7x58x2w9w')')4y 2y X(_[12]);gV7x138x2w;3y 2y b8}0y(gE=de(gV,hw))3y 2y b8(gE);0y(gE=cF(gV,hw))3y 2y b8(gE)};9z bs(gO,iB){5x7x648x=gO4w2x;5x7x598x=iB4w2x};bs9x7x648x=2x;bs9x7x598x=2x;9z eG(gV,hw){0y(gV7x148x2w)3y;0y(gV7x58x2w6w_[377]3wgV7x58x(1)6w'('){gV7x138x(2);0y(gV7x58x2w9w')')4y 2y X(_[12]);gV7x138x2w;3y 2y bs}8y gE,iB;0y(!gV7x148x2w3w(gE=dd(gV,hw))){iB=gV7x58x2w;0y(iB6w'?'4wiB6w'*'4wiB6w'+')gV7x138x2w;7z iB=2x;3y 2y bs(gE,iB)}};9z bv(gO,iB){5x7x648x=gO4w2x;5x7x598x=iB4w2x};bv9x7x648x=2x;bv9x7x598x=2x;9z eJ(gV,hw){8y gE,iB;0y(!gV7x148x2w3w(gE=cF(gV,hw))){iB=gV7x58x2w;0y(iB6w'?')gV7x138x2w;7z iB=2x;3y 2y bv(gE,iB)}};9z bL2w1w;bL9x7x238x=cQ7x3398x;9z bK2w1w;bK9x=2y bL;bK9x7x238x=cQ7x3248x;bK9x7x348x=2x;bK7x3228x=_[328];bK7x3278x=_[335];bK7x3208x=_[118];bK7x3518x=_[336];bK7x3488x=_[70];bK7x3408x=_[337];bK7x3468x=_[334];bK7x3168x=_[331];bK7x2868x=_[208];bK7x2898x=_[211];bK7x2938x=_[207];bK7x3138x=_[206];bK7x3498x=_[202];bK7x3038x=_[201];bK7x3018x=_[203];bK7x3068x=_[157];bK7x3158x=_[147];bK7x3118x=_[104];bK7x3098x=_[205];9z bJ2w1w;bJ9x=2y bK;bJ9x7x238x=cQ7x3268x;bJ7x38x=9z(j2){4y 2y X(_[46])};9z eZ(jY){3y jY 1y cY4wjY 1y cV4wjY 1y cU};eK(_[319],bJ);9z bM(jJ,ic,iD,iH,ip){5x7x668x=jJ;5x7x688x=ic;5x7x588x=iD;5x7x1228x=iH;5x7x1238x=ip};bM9x=2y bJ;bM9x7x238x=cQ7x3238x;bM9x7x348x=bK7x3228x;bM9x7x668x=2x;bM9x7x688x=2x;bM9x7x588x=2x;bM9x7x1228x=2x;bM9x7x1238x=2x;bM9x7x318x=9z2w{3y(5x7x668x?5x7x668x+':':'')+(5x7x688x?'/'+'/'+5x7x688x:'')+(5x7x588x?5x7x588x:'')+(5x7x1228x?'?'+5x7x1228x:'')+(5x7x1238x?'#'+5x7x1238x:'')};8y iS=/^(([^:\\/?#]+):)?(\\/\\/([^\\/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;bM7x38x=9z(j2){0y(j2 1y bM)3y j2;0y(j2 1y cl4wj2 1y cs){8y j;0y(j=eP(j2)7x258x(iS))3y 2y bM(j[2],j[4],j[5],j[7],j[9]);4y 2y X(_[33])}4y 2y X(_[9])};eK(_[328],bM);9z bN(jO){5x7x78x=jO};bN9x=2y bJ;bN9x7x238x=cQ7x3218x;bN9x7x348x=bK7x3278x;bN9x7x78x=2x;bN9x7x28x=9z2w{3y 5x7x78x};bN9x7x318x=9z2w{3y 5x7x78x};8y iT=/^((([A-Za-z0-9+\\/]\\s*){4})*(([A-Za-z0-9+\\/]\\s*){3}[A-Za-z0-9+\\/]|([A-Za-z0-9+\\/]\\s*){2}[AEIMQUYcgkosw048]\\s*=|[A-Za-z0-9+\\/]\\s*[AQgw]\\s*=\\s*=))?$/;bN7x38x=9z(j2){0y(j2 1y bN)3y j2;0y(j2 1y cl4wj2 1y cs){8y j=eP(j2)7x258x(iT);0y(j)3y 2y bN(j[0]);4y 2y X(_[33])}0y(j2 1y c4){8y j=j27x28x2w7x258x(/.{2}/g),r=0w;8z(8y fC=0,fJ=j7x18x;fCfw){9y(hG7x158x>fw){hG7x68x0v1;0y(hG7x68x>12){hG7x118x0v1;0y(hG7x118x6w0)hG7x118x=1;hG7x68x=1}hG7x158x1vfw;fw=e5(hG7x118x,hG7x68x)}}7z 0y(hG7x158x<1){9y(hG7x158x<1){hG7x68x1v1;0y(hG7x68x<1){hG7x118x1v1;0y(hG7x118x6w0)hG7x118x=-1;hG7x68x=12}fw=e5(hG7x118x,hG7x68x);hG7x158x0vfw}}}0y(hG7x68x>12){hG7x118x0v~~(hG7x68x/12);0y(hG7x118x6w0)hG7x118x=1;hG7x68x=hG7x68x%12}7z 0y(hG7x68x<1){hG7x118x0v~~(hG7x68x/12)-1;0y(hG7x118x6w0)hG7x118x=-1;hG7x68x=hG7x68x%12+12}3y hG};eK(_[336],cR);9z cS(gc,fN,fw,fB,fM,f5,f8,B){5x7x118x=gc;5x7x68x=fN;5x7x158x=fw;5x7x188x=fB;5x7x198x=fM;5x7x228x=f5;5x7x48x=f8;5x7x298x=B};cS9x=2y bJ;cS9x7x238x=cQ7x3508x;cS9x7x348x=bK7x3488x;cS9x7x118x=2x;cS9x7x68x=2x;cS9x7x158x=2x;cS9x7x188x=2x;cS9x7x198x=2x;cS9x7x228x=2x;cS9x7x48x=2x;cS9x7x298x=2x;cS9x7x318x=9z2w{3y e0(5x)+'T'+e2(5x)+e1(5x)};8y iW=/^(-?)([1-9]\\d\\d\\d+|0\\d\\d\\d)-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T(([01]\\d|2[0-3]):([0-5]\\d):([0-5]\\d)(?:\\.(\\d+))?|(24:00:00)(?:\\.(0+))?)(Z|([+\\-])(0\\d|1[0-4]):([0-5]\\d))?$/;cS7x38x=9z(j2){0y(j2 1y cS)3y j2;0y(j2 1y cl4wj2 1y cs){8y j=eP(j2)7x258x(iW);0y(j){8y gc=+j[2],fN=+j[3],fw=+j[4],H=7wj[10];0y(fw-10?'+':'-')+e4(bd7x408x(~~(f8/60)))+':'+e4(bd7x408x(f8%60)):'Z'};9z e0(gx){3y(gx7x298x?'-':'')+e4(gx7x118x,4)+'-'+e4(gx7x68x)+'-'+e4(gx7x158x)};9z e2(gx){8y r=by(gx7x228x)7x488x('.');3y e4(gx7x188x)+':'+e4(gx7x198x)+':'+e4(r[0])+(r7x18x>1?'.'+r[1]:'')};9z e3(hG){3y e6(eb(hG))};eK(_[70],cS);9z cU(fb){5x7x78x=fb};cU9x=2y bJ;cU9x7x238x=cQ7x3418x;cU9x7x348x=bK7x3408x;cU9x7x78x=2x;cU9x7x28x=9z2w{3y 5x7x78x};cU9x7x318x=9z2w{3y by(5x7x78x)};8y iY=/^[+\\-]?((\\d+(\\.\\d*)?)|(\\.\\d+))$/;cU7x38x=9z(j2){0y(j2 1y cU)3y j2;0y(j2 1y cl4wj2 1y cs){8y j=eP(j2)7x258x(iY);0y(j)3y 2y cU(+j2);4y 2y X(_[33])}0y(j2 1y bO)3y 2y cU(j2*1);0y(eZ(j2)){0y(dc(j2)4w!db(j2))4y 2y X(_[95]);3y 2y cU(+j2)}4y 2y X(_[9])};eK(_[337],cU);9z cV(fb){5x7x78x=fb};cV9x=2y bJ;cV9x7x238x=cQ7x3448x;cV9x7x348x=bK7x3468x;cV9x7x78x=2x;cV9x7x28x=9z2w{3y 5x7x78x};cV9x7x318x=9z2w{3y by(5x7x78x)};8y iZ=/^([+\\-]?((\\d+(\\.\\d*)?)|(\\.\\d+))([eE][+\\-]?\\d+)?|(-?INF)|NaN)$/;cV7x38x=9z(j2){0y(j2 1y cV)3y j2;0y(j2 1y cl4wj2 1y cs){8y j=eP(j2)7x258x(iZ);0y(j)3y 2y cV(j[7]?+j[7]7x388x(_[257],_[168]):+j2);4y 2y X(_[33])}0y(j2 1y bO)3y 2y cV(j2*1);0y(eZ(j2))3y 2y cV(j27x78x);4y 2y X(_[9])};eK(_[334],cV);9z cW(gc,fN,fw,fB,fM,f5,B){5x7x118x=gc;5x7x68x=fN;5x7x158x=fw;5x7x188x=fB;5x7x198x=fM;5x7x228x=f5;5x7x298x=B};cW9x=2y bJ;cW9x7x238x=cQ7x3178x;cW9x7x348x=bK7x3168x;cW9x7x118x=2x;cW9x7x68x=2x;cW9x7x158x=2x;cW9x7x188x=2x;cW9x7x198x=2x;cW9x7x228x=2x;cW9x7x298x=2x;cW9x7x318x=9z2w{3y(5x7x298x?'-':'')+'P'+((e9(5x)+e8(5x))4w'T0S')};8y i0=/^(-)?P(?:([0-9]+)Y)?(?:([0-9]+)M)?(?:([0-9]+)D)?(?:T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:((?:(?:[0-9]+(?:.[0-9]*)?)|(?:.[0-9]+)))S)?)?$/;cW7x38x=9z(j2){0y(j2 1y ct)3y 2y cW(j27x118x,j27x68x,0,0,0,0,j27x298x);0y(j2 1y cT)3y 2y cW(0,0,j27x158x,j27x188x,j27x198x,j27x228x,j27x298x);0y(j2 1y cW)3y j2;0y(j2 1y cl4wj2 1y cs){8y j=eP(j2)7x258x(i0);0y(j)3y ea(2y cW(+j[2]4w0,+j[3]4w0,+j[4]4w0,+j[5]4w0,+j[6]4w0,+j[7]4w0,j[1]6w'-'));4y 2y X(_[33])}4y 2y X(_[9])};9z e9(gA){3y(gA7x118x?gA7x118x+'Y':'')+(gA7x68x?gA7x68x+'M':'')};9z e8(gA){3y(gA7x158x?gA7x158x+'D':'')+(gA7x188x4wgA7x198x4wgA7x228x?'T'+(gA7x188x?gA7x188x+'H':'')+(gA7x198x?gA7x198x+'M':'')+(gA7x228x?gA7x228x+'S':''):'')};9z ea(gA){3y ec(e7(gA))};eK(_[331],cW);9z cY(fb){5x7x78x=fb};cY9x=2y bJ;cY9x7x238x=cQ7x2888x;cY9x7x348x=bK7x2868x;cY9x7x78x=2x;cY9x7x28x=9z2w{3y 5x7x78x};cY9x7x318x=9z2w{3y by(5x7x78x)};8y i1=/^([+\\-]?((\\d+(\\.\\d*)?)|(\\.\\d+))([eE][+\\-]?\\d+)?|(-?INF)|NaN)$/;cY7x38x=9z(j2){0y(j2 1y cY)3y j2;0y(j2 1y cl4wj2 1y cs){8y j=eP(j2)7x258x(i1);0y(j)3y 2y cY(j[7]?+j[7]7x388x(_[257],_[168]):+j2);4y 2y X(_[33])}0y(j2 1y bO)3y 2y cY(j2*1);0y(eZ(j2))3y 2y cY(j27x78x);4y 2y X(_[9])};eK(_[208],cY);9z cZ(fw,f8){5x7x158x=fw;5x7x48x=f8};cZ9x=2y bJ;cZ9x7x238x=cQ7x2858x;cZ9x7x348x=bK7x2898x;cZ9x7x158x=2x;cZ9x7x48x=2x;cZ9x7x318x=9z2w{3y '-'+'-'+'-'+e4(5x7x158x)+e1(5x)};8y i2=/^3v-(0[1-9]|[12]\\d|3[01])(Z|([+\\-])(0\\d|1[0-4]):([0-5]\\d))?$/;cZ7x38x=9z(j2){0y(j2 1y cZ)3y j2;0y(j2 1y cl4wj2 1y cs){8y j=eP(j2)7x258x(i2);0y(j){8y fw=+j[1];3y 2y cZ(fw,j[2]?j[2]6w'Z'?0:(j[3]6w'-'?-1:1)*(j[4]*60+j[5]*1):2x)}4y 2y X(_[33])}0y(j2 1y cR4wj2 1y cS)3y 2y cZ(j27x158x,j27x48x);4y 2y X(_[9])};eK(_[211],cZ);9z c0(fN,f8){5x7x68x=fN;5x7x48x=f8};c09x=2y bJ;c09x7x238x=cQ7x2908x;c09x7x348x=bK7x2938x;c09x7x68x=2x;c09x7x48x=2x;c09x7x318x=9z2w{3y '-'+'-'+e4(5x7x68x)+e1(5x)};8y i3=/^3v(0[1-9]|1[0-2])(Z|([+\\-])(0\\d|1[0-4]):([0-5]\\d))?$/;c07x38x=9z(j2){0y(j2 1y c0)3y j2;0y(j2 1y cl4wj2 1y cs){8y j=eP(j2)7x258x(i3);0y(j){8y fN=+j[1];3y 2y c0(fN,j[2]?j[2]6w'Z'?0:(j[3]6w'-'?-1:1)*(j[4]*60+j[5]*1):2x)}4y 2y X(_[33])}0y(j2 1y cR4wj2 1y cS)3y 2y c0(j27x68x,j27x48x);4y 2y X(_[9])};eK(_[207],c0);9z c1(fN,fw,f8){5x7x68x=fN;5x7x158x=fw;5x7x48x=f8};c19x=2y bJ;c19x7x238x=cQ7x2848x;c19x7x348x=bK7x3138x;c19x7x68x=2x;c19x7x158x=2x;c19x7x48x=2x;c19x7x318x=9z2w{3y '-'+'-'+e4(5x7x68x)+'-'+e4(5x7x158x)+e1(5x)};8y i4=/^3v(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])(Z|([+\\-])(0\\d|1[0-4]):([0-5]\\d))?$/;c17x38x=9z(j2){0y(j2 1y c1)3y j2;0y(j2 1y cl4wj2 1y cs){8y j=eP(j2)7x258x(i4);0y(j){8y fN=+j[1],fw=+j[2];0y(fw-1hl7x28x2w)};fn7x1598x=9z(gT,hl){3y 2y bO(ex(gT)ex(hl))};fn7x1548x=9z(gT,hl){3y 2y bO(dt(gT)dt(hl))};fn7x2568x=9z(gT,hl){3y 2y bO(gT7x298x6whl7x298x3wex(gT)6wex(hl)3wdt(gT)6wdt(hl))};fn7x2588x=9z(gT,hl){3y _b(gT,hl,'eq')};fn7x1568x=9z(gT,hl){3y _b(gT,hl,'lt')};fn7x1518x=9z(gT,hl){3y _b(gT,hl,'gt')};fn7x2558x=9z(gT,hl){3y dp(gT,hl,'eq')};fn7x1508x=9z(gT,hl){3y dp(gT,hl,'lt')};fn7x1458x=9z(gT,hl){3y dp(gT,hl,'gt')};fn7x2508x=9z(gT,hl){3y dq(gT,hl,'eq')};fn7x1448x=9z(gT,hl){3y dq(gT,hl,'lt')};fn7x1488x=9z(gT,hl){3y dq(gT,hl,'gt')};fn7x2528x=9z(gT,hl){3y _b(2y cS(gT7x118x,gT7x68x,e5(gT7x118x,gT7x68x),0,0,0,gT7x48x6w2x?5x7x48x:gT7x48x),2y cS(hl7x118x,hl7x68x,e5(hl7x118x,hl7x68x),0,0,0,hl7x48x6w2x?5x7x48x:hl7x48x),'eq')};fn7x2538x=9z(gT,hl){3y _b(2y cS(gT7x118x,1,1,0,0,0,gT7x48x6w2x?5x7x48x:gT7x48x),2y cS(hl7x118x,1,1,0,0,0,hl7x48x6w2x?5x7x48x:hl7x48x),'eq')};fn7x2608x=9z(gT,hl){3y _b(2y cS(1972,gT7x68x,gT7x158x,0,0,0,gT7x48x6w2x?5x7x48x:gT7x48x),2y cS(1972,hl7x68x,hl7x158x,0,0,0,hl7x48x6w2x?5x7x48x:hl7x48x),'eq')};fn7x2618x=9z(gT,hl){3y _b(2y cS(1972,gT7x68x,e5(1972,hl7x68x),0,0,0,gT7x48x6w2x?5x7x48x:gT7x48x),2y cS(1972,hl7x68x,e5(1972,hl7x68x),0,0,0,hl7x48x6w2x?5x7x48x:hl7x48x),'eq')};fn7x2688x=9z(gT,hl){3y _b(2y cS(1972,12,gT7x158x,0,0,0,gT7x48x6w2x?5x7x48x:gT7x48x),2y cS(1972,12,hl7x158x,0,0,0,hl7x48x6w2x?5x7x48x:hl7x48x),'eq')};fn7x2698x=9z(gT,hl){3y ew(ex(gT)+ex(hl))};fn7x2708x=9z(gT,hl){3y ew(ex(gT)-ex(hl))};fn7x1588x=9z(gT,hl){3y ew(ex(gT)*hl)};fn7x2678x=9z(gT,hl){3y ew(ex(gT)/hl)};fn7x2668x=9z(gT,hl){3y 2y cU(ex(gT)/ex(hl))};fn7x2628x=9z(gT,hl){3y ds(dt(gT)+dt(hl))};fn7x2638x=9z(gT,hl){3y ds(dt(gT)-dt(hl))};fn7x1698x=9z(gT,hl){3y ds(dt(gT)*hl)};fn7x2658x=9z(gT,hl){3y ds(dt(gT)/hl)};fn7x2498x=9z(gT,hl){3y 2y cU(dt(gT)/dt(hl))};fn7x2488x=9z(gT,hl){3y ds(dr(gT)-dr(hl))};fn7x2328x=9z(gT,hl){3y ds(dr(gT)-dr(hl))};fn7x2338x=9z(gT,hl){3y ds(dv(gT)-dv(hl))};fn7x1708x=9z(gT,hl){3y dn(gT,hl,'+')};fn7x1658x=9z(gT,hl){3y dm(gT,hl,'+')};fn7x2348x=9z(gT,hl){3y dn(gT,hl,'-')};fn7x2358x=9z(gT,hl){3y dm(gT,hl,'-')};fn7x1618x=9z(gT,hl){3y dn(gT,hl,'+')};fn7x1628x=9z(gT,hl){3y dm(gT,hl,'+')};fn7x2268x=9z(gT,hl){3y dn(gT,hl,'-')};fn7x2278x=9z(gT,hl){3y dm(gT,hl,'-')};fn7x1348x=9z(gT,hl){8y hG=2y cm(gT7x188x,gT7x198x,gT7x228x,gT7x48x);hG7x188x0vhl7x188x;hG7x198x0vhl7x198x;hG7x228x0vhl7x228x;3y eb(hG)};fn7x2288x=9z(gT,hl){8y hG=2y cm(gT7x188x,gT7x198x,gT7x228x,gT7x48x);hG7x188x1vhl7x188x;hG7x198x1vhl7x198x;hG7x228x1vhl7x228x;3y eb(hG)};9z dq(gT,hl,il){8y fG=dv(gT),f1=dv(hl);3y 2y bO(il6w'lt'?fGf1:fG6wf1)};9z dp(gT,hl,il){3y _b(cS7x38x(gT),cS7x38x(hl),il)};9z _b(gT,hl,il){8y hB=2y cT(0,0,0,0),_e=d0(gT,hB)7x318x2w,jI=d0(hl,hB)7x318x2w;3y 2y bO(il6w'lt'?_ejI:_e6wjI)};9z dn(gT,hl,iC){8y hG;0y(gT 1y cR)hG=2y cR(gT7x118x,gT7x68x,gT7x158x,gT7x48x,gT7x298x);7z 0y(gT 1y cS)hG=2y cS(gT7x118x,gT7x68x,gT7x158x,gT7x188x,gT7x198x,gT7x228x,gT7x48x,gT7x298x);hG7x118x=hG7x118x+hl7x118x*(iC6w'-'?-1:1);hG7x68x=hG7x68x+hl7x68x*(iC6w'-'?-1:1);e6(hG,3x);8y fw=e5(hG7x118x,hG7x68x);0y(hG7x158x>fw)hG7x158x=fw;3y hG};9z dm(gT,hl,iC){8y hG;0y(gT 1y cR){8y fb=(hl7x188x*60+hl7x198x)*60+hl7x228x;hG=2y cR(gT7x118x,gT7x68x,gT7x158x,gT7x48x,gT7x298x);hG7x158x=hG7x158x+hl7x158x*(iC6w'-'?-1:1)-1*(fb3wiC6w'-');e6(hG)}7z 0y(gT 1y cS){hG=2y cS(gT7x118x,gT7x68x,gT7x158x,gT7x188x,gT7x198x,gT7x228x,gT7x48x,gT7x298x);hG7x228x=hG7x228x+hl7x228x*(iC6w'-'?-1:1);hG7x198x=hG7x198x+hl7x198x*(iC6w'-'?-1:1);hG7x188x=hG7x188x+hl7x188x*(iC6w'-'?-1:1);hG7x158x=hG7x158x+hl7x158x*(iC6w'-'?-1:1);e3(hG)}3y hG};9z dt(gA){3y(((gA7x158x*24+gA7x188x)*60+gA7x198x)*60+gA7x228x)*(gA7x298x?-1:1)};9z ds(fb){8y B=(fb=bd7x438x(fb))<0,fx=~~((fb=bd7x408x(fb))/86400),fB=~~((fb1vfx*3600*24)/3600),fM=~~((fb1vfB*3600)/60),f5=fb1vfM*60;3y 2y cT(fx,fB,fM,f5,B)};9z ex(gA){3y(gA7x118x*12+gA7x68x)*(gA7x298x?-1:1)};9z ew(fb){8y fQ=(fb=bd7x438x(fb))<0,gd=~~((fb=bd7x408x(fb))/12),fO=fb1vgd*12;3y 2y ct(gd,fO,fQ)};9z dv(hA){3y hA7x228x+(hA7x198x-(hA7x48x9w2x?hA7x48x%60:0)+(hA7x188x-(hA7x48x9w2x?~~(hA7x48x/60):0))*60)*60};9z dr(hG){8y gw=2y U((hG7x298x?-1:1)*hG7x118x,hG7x68x,hG7x158x,0,0,0,0);0y(hG 1y cS){gw7x4708x(hG7x188x);gw7x1958x(hG7x198x);gw7x4588x(hG7x228x)}0y(hG7x48x9w2x)gw7x1958x(gw7x1948x2w-hG7x48x);3y gw7x4578x2w/1000};fn7x2878x=9z(gT,hl){3y 2y bO(5x7x248x7x1178x(gT,hl))};fn7x2418x=9z(gT,hl){3y 2y bO(7w(5x7x248x7x628x(gT,hl)&4))};fn7x2408x=9z(gT,hl){3y 2y bO(7w(5x7x248x7x628x(gT,hl)&2))};9z dX(gT,hl){0y(dc(gT)4w(bd7x408x(gT)6wfD)4wdc(hl)4w(bd7x408x(hl)6wfD))3y 0;8y h=by(gT)7x258x(hN),m=by(hl)7x258x(hN),fW=bd7x1918x(1,(h[2]4wh[3]4w'')7x18x+(h[5]4w0)*(h[4]6w'+'?-1:1),(m[2]4wm[3]4w'')7x18x+(m[5]4w0)*(m[4]6w'+'?-1:1));3y fW+(fW%2?0:1)};fn7x1158x=9z(gT,hl){8y fG=gT7x28x2w,f1=hl7x28x2w,fW=bd7x728x(10,dX(fG,f1));3y du(gT,hl,((fG*fW)+(f1*fW))/fW)};fn7x1208x=9z(gT,hl){8y fG=gT7x28x2w,f1=hl7x28x2w,fW=bd7x728x(10,dX(fG,f1));3y du(gT,hl,((fG*fW)-(f1*fW))/fW)};fn7x898x=9z(gT,hl){8y fG=gT7x28x2w,f1=hl7x28x2w,fW=bd7x728x(10,dX(fG,f1));3y du(gT,hl,((fG*fW)*(f1*fW))/(fW*fW))};fn7x908x=9z(gT,hl){8y fG=gT7x28x2w,f1=hl7x28x2w,fW=bd7x728x(10,dX(fG,f1));3y du(gT,hl,(gT*fW)/(hl*fW))};fn7x2398x=9z(gT,hl){3y 2y c7(~~(gT/hl))};fn7x2388x=9z(gT,hl){8y fG=gT7x28x2w,f1=hl7x28x2w,fW=bd7x728x(10,dX(fG,f1));3y du(gT,hl,((fG*fW)%(f1*fW))/fW)};fn7x2428x=9z(hl){3y hl};fn7x2438x=9z(hl){hl7x78x*=-1;3y hl};fn7x1308x=9z(gT,hl){3y 2y bO(gT7x28x2w6whl7x28x2w)};fn7x998x=9z(gT,hl){3y 2y bO(gT7x28x2whl7x28x2w)};9z du(gT,hl,f0){3y 2y(gT 1y c73whl 1y c73wf06wbd7x438x(f0)?c7:cU)(f0)};fn7x2468x=9z(gT,hl){3y 2y bO(gT7x208x6whl7x208x3wgT7x178x6whl7x178x)};fn7x2458x=9z(hr,hs){3y hr7x968x(hs)};fn7x1198x=9z(hr,hs){8y hq=0w;8z(8y fC=0,fJ=hr7x18x,gN;fCfr)c7x1778x2w;7z{c7x108x(q[fC]);fr2v}}7z 0y(q[fC]9w'.')c7x108x(q[fC])}0y(q[3vfC]6w'..'4wq[fC]6w'.')c7x108x('');hF7x588x=c7x418x('/')}}3y hF});eL(_[230],0w,9z2w{3y 2y bO(3x)});eL(_[499],0w,9z2w{3y 2y bO(1x)});eL(_[496],[[cy,'*'8x,9z(hr){3y 2y bO(!d5(hr,5x))});eL(_[76],0w,9z2w{3y 2y c7(5x7x768x)});eL(_[497],0w,9z2w{3y 2y c7(5x7x948x)});eL(_[498],0w,9z2w{3y 5x7x708x});eL(_[503],0w,9z2w{3y cR7x38x(5x7x708x)});eL(_[504],0w,9z2w{3y cm7x38x(5x7x708x)});eL(_[510],0w,9z2w{3y 5x7x48x});eL(_[511],0w,9z2w{3y 2y cl(5x7x538x7x1748x)});eL(_[509],0w,9z2w{3y bM7x38x(2y cl(5x7x538x7x838x4w''))});eL(_[508],[[cW,'?'8x,9z(gA){3y d2(gA,_[11])});eL(_[505],[[cW,'?'8x,9z(gA){3y d2(gA,_[6])});eL(_[506],[[cW,'?'8x,9z(gA){3y d2(gA,_[15])});eL(_[507],[[cW,'?'8x,9z(gA){3y d2(gA,_[18])});eL(_[495],[[cW,'?'8x,9z(gA){3y d2(gA,_[19])});eL(_[494],[[cW,'?'8x,9z(gA){3y d2(gA,_[22])});eL(_[482],[[cS,'?'8x,9z(gx){3y d1(gx,_[11])});eL(_[483],[[cS,'?'8x,9z(gx){3y d1(gx,_[6])});eL(_[484],[[cS,'?'8x,9z(gx){3y d1(gx,_[15])});eL(_[481],[[cS,'?'8x,9z(gx){3y d1(gx,_[18])});eL(_[480],[[cS,'?'8x,9z(gx){3y d1(gx,_[19])});eL(_[477],[[cS,'?'8x,9z(gx){3y d1(gx,_[22])});eL(_[478],[[cS,'?'8x,9z(gx){3y d1(gx,_[4])});eL(_[479],[[cR,'?'8x,9z(gw){3y d1(gw,_[11])});eL(_[485],[[cR,'?'8x,9z(gw){3y d1(gw,_[6])});eL(_[486],[[cR,'?'8x,9z(gw){3y d1(gw,_[15])});eL(_[492],[[cR,'?'8x,9z(gw){3y d1(gw,_[4])});eL(_[493],[[cm,'?'8x,9z(hA){3y d1(hA,_[18])});eL(_[491],[[cm,'?'8x,9z(hA){3y d1(hA,_[19])});eL(_[490],[[cm,'?'8x,9z(hA){3y d1(hA,_[22])});eL(_[487],[[cm,'?'8x,9z(hA){3y d1(hA,_[4])});eL(_[488],[[cS,'?'],[cT,'?',3x8x,9z(gx,gy){3y d0(gx,4x7x18x>13wgy9w2x?4x7x18x>1?gy:5x7x48x:2x)});eL(_[489],[[cR,'?'],[cT,'?',3x8x,9z(gw,gy){3y d0(gw,4x7x18x>13wgy9w2x?4x7x18x>1?gy:5x7x48x:2x)});eL(_[512],[[cm,'?'],[cT,'?',3x8x,9z(hA,gy){3y d0(hA,4x7x18x>13wgy9w2x?4x7x18x>1?gy:5x7x48x:2x)});9z d2(gA,iz){0y(gA6w2x)3y 2x;8y fb=gA[iz]*(gA7x298x?-1:1);3y iz6w_[22]?2y cU(fb):2y c7(fb)};9z d1(gx,iz){0y(gx6w2x)3y 2x;0y(iz6w_[4]){8y f8=gx7x48x;0y(f86w2x)3y 2x;3y 2y cT(0,bd7x408x(~~(f8/60)),bd7x408x(f8%60),0,f8<0)}7z{8y fb=gx[iz];0y(!(gx 1y cR)){0y(iz6w_[18])0y(fb6w24)fb=0}0y(!(gx 1y cm))fb*=gx7x298x?-1:1;3y iz6w_[22]?2y cU(fb):2y c7(fb)}};9z d0(gx,hB){0y(gx6w2x)3y 2x;8y hG;0y(gx 1y cR)hG=2y cR(gx7x118x,gx7x68x,gx7x158x,gx7x48x,gx7x298x);7z 0y(gx 1y cm)hG=2y cm(gx7x188x,gx7x198x,gx7x228x,gx7x48x,gx7x298x);7z hG=2y cS(gx7x118x,gx7x68x,gx7x158x,gx7x188x,gx7x198x,gx7x228x,gx7x48x,gx7x298x);0y(hB6w2x)hG7x48x=2x;7z{8y f8=dt(hB)/60;0y(gx7x48x9w2x){8y fz=f8-gx7x48x;0y(gx 1y cR){0y(fz<0)hG7x158x3v}7z{hG7x198x0vfz%60;hG7x188x0v~~(fz/60)}e3(hG)}hG7x48x=f8}3y hG};eL(_[47],[[cz,'?',3x8x,9z(g0){0y(!4x7x18x){0y(!5x7x248x7x368x(5x7x268x))4y 2y X(_[9]);g0=5x7x268x}7z 0y(g06w2x)3y 2y cl('');8y j2=fm7x2258x7x218x(5x,g0);3y 2y cl(j26w2x?'':j27x318x2w)});eL(_[513],[[cz,'?',3x8x,9z(g0){0y(!4x7x18x){0y(!5x7x248x7x368x(5x7x268x))4y 2y X(_[9]);g0=5x7x268x}7z 0y(g06w2x)3y 2y cl('');3y 2y cl(5x7x248x7x288x(g0,_[20])4w'')});eL(_[537],[[cz,'?',3x8x,9z(g0){0y(!4x7x18x){0y(!5x7x248x7x368x(5x7x268x))4y 2y X(_[9]);g0=5x7x268x}7z 0y(g06w2x)3y bM7x38x(2y cl(''));3y bM7x38x(2y cl(5x7x248x7x288x(g0,_[17])4w''))});eL(_[271],[[bJ,'?',3x8x,9z(gN){0y(!4x7x18x){0y(!5x7x268x)4y 2y X(_[75]);gN=d3([5x7x268x],5x)[0]}8y j2=2y cV(fP);0y(gN9w2x){7y{j2=cV7x38x(gN)}3z(e)1w}3y j2});eL(_[538],[[cl,'?'],[cz,'',3x8x,9z(ir,g0){0y(4x7x18x<2){0y(!5x7x248x7x368x(5x7x268x))4y 2y X(_[9]);g0=5x7x268x}8y d7=5x7x248x7x288x;0y(d7(g0,_[27])6w2)g0=d7(g0,_[56]);8z(8y b;g0;g0=d7(g0,_[42]))0y(b=d7(g0,_[57]))8z(8y fC=0,fJ=b7x18x;fC1?hc7x28x2w:0;0y(fX<0){8y hb=2y c7(bd7x728x(10,-fX)),f4=bd7x438x(fn7x908x7x218x(5x,hG,hb)),hm=2y c7(f4);fy=bd7x408x(fn7x1208x7x218x(5x,hm,fn7x908x7x218x(5x,hG,hb)));3y fn7x898x7x218x(5x,fn7x1158x7x218x(5x,hm,2y cU(fy6w0.53wf4%2?-1:0)),hb)}7z{8y hb=2y c7(bd7x728x(10,fX)),f4=bd7x438x(fn7x898x7x218x(5x,hG,hb)),hm=2y c7(f4);fy=bd7x408x(fn7x1208x7x218x(5x,hm,fn7x898x7x218x(5x,hG,hb)));3y fn7x908x7x218x(5x,fn7x1158x7x218x(5x,hm,2y cU(fy6w0.53wf4%2?-1:0)),hb)}});eL(_[533],[[cl,'?'],[cx8x,9z(hf,gB){0y(hf6w2x)3y 2x;8y iF=hf7x28x2w,j=iF7x258x(i9);0y(!j)4y 2y X(_[95]);8y iE=j[1]4w2x,iu=j[2],iA=5x7x248x7x558x(gB,iE);0y(iE9w2x3w!iA)4y 2y X(_[198]);3y 2y cj(iE,iu,iA4w2x)});eL(_[147],[[cl,'?'],[cl8x,9z(hF,hf){8y iF=hf7x28x2w,j=iF7x258x(i9);0y(!j)4y 2y X(_[95]);3y 2y cj(j[1]4w2x,j[2]4w2x,hF6w2x?'':hF7x28x2w)});eL(_[534],[[cj,'?'8x,9z(hf){0y(hf9w2x){0y(hf7x308x)3y 2y ca(hf7x308x)}3y 2x});eL(_[539],[[cj,'?'8x,9z(hf){0y(hf6w2x)3y 2x;3y 2y ca(hf7x208x)});eL(_[540],[[cj,'?'8x,9z(hf){0y(hf6w2x)3y 2x;3y bM7x38x(2y cl(hf7x178x4w''))});eL(_[546],[[cl,'?'],[cx8x,9z(hd,gB){8y iE=hd6w2x?'':hd7x28x2w,iA=5x7x248x7x558x(gB,iE4w2x);3y iA6w2x?2x:bM7x38x(2y cl(iA))});eL(_[181],[[cx8x,9z(gB){4y \"Function '\"+_[181]+\"' not implemented\"});eL(_[118],[[cy,'*'8x,9z(hr){3y 2y bO(d5(hr,5x))});eL(_[547],[[bJ,'*'],[bJ],[cl,'',3x8x,9z(hr,ho,gr){0y(!hr7x18x4who6w2x)3y 0w;8y jZ=ho;0y(jZ 1y cs)jZ=cl7x38x(jZ);8y hq=0w;8z(8y fC=0,fJ=hr7x18x,j1;fCfJ)fV=fJ+1;8y hq=0w;8z(8y fC=0;fCfJ)3y hr;8y hq=0w;8z(8y fC=0;fC2?bd7x438x(gU):hr7x18x-fV+1;3y hr7x4468x(fV-1,fV-1+fJ)});eL(_[530],[[cy,'*'8x,9z(hr){3y hr});eL(_[519],[[cy,'*'8x,9z(hr){0y(hr7x18x>1)4y 2y X(_[188]);3y hr});eL(_[520],[[cy,'*'8x,9z(hr){0y(!hr7x18x)4y 2y X(_[187]);3y hr});eL(_[518],[[cy,'*'8x,9z(hr){0y(hr7x18x9w1)4y 2y X(_[184]);3y hr});eL(_[185],[[cy,'*'],[cy,'*'],[cl,'',3x8x,9z(hr,hs,gr){4y \"Function '\"+_[185]+\"' not implemented\"});eL(_[517],[[cy,'*'8x,9z(hr){3y 2y c7(hr7x18x)});eL(_[514],[[bJ,'*'8x,9z(hr){0y(!hr7x18x)3y 2x;7y{8y j2=hr[0];0y(j2 1y cs)j2=cV7x38x(j2);8z(8y fC=1,fJ=hr7x18x,j1;fC1)3y hL;7z 3y 2y cV(0);3y 2x}7y{8y j2=hr[0];0y(j2 1y cs)j2=cV7x38x(j2);8z(8y fC=1,fJ=hr7x18x,j1;fC2)ik=gr7x28x2w;jW=ik6wix+_[223]?gq:5x7x538x7x2518x(ik);0y(!jW)4y 2y X(_[222]);3y 2y c7(jW7x508x(hH7x28x2w,hI7x28x2w))});eL(_[528],[[cl,'?'],[cl,'?'8x,9z(hH,hI){0y(hH6w2x4whI6w2x)3y 2x;3y 2y bO(hH7x28x2w6whI7x28x2w)});eL(_[96],2x,9z2w{0y(4x7x18x<2)4y 2y X(_[46]);8y r=0w;8z(8y fC=0,fJ=4x7x18x,hq;fC2?f7+bd7x438x(gU):jO7x18x;3y 2y cl(fA>f7?jO7x1018x(f7,fA):'')});eL(_[527],[[cl,'?',3x8x,9z(hG){0y(!4x7x18x){0y(!5x7x268x)4y 2y X(_[75]);hG=cl7x38x(d3([5x7x268x],5x)[0])}3y 2y c7(hG6w2x?0:hG7x28x2w7x18x)});eL(_[526],[[cl,'?',3x8x,9z(hG){0y(!4x7x18x){0y(!5x7x268x)4y 2y X(_[75]);hG=cl7x38x(d3([5x7x268x],5x)[0])}3y 2y cl(hG6w2x?'':eP(hG)7x388x(/\\s\\s+/g,' '))});eL(_[272],[[cl,'?'],[cl,'',3x8x,9z(hG,h3){4y \"Function '\"+_[272]+\"' not implemented\"});eL(_[523],[[cl,'?'8x,9z(hG){3y 2y cl(hG6w2x?'':hG7x28x2w7x2648x2w)});eL(_[524],[[cl,'?'8x,9z(hG){3y 2y cl(hG6w2x?'':hG7x28x2w7x778x2w)});eL(_[525],[[cl,'?'],[cl],[cl8x,9z(hG,gY,hC){0y(hG6w2x)3y 2y cl('');8y r=hG7x28x2w7x488x(''),i=gY7x28x2w7x488x(''),p=hC7x28x2w7x488x(''),f9=p7x18x,l=0w;8z(8y fC=0,fJ=r7x18x,fV;fC126)r[fC]=6x7x2318x(r[fC]);3y 2y cl(r7x418x(''))});eL(_[428],[[cl,'?'],[cl,'?'],[cl,'',3x8x,9z(hG,ho,gr){3y 2y bO((hG6w2x?'':hG7x28x2w)7x458x(ho6w2x?'':ho7x28x2w)5v0)});eL(_[426],[[cl,'?'],[cl,'?'],[cl,'',3x8x,9z(hG,ho,gr){3y 2y bO((hG6w2x?'':hG7x28x2w)7x458x(ho6w2x?'':ho7x28x2w)6w0)});eL(_[425],[[cl,'?'],[cl,'?'],[cl,'',3x8x,9z(hG,ho,gr){8y jO=hG6w2x?'':hG7x28x2w,jK=ho6w2x?'':ho7x28x2w;3y 2y bO(jO7x458x(jK)6wjO7x18x-jK7x18x)});eL(_[422],[[cl,'?'],[cl,'?'],[cl,'',3x8x,9z(hG,ho,gr){8y jO=hG6w2x?'':hG7x28x2w,jK=ho6w2x?'':ho7x28x2w,fV;3y 2y cl((fV=jO7x458x(jK))5v0?jO7x1018x(0,fV):'')});eL(_[423],[[cl,'?'],[cl,'?'],[cl,'',3x8x,9z(hG,ho,gr){8y jO=hG6w2x?'':hG7x28x2w,jK=ho6w2x?'':ho7x28x2w,fV;3y 2y cl((fV=jO7x458x(jK))5v0?jO7x1018x(fV+jK7x18x):'')});9z d6(jO,io){8y d1='\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF',d2='\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D',d3='\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\jR\\jS-\\jT\\jU-\\jV',c='A-Z_a-z\\\\-.0-9\\u00B7'+d1+'\\u0300-\\u036F'+d2+'\\u203F-\\u2040'+d3,i='A-Z_a-z'+d1+d2+d3;jO=jO 7x388x(/\\[\\\\i-\\[:\\]\\]/g,'['+i+']')7x388x(/\\[\\\\c-\\[:\\]\\]/g,'['+c+']')7x388x(/\\\\i/g,'[:'+i+']')7x388x(/\\\\I/g,'[^:'+i+']')7x388x(/\\\\c/g,'[:'+c+']')7x388x(/\\\\C/g,'[^:'+c+']');0y(io3w!io7x258x(/^[smix]+$/))4y 2y X(_[210]);8y v=io7x458x('s')5v0,w=io7x458x('x')5v0;0y(v4ww){io=io7x388x(/[sx]/g,'');8y r=0w,hR=/\\s/;8z(8y fC=0,fJ=jO7x18x,H=1x,ih,ii='';fC2?gH7x28x2w:'');3y 2y bO(hO7x378x(jO))});eL(_[38],[[cl,'?'],[cl],[cl],[cl,'',3x8x,9z(hG,h9,hi,gH){8y jO=hG6w2x?'':hG7x28x2w,hO=d6(h97x28x2w,4x7x18x>3?gH7x28x2w:'');3y 2y bO(jO7x388x(hO,hi7x28x2w))});eL(_[424],[[cl,'?'],[cl],[cl,'',3x8x,9z(hG,h9,gH){8y jO=hG6w2x?'':hG7x28x2w,hO=d6(h97x28x2w,4x7x18x>2?gH7x28x2w:'');8y hq=0w;8z(8y fC=0,r=jO7x488x(hO),fJ=r7x18x;fCjQ?1:-1};8y M=9z2w1w;M9x7x278x=2;M9x7x618x=M9x7x868x=M9x7x608x=M9x7x208x=M9x7x178x=M9x7x308x=M9x7x578x=M9x7x1768x=M9x7x858x=M9x7x2478x=M9x7x798x=M9x7x748x=M9x7x428x=M9x7x478x=M9x7x928x=M9x7x78x=M9x7x568x=2x;9z ba2w1w;ba9x=2y T;8y gR=2y bw;ba9x7x288x=9z(g0,iz){0y(iz 0z g0)3y g0[iz];0y(iz6w_[83]){8y ie='',eE=gR7x1788x('{'+_[361]+'}'+_[281]),cl=gR7x1068x('{'+_[362]+'}'+_[104]);8z(8y h7=g0,jN;h7;h7=h77x428x)0y(h77x278x6w13w(jN=h77x4418x(_[430])))ie=eE(2y cl(jN),2y cl(ie))7x318x2w;3y ie}7z 0y(iz6w_[91]){8y o=0w;(9z(g0){8z(8y fC=0,gp;gp=g07x1768x[fC];fC2v)0y(gp7x278x6w34wgp7x278x6w4)o7x108x(gp7x1168x);7z 0y(gp7x278x6w13wgp7x858x)4x7x1038x(gp)})(g0);3y o7x418x('')}};ba9x7x628x=9z(g0,gp){0y(_[62] 0z g0)3y g07x628x(gp);0y(gp6wg0)3y 0;8y gj=2x,gk=2x,b,gi,gB,fC,fJ;0y(g07x278x6w2){gj=g0;g0=5x7x288x(gj,_[56])}0y(gp7x278x6w2){gk=gp;gp=5x7x288x(gk,_[56])}0y(gj3wgk3wg03wg06wgp){8z(fC=0,b=5x7x288x(g0,_[57]),fJ=b7x18x;fC?!>=!..!,,!>.!>,!>\"!>>\"!\"\"!>>!>>>!}}!\'\'!*)!~|!^\\!^%\\!^^!\\`\\!xpeojx!tjiu!tuofnvhsb!fvsu!mmvo!ftmbg!iujx!fmjix!sbw!zsu!idujxt!gpfqzu!xpsiu!osvufs!xfo!gpfdobutoj!gj!opjudovg!spg!ftmf!fufmfe!umvbgfe!fvojuopd!idubd!ftbd!lbfsc!oj",'',0,this,'prototype length valueOf cast timezone peek month value evaluate XPTY0004 push year XPST0003 next eof day items namespaceURI hours minutes localName call seconds builtInKind DOMAdapter match item nodeType getProperty negative prefix toString left FORG0001 primitiveKind expression isNode test replace type abs join parentNode round bindings indexOf XPST0017 name split stack compare scope operator staticContext predicates lookupNamespaceURI ownerElement attributes path occurence ownerDocument nodeName compareDocumentPosition right itemType attribute scheme code authority FORG0006 dateTime args pow getURIForPrefix nextSibling XPDY0002 position toLowerCase index previousSibling inExpr node xmlns baseURI substr firstChild nodeValue defaultFunctionNamespace schema-attribute numeric-multiply numeric-divide textContent specified schema-element size FOCA0002 concat numeric-greater-than getElementsByTagNameNS numeric-less-than XPST0051 substring satisfiesExpr callee string XPDY0050 getDataType collations parent functions descendant-or-self dataTypes axis returnExpr namespaceResolver numeric-add data isSameNode boolean union numeric-subtract getElementById query fragment child intersect ancestor ancestor-or-self thenExpr internalExpression numeric-equal quantifier applyPredicates collections add-dayTimeDuration-to-time to popVariable except condExpr pushVariable defaultElementNamespace hasOwnProperty elseExpr document-node time-less-than date-greater-than boolean-less-than QName time-greater-than root date-less-than dateTime-greater-than boolean-greater-than yearMonthDuration-greater-than dayTimeDuration-less-than dayTimeDuration-greater-than dateTime-less-than NOTATION multiply-yearMonthDuration yearMonthDuration-less-than element add-yearMonthDuration-to-date add-dayTimeDuration-to-date preceding-sibling processing-instruction add-dayTimeDuration-to-dateTime as undefined Infinity multiply-dayTimeDuration add-yearMonthDuration-to-dateTime preceding documents charAt defaultCollationName charCodeAt childNodes pop getFunction reverse text in-scope-prefixes hexBinary-equal base64Binary-equal FORG0005 deep-equal NMTOKEN_DT FORG0004 FORG0003 and or max baseName in getMinutes setMinutes XPTY0020 extend FONS0004 boolean-equal doc gYearMonth gYear hexBinary ENTITY_DT time gMonthDay gMonth float NCNAME_DT FORX0001 gDay BOOLEAN_DT ID_DT collection doc-available floor idref element-with-id LANGUAGE_DT xs2js xpath FOCH0002 /collation/codepoint FODC0001 node-name subtract-yearMonthDuration-from-date subtract-dayTimeDuration-from-date subtract-dayTimeDuration-from-time target true encodeURIComponent subtract-dates subtract-times subtract-yearMonthDuration-from-dateTime subtract-dayTimeDuration-from-dateTime min log numeric-mod numeric-integer-divide node-after node-before numeric-unary-plus numeric-unary-minus equals concatenate QName-equal lastChild subtract-dateTimes divide-dayTimeDuration-by-dayTimeDuration time-equal getCollation gYearMonth-equal gYear-equal fromCharCode date-equal duration-equal INF dateTime-equal every gMonthDay-equal gMonth-equal add-dayTimeDurations subtract-dayTimeDurations toUpperCase divide-dayTimeDuration divide-yearMonthDuration-by-yearMonthDuration divide-yearMonthDuration gDay-equal add-yearMonthDurations subtract-yearMonthDurations number normalize-unicode INT_DT comment SHORT_DT BYTE_DT LONG_DT NEGATIVEINTEGER_DT DAYTIMEDURATION_DT INTEGER_DT resolve-uri NONPOSITIVEINTEGER_DT NONNEGATIVEINTEGER_DT GMONTHDAY_DT GDAY_DT PRIMITIVE_FLOAT is-same-node FLOAT_DT PRIMITIVE_GDAY GMONTH_DT xml XPST0008 PRIMITIVE_GMONTH XPTY0019 XT_YEARMONTHDURATION_DT following following-sibling self NOTATION_DT descendant PRIMITIVE_HEXBINARY GYEARMONTH_DT PRIMITIVE_GYEARMONTH HEXBINARY_DT GYEAR_DT PRIMITIVE_NOTATION TIME_DT XPST0081 PRIMITIVE_TIME XT_UNTYPEDATOMIC_DT PRIMITIVE_STRING STRING_DT PRIMITIVE_GMONTHDAY QNAME_DT PRIMITIVE_QNAME PRIMITIVE_DURATION DURATION_DT DATE_DT anyAtomicType PRIMITIVE_BOOLEAN BASE64BINARY_DT PRIMITIVE_ANYURI ANYURI_DT ANYSIMPLETYPE_DT UNSIGNEDSHORT_DT ANYATOMICTYPE_DT PRIMITIVE_BASE64BINARY anyURI NORMALIZEDSTRING_DT TOKEN_DT duration NAME_DT UNSIGNEDBYTE_DT double base64Binary date decimal UNSIGNEDINT_DT ANYTYPE_DT PRIMITIVE_DECIMAL DECIMAL_DT documentElement apply DOUBLE_DT trim PRIMITIVE_DOUBLE POSITIVEINTEGER_DT PRIMITIVE_DATETIME PRIMITIVE_GYEAR DATETIME_DT PRIMITIVE_DATE UNSIGNEDLONG_DT XPTY0018 else some XPST0010 http://www.w3.org/XML/1998/namespace if then http://www.w3.org/2000/xmlns/ http://www.w3.org/2005/xpath-functions http://www.w3.org/2001/XMLSchema treat castable int of instance fourth for fifth long XPST0080 dayTimeDuration yearMonthDuration untypedAtomic http://www.w3.org/1999/xhtml empty-sequence negativeInteger nonPositiveInteger integer short byte NCName Name token ENTITY ID satisfies NMTOKEN language normalizedString unsignedByte third positiveInteger nonNegativeInteger second unsignedLong unsignedShort first unsignedInt return matches isNaN isFinite NaN TypeError SyntaxError Function Math Error btoa atob getTimezoneOffset getFullYear getMonth back reset parseInt message Date RegExp substring-before substring-after tokenize ends-with starts-with escape-html-uri contains trace xml:base Number Object Array Boolean String div DIV getDate getHours console getAttribute innerText decodeURI encodeURI ceil slice sort nodeFromID jQuery href createElement tagName location createElementNS document namespaces getTime setSeconds setFunction setCollation setCollection setDocument setDataType getSeconds getMilliseconds js2xs IDREF_DT DAYMONTHDURATION_DT PRECISIONDECIMAL_DT setHours DATETIMESTAMP_DT UNAVAILABLE_DT LISTOFUNION_DT LIST_DT iri-to-uri encode-for-uri seconds-from-dateTime timezone-from-dateTime year-from-date minutes-from-dateTime hours-from-dateTime year-from-dateTime month-from-dateTime day-from-dateTime month-from-date day-from-date timezone-from-time adjust-dateTime-to-timezone adjust-date-to-timezone seconds-from-time minutes-from-time timezone-from-date hours-from-time seconds-from-duration minutes-from-duration not last current-dateTime false documentURI base-uri document-uri current-date current-time months-from-duration days-from-duration hours-from-duration years-from-duration static-base-uri implicit-timezone default-collation adjust-time-to-timezone local-name avg sum id count exactly-one zero-or-one one-or-more codepoints-to-string string-to-codepoints upper-case lower-case translate normalize-space string-length codepoint-equal string-join unordered subsequence round-half-to-even resolve-QName prefix-from-QName ceiling xml:lang namespace-uri lang local-name-from-QName namespace-uri-from-QName distinct-values insert-before remove exists empty namespace-uri-for-prefix index-of nilled'.split(' ')); 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-xpath", 3 | "title": "jQuery XPath plugin", 4 | "description": "jQuery plugin for querying XML and HTML documents with XPath 2.0", 5 | "version": "0.3.1", 6 | "main": "jquery.xpath.js", 7 | "homepage": "https://github.com/ilinsky/jquery-xpath", 8 | "author": { 9 | "name": "Sergey Ilinsky", 10 | "email": "sergey@ilinsky.com", 11 | "url": "http://www.ilinsky.com" 12 | }, 13 | "licenses": [ 14 | { 15 | "type": "MIT", 16 | "url": "https://github.com/ilinsky/jquery-xpath/blob/master/res/license/MIT-LICENSE.txt" 17 | } 18 | ], 19 | "repository": { 20 | "type": "git", 21 | "url": "https://github.com/ilinsky/jquery-xpath.git" 22 | }, 23 | "bugs": { 24 | "url": "https://github.com/ilinsky/jquery-xpath/issues" 25 | }, 26 | "keywords": [ 27 | "jquery", 28 | "xpath", 29 | "xpath2", 30 | "jquery-plugin" 31 | ], 32 | "dependencies": { 33 | "jquery": ">=1.0.0" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /res/assemble.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | var cXMLHttpRequest = window.XMLHttpRequest || function() { 4 | return new ActiveXObject("Microsoft.XMLHTTP"); 5 | }; 6 | 7 | // Uri utilities 8 | var hUriCache = {}; 9 | function fGetUriComponents(sUri) { 10 | var aResult = hUriCache[sUri] ||(hUriCache[sUri] = sUri.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)); 11 | return [aResult[1], aResult[3], aResult[5], aResult[6], aResult[8]]; 12 | }; 13 | 14 | function fResolveUri(sUri, sBaseUri) { 15 | if (sUri == '' || sUri.charAt(0) == '#') 16 | return sBaseUri; 17 | 18 | var aUri = fGetUriComponents(sUri); 19 | if (aUri[0]) // scheme 20 | return sUri; 21 | 22 | var aBaseUri = fGetUriComponents(sBaseUri); 23 | aUri[0] = aBaseUri[0]; // scheme 24 | 25 | if (!aUri[1]) { 26 | // authority 27 | aUri[1] = aBaseUri[1]; 28 | 29 | // path 30 | if (aUri[2].charAt(0) != '/') { 31 | var aUriSegments = aUri[2].split('/'), 32 | aBaseUriSegments = aBaseUri[2].split('/'); 33 | aBaseUriSegments.pop(); 34 | 35 | var nBaseUriStart = aBaseUriSegments[0] == '' ? 1 : 0; 36 | for (var nIndex = 0, nLength = aUriSegments.length; nIndex < nLength; nIndex++) { 37 | if (aUriSegments[nIndex] == '..') { 38 | if (aBaseUriSegments.length > nBaseUriStart) 39 | aBaseUriSegments.pop(); 40 | else { 41 | aBaseUriSegments.push(aUriSegments[nIndex]); 42 | nBaseUriStart++; 43 | } 44 | } 45 | else 46 | if (aUriSegments[nIndex] != '.') 47 | aBaseUriSegments.push(aUriSegments[nIndex]); 48 | } 49 | if (aUriSegments[--nIndex] == '..' || aUriSegments[nIndex] == '.') 50 | aBaseUriSegments.push(''); 51 | aUri[2] = aBaseUriSegments.join('/'); 52 | } 53 | } 54 | 55 | var aResult = []; 56 | if (aUri[0]) 57 | aResult.push(aUri[0]); 58 | if (aUri[1]) // '//' 59 | aResult.push(aUri[1]); 60 | if (aUri[2]) 61 | aResult.push(aUri[2]); 62 | if (aUri[3]) // '?' 63 | aResult.push(aUri[3]); 64 | if (aUri[4]) // '#' 65 | aResult.push(aUri[4]); 66 | 67 | return aResult.join(''); 68 | }; 69 | 70 | function fAssemble(descriptor) { 71 | // get files list 72 | var oRequest = new cXMLHttpRequest; 73 | oRequest.open("GET", descriptor, false); 74 | oRequest.send(null); 75 | 76 | // read files 77 | var source = []; 78 | for (var n = 0, files = oRequest.responseText.split(/\n/g), file; n < files.length; n++) { 79 | if ((file = files[n].replace(/^\s+/, "").replace(/\s+$/, "")) != '' && file.substr(0, 1) != "#") { 80 | file = fResolveUri(file, descriptor); 81 | if (file.match(/.files$/)) 82 | source[source.length] = fAssemble(file); 83 | else { 84 | oRequest.open("GET", file, false); 85 | oRequest.send(null); 86 | source[source.length] = oRequest.responseText; 87 | } 88 | } 89 | } 90 | return source.join("\n"); 91 | }; 92 | 93 | // Get baseUri 94 | var scripts = document.getElementsByTagName("script"), 95 | self = scripts[scripts.length-1], 96 | match = self.src.match(/\?path=(.+)$/); 97 | 98 | // 99 | self.parentNode.removeChild(self); 100 | 101 | // Remove self 102 | var code = fAssemble(match[1] + ".files"); 103 | 104 | // Evaluate 105 | var oScript = document.getElementsByTagName("head")[0].appendChild(document.createElement("script")); 106 | oScript.type = "text/javascript"; 107 | oScript.text = "" + 108 | "(function(){" + 109 | code + 110 | "})();" + 111 | ""; 112 | })(); -------------------------------------------------------------------------------- /res/assemble.php: -------------------------------------------------------------------------------- 1 | ' . $sTagName . '.+\/\/<\-' . $sTagName . '/Us', "", $sInput); 32 | } 33 | 34 | function fAssemble($descriptor) { 35 | $files = file($descriptor); 36 | 37 | $output = ""; 38 | for ($n = 0; $n < count($files); $n++) 39 | if (($file = trim($files[$n])) != "" && substr($file, 0, 1) != "#") { 40 | $file = fResolveUri($file, $descriptor); 41 | if (preg_match("/\.files$/", $file, $match)) 42 | $source .= fAssemble($file); 43 | else 44 | $source .= join('', file($file)) . "\n"; 45 | } 46 | return $source; 47 | }; 48 | 49 | // Uri utilities 50 | $hUriCache = array(); 51 | function fGetUriComponents($sUri) { 52 | if (!isset($hUriCache[$sUri])) { 53 | preg_match("/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/", $sUri, $match); 54 | $hUriCache[$sUri] = array($match[1], $match[3], $match[5], $match[6], $match[8]); 55 | } 56 | return $hUriCache[$sUri]; 57 | }; 58 | 59 | function fResolveUri($sUri, $sBaseUri) { 60 | if ($sUri == '' || substr($sUri, 0, 1) == '#') 61 | return $sBaseUri; 62 | 63 | $aUri = fGetUriComponents($sUri); 64 | if ($aUri[0]) // scheme 65 | return $sUri; 66 | 67 | $aBaseUri = fGetUriComponents($sBaseUri); 68 | $aUri[0] = $aBaseUri[0]; // scheme 69 | 70 | if (!$aUri[1]) { 71 | // authority 72 | $aUri[1] = $aBaseUri[1]; 73 | 74 | // path 75 | if (substr($aUri[2], 0, 1) != '/') { 76 | $aUriSegments = explode("/", $aUri[2]); 77 | $aBaseUriSegments = explode("/", $aBaseUri[2]); 78 | array_pop($aBaseUriSegments); 79 | 80 | $nBaseUriStart = $aBaseUriSegments[0] == '' ? 1 : 0; 81 | for ($nIndex = 0, $nLength = count($aUriSegments); $nIndex < $nLength; $nIndex++) { 82 | if ($aUriSegments[$nIndex] == '..') { 83 | if ($aBaseUriSegments.length > $nBaseUriStart) 84 | array_pop($aBaseUriSegments); 85 | else { 86 | array_push($aBaseUriSegments, $aUriSegments[$nIndex]); 87 | $nBaseUriStart++; 88 | } 89 | } 90 | else 91 | if ($aUriSegments[$nIndex] != '.') 92 | array_push($aBaseUriSegments, $aUriSegments[$nIndex]); 93 | } 94 | if ($aUriSegments[--$nIndex] == '..' || $aUriSegments[$nIndex] == '.') 95 | array_push($aBaseUriSegments, ''); 96 | $aUri[2] = implode($aBaseUriSegments, '/'); 97 | } 98 | } 99 | 100 | $result = ""; 101 | if ($aUri[0]) 102 | $result .= $aUri[0]; 103 | if ($aUri[1]) // '//' 104 | $result .= $aUri[1]; 105 | if ($aUri[2]) 106 | $result .= $aUri[2]; 107 | if ($aUri[3]) // '?' 108 | $result .= $aUri[3]; 109 | if ($aUri[4]) // '#' 110 | $result .= $aUri[4]; 111 | 112 | return $result; 113 | }; 114 | ?> -------------------------------------------------------------------------------- /res/build/COPYING.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @project.name@ v@project.version@ 3 | * https://github.com/ilinsky/jquery-xpath 4 | * Copyright 2015, Sergey Ilinsky 5 | * Dual licensed under the MIT and GPL licenses. 6 | * 7 | * Includes xpath.js - XPath 2.0 implementation in JavaScript 8 | * https://github.com/ilinsky/xpath.js 9 | * Copyright 2015, Sergey Ilinsky 10 | * Dual licensed under the MIT and GPL licenses. 11 | * 12 | */ 13 | -------------------------------------------------------------------------------- /res/build/compiler/cJSCompiler.php: -------------------------------------------------------------------------------- 1 | output = $sString; 16 | } 17 | 18 | function readFromFile($sFileName) { 19 | $this->output = $this->output . join("", file($sFileName)); 20 | } 21 | 22 | function getOutput() { 23 | return $this->output; 24 | } 25 | 26 | function addOmmitArray($aOmmit) { 27 | for ($nIndex = 0; $nIndex < count($aOmmit); $nIndex++) 28 | $this->addOmmitString($aOmmit[$nIndex]); 29 | } 30 | 31 | function addOmmitString($sString) { 32 | if (!in_array($sString, $this->aStrings)) 33 | array_push($this->aStrings, $sString); 34 | } 35 | 36 | function stripComments() { 37 | $sData = $this->output; 38 | 39 | // Strip '//' comments 40 | $sData = str_replace('://', '?????', $sData); 41 | $sData = preg_replace('/\/\/.*(\r?\n)/', "", $sData); 42 | $sData = str_replace('?????', '://', $sData); 43 | 44 | // Strip '/* comment */' comments 45 | $sData = preg_replace('/\/\*.+\*\//Us', "", $sData); 46 | 47 | $this->output = $sData; 48 | } 49 | 50 | function stripSpaces() { 51 | $sData = $this->output; 52 | 53 | // replace tabs with spaces 54 | $sData = str_replace(" ", " ", $sData); 55 | 56 | // Strip ' : ' spaces around 57 | $sData = preg_replace('/\s*([=\+\-\*\/\?\:\|\&\^\!<>\{\},%;\(\)])\s*/', '\\1', $sData); 58 | // 59 | $sData = preg_replace('/\s*(if|for|with|do|while|try|catch)\s+/', '\\1', $sData); 60 | 61 | // strip carriage returns 62 | $sData = preg_replace("/\r\n|\r|\n/", "", $sData); 63 | // strip all more than one spaces 64 | $sData = preg_replace("/\s\s+/", " ", $sData); 65 | 66 | // Additional tweaks 67 | $sData = str_replace(";}", "}", $sData); 68 | 69 | $this->output = $sData; 70 | } 71 | 72 | /* 73 | * Obfuscates variables (starting with any known variable prefix) 74 | * 75 | */ 76 | function obfuscateVariables() { 77 | $sData = $this->output; 78 | 79 | preg_match_all('/[^a-zA-Z]([a-z][A-Z][a-zA-Z0-9_]+)/', $sData, $aTemp); 80 | 81 | $aValues = array_unique($aTemp[1]); 82 | sort($aValues); 83 | reset($aValues); 84 | 85 | // $aValues = $this->_normalizeArray($aTemp[1]); 86 | 87 | // Debug 88 | if ($this->debug) 89 | echo "Processing local variables:\n"; 90 | 91 | for ($nIndex = count($aValues)-1; $nIndex >= 0; $nIndex--) { 92 | $sReplace = /*$nIndex < 26 ? chr(97 + $nIndex) :*/ $this->createToken($nIndex); 93 | 94 | $sData = str_replace($aValues[$nIndex], $sReplace, $sData); 95 | // $sData = preg_replace('/(\W)' . $aValues[$nIndex] . '(\W)/', '$1' . $sReplace . '$2', $sData); 96 | 97 | // Debug 98 | if ($this->debug) 99 | echo $aValues[$nIndex] . " [" . count(array_intersect($aTemp[1], array($aValues[$nIndex]))). "] -> " . $sReplace . "\n"; 100 | } 101 | // Debug 102 | if ($this->debug) 103 | echo "\n"; 104 | 105 | $this->output = $sData; 106 | } 107 | 108 | /* 109 | * Obfuscates private properties (starting with "_" prefix) 110 | * 111 | */ 112 | function obfuscatePrivates() { 113 | $sData = $this->output; 114 | 115 | preg_match_all('/(\._[a-z_]+)/i', $sData, $aTemp); 116 | $aValues = array_unique($aTemp[1]); 117 | sort($aValues); 118 | reset($aValues); 119 | 120 | // Debug 121 | if ($this->debug) 122 | echo "Processing private members:\n"; 123 | 124 | for ($nIndex = count($aValues)-1; $nIndex >= 0; $nIndex--) { 125 | $sReplace = "." . $this->createToken($nIndex); 126 | $sData = str_replace($aValues[$nIndex], $sReplace, $sData); 127 | 128 | // Debug 129 | if ($this->debug) 130 | echo $aValues[$nIndex] . " [" . count(array_intersect($aTemp[1], array($aValues[$nIndex]))). "] -> " . $sReplace . "\n"; 131 | } 132 | // Debug 133 | if ($this->debug) 134 | echo "\n"; 135 | 136 | $this->output = $sData; 137 | } 138 | 139 | function obfuscateStrings() { 140 | $sData = $this->output; 141 | $sDataTemp = $sData; 142 | if (count($this->aStrings)) 143 | $sDataTemp = str_replace($this->aStrings, array_fill(0, count($this->aStrings), ""), $sDataTemp); 144 | 145 | // find "values" 146 | preg_match_all('/\"([a-z0-9_\-+\#\:\;\/\.]{2,})\"/i', $sDataTemp, $aTempValues); 147 | 148 | // find .properties 149 | preg_match_all('/\.(\$?[a-z][a-z0-9_]{2,})/i', $sDataTemp, $aTempProperties); 150 | /* 151 | $this->aStrings = array_unique(array_merge($this->aStrings, $aTempValues[1], $aTempProperties[1])); 152 | sort($this->aStrings); 153 | reset($this->aStrings); 154 | */ 155 | $this->aStrings = $this->_normalizeArray(array_merge($this->aStrings, $aTempValues[1], $aTempProperties[1])); 156 | 157 | // Debug 158 | if ($this->debug) 159 | echo "Processing public properties and string values:\n"; 160 | 161 | // manually replace most used property "prototype" 162 | $sData = str_replace(".prototype", "[$]", $sData); 163 | 164 | // Strings 165 | for ($nIndex = count($this->aStrings)-1; $nIndex >= 0; $nIndex--) 166 | $sData = str_replace( '"' . $this->aStrings[$nIndex] . '"', "_[" . $nIndex . ']', $sData); 167 | 168 | // Properties 169 | for ($nIndex = count($this->aStrings)-1; $nIndex >= 0; $nIndex--) { 170 | /* 171 | $sData = str_replace( '.' . $this->aStrings[$nIndex], "[_[" . $nIndex . ']]', $sData); 172 | */ 173 | $sData = preg_replace( '/\.' . 174 | str_replace( 175 | array('/', '.', '$'), 176 | array('\/', '\.', '\$'), 177 | $this->aStrings[$nIndex] 178 | ). '(?!\w)/', "[_[" . $nIndex . ']]', $sData); 179 | 180 | // Debug 181 | if ($this->debug) 182 | echo $this->aStrings[$nIndex] . " [" . count(array_intersect(array_merge($aTempValues[1], $aTempProperties[1]), array($this->aStrings[$nIndex]))). "]\n"; 183 | } 184 | 185 | // Debug 186 | if ($this->debug) 187 | echo "\n"; 188 | 189 | $this->output = $sData; 190 | } 191 | 192 | function obfuscate() { 193 | // get or create obfuscated properties 194 | $nWString = array_search("String", $this->aStrings); 195 | if (!$nWString) 196 | $nWString = array_push($this->aStrings, "String") - 1; 197 | $nWMath = array_search("Math", $this->aStrings); 198 | if (!$nWMath) 199 | $nWMath = array_push($this->aStrings, "Math") - 1; 200 | $nWRegExp = array_search("RegExp", $this->aStrings); 201 | if (!$nWRegExp) 202 | $nWRegExp = array_push($this->aStrings, "RegExp") - 1; 203 | $nWFunction = array_search("Function", $this->aStrings); 204 | if (!$nWFunction) 205 | $nWFunction = array_push($this->aStrings, "Function") - 1; 206 | $nWlength = array_search("length", $this->aStrings); 207 | if (!$nWlength) 208 | $nWlength = array_push($this->aStrings, "length") - 1; 209 | $nWreplace = array_search("replace", $this->aStrings); 210 | if (!$nWreplace) 211 | $nWreplace = array_push($this->aStrings, "replace") - 1; 212 | $nWsplit = array_search("split", $this->aStrings); 213 | if (!$nWsplit) 214 | $nWsplit = array_push($this->aStrings, "split") - 1; 215 | $nWfromCharCode = array_search("fromCharCode", $this->aStrings); 216 | if (!$nWfromCharCode) 217 | $nWfromCharCode = array_push($this->aStrings, "fromCharCode") - 1; 218 | $nWcharCodeAt = array_search("charCodeAt", $this->aStrings); 219 | if (!$nWcharCodeAt) 220 | $nWcharCodeAt = array_push($this->aStrings, "charCodeAt") - 1; 221 | $nWfloor = array_search("floor", $this->aStrings); 222 | if (!$nWfloor) 223 | $nWfloor = array_push($this->aStrings, "floor") - 1; 224 | 225 | $output = $this->output; 226 | $sKeyWords = ""; 227 | $nShift = 1; 228 | 229 | if (true) { 230 | $aKeyWords = array(); 231 | $aKeyWords = array_merge($aKeyWords, array("in", "break", "case", "catch", "continue", "default", "delete", "else", "for", "function", "if", "instanceof", "new", "return", "throw", "typeof", "switch", "try", "var", "while", "with")); 232 | $aKeyWords = array_merge($aKeyWords, array("false", "null", "true")); 233 | $aKeyWords = array_merge($aKeyWords, array("arguments", "this", "window")); 234 | $aKeyWords = array_merge($aKeyWords, array("[_[", "]]", "[$]")); 235 | $aKeyWords = array_merge($aKeyWords, array("[]", "{}", "()", "&&", "||", "===", "==", "!!", "!==", "!=", "+=", "-=", "++", "--", "<=", ">=")); 236 | 237 | // replace js keywords 238 | for ($nIndex = count($aKeyWords) - 1; $nIndex >= 0; $nIndex--) 239 | $output = str_replace($aKeyWords[$nIndex], ($nIndex % 10) . chr(122 - floor($nIndex/10)), $output); 240 | 241 | // encode keywords 242 | $sKeyWords = join(" ", $aKeyWords); 243 | $sKeyWords2 = ""; 244 | for ($nIndex = strlen($sKeyWords) - 1; $nIndex >= 0; $nIndex--) 245 | $sKeyWords2 .= chr(ord(substr($sKeyWords, $nIndex, 1)) + $nShift); 246 | $sKeyWords = $sKeyWords2; 247 | } 248 | 249 | $m = $this->keyword[0]; 250 | $u = $this->keyword[1]; 251 | $n = $this->keyword[2]; 252 | $g = $this->keyword[3]; 253 | $e = $this->keyword[4]; 254 | $d = $this->keyword[5]; 255 | 256 | // create JS wrapper 257 | $sData = "(function({$m},{$u},{$n},{$g},{$e},{$d}){"; 258 | if (true) { 259 | // decode js keywords 260 | $sData.= "for({$g}={$u}[{$d}[$nWlength]]-1;{$g}>=0;{$g}--)". 261 | "{$n}+={$e}[{$d}[$nWString]][{$d}[$nWfromCharCode]]({$u}[{$d}[$nWcharCodeAt]]({$g})-$nShift);"; 262 | // restore js source 263 | $sData.= "{$u}={$n}[{$d}[$nWsplit]](' ');". 264 | "for({$g}={$u}[{$d}[$nWlength]]-1;{$g}>=0;{$g}--)". 265 | "{$m}={$m}[{$d}[$nWreplace]]({$e}[{$d}[$nWRegExp]]({$g}%10+({$e}[{$d}[$nWString]][{$d}[$nWfromCharCode]](122-{$e}[{$d}[$nWMath]][{$d}[$nWfloor]]({$g}/10))),'g'),{$u}[{$g}]);"; 266 | } 267 | 268 | // execute source 269 | $sData .= "{$e}[{$d}[$nWFunction]]('_','$',{$m})({$d},{$d}[" . array_search("prototype", $this->aStrings) . "])"; 270 | 271 | $sData .= "})(". 272 | "\"" . str_replace("\'", "'", addslashes($output)) . "\"," . 273 | "\"" . addslashes($sKeyWords) ."\",". 274 | "''," . 275 | "0," . 276 | "this,". 277 | "'" . join(" ", $this->aStrings) . "'.split(' ')". 278 | ");"; 279 | 280 | $this->output = $sData; 281 | } 282 | 283 | function obfuscate2() { 284 | $output = $this->output; 285 | 286 | // Restore prototype to proper reference 287 | // $output = str_replace("[$]", "[_[0]]", $output); 288 | 289 | $sData = "(function($,_,_\$){" 290 | . str_replace("window", "_\$", $output) 291 | . "})('prototype','" . join(" ", $this->aStrings) . "'.split(' '),window)"; 292 | 293 | $this->output = $sData; 294 | } 295 | 296 | function _normalizeArray($aTemp) { 297 | $aValuesTemp = array(); 298 | for ($nIndex = count($aTemp) - 1; $nIndex >= 0; $nIndex--) { 299 | if (array_key_exists($aTemp[$nIndex], $aValuesTemp)) 300 | $aValuesTemp[$aTemp[$nIndex]]++; 301 | else 302 | $aValuesTemp[$aTemp[$nIndex]] = 1; 303 | } 304 | arsort($aValuesTemp); 305 | // print_r($aValuesTemp); 306 | $aValues = array_keys($aValuesTemp); 307 | return $aValues; 308 | } 309 | 310 | var $reservedTokens = array("as", "do", "if", "in", "is", "for"/*, "let"*/, "var"); 311 | var $alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; 312 | 313 | function createToken($nIndex) { 314 | $sToken = $nIndex < 52 315 | ? substr($this->alphabet, $nIndex, 1) 316 | : substr($this->alphabet, (int) ($nIndex / 52), 1) . substr($this->alphabet, $nIndex % 62, 1); 317 | $nPosition = array_search($sToken, $this->reservedTokens); 318 | 319 | return $nPosition ? "_" . chr(97 + $nPosition % 62) : $sToken; 320 | } 321 | } 322 | ?> -------------------------------------------------------------------------------- /res/build/compiler/js.php: -------------------------------------------------------------------------------- 1 | ' . $sTagName . '.+\/\/<\-' . $sTagName . '/Us', "", $sInput); 8 | } 9 | 10 | $sInputFile = $_SERVER["argv"][1]; 11 | $sOutputFile = $_SERVER["argv"][2]; 12 | 13 | $sInput = join('', file($sInputFile)); 14 | $sOutput = $sInput; 15 | 16 | echo "Reading: " . $sInputFile . "\n"; 17 | 18 | // Strip "Source" version tags 19 | if (in_array("--strip-Source", $_SERVER["argv"])) { 20 | echo "Stripping 'Source' code\n"; 21 | $sOutput = fStripTags($sOutput, "Source"); 22 | } 23 | // Strip "Debug" version tags 24 | if (in_array("--strip-Debug", $_SERVER["argv"])) { 25 | echo "Stripping 'Debug' code\n"; 26 | $sOutput = fStripTags($sOutput, "Debug"); 27 | } 28 | // Strip "Guard" version tags 29 | if (in_array("--strip-Guard", $_SERVER["argv"])) { 30 | echo "Stripping 'Guard' code\n"; 31 | $sOutput = fStripTags($sOutput, "Guard"); 32 | } 33 | 34 | if (in_array("--obfuscate", $_SERVER["argv"])) { 35 | 36 | $oCompiler = new cJSCompiler; 37 | $oCompiler->keyword = "packed"; 38 | $oCompiler->readFromString($sOutput); 39 | 40 | echo "Obfuscating contents\n"; 41 | 42 | $oCompiler->addOmmitArray(array( 43 | "http://www.w3.org/1999/xhtml", 44 | "http://www.w3.org/2001/XMLSchema", 45 | "http://www.w3.org/2005/xpath-functions", 46 | "http://www.w3.org/2000/xmlns/", 47 | "http://www.w3.org/XML/1998/namespace" 48 | )); 49 | 50 | // 51 | $oCompiler->stripComments(); 52 | $oCompiler->stripSpaces(); 53 | 54 | $oCompiler->obfuscateStrings(); 55 | $oCompiler->obfuscateVariables(); 56 | $oCompiler->obfuscatePrivates(); 57 | $oCompiler->obfuscate(); 58 | 59 | $sOutput = $oCompiler->getOutput(); 60 | } 61 | else { 62 | echo "Wrapping contents\n"; 63 | 64 | $oCompiler = new cJSCompiler; 65 | $oCompiler->readFromString($sOutput); 66 | $oCompiler->stripComments(); 67 | $sOutput = $oCompiler->output; 68 | 69 | $sOutput = "". 70 | "(function () {\n" . 71 | $sOutput . "\n" . 72 | "})();" . 73 | ""; 74 | } 75 | 76 | echo "Writing: " . $sOutputFile ."\n"; 77 | 78 | $fOutputFile = fopen($sOutputFile, "w+"); 79 | fwrite($fOutputFile, $sOutput); 80 | fclose($fOutputFile); 81 | ?> -------------------------------------------------------------------------------- /res/license/GPL-LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /res/license/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Sergey Ilinsky 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /src/.files: -------------------------------------------------------------------------------- 1 | # XPath 2 engine 2 | ../../xpath.js/src/.files 3 | # Browser adapters 4 | adapters/classes/Attr.js 5 | adapters/classes/LXDOMAdapter.js 6 | adapters/L2DOMAdapter.js 7 | adapters/L2HTMLDOMAdapter.js 8 | adapters/MSHTMLDOMAdapter.js 9 | adapters/MSXMLDOMAdapter.js 10 | # API implementation 11 | jquery-xpath.js -------------------------------------------------------------------------------- /src/.htaccess: -------------------------------------------------------------------------------- 1 | ## Rewrite engine 2 | RewriteEngine on 3 | 4 | ## 5 | RewriteRule jquery.xpath.js ../res/assemble.php?path=../src/ -------------------------------------------------------------------------------- /src/adapters/L2DOMAdapter.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery XPath plugin (with full XPath 2.0 language support) 3 | * 4 | * Copyright (c) 2013 Sergey Ilinsky 5 | * Dual licensed under the MIT and GPL licenses. 6 | * 7 | * 8 | */ 9 | 10 | var oL2DOMAdapter = new cLXDOMAdapter; 11 | 12 | -------------------------------------------------------------------------------- /src/adapters/L2HTMLDOMAdapter.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery XPath plugin (with full XPath 2.0 language support) 3 | * 4 | * Copyright (c) 2013 Sergey Ilinsky 5 | * Dual licensed under the MIT and GPL licenses. 6 | * 7 | * 8 | */ 9 | 10 | var oL2HTMLDOMAdapter = new cLXDOMAdapter; 11 | 12 | // 13 | oL2HTMLDOMAdapter.getProperty = function(oNode, sName) { 14 | if (sName == "localName") { 15 | if (oNode.nodeType == 1) 16 | return oNode.localName.toLowerCase(); 17 | } 18 | if (sName == "namespaceURI") 19 | return oNode.nodeType == 1 ? "http://www.w3.org/1999/xhtml" : null; 20 | // 21 | return cLXDOMAdapter.prototype.getProperty.call(this, oNode, sName); 22 | }; -------------------------------------------------------------------------------- /src/adapters/MSHTMLDOMAdapter.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery XPath plugin (with full XPath 2.0 language support) 3 | * 4 | * Copyright (c) 2013 Sergey Ilinsky 5 | * Dual licensed under the MIT and GPL licenses. 6 | * 7 | * 8 | */ 9 | 10 | var oMSHTMLDOMAdapter = new cLXDOMAdapter; 11 | 12 | // 13 | oMSHTMLDOMAdapter.getProperty = function(oNode, sName) { 14 | if (sName == "localName") { 15 | if (oNode.nodeType == 1) 16 | return oNode.nodeName.toLowerCase(); 17 | } 18 | if (sName == "prefix") 19 | return null; 20 | if (sName == "namespaceURI") 21 | return oNode.nodeType == 1 ? "http://www.w3.org/1999/xhtml" : null; 22 | if (sName == "textContent") 23 | return oNode.innerText; 24 | if (sName == "attributes" && oNode.nodeType == 1) { 25 | var aAttributes = []; 26 | for (var nIndex = 0, oAttributes = oNode.attributes, nLength = oAttributes.length, oNode2, oAttribute; nIndex < nLength; nIndex++) { 27 | oNode2 = oAttributes[nIndex]; 28 | if (oNode2.specified) { 29 | oAttribute = new cAttr; 30 | oAttribute.ownerElement = oNode; 31 | oAttribute.ownerDocument= oNode.ownerDocument; 32 | oAttribute.specified = true; 33 | oAttribute.value = 34 | oAttribute.nodeValue = oNode2.nodeValue; 35 | oAttribute.name = 36 | oAttribute.nodeName = 37 | // 38 | oAttribute.localName = oNode2.nodeName.toLowerCase(); 39 | // 40 | aAttributes[aAttributes.length] = oAttribute; 41 | } 42 | } 43 | return aAttributes; 44 | } 45 | // 46 | return cLXDOMAdapter.prototype.getProperty.call(this, oNode, sName); 47 | }; 48 | -------------------------------------------------------------------------------- /src/adapters/MSXMLDOMAdapter.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery XPath plugin (with full XPath 2.0 language support) 3 | * 4 | * Copyright (c) 2013 Sergey Ilinsky 5 | * Dual licensed under the MIT and GPL licenses. 6 | * 7 | * 8 | */ 9 | 10 | var oMSXMLDOMAdapter = new cLXDOMAdapter; 11 | 12 | // 13 | oMSXMLDOMAdapter.getProperty = function(oNode, sName) { 14 | if (sName == "localName") { 15 | if (oNode.nodeType == 7) 16 | return null; 17 | if (oNode.nodeType == 1) 18 | return oNode.baseName; 19 | } 20 | if (sName == "prefix" || sName == "namespaceURI") 21 | return oNode[sName] || null; 22 | if (sName == "textContent") 23 | return oNode.text; 24 | if (sName == "attributes" && oNode.nodeType == 1) { 25 | var aAttributes = []; 26 | for (var nIndex = 0, oAttributes = oNode.attributes, nLength = oAttributes.length, oNode2, oAttribute; nIndex < nLength; nIndex++) { 27 | oNode2 = oAttributes[nIndex]; 28 | if (oNode2.specified) { 29 | oAttribute = new cAttr; 30 | oAttribute.nodeType = 2; 31 | oAttribute.ownerElement = oNode; 32 | oAttribute.ownerDocument= oNode.ownerDocument; 33 | oAttribute.specified = true; 34 | oAttribute.value = 35 | oAttribute.nodeValue = oNode2.nodeValue; 36 | oAttribute.name = 37 | oAttribute.nodeName = oNode2.nodeName; 38 | // 39 | oAttribute.localName = oNode2.baseName; 40 | oAttribute.prefix = oNode2.prefix || null; 41 | oAttribute.namespaceURI = oNode2.namespaceURI || null; 42 | // 43 | aAttributes[aAttributes.length] = oAttribute; 44 | } 45 | } 46 | return aAttributes; 47 | } 48 | // 49 | return cLXDOMAdapter.prototype.getProperty.call(this, oNode, sName); 50 | }; 51 | 52 | // Document object members 53 | oMSXMLDOMAdapter.getElementById = function(oDocument, sId) { 54 | return oDocument.nodeFromID(sId); 55 | }; 56 | 57 | /*oMSXMLDOMAdapter.getElementById = function(oNode, sId) { 58 | return oNode.selectSingleNode('/' + '/' + '*[@id="' + sId + '"]'); 59 | };*/ 60 | -------------------------------------------------------------------------------- /src/adapters/classes/Attr.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery XPath plugin (with full XPath 2.0 language support) 3 | * 4 | * Copyright (c) 2013 Sergey Ilinsky 5 | * Dual licensed under the MIT and GPL licenses. 6 | * 7 | * 8 | */ 9 | 10 | var cAttr = function() { 11 | 12 | }; 13 | 14 | // Node 15 | cAttr.prototype.nodeType = 2; 16 | cAttr.prototype.nodeName = 17 | cAttr.prototype.nodeValue = 18 | cAttr.prototype.ownerDocument = 19 | cAttr.prototype.localName = 20 | cAttr.prototype.namespaceURI = 21 | cAttr.prototype.prefix = 22 | cAttr.prototype.attributes = 23 | cAttr.prototype.childNodes = 24 | cAttr.prototype.firstChild = 25 | cAttr.prototype.lastChild = 26 | cAttr.prototype.previousSibling = 27 | cAttr.prototype.nextSibling = 28 | cAttr.prototype.parentNode = 29 | 30 | // Attr 31 | cAttr.prototype.name = 32 | cAttr.prototype.specified = 33 | cAttr.prototype.value = 34 | cAttr.prototype.ownerElement = null; 35 | -------------------------------------------------------------------------------- /src/adapters/classes/LXDOMAdapter.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery XPath plugin (with full XPath 2.0 language support) 3 | * 4 | * Copyright (c) 2013 Sergey Ilinsky 5 | * Dual licensed under the MIT and GPL licenses. 6 | * 7 | * 8 | */ 9 | 10 | function cLXDOMAdapter() { 11 | 12 | }; 13 | 14 | cLXDOMAdapter.prototype = new cDOMAdapter; 15 | 16 | // Create default static context object to enable access implementation functions 17 | var oLXDOMAdapter_staticContext = new cStaticContext; 18 | 19 | // Standard members 20 | cLXDOMAdapter.prototype.getProperty = function(oNode, sName) { 21 | // Run native if there is one 22 | if (sName in oNode) 23 | return oNode[sName]; 24 | 25 | // Otherwise run JS fallback 26 | if (sName == "baseURI") { 27 | var sBaseURI = '', 28 | fResolveUri = oLXDOMAdapter_staticContext.getFunction('{' + "http://www.w3.org/2005/xpath-functions" + '}' + "resolve-uri"), 29 | cXSString = oLXDOMAdapter_staticContext.getDataType('{' + "http://www.w3.org/2001/XMLSchema" + '}' + "string"); 30 | 31 | for (var oParent = oNode, sUri; oParent; oParent = oParent.parentNode) 32 | if (oParent.nodeType == 1 /* cNode.ELEMENT_NODE */ && (sUri = oParent.getAttribute("xml:base"))) 33 | sBaseURI = fResolveUri(new cXSString(sUri), new cXSString(sBaseURI)).toString(); 34 | // 35 | return sBaseURI; 36 | } 37 | else 38 | if (sName == "textContent") { 39 | var aText = []; 40 | (function(oNode) { 41 | for (var nIndex = 0, oChild; oChild = oNode.childNodes[nIndex]; nIndex++) 42 | if (oChild.nodeType == 3 /* cNode.TEXT_NODE */ || oChild.nodeType == 4 /* cNode.CDATA_SECTION_NODE */) 43 | aText.push(oChild.data); 44 | else 45 | if (oChild.nodeType == 1 /* cNode.ELEMENT_NODE */ && oChild.firstChild) 46 | arguments.callee(oChild); 47 | })(oNode); 48 | return aText.join(''); 49 | } 50 | }; 51 | 52 | cLXDOMAdapter.prototype.compareDocumentPosition = function(oNode, oChild) { 53 | // Run native if there is one 54 | if ("compareDocumentPosition" in oNode) 55 | return oNode.compareDocumentPosition(oChild); 56 | 57 | // Otherwise run JS fallback 58 | if (oChild == oNode) 59 | return 0; 60 | 61 | // 62 | var oAttr1 = null, 63 | oAttr2 = null, 64 | aAttributes, 65 | oAttr, oElement, nIndex, nLength; 66 | if (oNode.nodeType == 2 /* cNode.ATTRIBUTE_NODE */) { 67 | oAttr1 = oNode; 68 | oNode = this.getProperty(oAttr1, "ownerElement"); 69 | } 70 | if (oChild.nodeType == 2 /* cNode.ATTRIBUTE_NODE */) { 71 | oAttr2 = oChild; 72 | oChild = this.getProperty(oAttr2, "ownerElement"); 73 | } 74 | 75 | // Compare attributes from same element 76 | if (oAttr1 && oAttr2 && oNode && oNode == oChild) { 77 | for (nIndex = 0, aAttributes = this.getProperty(oNode, "attributes"), nLength = aAttributes.length; nIndex < nLength; nIndex++) { 78 | oAttr = aAttributes[nIndex]; 79 | if (oAttr == oAttr1) 80 | return 32 /* cNode.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC */ | 4 /* cNode.DOCUMENT_POSITION_FOLLOWING */; 81 | if (oAttr == oAttr2) 82 | return 32 /* cNode.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC */ | 2 /* cNode.DOCUMENT_POSITION_PRECEDING */; 83 | } 84 | } 85 | 86 | // 87 | var aChain1 = [], nLength1, oNode1, 88 | aChain2 = [], nLength2, oNode2; 89 | // 90 | if (oAttr1) 91 | aChain1.push(oAttr1); 92 | for (oElement = oNode; oElement; oElement = oElement.parentNode) 93 | aChain1.push(oElement); 94 | if (oAttr2) 95 | aChain2.push(oAttr2); 96 | for (oElement = oChild; oElement; oElement = oElement.parentNode) 97 | aChain2.push(oElement); 98 | // If nodes are from different documents or if they do not have common top, they are disconnected 99 | if (((oNode.ownerDocument || oNode) != (oChild.ownerDocument || oChild)) || (aChain1[aChain1.length - 1] != aChain2[aChain2.length - 1])) 100 | return 32 /* cNode.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC */ | 1 /* cNode.DOCUMENT_POSITION_DISCONNECTED */; 101 | // 102 | for (nIndex = cMath.min(nLength1 = aChain1.length, nLength2 = aChain2.length); nIndex; --nIndex) 103 | if ((oNode1 = aChain1[--nLength1]) != (oNode2 = aChain2[--nLength2])) { 104 | // 105 | if (oNode1.nodeType == 2 /* cNode.ATTRIBUTE_NODE */) 106 | return 4 /* cNode.DOCUMENT_POSITION_FOLLOWING */; 107 | if (oNode2.nodeType == 2 /* cNode.ATTRIBUTE_NODE */) 108 | return 2 /* cNode.DOCUMENT_POSITION_PRECEDING */; 109 | // 110 | if (!oNode2.nextSibling) 111 | return 4 /* cNode.DOCUMENT_POSITION_FOLLOWING */; 112 | if (!oNode1.nextSibling) 113 | return 2 /* cNode.DOCUMENT_POSITION_PRECEDING */; 114 | for (oElement = oNode2.previousSibling; oElement; oElement = oElement.previousSibling) 115 | if (oElement == oNode1) 116 | return 4 /* cNode.DOCUMENT_POSITION_FOLLOWING */; 117 | return 2 /* cNode.DOCUMENT_POSITION_PRECEDING */; 118 | } 119 | // 120 | return nLength1 < nLength2 ? 4 /* cNode.DOCUMENT_POSITION_FOLLOWING */ | 16 /* cNode.DOCUMENT_POSITION_CONTAINED_BY */ : 2 /* cNode.DOCUMENT_POSITION_PRECEDING */ | 8 /* cNode.DOCUMENT_POSITION_CONTAINS */; 121 | }; 122 | 123 | cLXDOMAdapter.prototype.lookupNamespaceURI = function(oNode, sPrefix) { 124 | // Run native if there is one 125 | if ("lookupNamespaceURI" in oNode) 126 | return oNode.lookupNamespaceURI(sPrefix); 127 | 128 | // Otherwise run JS fallback 129 | for (; oNode && oNode.nodeType != 9 /* cNode.DOCUMENT_NODE */ ; oNode = oNode.parentNode) 130 | if (sPrefix == this.getProperty(oChild, "prefix")) 131 | return this.getProperty(oNode, "namespaceURI"); 132 | else 133 | if (oNode.nodeType == 1) // cNode.ELEMENT_NODE 134 | for (var oAttributes = this.getProperty(oNode, "attributes"), nIndex = 0, nLength = oAttributes.length, sName = "xmlns" + ':' + sPrefix; nIndex < nLength; nIndex++) 135 | if (this.getProperty(oAttributes[nIndex], "nodeName") == sName) 136 | return this.getProperty(oAttributes[nIndex], "value"); 137 | return null; 138 | }; 139 | 140 | // Element/Document object members 141 | cLXDOMAdapter.prototype.getElementsByTagNameNS = function(oNode, sNameSpaceURI, sLocalName) { 142 | // Run native if there is one 143 | if ("getElementsByTagNameNS" in oNode) 144 | return oNode.getElementsByTagNameNS(sNameSpaceURI, sLocalName); 145 | 146 | // Otherwise run JS fallback 147 | var aElements = [], 148 | bNameSpaceURI = '*' == sNameSpaceURI, 149 | bLocalName = '*' == sLocalName; 150 | (function(oNode) { 151 | for (var nIndex = 0, oChild; oChild = oNode.childNodes[nIndex]; nIndex++) 152 | if (oChild.nodeType == 1) { // cNode.ELEMENT_NODE 153 | if ((bLocalName || sLocalName == this.getProperty(oChild, "localName")) && (bNameSpaceURI || sNameSpaceURI == this.getProperty(oChild, "namespaceURI"))) 154 | aElements[aElements.length] = oChild; 155 | if (oChild.firstChild) 156 | arguments.callee(oChild); 157 | } 158 | })(oNode); 159 | return aElements; 160 | }; -------------------------------------------------------------------------------- /src/jquery-xpath.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery XPath plugin (with full XPath 2.0 language support) 3 | * 4 | * Copyright (c) 2013 Sergey Ilinsky 5 | * Dual licensed under the MIT and GPL licenses. 6 | * 7 | * 8 | */ 9 | 10 | var cQuery = window.jQuery, 11 | oDocument = window.document, 12 | // Internet Explorer 8 or older 13 | bOldMS = !!oDocument.namespaces && !oDocument.createElementNS, 14 | // Older other browsers 15 | bOldW3 = !bOldMS && oDocument.documentElement.namespaceURI != "http://www.w3.org/1999/xhtml"; 16 | 17 | // Create two separate HTML and XML contexts 18 | var oHTMLStaticContext = new cStaticContext, 19 | oXMLStaticContext = new cStaticContext; 20 | 21 | // Initialize HTML context (this has default xhtml namespace) 22 | oHTMLStaticContext.baseURI = oDocument.location.href; 23 | oHTMLStaticContext.defaultFunctionNamespace = "http://www.w3.org/2005/xpath-functions"; 24 | oHTMLStaticContext.defaultElementNamespace = "http://www.w3.org/1999/xhtml"; 25 | 26 | // Initialize XML context (this has default element null namespace) 27 | oXMLStaticContext.defaultFunctionNamespace = oHTMLStaticContext.defaultFunctionNamespace; 28 | 29 | // 30 | function fXPath_evaluate(oQuery, sExpression, fNSResolver) { 31 | // Return empty jQuery object if expression missing 32 | if (typeof sExpression == "undefined" || sExpression === null) 33 | sExpression = ''; 34 | 35 | // Check if context specified 36 | var oNode = oQuery[0]; 37 | if (typeof oNode == "undefined") 38 | oNode = null; 39 | 40 | // Choose static context 41 | var oStaticContext = oNode && (oNode.nodeType == 9 ? oNode : oNode.ownerDocument).createElement("div").tagName == "DIV" ? oHTMLStaticContext : oXMLStaticContext; 42 | 43 | // Set static context's resolver 44 | oStaticContext.namespaceResolver = fNSResolver; 45 | 46 | // Create expression tree 47 | var oExpression = new cExpression(cString(sExpression), oStaticContext); 48 | 49 | // Reset static context's resolver 50 | oStaticContext.namespaceResolver = null; 51 | 52 | // Evaluate expression 53 | var aSequence, 54 | oSequence = new cQuery, 55 | oAdapter = oL2DOMAdapter; 56 | 57 | // Determine which DOMAdapter to use based on browser and DOM type 58 | if (bOldMS) 59 | oAdapter = oStaticContext == oHTMLStaticContext ? oMSHTMLDOMAdapter : oMSXMLDOMAdapter; 60 | else 61 | if (bOldW3 && oStaticContext == oHTMLStaticContext) 62 | oAdapter = oL2HTMLDOMAdapter; 63 | 64 | // Evaluate expression tree 65 | aSequence = oExpression.evaluate(new cDynamicContext(oStaticContext, oNode, null, oAdapter)); 66 | for (var nIndex = 0, nLength = aSequence.length, oItem; nIndex < nLength; nIndex++) 67 | oSequence.push(oAdapter.isNode(oItem = aSequence[nIndex]) ? oItem : cStaticContext.xs2js(oItem)); 68 | 69 | return oSequence; 70 | }; 71 | 72 | // Extend jQuery 73 | var oObject = {}; 74 | oObject.xpath = function(oQuery, sExpression, fNSResolver) { 75 | return fXPath_evaluate(oQuery instanceof cQuery ? oQuery : new cQuery(oQuery), sExpression, fNSResolver); 76 | }; 77 | cQuery.extend(cQuery, oObject); 78 | 79 | oObject = {}; 80 | oObject.xpath = function(sExpression, fNSResolver) { 81 | return fXPath_evaluate(this, sExpression, fNSResolver); 82 | }; 83 | cQuery.extend(cQuery.prototype, oObject); 84 | -------------------------------------------------------------------------------- /src/jquery.xpath.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery XPath plugin (with full XPath 2.0 language support) 3 | * 4 | * Copyright (c) 2013 Sergey Ilinsky 5 | * Dual licensed under the MIT and GPL licenses. 6 | * 7 | * 8 | */ 9 | 10 | // Source code loader 11 | (function() { 12 | // Get base folder 13 | var scripts = document.getElementsByTagName("script"), 14 | self = scripts[scripts.length-1], 15 | base = self.src.replace(/\/?[^\/]+$/, '/'); 16 | // Remove self 17 | self.parentNode.removeChild(self); 18 | // Include loader 19 | document.write(''); 20 | })(); 21 | -------------------------------------------------------------------------------- /test/lib/jquery.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery JavaScript Library v1.4.2 3 | * http://jquery.com/ 4 | * 5 | * Copyright 2010, John Resig 6 | * Dual licensed under the MIT or GPL Version 2 licenses. 7 | * http://jquery.org/license 8 | * 9 | * Includes Sizzle.js 10 | * http://sizzlejs.com/ 11 | * Copyright 2010, The Dojo Foundation 12 | * Released under the MIT, BSD, and GPL Licenses. 13 | * 14 | * Date: Sat Feb 13 22:33:48 2010 -0500 15 | */ 16 | (function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, 21 | Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& 22 | (d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, 23 | a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== 24 | "find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, 25 | function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; 34 | var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, 35 | parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= 36 | false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= 37 | s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, 38 | applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; 39 | else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, 40 | a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== 41 | w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, 42 | cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= 47 | c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); 48 | a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, 49 | function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); 50 | k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), 51 | C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= 53 | e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& 54 | f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; 55 | if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", 63 | e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, 64 | "_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, 65 | d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, 71 | e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); 72 | t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| 73 | g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, 80 | CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, 81 | g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, 82 | text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, 83 | setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= 84 | h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== 86 | "="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, 87 | h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& 90 | q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; 91 | if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); 92 | (function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: 93 | function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= 96 | {},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== 97 | "string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", 98 | d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? 99 | a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== 100 | 1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= 102 | c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, 103 | wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, 104 | prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, 105 | this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); 106 | return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, 107 | ""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); 111 | return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", 112 | ""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= 113 | c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? 114 | c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= 115 | function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= 116 | Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, 117 | "border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= 118 | a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= 119 | a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== 120 | "string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, 121 | serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), 122 | function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, 123 | global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& 124 | e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? 125 | "&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== 126 | false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= 127 | false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", 128 | c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| 129 | d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); 130 | g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== 131 | 1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== 132 | "json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; 133 | if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== 139 | "number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| 140 | c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; 141 | this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= 142 | this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, 143 | e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; 149 | a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); 150 | c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, 151 | d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- 152 | f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": 153 | "pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in 154 | e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); 155 | -------------------------------------------------------------------------------- /test/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery XPath plugin test page 5 | 6 | 7 | 17 | 18 | 19 | 65 | 66 | --------------------------------------------------------------------------------