collin-lucky7 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +65 -0
- data/Rakefile.rb +55 -0
- data/config/environment.rb +9 -0
- data/lib/jabs.rb +9 -0
- data/lib/jass.rb +23 -0
- data/lib/jsspec/example.html.jass +180 -0
- data/lib/jsspec/layout.html.haml +14 -0
- data/lib/lucky7.rb +5 -0
- data/lib/lucky7/builder.rb +140 -0
- data/lib/lucky7/renders.rb +9 -0
- data/rspec/fixtures/lucky7/build/app/layout.html +4 -0
- data/rspec/fixtures/lucky7/src/app/_category.html.haml +2 -0
- data/rspec/fixtures/lucky7/src/app/_header.html.haml +7 -0
- data/rspec/fixtures/lucky7/src/app/_page_link.html.haml +2 -0
- data/rspec/fixtures/lucky7/src/app/_pagination.html.haml +3 -0
- data/rspec/fixtures/lucky7/src/app/_result.html.haml +3 -0
- data/rspec/fixtures/lucky7/src/app/_result_set.html.haml +4 -0
- data/rspec/fixtures/lucky7/src/app/_side_bar.html.haml +3 -0
- data/rspec/fixtures/lucky7/src/app/behavior.css.sass +3 -0
- data/rspec/fixtures/lucky7/src/app/controller.js.jabs +3 -0
- data/rspec/fixtures/lucky7/src/app/fixture_spec.html.jass +6 -0
- data/rspec/fixtures/lucky7/src/app/layout.html.haml +4 -0
- data/rspec/fixtures/lucky7/src/app/no_results.html.haml +10 -0
- data/rspec/fixtures/lucky7/src/app/results.html.haml +5 -0
- data/rspec/jabs/jabs_engine_spec.rb +3 -0
- data/rspec/jabs/jabs_precompiler_spec.rb +50 -0
- data/rspec/jabs_spec.rb +15 -0
- data/rspec/jabs_spec_helper.rb +2 -0
- data/rspec/jass/jass_engine_spec.rb +1 -0
- data/rspec/jass/jass_precompiler_spec.rb +49 -0
- data/rspec/jass_spec.rb +15 -0
- data/rspec/lucky7/builder_spec.rb +322 -0
- data/rspec/lucky7/renders_spec.rb +13 -0
- data/rspec/lucky7_spec.rb +19 -0
- data/rspec/lucky7_spec_helper.rb +1 -0
- data/rspec/spec_helper.rb +3 -0
- data/templates/environment/[environment].rb +1 -0
- data/templates/skeleton/[application]/README +1 -0
- data/templates/skeleton/[application]/Rakefile.rb +1 -0
- data/templates/skeleton/[application]/environment/environment.rb +1 -0
- data/vendor/jquery/jquery-1.2.6.js +3549 -0
- data/vendor/jquery/jquery-1.2.6.min.js +32 -0
- data/vendor/jquery/jquery-1.2.6.pack.js.gz +11 -0
- data/vendor/jquery/jquery.simulate.js +152 -0
- data/vendor/js_spec/JSSpec.css +224 -0
- data/vendor/js_spec/JSSpec.js +1548 -0
- data/vendor/js_spec/copying +459 -0
- data/vendor/js_spec/demo.html +210 -0
- data/vendor/js_spec/diff_match_patch.js +1 -0
- data/vendor/js_spec/example.spec.html +198 -0
- data/vendor/js_spec/exp/build.properties +1 -0
- data/vendor/js_spec/exp/build.xml +9 -0
- data/vendor/js_spec/exp/lib/diff_match_patch.js +1 -0
- data/vendor/js_spec/exp/lib/js.jar +0 -0
- data/vendor/js_spec/exp/src/JSSpec2.js +356 -0
- data/vendor/js_spec/exp/src/JSSpec2_spec.js +238 -0
- data/vendor/js_spec/sample/datetime/String_Parser.html +22 -0
- data/vendor/js_spec/sample/datetime/datetime.js +24 -0
- data/vendor/orbited/ez_setup.py +272 -0
- data/vendor/orbited/pyevent-0.3/Makefile +18 -0
- data/vendor/orbited/pyevent-0.3/build/lib.linux-i686-2.5/event.so +0 -0
- data/vendor/orbited/pyevent-0.3/build/temp.linux-i686-2.5/event.o +0 -0
- data/vendor/orbited/pyevent-0.3/changes +9 -0
- data/vendor/orbited/pyevent-0.3/cvs/Entries +9 -0
- data/vendor/orbited/pyevent-0.3/cvs/Repository +1 -0
- data/vendor/orbited/pyevent-0.3/cvs/Root +1 -0
- data/vendor/orbited/pyevent-0.3/event.c +2516 -0
- data/vendor/orbited/pyevent-0.3/event.pyx +280 -0
- data/vendor/orbited/pyevent-0.3/license +29 -0
- data/vendor/orbited/pyevent-0.3/readme +12 -0
- data/vendor/orbited/pyevent-0.3/setup.py +61 -0
- data/vendor/orbited/pyevent-0.3/test.py +73 -0
- data/vendor/orbited/ruby-orbited.rb +84 -0
- metadata +188 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery 1.2.6 - New Wave Javascript
|
3
|
+
*
|
4
|
+
* Copyright (c) 2008 John Resig (jquery.com)
|
5
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
6
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
7
|
+
*
|
8
|
+
* $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
|
9
|
+
* $Rev: 5685 $
|
10
|
+
*/
|
11
|
+
(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
|
12
|
+
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
|
13
|
+
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
|
14
|
+
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
|
15
|
+
return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
|
16
|
+
this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
|
17
|
+
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
|
18
|
+
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
|
19
|
+
script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
|
20
|
+
for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
|
21
|
+
for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
|
22
|
+
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
|
23
|
+
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
|
24
|
+
while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
|
25
|
+
while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
|
26
|
+
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
|
27
|
+
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
|
28
|
+
xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
|
29
|
+
jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
|
30
|
+
for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
|
31
|
+
s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
|
32
|
+
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery 1.2.6 - New Wave Javascript
|
3
|
+
*
|
4
|
+
* Copyright (c) 2008 John Resig (jquery.com)
|
5
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
6
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
7
|
+
*
|
8
|
+
* $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
|
9
|
+
* $Rev: 5685 $
|
10
|
+
*/
|
11
|
+
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(H(){J w=1b.4M,3m$=1b.$;J D=1b.4M=1b.$=H(a,b){I 2B D.17.5j(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,62=/^.[^:#\\[\\.]*$/,12;D.17=D.44={5j:H(d,b){d=d||S;G(d.16){7[0]=d;7.K=1;I 7}G(1j d=="23"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.61(c[3]);G(a){G(a.2v!=c[3])I D().2q(d);I D(a)}d=[]}}N I D(b).2q(d)}N G(D.1D(d))I D(S)[D.17.27?"27":"43"](d);I 7.6Y(D.2d(d))},5w:"1.2.6",8G:H(){I 7.K},K:0,3p:H(a){I a==12?D.2d(7):7[a]},2I:H(b){J a=D(b);a.5n=7;I a},6Y:H(a){7.K=0;2p.44.1p.1w(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5i:H(b){J a=-1;I D.2L(b&&b.5w?b[0]:b,7)},1K:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1K"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1n d)D.1K(b?7.V:7,c,D.1i(7,d[c],b,i,c))})},1g:H(b,a){G((b==\'2h\'||b==\'1Z\')&&3d(a)<0)a=12;I 7.1K(b,a,"2a")},1r:H(b){G(1j b!="49"&&b!=U)I 7.4E().3v((7[0]&&7[0].2z||S).5F(b));J a="";D.P(b||7,H(){D.P(7.3t,H(){G(7.16!=8)a+=7.16!=1?7.76:D.17.1r([7])})});I a},5z:H(b){G(7[0])D(b,7[0].2z).5y().39(7[0]).2l(H(){J a=7;1B(a.1x)a=a.1x;I a}).3v(7);I 7},8Y:H(a){I 7.P(H(){D(7).6Q().5z(a)})},8R:H(a){I 7.P(H(){D(7).5z(a)})},3v:H(){I 7.3W(19,M,Q,H(a){G(7.16==1)7.3U(a)})},6F:H(){I 7.3W(19,M,M,H(a){G(7.16==1)7.39(a,7.1x)})},6E:H(){I 7.3W(19,Q,Q,H(a){7.1d.39(a,7)})},5q:H(){I 7.3W(19,Q,M,H(a){7.1d.39(a,7.2H)})},3l:H(){I 7.5n||D([])},2q:H(b){J c=D.2l(7,H(a){I D.2q(b,a)});I 7.2I(/[^+>] [^+>]/.11(b)||b.1h("..")>-1?D.4r(c):c)},5y:H(e){J f=7.2l(H(){G(D.14.1f&&!D.4n(7)){J a=7.6o(M),5h=S.3h("1v");5h.3U(a);I D.4h([5h.4H])[0]}N I 7.6o(M)});J d=f.2q("*").5c().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2q("*").5c().P(H(i){G(7.16==3)I;J c=D.L(7,"3w");R(J a 1n c)R(J b 1n c[a])D.W.1e(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2I(D.1D(b)&&D.3C(7,H(a,i){I b.1k(a,i)})||D.3g(b,7))},4Y:H(b){G(b.1q==56)G(62.11(b))I 7.2I(D.3g(b,7,M));N b=D.3g(b,7);J a=b.K&&b[b.K-1]!==12&&!b.16;I 7.1E(H(){I a?D.2L(7,b)<0:7!=b})},1e:H(a){I 7.2I(D.4r(D.2R(7.3p(),1j a==\'23\'?D(a):D.2d(a))))},3F:H(a){I!!a&&D.3g(a,7).K>0},7T:H(a){I 7.3F("."+a)},6e:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2A")){J e=c.64,63=[],15=c.15,2V=c.O=="2A-2V";G(e<0)I U;R(J i=2V?e:0,2f=2V?e+1:15.K;i<2f;i++){J d=15[i];G(d.2W){b=D.14.1f&&!d.at.2x.an?d.1r:d.2x;G(2V)I b;63.1p(b)}}I 63}N I(7[0].2x||"").1o(/\\r/g,"")}I 12}G(b.1q==4L)b+=\'\';I 7.P(H(){G(7.16!=1)I;G(b.1q==2p&&/5O|5L/.11(7.O))7.4J=(D.2L(7.2x,b)>=0||D.2L(7.34,b)>=0);N G(D.Y(7,"2A")){J a=D.2d(b);D("9R",7).P(H(){7.2W=(D.2L(7.2x,a)>=0||D.2L(7.1r,a)>=0)});G(!a.K)7.64=-1}N 7.2x=b})},2K:H(a){I a==12?(7[0]?7[0].4H:U):7.4E().3v(a)},7b:H(a){I 7.5q(a).21()},79:H(i){I 7.3s(i,i+1)},3s:H(){I 7.2I(2p.44.3s.1w(7,19))},2l:H(b){I 7.2I(D.2l(7,H(a,i){I b.1k(a,i,a)}))},5c:H(){I 7.1e(7.5n)},L:H(d,b){J a=d.1R(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5C("9z"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1P("9u"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3W:H(g,f,h,d){J e=7.K>1,3x;I 7.P(H(){G(!3x){3x=D.4h(g,7.2z);G(h)3x.9o()}J b=7;G(f&&D.Y(7,"1T")&&D.Y(3x[0],"4F"))b=7.3H("22")[0]||7.3U(7.2z.3h("22"));J c=D([]);D.P(3x,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.1e(a);N{G(a.16==1)c=c.1e(D("1m",a).21());d.1k(b,a)}});c.P(6T)})}};D.17.5j.44=D.17;H 6T(i,a){G(a.4d)D.3Y({1a:a.4d,31:Q,1O:"1m"});N D.5u(a.1r||a.6O||a.4H||"");G(a.1d)a.1d.37(a)}H 1z(){I+2B 8J}D.1l=D.17.1l=H(){J b=19[0]||{},i=1,K=19.K,4x=Q,15;G(b.1q==8I){4x=b;b=19[1]||{};i=2}G(1j b!="49"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i<K;i++)G((15=19[i])!=U)R(J c 1n 15){J a=b[c],2w=15[c];G(b===2w)6M;G(4x&&2w&&1j 2w=="49"&&!2w.16)b[c]=D.1l(4x,a||(2w.K!=U?[]:{}),2w);N G(2w!==12)b[c]=2w}I b};J E="4M"+1z(),6K=0,5r={},6G=/z-?5i|8B-?8A|1y|6B|8v-?1Z/i,3P=S.3P||{};D.1l({8u:H(a){1b.$=3m$;G(a)1b.4M=w;I D},1D:H(a){I!!a&&1j a!="23"&&!a.Y&&a.1q!=2p&&/^[\\s[]?H/.11(a+"")},4n:H(a){I a.1C&&!a.1c||a.2j&&a.2z&&!a.2z.1c},5u:H(a){a=D.3k(a);G(a){J b=S.3H("6w")[0]||S.1C,1m=S.3h("1m");1m.O="1r/4t";G(D.14.1f)1m.1r=a;N 1m.3U(S.5F(a));b.39(1m,b.1x);b.37(1m)}},Y:H(b,a){I b.Y&&b.Y.2r()==a.2r()},1Y:{},L:H(c,d,b){c=c==1b?5r:c;J a=c[E];G(!a)a=c[E]=++6K;G(d&&!D.1Y[a])D.1Y[a]={};G(b!==12)D.1Y[a][d]=b;I d?D.1Y[a][d]:a},3b:H(c,b){c=c==1b?5r:c;J a=c[E];G(b){G(D.1Y[a]){2U D.1Y[a][b];b="";R(b 1n D.1Y[a])1X;G(!b)D.3b(c)}}N{1U{2U c[E]}1V(e){G(c.5l)c.5l(E)}2U D.1Y[a]}},P:H(d,a,c){J e,i=0,K=d.K;G(c){G(K==12){R(e 1n d)G(a.1w(d[e],c)===Q)1X}N R(;i<K;)G(a.1w(d[i++],c)===Q)1X}N{G(K==12){R(e 1n d)G(a.1k(d[e],e,d[e])===Q)1X}N R(J b=d[0];i<K&&a.1k(b,i,b)!==Q;b=d[++i]){}}I d},1i:H(b,a,c,i,d){G(D.1D(a))a=a.1k(b,i);I a&&a.1q==4L&&c=="2a"&&!6G.11(d)?a+"2X":a},1F:{1e:H(c,b){D.P((b||"").1R(/\\s+/),H(i,a){G(c.16==1&&!D.1F.3T(c.1F,a))c.1F+=(c.1F?" ":"")+a})},21:H(c,b){G(c.16==1)c.1F=b!=12?D.3C(c.1F.1R(/\\s+/),H(a){I!D.1F.3T(b,a)}).6s(" "):""},3T:H(b,a){I D.2L(a,(b.1F||b).6r().1R(/\\s+/))>-1}},6q:H(b,c,a){J e={};R(J d 1n c){e[d]=b.V[d];b.V[d]=c[d]}a.1k(b);R(J d 1n c)b.V[d]=e[d]},1g:H(d,e,c){G(e=="2h"||e=="1Z"){J b,3X={30:"5x",5g:"1G",18:"3I"},35=e=="2h"?["5e","6k"]:["5G","6i"];H 5b(){b=e=="2h"?d.8f:d.8c;J a=0,2C=0;D.P(35,H(){a+=3d(D.2a(d,"57"+7,M))||0;2C+=3d(D.2a(d,"2C"+7+"4b",M))||0});b-=29.83(a+2C)}G(D(d).3F(":4j"))5b();N D.6q(d,3X,5b);I 29.2f(0,b)}I D.2a(d,e,c)},2a:H(f,l,k){J e,V=f.V;H 3E(b){G(!D.14.2k)I Q;J a=3P.54(b,U);I!a||a.52("3E")==""}G(l=="1y"&&D.14.1f){e=D.1K(V,"1y");I e==""?"1":e}G(D.14.2G&&l=="18"){J d=V.50;V.50="0 7Y 7W";V.50=d}G(l.1I(/4i/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3P.54){G(l.1I(/4i/i))l="4i";l=l.1o(/([A-Z])/g,"-$1").3y();J c=3P.54(f,U);G(c&&!3E(f))e=c.52(l);N{J g=[],2E=[],a=f,i=0;R(;a&&3E(a);a=a.1d)2E.6h(a);R(;i<2E.K;i++)G(3E(2E[i])){g[i]=2E[i].V.18;2E[i].V.18="3I"}e=l=="18"&&g[2E.K-1]!=U?"2F":(c&&c.52(l))||"";R(i=0;i<g.K;i++)G(g[i]!=U)2E[i].V.18=g[i]}G(l=="1y"&&e=="")e="1"}N G(f.4g){J h=l.1o(/\\-(\\w)/g,H(a,b){I b.2r()});e=f.4g[l]||f.4g[h];G(!/^\\d+(2X)?$/i.11(e)&&/^\\d/.11(e)){J j=V.1A,66=f.65.1A;f.65.1A=f.4g.1A;V.1A=e||0;e=V.aM+"2X";V.1A=j;f.65.1A=66}}I e},4h:H(l,h){J k=[];h=h||S;G(1j h.3h==\'12\')h=h.2z||h[0]&&h[0].2z||S;D.P(l,H(i,d){G(!d)I;G(d.1q==4L)d+=\'\';G(1j d=="23"){d=d.1o(/(<(\\w+)[^>]*?)\\/>/g,H(b,a,c){I c.1I(/^(aK|4f|7E|aG|4T|7A|aB|3n|az|ay|av)$/i)?b:a+"></"+c+">"});J f=D.3k(d).3y(),1v=h.3h("1v");J e=!f.1h("<au")&&[1,"<2A 7w=\'7w\'>","</2A>"]||!f.1h("<ar")&&[1,"<7v>","</7v>"]||f.1I(/^<(aq|22|am|ak|ai)/)&&[1,"<1T>","</1T>"]||!f.1h("<4F")&&[2,"<1T><22>","</22></1T>"]||(!f.1h("<af")||!f.1h("<ad"))&&[3,"<1T><22><4F>","</4F></22></1T>"]||!f.1h("<7E")&&[2,"<1T><22></22><7q>","</7q></1T>"]||D.14.1f&&[1,"1v<1v>","</1v>"]||[0,"",""];1v.4H=e[1]+d+e[2];1B(e[0]--)1v=1v.5T;G(D.14.1f){J g=!f.1h("<1T")&&f.1h("<22")<0?1v.1x&&1v.1x.3t:e[1]=="<1T>"&&f.1h("<22")<0?1v.3t:[];R(J j=g.K-1;j>=0;--j)G(D.Y(g[j],"22")&&!g[j].3t.K)g[j].1d.37(g[j]);G(/^\\s/.11(d))1v.39(h.5F(d.1I(/^\\s*/)[0]),1v.1x)}d=D.2d(1v.3t)}G(d.K===0&&(!D.Y(d,"3V")&&!D.Y(d,"2A")))I;G(d[0]==12||D.Y(d,"3V")||d.15)k.1p(d);N k=D.2R(k,d)});I k},1K:H(d,f,c){G(!d||d.16==3||d.16==8)I 12;J e=!D.4n(d),40=c!==12,1f=D.14.1f;f=e&&D.3X[f]||f;G(d.2j){J g=/5Q|4d|V/.11(f);G(f=="2W"&&D.14.2k)d.1d.64;G(f 1n d&&e&&!g){G(40){G(f=="O"&&D.Y(d,"4T")&&d.1d)7p"O a3 a1\'t 9V 9U";d[f]=c}G(D.Y(d,"3V")&&d.7i(f))I d.7i(f).76;I d[f]}G(1f&&e&&f=="V")I D.1K(d.V,"9T",c);G(40)d.9Q(f,""+c);J h=1f&&e&&g?d.4G(f,2):d.4G(f);I h===U?12:h}G(1f&&f=="1y"){G(40){d.6B=1;d.1E=(d.1E||"").1o(/7f\\([^)]*\\)/,"")+(3r(c)+\'\'=="9L"?"":"7f(1y="+c*7a+")")}I d.1E&&d.1E.1h("1y=")>=0?(3d(d.1E.1I(/1y=([^)]*)/)[1])/7a)+\'\':""}f=f.1o(/-([a-z])/9H,H(a,b){I b.2r()});G(40)d[f]=c;I d[f]},3k:H(a){I(a||"").1o(/^\\s+|\\s+$/g,"")},2d:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1R||b.4I||b.1k)a[0]=b;N 1B(i)a[--i]=b[i]}I a},2L:H(b,a){R(J i=0,K=a.K;i<K;i++)G(a[i]===b)I i;I-1},2R:H(a,b){J i=0,T,2S=a.K;G(D.14.1f){1B(T=b[i++])G(T.16!=8)a[2S++]=T}N 1B(T=b[i++])a[2S++]=T;I a},4r:H(a){J c=[],2o={};1U{R(J i=0,K=a.K;i<K;i++){J b=D.L(a[i]);G(!2o[b]){2o[b]=M;c.1p(a[i])}}}1V(e){c=a}I c},3C:H(c,a,d){J b=[];R(J i=0,K=c.K;i<K;i++)G(!d!=!a(c[i],i))b.1p(c[i]);I b},2l:H(d,a){J c=[];R(J i=0,K=d.K;i<K;i++){J b=a(d[i],i);G(b!=U)c[c.K]=b}I c.7d.1w([],c)}});J v=9B.9A.3y();D.14={5B:(v.1I(/.+(?:9y|9x|9w|9v)[\\/: ]([\\d.]+)/)||[])[1],2k:/75/.11(v),2G:/2G/.11(v),1f:/1f/.11(v)&&!/2G/.11(v),42:/42/.11(v)&&!/(9s|75)/.11(v)};J y=D.14.1f?"7o":"72";D.1l({71:!D.14.1f||S.70=="6Z",3X:{"R":"9n","9k":"1F","4i":y,72:y,7o:y,9h:"9f",9e:"9d",9b:"99"}});D.P({6W:H(a){I a.1d},97:H(a){I D.4S(a,"1d")},95:H(a){I D.3a(a,2,"2H")},91:H(a){I D.3a(a,2,"4l")},8Z:H(a){I D.4S(a,"2H")},8X:H(a){I D.4S(a,"4l")},8W:H(a){I D.5v(a.1d.1x,a)},8V:H(a){I D.5v(a.1x)},6Q:H(a){I D.Y(a,"8U")?a.8T||a.8S.S:D.2d(a.3t)}},H(c,d){D.17[c]=H(b){J a=D.2l(7,d);G(b&&1j b=="23")a=D.3g(b,a);I 7.2I(D.4r(a))}});D.P({6P:"3v",8Q:"6F",39:"6E",8P:"5q",8O:"7b"},H(c,b){D.17[c]=H(){J a=19;I 7.P(H(){R(J i=0,K=a.K;i<K;i++)D(a[i])[b](7)})}});D.P({8N:H(a){D.1K(7,a,"");G(7.16==1)7.5l(a)},8M:H(a){D.1F.1e(7,a)},8L:H(a){D.1F.21(7,a)},8K:H(a){D.1F[D.1F.3T(7,a)?"21":"1e"](7,a)},21:H(a){G(!a||D.1E(a,[7]).r.K){D("*",7).1e(7).P(H(){D.W.21(7);D.3b(7)});G(7.1d)7.1d.37(7)}},4E:H(){D(">*",7).21();1B(7.1x)7.37(7.1x)}},H(a,b){D.17[a]=H(){I 7.P(b,19)}});D.P(["6N","4b"],H(i,c){J b=c.3y();D.17[b]=H(a){I 7[0]==1b?D.14.2G&&S.1c["5t"+c]||D.14.2k&&1b["5s"+c]||S.70=="6Z"&&S.1C["5t"+c]||S.1c["5t"+c]:7[0]==S?29.2f(29.2f(S.1c["4y"+c],S.1C["4y"+c]),29.2f(S.1c["2i"+c],S.1C["2i"+c])):a==12?(7.K?D.1g(7[0],b):U):7.1g(b,a.1q==56?a:a+"2X")}});H 25(a,b){I a[0]&&3r(D.2a(a[0],b,M),10)||0}J C=D.14.2k&&3r(D.14.5B)<8H?"(?:[\\\\w*3m-]|\\\\\\\\.)":"(?:[\\\\w\\8F-\\8E*3m-]|\\\\\\\\.)",6L=2B 4v("^>\\\\s*("+C+"+)"),6J=2B 4v("^("+C+"+)(#)("+C+"+)"),6I=2B 4v("^([#.]?)("+C+"*)");D.1l({6H:{"":H(a,i,m){I m[2]=="*"||D.Y(a,m[2])},"#":H(a,i,m){I a.4G("2v")==m[2]},":":{8D:H(a,i,m){I i<m[3]-0},8C:H(a,i,m){I i>m[3]-0},3a:H(a,i,m){I m[3]-0==i},79:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3S:H(a,i,m,r){I i==r.K-1},6D:H(a,i){I i%2==0},6C:H(a,i){I i%2},"3o-4u":H(a){I a.1d.3H("*")[0]==a},"3S-4u":H(a){I D.3a(a.1d.5T,1,"4l")==a},"8z-4u":H(a){I!D.3a(a.1d.5T,2,"4l")},6W:H(a){I a.1x},4E:H(a){I!a.1x},8y:H(a,i,m){I(a.6O||a.8x||D(a).1r()||"").1h(m[3])>=0},4j:H(a){I"1G"!=a.O&&D.1g(a,"18")!="2F"&&D.1g(a,"5g")!="1G"},1G:H(a){I"1G"==a.O||D.1g(a,"18")=="2F"||D.1g(a,"5g")=="1G"},8w:H(a){I!a.3R},3R:H(a){I a.3R},4J:H(a){I a.4J},2W:H(a){I a.2W||D.1K(a,"2W")},1r:H(a){I"1r"==a.O},5O:H(a){I"5O"==a.O},5L:H(a){I"5L"==a.O},5p:H(a){I"5p"==a.O},3Q:H(a){I"3Q"==a.O},5o:H(a){I"5o"==a.O},6A:H(a){I"6A"==a.O},6z:H(a){I"6z"==a.O},2s:H(a){I"2s"==a.O||D.Y(a,"2s")},4T:H(a){I/4T|2A|6y|2s/i.11(a.Y)},3T:H(a,i,m){I D.2q(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3C(D.3O,H(b){I a==b.T}).K}}},6x:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,2B 4v("^([:.#]*)("+C+"+)")],3g:H(a,c,b){J d,1t=[];1B(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");1t=b?c=f.r:D.2R(1t,f.r)}I 1t},2q:H(t,o){G(1j t!="23")I[t];G(o&&o.16!=1&&o.16!=9)I[];o=o||S;J d=[o],2o=[],3S,Y;1B(t&&3S!=t){J r=[];3S=t;t=D.3k(t);J l=Q,3j=6L,m=3j.2D(t);G(m){Y=m[1].2r();R(J i=0;d[i];i++)R(J c=d[i].1x;c;c=c.2H)G(c.16==1&&(Y=="*"||c.Y.2r()==Y))r.1p(c);d=r;t=t.1o(3j,"");G(t.1h(" ")==0)6M;l=M}N{3j=/^([>+~])\\s*(\\w*)/i;G((m=3j.2D(t))!=U){r=[];J k={};Y=m[2].2r();m=m[1];R(J j=0,3i=d.K;j<3i;j++){J n=m=="~"||m=="+"?d[j].2H:d[j].1x;R(;n;n=n.2H)G(n.16==1){J g=D.L(n);G(m=="~"&&k[g])1X;G(!Y||n.Y.2r()==Y){G(m=="~")k[g]=M;r.1p(n)}G(m=="+")1X}}d=r;t=D.3k(t.1o(3j,""));l=M}}G(t&&!l){G(!t.1h(",")){G(o==d[0])d.4s();2o=D.2R(2o,d);r=d=[o];t=" "+t.6v(1,t.K)}N{J h=6J;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6I;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,"");J f=d[d.K-1];G(m[1]=="#"&&f&&f.61&&!D.4n(f)){J p=f.61(m[2]);G((D.14.1f||D.14.2G)&&p&&1j p.2v=="23"&&p.2v!=m[2])p=D(\'[@2v="\'+m[2]+\'"]\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];G(a=="*"&&d[i].Y.3y()=="49")a="3n";r=D.2R(r,d[i].3H(a))}G(m[1]==".")r=D.5m(r,m[2]);G(m[1]=="#"){J e=[];R(J i=0;r[i];i++)G(r[i].4G("2v")==m[2]){e=[r[i]];1X}r=e}d=r}t=t.1o(h,"")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3k(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2o=D.2R(2o,d);I 2o},5m:H(r,m,a){m=" "+m+" ";J c=[];R(J i=0;r[i];i++){J b=(" "+r[i].1F+" ").1h(m)>=0;G(!a&&b||a&&!b)c.1p(r[i])}I c},1E:H(t,r,h){J d;1B(t&&t!=d){d=t;J p=D.6x,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,"");1X}}G(!m)1X;G(m[1]==":"&&m[2]=="4Y")r=62.11(m[3])?D.1E(m[3],r,M).r:D(r).4Y(m[3]);N G(m[1]==".")r=D.5m(r,m[2],h);N G(m[1]=="["){J g=[],O=m[3];R(J i=0,3i=r.K;i<3i;i++){J a=r[i],z=a[D.3X[m[2]]||m[2]];G(z==U||/5Q|4d|2W/.11(m[2]))z=D.1K(a,m[2])||\'\';G((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1h(m[5])||O=="$="&&z.6v(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1h(m[5])>=0)^h)g.1p(a)}r=g}N G(m[1]==":"&&m[2]=="3a-4u"){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]=="6D"&&"2n"||m[3]=="6C"&&"2n+1"||!/\\D/.11(m[3])&&"8q+"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3i=r.K;i<3i;i++){J j=r[i],1d=j.1d,2v=D.L(1d);G(!e[2v]){J c=1;R(J n=1d.1x;n;n=n.2H)G(n.16==1)n.4q=c++;e[2v]=M}J b=Q;G(3o==0){G(j.4q==d)b=M}N G((j.4q-d)%3o==0&&(j.4q-d)/3o>=0)b=M;G(b^h)g.1p(j)}r=g}N{J f=D.6H[m[1]];G(1j f=="49")f=f[m[2]];G(1j f=="23")f=6u("Q||H(a,i){I "+f+";}");r=D.3C(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4S:H(b,c){J a=[],1t=b[c];1B(1t&&1t!=S){G(1t.16==1)a.1p(1t);1t=1t[c]}I a},3a:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.16==1&&++d==e)1X;I a},5v:H(n,a){J r=[];R(;n;n=n.2H){G(n.16==1&&n!=a)r.1p(n)}I r}});D.W={1e:H(f,i,g,e){G(f.16==3||f.16==8)I;G(D.14.1f&&f.4I)f=1b;G(!g.24)g.24=7.24++;G(e!=12){J h=g;g=7.3M(h,H(){I h.1w(7,19)});g.L=e}J j=D.L(f,"3w")||D.L(f,"3w",{}),1H=D.L(f,"1H")||D.L(f,"1H",H(){G(1j D!="12"&&!D.W.5k)I D.W.1H.1w(19.3L.T,19)});1H.T=f;D.P(i.1R(/\\s+/),H(c,b){J a=b.1R(".");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2t[b]||D.W.2t[b].4p.1k(f)===Q){G(f.3K)f.3K(b,1H,Q);N G(f.6t)f.6t("4o"+b,1H)}}d[g.24]=g;D.W.26[b]=M});f=U},24:1,26:{},21:H(e,h,f){G(e.16==3||e.16==8)I;J i=D.L(e,"3w"),1L,5i;G(i){G(h==12||(1j h=="23"&&h.8p(0)=="."))R(J g 1n i)7.21(e,g+(h||""));N{G(h.O){f=h.2y;h=h.O}D.P(h.1R(/\\s+/),H(b,a){J c=a.1R(".");a=c[0];G(i[a]){G(f)2U i[a][f.24];N R(f 1n i[a])G(!c[1]||i[a][f].O==c[1])2U i[a][f];R(1L 1n i[a])1X;G(!1L){G(!D.W.2t[a]||D.W.2t[a].4A.1k(e)===Q){G(e.6p)e.6p(a,D.L(e,"1H"),Q);N G(e.6n)e.6n("4o"+a,D.L(e,"1H"))}1L=U;2U i[a]}}})}R(1L 1n i)1X;G(!1L){J d=D.L(e,"1H");G(d)d.T=U;D.3b(e,"3w");D.3b(e,"1H")}}},1P:H(h,c,f,g,i){c=D.2d(c);G(h.1h("!")>=0){h=h.3s(0,-1);J a=M}G(!f){G(7.26[h])D("*").1e([1b,S]).1P(h,c)}N{G(f.16==3||f.16==8)I 12;J b,1L,17=D.1D(f[h]||U),W=!c[0]||!c[0].32;G(W){c.6h({O:h,2J:f,32:H(){},3J:H(){},4C:1z()});c[0][E]=M}c[0].O=h;G(a)c[0].6m=M;J d=D.L(f,"1H");G(d)b=d.1w(f,c);G((!17||(D.Y(f,\'a\')&&h=="4V"))&&f["4o"+h]&&f["4o"+h].1w(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1D(i)){1L=i.1w(f,b==U?c:c.7d(b));G(1L!==12)b=1L}G(17&&g!==Q&&b!==Q&&!(D.Y(f,\'a\')&&h=="4V")){7.5k=M;1U{f[h]()}1V(e){}}7.5k=Q}I b},1H:H(b){J a,1L,38,5f,4m;b=19[0]=D.W.6l(b||1b.W);38=b.O.1R(".");b.O=38[0];38=38[1];5f=!38&&!b.6m;4m=(D.L(7,"3w")||{})[b.O];R(J j 1n 4m){J c=4m[j];G(5f||c.O==38){b.2y=c;b.L=c.L;1L=c.1w(7,19);G(a!==Q)a=1L;G(1L===Q){b.32();b.3J()}}}I a},6l:H(b){G(b[E]==M)I b;J d=b;b={8o:d};J c="8n 8m 8l 8k 2s 8j 47 5d 6j 5E 8i L 8h 8g 4K 2y 5a 59 8e 8b 58 6f 8a 88 4k 87 86 84 6d 2J 4C 6c O 82 81 35".1R(" ");R(J i=c.K;i;i--)b[c[i]]=d[c[i]];b[E]=M;b.32=H(){G(d.32)d.32();d.80=Q};b.3J=H(){G(d.3J)d.3J();d.7Z=M};b.4C=b.4C||1z();G(!b.2J)b.2J=b.6d||S;G(b.2J.16==3)b.2J=b.2J.1d;G(!b.4k&&b.4K)b.4k=b.4K==b.2J?b.6c:b.4K;G(b.58==U&&b.5d!=U){J a=S.1C,1c=S.1c;b.58=b.5d+(a&&a.2e||1c&&1c.2e||0)-(a.6b||0);b.6f=b.6j+(a&&a.2c||1c&&1c.2c||0)-(a.6a||0)}G(!b.35&&((b.47||b.47===0)?b.47:b.5a))b.35=b.47||b.5a;G(!b.59&&b.5E)b.59=b.5E;G(!b.35&&b.2s)b.35=(b.2s&1?1:(b.2s&2?3:(b.2s&4?2:0)));I b},3M:H(a,b){b.24=a.24=a.24||b.24||7.24++;I b},2t:{27:{4p:H(){55();I},4A:H(){I}},3D:{4p:H(){G(D.14.1f)I Q;D(7).2O("53",D.W.2t.3D.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("53",D.W.2t.3D.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3D";I D.W.1H.1w(7,19)}},3N:{4p:H(){G(D.14.1f)I Q;D(7).2O("51",D.W.2t.3N.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("51",D.W.2t.3N.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3N";I D.W.1H.1w(7,19)}}}};D.17.1l({2O:H(c,a,b){I c=="4X"?7.2V(c,a,b):7.P(H(){D.W.1e(7,c,b||a,b&&a)})},2V:H(d,b,c){J e=D.W.3M(c||b,H(a){D(7).4e(a,e);I(c||b).1w(7,19)});I 7.P(H(){D.W.1e(7,d,e,c&&b)})},4e:H(a,b){I 7.P(H(){D.W.21(7,a,b)})},1P:H(c,a,b){I 7.P(H(){D.W.1P(c,a,7,M,b)})},5C:H(c,a,b){I 7[0]&&D.W.1P(c,a,7[0],Q,b)},2m:H(b){J c=19,i=1;1B(i<c.K)D.W.3M(b,c[i++]);I 7.4V(D.W.3M(b,H(a){7.4Z=(7.4Z||0)%i;a.32();I c[7.4Z++].1w(7,19)||Q}))},7X:H(a,b){I 7.2O(\'3D\',a).2O(\'3N\',b)},27:H(a){55();G(D.2Q)a.1k(S,D);N D.3A.1p(H(){I a.1k(7,D)});I 7}});D.1l({2Q:Q,3A:[],27:H(){G(!D.2Q){D.2Q=M;G(D.3A){D.P(D.3A,H(){7.1k(S)});D.3A=U}D(S).5C("27")}}});J x=Q;H 55(){G(x)I;x=M;G(S.3K&&!D.14.2G)S.3K("69",D.27,Q);G(D.14.1f&&1b==1S)(H(){G(D.2Q)I;1U{S.1C.7V("1A")}1V(3e){3B(19.3L,0);I}D.27()})();G(D.14.2G)S.3K("69",H(){G(D.2Q)I;R(J i=0;i<S.4W.K;i++)G(S.4W[i].3R){3B(19.3L,0);I}D.27()},Q);G(D.14.2k){J a;(H(){G(D.2Q)I;G(S.3f!="68"&&S.3f!="1J"){3B(19.3L,0);I}G(a===12)a=D("V, 7A[7U=7S]").K;G(S.4W.K!=a){3B(19.3L,0);I}D.27()})()}D.W.1e(1b,"43",D.27)}D.P(("7R,7Q,43,85,4y,4X,4V,7P,"+"7O,7N,89,53,51,7M,2A,"+"5o,7L,7K,8d,3e").1R(","),H(i,b){D.17[b]=H(a){I a?7.2O(b,a):7.1P(b)}});J F=H(a,c){J b=a.4k;1B(b&&b!=c)1U{b=b.1d}1V(3e){b=c}I b==c};D(1b).2O("4X",H(){D("*").1e(S).4e()});D.17.1l({67:D.17.43,43:H(g,d,c){G(1j g!=\'23\')I 7.67(g);J e=g.1h(" ");G(e>=0){J i=g.3s(e,g.K);g=g.3s(0,e)}c=c||H(){};J f="2P";G(d)G(D.1D(d)){c=d;d=U}N{d=D.3n(d);f="6g"}J h=7;D.3Y({1a:g,O:f,1O:"2K",L:d,1J:H(a,b){G(b=="1W"||b=="7J")h.2K(i?D("<1v/>").3v(a.4U.1o(/<1m(.|\\s)*?\\/1m>/g,"")).2q(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3n(7.7I())},7I:H(){I 7.2l(H(){I D.Y(7,"3V")?D.2d(7.aH):7}).1E(H(){I 7.34&&!7.3R&&(7.4J||/2A|6y/i.11(7.Y)||/1r|1G|3Q/i.11(7.O))}).2l(H(i,c){J b=D(7).6e();I b==U?U:b.1q==2p?D.2l(b,H(a,i){I{34:c.34,2x:a}}):{34:c.34,2x:b}}).3p()}});D.P("7H,7G,7F,7D,7C,7B".1R(","),H(i,o){D.17[o]=H(f){I 7.2O(o,f)}});J B=1z();D.1l({3p:H(d,b,a,c){G(D.1D(b)){a=b;b=U}I D.3Y({O:"2P",1a:d,L:b,1W:a,1O:c})},aE:H(b,a){I D.3p(b,U,a,"1m")},aD:H(c,b,a){I D.3p(c,b,a,"3z")},aC:H(d,b,a,c){G(D.1D(b)){a=b;b={}}I D.3Y({O:"6g",1a:d,L:b,1W:a,1O:c})},aA:H(a){D.1l(D.60,a)},60:{1a:5Z.5Q,26:M,O:"2P",2T:0,7z:"4R/x-ax-3V-aw",7x:M,31:M,L:U,5Y:U,3Q:U,4Q:{2N:"4R/2N, 1r/2N",2K:"1r/2K",1m:"1r/4t, 4R/4t",3z:"4R/3z, 1r/4t",1r:"1r/as",4w:"*/*"}},4z:{},3Y:H(s){s=D.1l(M,s,D.1l(M,{},D.60,s));J g,2Z=/=\\?(&|$)/g,1u,L,O=s.O.2r();G(s.L&&s.7x&&1j s.L!="23")s.L=D.3n(s.L);G(s.1O=="4P"){G(O=="2P"){G(!s.1a.1I(2Z))s.1a+=(s.1a.1I(/\\?/)?"&":"?")+(s.4P||"7u")+"=?"}N G(!s.L||!s.L.1I(2Z))s.L=(s.L?s.L+"&":"")+(s.4P||"7u")+"=?";s.1O="3z"}G(s.1O=="3z"&&(s.L&&s.L.1I(2Z)||s.1a.1I(2Z))){g="4P"+B++;G(s.L)s.L=(s.L+"").1o(2Z,"="+g+"$1");s.1a=s.1a.1o(2Z,"="+g+"$1");s.1O="1m";1b[g]=H(a){L=a;1W();1J();1b[g]=12;1U{2U 1b[g]}1V(e){}G(i)i.37(h)}}G(s.1O=="1m"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O=="2P"){J j=1z();J k=s.1a.1o(/(\\?|&)3m=.*?(&|$)/,"$ap="+j+"$2");s.1a=k+((k==s.1a)?(s.1a.1I(/\\?/)?"&":"?")+"3m="+j:"")}G(s.L&&O=="2P"){s.1a+=(s.1a.1I(/\\?/)?"&":"?")+s.L;s.L=U}G(s.26&&!D.4O++)D.W.1P("7H");J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1O=="1m"&&O=="2P"&&n.11(s.1a)&&n.2D(s.1a)[1]!=5Z.al){J i=S.3H("6w")[0];J h=S.3h("1m");h.4d=s.1a;G(s.7t)h.aj=s.7t;G(!g){J l=Q;h.ah=h.ag=H(){G(!l&&(!7.3f||7.3f=="68"||7.3f=="1J")){l=M;1W();1J();i.37(h)}}}i.3U(h);I 12}J m=Q;J c=1b.7s?2B 7s("ae.ac"):2B 7r();G(s.5Y)c.6R(O,s.1a,s.31,s.5Y,s.3Q);N c.6R(O,s.1a,s.31);1U{G(s.L)c.4B("ab-aa",s.7z);G(s.5S)c.4B("a9-5R-a8",D.4z[s.1a]||"a7, a6 a5 a4 5N:5N:5N a2");c.4B("X-9Z-9Y","7r");c.4B("9W",s.1O&&s.4Q[s.1O]?s.4Q[s.1O]+", */*":s.4Q.4w)}1V(e){}G(s.7m&&s.7m(c,s)===Q){s.26&&D.4O--;c.7l();I Q}G(s.26)D.W.1P("7B",[c,s]);J d=H(a){G(!m&&c&&(c.3f==4||a=="2T")){m=M;G(f){7k(f);f=U}1u=a=="2T"&&"2T"||!D.7j(c)&&"3e"||s.5S&&D.7h(c,s.1a)&&"7J"||"1W";G(1u=="1W"){1U{L=D.6X(c,s.1O,s.9S)}1V(e){1u="5J"}}G(1u=="1W"){J b;1U{b=c.5I("7g-5R")}1V(e){}G(s.5S&&b)D.4z[s.1a]=b;G(!g)1W()}N D.5H(s,c,1u);1J();G(s.31)c=U}};G(s.31){J f=4I(d,13);G(s.2T>0)3B(H(){G(c){c.7l();G(!m)d("2T")}},s.2T)}1U{c.9P(s.L)}1V(e){D.5H(s,c,U,e)}G(!s.31)d();H 1W(){G(s.1W)s.1W(L,1u);G(s.26)D.W.1P("7C",[c,s])}H 1J(){G(s.1J)s.1J(c,1u);G(s.26)D.W.1P("7F",[c,s]);G(s.26&&!--D.4O)D.W.1P("7G")}I c},5H:H(s,a,b,e){G(s.3e)s.3e(a,b,e);G(s.26)D.W.1P("7D",[a,s,e])},4O:0,7j:H(a){1U{I!a.1u&&5Z.9O=="5p:"||(a.1u>=7e&&a.1u<9N)||a.1u==7c||a.1u==9K||D.14.2k&&a.1u==12}1V(e){}I Q},7h:H(a,c){1U{J b=a.5I("7g-5R");I a.1u==7c||b==D.4z[c]||D.14.2k&&a.1u==12}1V(e){}I Q},6X:H(a,c,b){J d=a.5I("9J-O"),2N=c=="2N"||!c&&d&&d.1h("2N")>=0,L=2N?a.9I:a.4U;G(2N&&L.1C.2j=="5J")7p"5J";G(b)L=b(L,c);G(c=="1m")D.5u(L);G(c=="3z")L=6u("("+L+")");I L},3n:H(a){J s=[];G(a.1q==2p||a.5w)D.P(a,H(){s.1p(3u(7.34)+"="+3u(7.2x))});N R(J j 1n a)G(a[j]&&a[j].1q==2p)D.P(a[j],H(){s.1p(3u(j)+"="+3u(7))});N s.1p(3u(j)+"="+3u(D.1D(a[j])?a[j]():a[j]));I s.6s("&").1o(/%20/g,"+")}});D.17.1l({1N:H(c,b){I c?7.2g({1Z:"1N",2h:"1N",1y:"1N"},c,b):7.1E(":1G").P(H(){7.V.18=7.5D||"";G(D.1g(7,"18")=="2F"){J a=D("<"+7.2j+" />").6P("1c");7.V.18=a.1g("18");G(7.V.18=="2F")7.V.18="3I";a.21()}}).3l()},1M:H(b,a){I b?7.2g({1Z:"1M",2h:"1M",1y:"1M"},b,a):7.1E(":4j").P(H(){7.5D=7.5D||D.1g(7,"18");7.V.18="2F"}).3l()},78:D.17.2m,2m:H(a,b){I D.1D(a)&&D.1D(b)?7.78.1w(7,19):a?7.2g({1Z:"2m",2h:"2m",1y:"2m"},a,b):7.P(H(){D(7)[D(7).3F(":1G")?"1N":"1M"]()})},9G:H(b,a){I 7.2g({1Z:"1N"},b,a)},9F:H(b,a){I 7.2g({1Z:"1M"},b,a)},9E:H(b,a){I 7.2g({1Z:"2m"},b,a)},9D:H(b,a){I 7.2g({1y:"1N"},b,a)},9M:H(b,a){I 7.2g({1y:"1M"},b,a)},9C:H(c,a,b){I 7.2g({1y:a},c,b)},2g:H(k,j,i,g){J h=D.77(j,i,g);I 7[h.36===Q?"P":"36"](H(){G(7.16!=1)I Q;J f=D.1l({},h),p,1G=D(7).3F(":1G"),46=7;R(p 1n k){G(k[p]=="1M"&&1G||k[p]=="1N"&&!1G)I f.1J.1k(7);G(p=="1Z"||p=="2h"){f.18=D.1g(7,"18");f.33=7.V.33}}G(f.33!=U)7.V.33="1G";f.45=D.1l({},k);D.P(k,H(c,a){J e=2B D.28(46,f,c);G(/2m|1N|1M/.11(a))e[a=="2m"?1G?"1N":"1M":a](k);N{J b=a.6r().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1t(M)||0;G(b){J d=3d(b[2]),2M=b[3]||"2X";G(2M!="2X"){46.V[c]=(d||1)+2M;2b=((d||1)/e.1t(M))*2b;46.V[c]=2b+2M}G(b[1])d=((b[1]=="-="?-1:1)*d)+2b;e.3G(2b,d,2M)}N e.3G(2b,a,"")}});I M})},36:H(a,b){G(D.1D(a)||(a&&a.1q==2p)){b=a;a="28"}G(!a||(1j a=="23"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2p)A(7,a,b);N{A(7,a).1p(b);G(A(7,a).K==1)b.1k(7)}})},9X:H(b,c){J a=D.3O;G(b)7.36([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7n(i,1)}});G(!c)7.5A();I 7}});J A=H(b,c,a){G(b){c=c||"28";J q=D.L(b,c+"36");G(!q||a)q=D.L(b,c+"36",D.2d(a))}I q};D.17.5A=H(a){a=a||"28";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1k(7)})};D.1l({77:H(b,a,c){J d=b&&b.1q==a0?b:{1J:c||!c&&a||D.1D(b)&&b,2u:b,41:c&&a||a&&a.1q!=9t&&a};d.2u=(d.2u&&d.2u.1q==4L?d.2u:D.28.5K[d.2u])||D.28.5K.74;d.5M=d.1J;d.1J=H(){G(d.36!==Q)D(7).5A();G(D.1D(d.5M))d.5M.1k(7)};I d},41:{73:H(p,n,b,a){I b+a*p},5P:H(p,n,b,a){I((-29.9r(p*29.9q)/2)+0.5)*a+b}},3O:[],48:U,28:H(b,c,a){7.15=c;7.T=b;7.1i=a;G(!c.3Z)c.3Z={}}});D.28.44={4D:H(){G(7.15.2Y)7.15.2Y.1k(7.T,7.1z,7);(D.28.2Y[7.1i]||D.28.2Y.4w)(7);G(7.1i=="1Z"||7.1i=="2h")7.T.V.18="3I"},1t:H(a){G(7.T[7.1i]!=U&&7.T.V[7.1i]==U)I 7.T[7.1i];J r=3d(D.1g(7.T,7.1i,a));I r&&r>-9p?r:3d(D.2a(7.T,7.1i))||0},3G:H(c,b,d){7.5V=1z();7.2b=c;7.3l=b;7.2M=d||7.2M||"2X";7.1z=7.2b;7.2S=7.4N=0;7.4D();J e=7;H t(a){I e.2Y(a)}t.T=7.T;D.3O.1p(t);G(D.48==U){D.48=4I(H(){J a=D.3O;R(J i=0;i<a.K;i++)G(!a[i]())a.7n(i--,1);G(!a.K){7k(D.48);D.48=U}},13)}},1N:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1N=M;7.3G(0,7.1t());G(7.1i=="2h"||7.1i=="1Z")7.T.V[7.1i]="9m";D(7.T).1N()},1M:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1M=M;7.3G(7.1t(),0)},2Y:H(a){J t=1z();G(a||t>7.15.2u+7.5V){7.1z=7.3l;7.2S=7.4N=1;7.4D();7.15.45[7.1i]=M;J b=M;R(J i 1n 7.15.45)G(7.15.45[i]!==M)b=Q;G(b){G(7.15.18!=U){7.T.V.33=7.15.33;7.T.V.18=7.15.18;G(D.1g(7.T,"18")=="2F")7.T.V.18="3I"}G(7.15.1M)7.T.V.18="2F";G(7.15.1M||7.15.1N)R(J p 1n 7.15.45)D.1K(7.T.V,p,7.15.3Z[p])}G(b)7.15.1J.1k(7.T);I Q}N{J n=t-7.5V;7.4N=n/7.15.2u;7.2S=D.41[7.15.41||(D.41.5P?"5P":"73")](7.4N,n,0,1,7.15.2u);7.1z=7.2b+((7.3l-7.2b)*7.2S);7.4D()}I M}};D.1l(D.28,{5K:{9l:9j,9i:7e,74:9g},2Y:{2e:H(a){a.T.2e=a.1z},2c:H(a){a.T.2c=a.1z},1y:H(a){D.1K(a.T.V,"1y",a.1z)},4w:H(a){a.T.V[a.1i]=a.1z+a.2M}}});D.17.2i=H(){J b=0,1S=0,T=7[0],3q;G(T)ao(D.14){J d=T.1d,4a=T,1s=T.1s,1Q=T.2z,5U=2k&&3r(5B)<9c&&!/9a/i.11(v),1g=D.2a,3c=1g(T,"30")=="3c";G(T.7y){J c=T.7y();1e(c.1A+29.2f(1Q.1C.2e,1Q.1c.2e),c.1S+29.2f(1Q.1C.2c,1Q.1c.2c));1e(-1Q.1C.6b,-1Q.1C.6a)}N{1e(T.5X,T.5W);1B(1s){1e(1s.5X,1s.5W);G(42&&!/^t(98|d|h)$/i.11(1s.2j)||2k&&!5U)2C(1s);G(!3c&&1g(1s,"30")=="3c")3c=M;4a=/^1c$/i.11(1s.2j)?4a:1s;1s=1s.1s}1B(d&&d.2j&&!/^1c|2K$/i.11(d.2j)){G(!/^96|1T.*$/i.11(1g(d,"18")))1e(-d.2e,-d.2c);G(42&&1g(d,"33")!="4j")2C(d);d=d.1d}G((5U&&(3c||1g(4a,"30")=="5x"))||(42&&1g(4a,"30")!="5x"))1e(-1Q.1c.5X,-1Q.1c.5W);G(3c)1e(29.2f(1Q.1C.2e,1Q.1c.2e),29.2f(1Q.1C.2c,1Q.1c.2c))}3q={1S:1S,1A:b}}H 2C(a){1e(D.2a(a,"6V",M),D.2a(a,"6U",M))}H 1e(l,t){b+=3r(l,10)||0;1S+=3r(t,10)||0}I 3q};D.17.1l({30:H(){J a=0,1S=0,3q;G(7[0]){J b=7.1s(),2i=7.2i(),4c=/^1c|2K$/i.11(b[0].2j)?{1S:0,1A:0}:b.2i();2i.1S-=25(7,\'94\');2i.1A-=25(7,\'aF\');4c.1S+=25(b,\'6U\');4c.1A+=25(b,\'6V\');3q={1S:2i.1S-4c.1S,1A:2i.1A-4c.1A}}I 3q},1s:H(){J a=7[0].1s;1B(a&&(!/^1c|2K$/i.11(a.2j)&&D.1g(a,\'30\')==\'93\'))a=a.1s;I D(a)}});D.P([\'5e\',\'5G\'],H(i,b){J c=\'4y\'+b;D.17[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1b||7==S?1b.92(!i?a:D(1b).2e(),i?a:D(1b).2c()):7[c]=a}):7[0]==1b||7[0]==S?46[i?\'aI\':\'aJ\']||D.71&&S.1C[c]||S.1c[c]:7[0][c]}});D.P(["6N","4b"],H(i,b){J c=i?"5e":"5G",4f=i?"6k":"6i";D.17["5s"+b]=H(){I 7[b.3y()]()+25(7,"57"+c)+25(7,"57"+4f)};D.17["90"+b]=H(a){I 7["5s"+b]()+25(7,"2C"+c+"4b")+25(7,"2C"+4f+"4b")+(a?25(7,"6S"+c)+25(7,"6S"+4f):0)}})})();',62,669,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|options|nodeType|fn|display|arguments|url|window|body|parentNode|add|msie|css|indexOf|prop|typeof|call|extend|script|in|replace|push|constructor|text|offsetParent|cur|status|div|apply|firstChild|opacity|now|left|while|documentElement|isFunction|filter|className|hidden|handle|match|complete|attr|ret|hide|show|dataType|trigger|doc|split|top|table|try|catch|success|break|cache|height||remove|tbody|string|guid|num|global|ready|fx|Math|curCSS|start|scrollTop|makeArray|scrollLeft|max|animate|width|offset|tagName|safari|map|toggle||done|Array|find|toUpperCase|button|special|duration|id|copy|value|handler|ownerDocument|select|new|border|exec|stack|none|opera|nextSibling|pushStack|target|html|inArray|unit|xml|bind|GET|isReady|merge|pos|timeout|delete|one|selected|px|step|jsre|position|async|preventDefault|overflow|name|which|queue|removeChild|namespace|insertBefore|nth|removeData|fixed|parseFloat|error|readyState|multiFilter|createElement|rl|re|trim|end|_|param|first|get|results|parseInt|slice|childNodes|encodeURIComponent|append|events|elems|toLowerCase|json|readyList|setTimeout|grep|mouseenter|color|is|custom|getElementsByTagName|block|stopPropagation|addEventListener|callee|proxy|mouseleave|timers|defaultView|password|disabled|last|has|appendChild|form|domManip|props|ajax|orig|set|easing|mozilla|load|prototype|curAnim|self|charCode|timerId|object|offsetChild|Width|parentOffset|src|unbind|br|currentStyle|clean|float|visible|relatedTarget|previousSibling|handlers|isXMLDoc|on|setup|nodeIndex|unique|shift|javascript|child|RegExp|_default|deep|scroll|lastModified|teardown|setRequestHeader|timeStamp|update|empty|tr|getAttribute|innerHTML|setInterval|checked|fromElement|Number|jQuery|state|active|jsonp|accepts|application|dir|input|responseText|click|styleSheets|unload|not|lastToggle|outline|mouseout|getPropertyValue|mouseover|getComputedStyle|bindReady|String|padding|pageX|metaKey|keyCode|getWH|andSelf|clientX|Left|all|visibility|container|index|init|triggered|removeAttribute|classFilter|prevObject|submit|file|after|windowData|inner|client|globalEval|sibling|jquery|absolute|clone|wrapAll|dequeue|version|triggerHandler|oldblock|ctrlKey|createTextNode|Top|handleError|getResponseHeader|parsererror|speeds|checkbox|old|00|radio|swing|href|Modified|ifModified|lastChild|safari2|startTime|offsetTop|offsetLeft|username|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|_load|loaded|DOMContentLoaded|clientTop|clientLeft|toElement|srcElement|val|pageY|POST|unshift|Bottom|clientY|Right|fix|exclusive|detachEvent|cloneNode|removeEventListener|swap|toString|join|attachEvent|eval|substr|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|exclude|expr|quickClass|quickID|uuid|quickChild|continue|Height|textContent|appendTo|contents|open|margin|evalScript|borderTopWidth|borderLeftWidth|parent|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|linear|def|webkit|nodeValue|speed|_toggle|eq|100|replaceWith|304|concat|200|alpha|Last|httpNotModified|getAttributeNode|httpSuccess|clearInterval|abort|beforeSend|splice|styleFloat|throw|colgroup|XMLHttpRequest|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|getBoundingClientRect|contentType|link|ajaxSend|ajaxSuccess|ajaxError|col|ajaxComplete|ajaxStop|ajaxStart|serializeArray|notmodified|keypress|keydown|change|mouseup|mousedown|dblclick|focus|blur|stylesheet|hasClass|rel|doScroll|black|hover|solid|cancelBubble|returnValue|wheelDelta|view|round|shiftKey|resize|screenY|screenX|relatedNode|mousemove|prevValue|originalTarget|offsetHeight|keyup|newValue|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|originalEvent|charAt|0n|substring|animated|header|noConflict|line|enabled|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|size|417|Boolean|Date|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|wrap|contentWindow|contentDocument|iframe|children|siblings|prevAll|wrapInner|nextAll|outer|prev|scrollTo|static|marginTop|next|inline|parents|able|cellSpacing|adobeair|cellspacing|522|maxLength|maxlength|readOnly|400|readonly|fast|600|class|slow|1px|htmlFor|reverse|10000|PI|cos|compatible|Function|setData|ie|ra|it|rv|getData|userAgent|navigator|fadeTo|fadeIn|slideToggle|slideUp|slideDown|ig|responseXML|content|1223|NaN|fadeOut|300|protocol|send|setAttribute|option|dataFilter|cssText|changed|be|Accept|stop|With|Requested|Object|can|GMT|property|1970|Jan|01|Thu|Since|If|Type|Content|XMLHTTP|th|Microsoft|td|onreadystatechange|onload|cap|charset|colg|host|tfoot|specified|with|1_|thead|leg|plain|attributes|opt|embed|urlencoded|www|area|hr|ajaxSetup|meta|post|getJSON|getScript|marginLeft|img|elements|pageYOffset|pageXOffset|abbr|serialize|pixelLeft'.split('|'),0,{}))
|
@@ -0,0 +1,152 @@
|
|
1
|
+
/*
|
2
|
+
* jquery.simulate - simulate browser mouse and keyboard events
|
3
|
+
*
|
4
|
+
* Copyright (c) 2007 Eduardo Lundgren (eduardolundgren@gmail.com)
|
5
|
+
* and Richard D. Worth (rdworth@gmail.com)
|
6
|
+
*
|
7
|
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
8
|
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
|
12
|
+
;(function($) {
|
13
|
+
|
14
|
+
$.fn.extend({
|
15
|
+
simulate: function(type, options) {
|
16
|
+
return this.each(function() {
|
17
|
+
var opt = $.extend({}, $.simulate.defaults, options || {});
|
18
|
+
new $.simulate(this, type, opt);
|
19
|
+
});
|
20
|
+
}
|
21
|
+
});
|
22
|
+
|
23
|
+
$.simulate = function(el, type, options) {
|
24
|
+
this.target = el;
|
25
|
+
this.options = options;
|
26
|
+
|
27
|
+
if (/^drag$/.test(type)) {
|
28
|
+
this[type].apply(this, [this.target, options]);
|
29
|
+
} else {
|
30
|
+
this.simulateEvent(el, type, options);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
$.extend($.simulate.prototype, {
|
35
|
+
simulateEvent: function(el, type, options) {
|
36
|
+
var evt = this.createEvent(type, options);
|
37
|
+
this.dispatchEvent(el, type, evt, options);
|
38
|
+
return evt;
|
39
|
+
},
|
40
|
+
createEvent: function(type, options) {
|
41
|
+
if (/^mouse(over|out|down|up|move)|(dbl)?click$/.test(type)) {
|
42
|
+
return this.mouseEvent(type, options);
|
43
|
+
} else if (/^key(up|down|press)$/.test(type)) {
|
44
|
+
return this.keyboardEvent(type, options);
|
45
|
+
}
|
46
|
+
},
|
47
|
+
mouseEvent: function(type, options) {
|
48
|
+
var evt;
|
49
|
+
var e = $.extend({
|
50
|
+
bubbles: true, cancelable: (type != "mousemove"), view: window, detail: 0,
|
51
|
+
screenX: 0, screenY: 0, clientX: 0, clientY: 0,
|
52
|
+
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
|
53
|
+
button: 0, relatedTarget: undefined
|
54
|
+
}, options);
|
55
|
+
|
56
|
+
var relatedTarget = $(e.relatedTarget)[0];
|
57
|
+
|
58
|
+
if ($.isFunction(document.createEvent)) {
|
59
|
+
evt = document.createEvent("MouseEvents");
|
60
|
+
evt.initMouseEvent(type, e.bubbles, e.cancelable, e.view, e.detail,
|
61
|
+
e.screenX, e.screenY, e.clientX, e.clientY,
|
62
|
+
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
|
63
|
+
e.button, e.relatedTarget || document.body.parentNode);
|
64
|
+
} else if (document.createEventObject) {
|
65
|
+
evt = document.createEventObject();
|
66
|
+
$.extend(evt, e);
|
67
|
+
evt.button = { 0:1, 1:4, 2:2 }[evt.button] || evt.button;
|
68
|
+
}
|
69
|
+
return evt;
|
70
|
+
},
|
71
|
+
keyboardEvent: function(type, options) {
|
72
|
+
var evt;
|
73
|
+
|
74
|
+
var e = $.extend({ bubbles: true, cancelable: true, view: window,
|
75
|
+
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
|
76
|
+
keyCode: 0, charCode: 0
|
77
|
+
}, options);
|
78
|
+
|
79
|
+
if ($.isFunction(document.createEvent)) {
|
80
|
+
try {
|
81
|
+
evt = document.createEvent("KeyEvents");
|
82
|
+
evt.initKeyEvent(type, e.bubbles, e.cancelable, e.view,
|
83
|
+
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
|
84
|
+
e.keyCode, e.charCode);
|
85
|
+
} catch(err) {
|
86
|
+
evt = document.createEvent("Events");
|
87
|
+
evt.initEvent(type, e.bubbles, e.cancelable);
|
88
|
+
$.extend(evt, { view: e.view,
|
89
|
+
ctrlKey: e.ctrlKey, altKey: e.altKey, shiftKey: e.shiftKey, metaKey: e.metaKey,
|
90
|
+
keyCode: e.keyCode, charCode: e.charCode
|
91
|
+
});
|
92
|
+
}
|
93
|
+
} else if (document.createEventObject) {
|
94
|
+
evt = document.createEventObject();
|
95
|
+
$.extend(evt, e);
|
96
|
+
}
|
97
|
+
if ($.browser.msie || $.browser.opera) {
|
98
|
+
evt.keyCode = (e.charCode > 0) ? e.charCode : e.keyCode;
|
99
|
+
evt.charCode = undefined;
|
100
|
+
}
|
101
|
+
return evt;
|
102
|
+
},
|
103
|
+
|
104
|
+
dispatchEvent: function(el, type, evt) {
|
105
|
+
if (el.dispatchEvent) {
|
106
|
+
el.dispatchEvent(evt);
|
107
|
+
} else if (el.fireEvent) {
|
108
|
+
el.fireEvent('on' + type, evt);
|
109
|
+
}
|
110
|
+
return evt;
|
111
|
+
},
|
112
|
+
|
113
|
+
drag: function(el) {
|
114
|
+
var self = this, center = this.findCenter(this.target),
|
115
|
+
options = this.options, x = Math.floor(center.x), y = Math.floor(center.y),
|
116
|
+
dx = options.dx || 0, dy = options.dy || 0, target = this.target;
|
117
|
+
var coord = { clientX: x, clientY: y };
|
118
|
+
this.simulateEvent(target, "mousedown", coord);
|
119
|
+
coord = { clientX: x + 1, clientY: y + 1 };
|
120
|
+
this.simulateEvent(document, "mousemove", coord);
|
121
|
+
coord = { clientX: x + dx, clientY: y + dy };
|
122
|
+
this.simulateEvent(document, "mousemove", coord);
|
123
|
+
this.simulateEvent(document, "mousemove", coord);
|
124
|
+
this.simulateEvent(target, "mouseup", coord);
|
125
|
+
},
|
126
|
+
findCenter: function(el) {
|
127
|
+
var el = $(this.target), o = el.offset();
|
128
|
+
return {
|
129
|
+
x: o.left + el.outerWidth() / 2,
|
130
|
+
y: o.top + el.outerHeight() / 2
|
131
|
+
};
|
132
|
+
}
|
133
|
+
});
|
134
|
+
|
135
|
+
$.extend($.simulate, {
|
136
|
+
defaults: {
|
137
|
+
speed: 'sync'
|
138
|
+
},
|
139
|
+
VK_TAB: 9,
|
140
|
+
VK_ENTER: 13,
|
141
|
+
VK_ESC: 27,
|
142
|
+
VK_PGUP: 33,
|
143
|
+
VK_PGDN: 34,
|
144
|
+
VK_END: 35,
|
145
|
+
VK_HOME: 36,
|
146
|
+
VK_LEFT: 37,
|
147
|
+
VK_UP: 38,
|
148
|
+
VK_RIGHT: 39,
|
149
|
+
VK_DOWN: 40
|
150
|
+
});
|
151
|
+
|
152
|
+
})(jQuery);
|
@@ -0,0 +1,224 @@
|
|
1
|
+
@CHARSET "UTF-8";
|
2
|
+
|
3
|
+
/* --------------------
|
4
|
+
* @Layout
|
5
|
+
*/
|
6
|
+
|
7
|
+
html {
|
8
|
+
overflow: hidden;
|
9
|
+
}
|
10
|
+
|
11
|
+
body, #jsspec_container {
|
12
|
+
overflow: hidden;
|
13
|
+
padding: 0;
|
14
|
+
margin: 0;
|
15
|
+
width: 100%;
|
16
|
+
height: 100%;
|
17
|
+
background-color: white;
|
18
|
+
}
|
19
|
+
|
20
|
+
#title {
|
21
|
+
padding: 0;
|
22
|
+
margin: 0;
|
23
|
+
position: absolute;
|
24
|
+
top: 0px;
|
25
|
+
left: 0px;
|
26
|
+
width: 100%;
|
27
|
+
height: 40px;
|
28
|
+
overflow: hidden;
|
29
|
+
}
|
30
|
+
|
31
|
+
#list {
|
32
|
+
padding: 0;
|
33
|
+
margin: 0;
|
34
|
+
position: absolute;
|
35
|
+
top: 40px;
|
36
|
+
left: 0px;
|
37
|
+
bottom: 0px;
|
38
|
+
overflow: auto;
|
39
|
+
width: 250px;
|
40
|
+
_height:expression(document.body.clientHeight-40);
|
41
|
+
}
|
42
|
+
|
43
|
+
#log {
|
44
|
+
padding: 0;
|
45
|
+
margin: 0;
|
46
|
+
position: absolute;
|
47
|
+
top: 40px;
|
48
|
+
left: 250px;
|
49
|
+
right: 0px;
|
50
|
+
bottom: 0px;
|
51
|
+
overflow: auto;
|
52
|
+
_height:expression(document.body.clientHeight-40);
|
53
|
+
_width:expression(document.body.clientWidth-250);
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
/* --------------------
|
59
|
+
* @Decorations and colors
|
60
|
+
*/
|
61
|
+
* {
|
62
|
+
padding: 0;
|
63
|
+
margin: 0;
|
64
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
65
|
+
}
|
66
|
+
|
67
|
+
li {
|
68
|
+
list-style: none;
|
69
|
+
}
|
70
|
+
|
71
|
+
/* hiding subtitles */
|
72
|
+
h2 {
|
73
|
+
display: none;
|
74
|
+
}
|
75
|
+
|
76
|
+
/* title section */
|
77
|
+
div#title {
|
78
|
+
padding: 0em 0.5em;
|
79
|
+
}
|
80
|
+
|
81
|
+
div#title h1 {
|
82
|
+
font-size: 1.5em;
|
83
|
+
float: left;
|
84
|
+
}
|
85
|
+
|
86
|
+
div#title ul li {
|
87
|
+
float: left;
|
88
|
+
padding: 0.5em 0em 0.5em 0.75em;
|
89
|
+
}
|
90
|
+
|
91
|
+
div#title p {
|
92
|
+
float:right;
|
93
|
+
margin-right:1em;
|
94
|
+
font-size: 0.75em;
|
95
|
+
}
|
96
|
+
|
97
|
+
/* spec container */
|
98
|
+
ul.specs {
|
99
|
+
margin: 0.5em;
|
100
|
+
}
|
101
|
+
ul.specs li {
|
102
|
+
margin-bottom: 0.1em;
|
103
|
+
}
|
104
|
+
|
105
|
+
/* spec title */
|
106
|
+
ul.specs li h3 {
|
107
|
+
font-weight: bold;
|
108
|
+
font-size: 0.75em;
|
109
|
+
padding: 0.2em 1em;
|
110
|
+
cursor: pointer;
|
111
|
+
_cursor: hand;
|
112
|
+
}
|
113
|
+
|
114
|
+
/* example container */
|
115
|
+
ul.examples li {
|
116
|
+
border-style: solid;
|
117
|
+
border-width: 0px 0px 1px 5px;
|
118
|
+
margin: 0.2em 0em 0.2em 1em;
|
119
|
+
}
|
120
|
+
|
121
|
+
/* example title */
|
122
|
+
ul.examples li h4 {
|
123
|
+
font-weight: normal;
|
124
|
+
font-size: 0.75em;
|
125
|
+
margin-left: 1em;
|
126
|
+
}
|
127
|
+
|
128
|
+
pre.examples-code {
|
129
|
+
margin: 0.5em 2em;
|
130
|
+
padding: 0.5em;
|
131
|
+
background: white;
|
132
|
+
border: solid 1px #CCC;
|
133
|
+
}
|
134
|
+
|
135
|
+
/* example explaination */
|
136
|
+
ul.examples li div {
|
137
|
+
padding: 1em 2em;
|
138
|
+
font-size: 0.75em;
|
139
|
+
}
|
140
|
+
|
141
|
+
/* styles for ongoing, success, failure, error */
|
142
|
+
div.success, div.success a {
|
143
|
+
color: #FFFFFF;
|
144
|
+
background-color: #65C400;
|
145
|
+
}
|
146
|
+
|
147
|
+
ul.specs li.success h3, ul.specs li.success h3 a {
|
148
|
+
color: #FFFFFF;
|
149
|
+
background-color: #65C400;
|
150
|
+
}
|
151
|
+
|
152
|
+
ul.examples li.success, ul.examples li.success a {
|
153
|
+
color: #3D7700;
|
154
|
+
background-color: #DBFFB4;
|
155
|
+
border-color: #65C400;
|
156
|
+
}
|
157
|
+
|
158
|
+
div.exception, div.exception a {
|
159
|
+
color: #FFFFFF;
|
160
|
+
background-color: #C20000;
|
161
|
+
}
|
162
|
+
|
163
|
+
ul.specs li.exception h3, ul.specs li.exception h3 a {
|
164
|
+
color: #FFFFFF;
|
165
|
+
background-color: #C20000;
|
166
|
+
}
|
167
|
+
|
168
|
+
ul.examples li.exception, ul.examples li.exception a {
|
169
|
+
color: #C20000;
|
170
|
+
background-color: #FFFBD3;
|
171
|
+
border-color: #C20000;
|
172
|
+
}
|
173
|
+
|
174
|
+
div.ongoing, div.ongoing a {
|
175
|
+
color: #000000;
|
176
|
+
background-color: #FFFF80;
|
177
|
+
}
|
178
|
+
|
179
|
+
ul.specs li.ongoing h3, ul.specs li.ongoing h3 a {
|
180
|
+
color: #000000;
|
181
|
+
background-color: #FFFF80;
|
182
|
+
}
|
183
|
+
|
184
|
+
ul.examples li.ongoing, ul.examples li.ongoing a {
|
185
|
+
color: #000000;
|
186
|
+
background-color: #FFFF80;
|
187
|
+
border-color: #DDDD00;
|
188
|
+
}
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
/* --------------------
|
193
|
+
* values
|
194
|
+
*/
|
195
|
+
.number_value, .string_value, .regexp_value, .boolean_value, .dom_value {
|
196
|
+
font-family: monospace;
|
197
|
+
color: blue;
|
198
|
+
}
|
199
|
+
.object_value, .array_value {
|
200
|
+
line-height: 2em;
|
201
|
+
padding: 0.1em 0.2em;
|
202
|
+
margin: 0.1em 0;
|
203
|
+
}
|
204
|
+
.date_value {
|
205
|
+
font-family: monospace;
|
206
|
+
color: olive;
|
207
|
+
}
|
208
|
+
.undefined_value, .null_value {
|
209
|
+
font-style: italic;
|
210
|
+
color: blue;
|
211
|
+
}
|
212
|
+
.dom_attr_name {
|
213
|
+
}
|
214
|
+
.dom_attr_value {
|
215
|
+
color: red;
|
216
|
+
}
|
217
|
+
.dom_path {
|
218
|
+
font-size: 0.75em;
|
219
|
+
color: gray;
|
220
|
+
}
|
221
|
+
strong {
|
222
|
+
font-weight: normal;
|
223
|
+
background-color: #FFC6C6;
|
224
|
+
}
|
@@ -0,0 +1,1548 @@
|
|
1
|
+
/**
|
2
|
+
* JSSpec
|
3
|
+
*
|
4
|
+
* Copyright 2007 Alan Kang
|
5
|
+
* - mailto:jania902@gmail.com
|
6
|
+
* - http://jania.pe.kr
|
7
|
+
*
|
8
|
+
* http://jania.pe.kr/aw/moin.cgi/JSSpec
|
9
|
+
*
|
10
|
+
* Dependencies:
|
11
|
+
* - diff_match_patch.js ( http://code.google.com/p/google-diff-match-patch )
|
12
|
+
*
|
13
|
+
* This library is free software; you can redistribute it and/or
|
14
|
+
* modify it under the terms of the GNU Lesser General Public
|
15
|
+
* License as published by the Free Software Foundation; either
|
16
|
+
* version 2.1 of the License, or (at your option) any later version.
|
17
|
+
*
|
18
|
+
* This library is distributed in the hope that it will be useful,
|
19
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
21
|
+
* Lesser General Public License for more details.
|
22
|
+
*
|
23
|
+
* You should have received a copy of the GNU Lesser General Public
|
24
|
+
* License along with this library; if not, write to the Free Software
|
25
|
+
* Foundation, Inc, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
26
|
+
*/
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Namespace
|
30
|
+
*/
|
31
|
+
|
32
|
+
var JSSpec = {
|
33
|
+
specs: [],
|
34
|
+
|
35
|
+
EMPTY_FUNCTION: function() {},
|
36
|
+
|
37
|
+
Browser: {
|
38
|
+
// By Rendering Engines
|
39
|
+
Trident: navigator.appName === "Microsoft Internet Explorer",
|
40
|
+
Webkit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
|
41
|
+
Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') === -1,
|
42
|
+
KHTML: navigator.userAgent.indexOf('KHTML') !== -1,
|
43
|
+
Presto: navigator.appName === "Opera",
|
44
|
+
|
45
|
+
// By Platforms
|
46
|
+
Mac: navigator.userAgent.indexOf("Macintosh") !== -1,
|
47
|
+
Ubuntu: navigator.userAgent.indexOf('Ubuntu') !== -1,
|
48
|
+
Win: navigator.userAgent.indexOf('Windows') !== -1,
|
49
|
+
|
50
|
+
// By Browsers
|
51
|
+
IE: navigator.appName === "Microsoft Internet Explorer",
|
52
|
+
IE6: navigator.userAgent.indexOf('MSIE 6') !== -1,
|
53
|
+
IE7: navigator.userAgent.indexOf('MSIE 7') !== -1,
|
54
|
+
IE8: navigator.userAgent.indexOf('MSIE 8') !== -1,
|
55
|
+
|
56
|
+
FF: navigator.userAgent.indexOf('Firefox') !== -1,
|
57
|
+
FF2: navigator.userAgent.indexOf('Firefox/2') !== -1,
|
58
|
+
FF3: navigator.userAgent.indexOf('Firefox/3') !== -1,
|
59
|
+
Safari: navigator.userAgent.indexOf('Safari') !== -1
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Executor
|
67
|
+
*/
|
68
|
+
JSSpec.Executor = function(target, onSuccess, onException) {
|
69
|
+
this.target = target;
|
70
|
+
this.onSuccess = typeof onSuccess == 'function' ? onSuccess : JSSpec.EMPTY_FUNCTION;
|
71
|
+
this.onException = typeof onException == 'function' ? onException : JSSpec.EMPTY_FUNCTION;
|
72
|
+
|
73
|
+
if(JSSpec.Browser.Trident) {
|
74
|
+
// Exception handler for Trident. It helps to collect exact line number where exception occured.
|
75
|
+
window.onerror = function(message, fileName, lineNumber) {
|
76
|
+
var self = window._curExecutor;
|
77
|
+
var ex = {message:message, fileName:fileName, lineNumber:lineNumber};
|
78
|
+
|
79
|
+
if(JSSpec._secondPass) {
|
80
|
+
ex = self.mergeExceptions(JSSpec._assertionFailure, ex);
|
81
|
+
delete JSSpec._secondPass;
|
82
|
+
delete JSSpec._assertionFailure;
|
83
|
+
|
84
|
+
ex.type = "failure";
|
85
|
+
self.onException(self, ex);
|
86
|
+
} else if(JSSpec._assertionFailure) {
|
87
|
+
JSSpec._secondPass = true;
|
88
|
+
self.run();
|
89
|
+
} else {
|
90
|
+
self.onException(self, ex);
|
91
|
+
}
|
92
|
+
|
93
|
+
return true;
|
94
|
+
};
|
95
|
+
}
|
96
|
+
};
|
97
|
+
JSSpec.Executor.prototype.mergeExceptions = function(assertionFailure, normalException) {
|
98
|
+
var merged = {
|
99
|
+
message:assertionFailure.message,
|
100
|
+
fileName:normalException.fileName,
|
101
|
+
lineNumber:normalException.lineNumber
|
102
|
+
};
|
103
|
+
|
104
|
+
return merged;
|
105
|
+
};
|
106
|
+
|
107
|
+
JSSpec.Executor.prototype.run = function() {
|
108
|
+
var self = this;
|
109
|
+
var target = this.target;
|
110
|
+
var onSuccess = this.onSuccess;
|
111
|
+
var onException = this.onException;
|
112
|
+
|
113
|
+
window.setTimeout(
|
114
|
+
function() {
|
115
|
+
var result;
|
116
|
+
if(JSSpec.Browser.Trident) {
|
117
|
+
window._curExecutor = self;
|
118
|
+
|
119
|
+
result = self.target();
|
120
|
+
self.onSuccess(self, result);
|
121
|
+
} else {
|
122
|
+
try {
|
123
|
+
result = self.target();
|
124
|
+
self.onSuccess(self, result);
|
125
|
+
} catch(ex) {
|
126
|
+
if(JSSpec.Browser.Webkit) ex = {message:ex.message, fileName:ex.sourceURL, lineNumber:ex.line};
|
127
|
+
|
128
|
+
if(JSSpec._secondPass) {
|
129
|
+
ex = self.mergeExceptions(JSSpec._assertionFailure, ex);
|
130
|
+
delete JSSpec._secondPass;
|
131
|
+
delete JSSpec._assertionFailure;
|
132
|
+
|
133
|
+
ex.type = "failure";
|
134
|
+
self.onException(self, ex);
|
135
|
+
} else if(JSSpec._assertionFailure) {
|
136
|
+
JSSpec._secondPass = true;
|
137
|
+
self.run();
|
138
|
+
} else {
|
139
|
+
self.onException(self, ex);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
},
|
144
|
+
0
|
145
|
+
);
|
146
|
+
};
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
/**
|
151
|
+
* CompositeExecutor composites one or more executors and execute them sequencially.
|
152
|
+
*/
|
153
|
+
JSSpec.CompositeExecutor = function(onSuccess, onException, continueOnException) {
|
154
|
+
this.queue = [];
|
155
|
+
this.onSuccess = typeof onSuccess == 'function' ? onSuccess : JSSpec.EMPTY_FUNCTION;
|
156
|
+
this.onException = typeof onException == 'function' ? onException : JSSpec.EMPTY_FUNCTION;
|
157
|
+
this.continueOnException = !!continueOnException;
|
158
|
+
};
|
159
|
+
|
160
|
+
JSSpec.CompositeExecutor.prototype.addFunction = function(func) {
|
161
|
+
this.addExecutor(new JSSpec.Executor(func));
|
162
|
+
};
|
163
|
+
|
164
|
+
JSSpec.CompositeExecutor.prototype.addExecutor = function(executor) {
|
165
|
+
var last = this.queue.length == 0 ? null : this.queue[this.queue.length - 1];
|
166
|
+
if(last) {
|
167
|
+
last.next = executor;
|
168
|
+
}
|
169
|
+
|
170
|
+
executor.parent = this;
|
171
|
+
executor.onSuccessBackup = executor.onSuccess;
|
172
|
+
executor.onSuccess = function(result) {
|
173
|
+
this.onSuccessBackup(result);
|
174
|
+
if(this.next) {
|
175
|
+
this.next.run();
|
176
|
+
} else {
|
177
|
+
this.parent.onSuccess();
|
178
|
+
}
|
179
|
+
};
|
180
|
+
executor.onExceptionBackup = executor.onException;
|
181
|
+
executor.onException = function(executor, ex) {
|
182
|
+
this.onExceptionBackup(executor, ex);
|
183
|
+
|
184
|
+
if(this.parent.continueOnException) {
|
185
|
+
if(this.next) {
|
186
|
+
this.next.run();
|
187
|
+
} else {
|
188
|
+
this.parent.onSuccess();
|
189
|
+
}
|
190
|
+
} else {
|
191
|
+
this.parent.onException(executor, ex);
|
192
|
+
}
|
193
|
+
};
|
194
|
+
|
195
|
+
this.queue.push(executor);
|
196
|
+
};
|
197
|
+
|
198
|
+
JSSpec.CompositeExecutor.prototype.run = function() {
|
199
|
+
if(this.queue.length > 0) {
|
200
|
+
this.queue[0].run();
|
201
|
+
}
|
202
|
+
};
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Spec is a set of Examples in a specific context
|
206
|
+
*/
|
207
|
+
JSSpec.Spec = function(context, entries) {
|
208
|
+
this.id = JSSpec.Spec.id++;
|
209
|
+
this.context = context;
|
210
|
+
this.url = location.href;
|
211
|
+
|
212
|
+
this.filterEntriesByEmbeddedExpressions(entries);
|
213
|
+
this.extractOutSpecialEntries(entries);
|
214
|
+
this.examples = this.makeExamplesFromEntries(entries);
|
215
|
+
this.examplesMap = this.makeMapFromExamples(this.examples);
|
216
|
+
};
|
217
|
+
|
218
|
+
JSSpec.Spec.id = 0;
|
219
|
+
JSSpec.Spec.prototype.getExamples = function() {
|
220
|
+
return this.examples;
|
221
|
+
};
|
222
|
+
|
223
|
+
JSSpec.Spec.prototype.hasException = function() {
|
224
|
+
return this.getTotalFailures() > 0 || this.getTotalErrors() > 0;
|
225
|
+
};
|
226
|
+
|
227
|
+
JSSpec.Spec.prototype.getTotalFailures = function() {
|
228
|
+
var examples = this.examples;
|
229
|
+
var failures = 0;
|
230
|
+
for(var i = 0; i < examples.length; i++) {
|
231
|
+
if(examples[i].isFailure()) failures++;
|
232
|
+
}
|
233
|
+
return failures;
|
234
|
+
};
|
235
|
+
|
236
|
+
JSSpec.Spec.prototype.getTotalErrors = function() {
|
237
|
+
var examples = this.examples;
|
238
|
+
var errors = 0;
|
239
|
+
for(var i = 0; i < examples.length; i++) {
|
240
|
+
if(examples[i].isError()) errors++;
|
241
|
+
}
|
242
|
+
return errors;
|
243
|
+
};
|
244
|
+
|
245
|
+
JSSpec.Spec.prototype.filterEntriesByEmbeddedExpressions = function(entries) {
|
246
|
+
var isTrue;
|
247
|
+
for(name in entries) if(entries.hasOwnProperty(name)) {
|
248
|
+
var m = name.match(/\[\[(.+)\]\]/);
|
249
|
+
if(m && m[1]) {
|
250
|
+
eval("isTrue = (" + m[1] + ")");
|
251
|
+
if(!isTrue) delete entries[name];
|
252
|
+
}
|
253
|
+
}
|
254
|
+
};
|
255
|
+
|
256
|
+
JSSpec.Spec.prototype.extractOutSpecialEntries = function(entries) {
|
257
|
+
this.beforeEach = JSSpec.EMPTY_FUNCTION;
|
258
|
+
this.beforeAll = JSSpec.EMPTY_FUNCTION;
|
259
|
+
this.afterEach = JSSpec.EMPTY_FUNCTION;
|
260
|
+
this.afterAll = JSSpec.EMPTY_FUNCTION;
|
261
|
+
|
262
|
+
for(name in entries) if(entries.hasOwnProperty(name)) {
|
263
|
+
if(name == 'before' || name == 'before each' || name == 'before_each') {
|
264
|
+
this.beforeEach = entries[name];
|
265
|
+
} else if(name == 'before all' || name == 'before_all') {
|
266
|
+
this.beforeAll = entries[name];
|
267
|
+
} else if(name == 'after' || name == 'after each' || name == 'after_each') {
|
268
|
+
this.afterEach = entries[name];
|
269
|
+
} else if(name == 'after all' || name == 'after_all') {
|
270
|
+
this.afterAll = entries[name];
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
delete entries['before'];
|
275
|
+
delete entries['before each'];
|
276
|
+
delete entries['before_each'];
|
277
|
+
delete entries['before all'];
|
278
|
+
delete entries['before_all'];
|
279
|
+
delete entries['after'];
|
280
|
+
delete entries['after each'];
|
281
|
+
delete entries['after_each'];
|
282
|
+
delete entries['after all'];
|
283
|
+
delete entries['after_all'];
|
284
|
+
};
|
285
|
+
|
286
|
+
JSSpec.Spec.prototype.makeExamplesFromEntries = function(entries) {
|
287
|
+
var examples = [];
|
288
|
+
for(name in entries) if(entries.hasOwnProperty(name)) {
|
289
|
+
examples.push(new JSSpec.Example(name, entries[name], this.beforeEach, this.afterEach));
|
290
|
+
}
|
291
|
+
return examples;
|
292
|
+
};
|
293
|
+
|
294
|
+
JSSpec.Spec.prototype.makeMapFromExamples = function(examples) {
|
295
|
+
var map = {};
|
296
|
+
for(var i = 0; i < examples.length; i++) {
|
297
|
+
var example = examples[i];
|
298
|
+
map[example.id] = examples[i];
|
299
|
+
}
|
300
|
+
return map;
|
301
|
+
};
|
302
|
+
|
303
|
+
JSSpec.Spec.prototype.getExampleById = function(id) {
|
304
|
+
return this.examplesMap[id];
|
305
|
+
};
|
306
|
+
|
307
|
+
JSSpec.Spec.prototype.getExecutor = function() {
|
308
|
+
var self = this;
|
309
|
+
var onException = function(executor, ex) {
|
310
|
+
self.exception = ex;
|
311
|
+
};
|
312
|
+
|
313
|
+
var composite = new JSSpec.CompositeExecutor();
|
314
|
+
composite.addFunction(function() {JSSpec.log.onSpecStart(self);});
|
315
|
+
composite.addExecutor(new JSSpec.Executor(this.beforeAll, null, function(exec, ex) {
|
316
|
+
self.exception = ex;
|
317
|
+
JSSpec.log.onSpecEnd(self);
|
318
|
+
}));
|
319
|
+
|
320
|
+
var exampleAndAfter = new JSSpec.CompositeExecutor(null,null,true);
|
321
|
+
for(var i = 0; i < this.examples.length; i++) {
|
322
|
+
exampleAndAfter.addExecutor(this.examples[i].getExecutor());
|
323
|
+
}
|
324
|
+
exampleAndAfter.addExecutor(new JSSpec.Executor(this.afterAll, null, onException));
|
325
|
+
exampleAndAfter.addFunction(function() {JSSpec.log.onSpecEnd(self);});
|
326
|
+
composite.addExecutor(exampleAndAfter);
|
327
|
+
|
328
|
+
return composite;
|
329
|
+
};
|
330
|
+
|
331
|
+
/**
|
332
|
+
* Example
|
333
|
+
*/
|
334
|
+
JSSpec.Example = function(name, target, before, after) {
|
335
|
+
this.id = JSSpec.Example.id++;
|
336
|
+
this.name = name;
|
337
|
+
this.target = target;
|
338
|
+
this.before = before;
|
339
|
+
this.after = after;
|
340
|
+
};
|
341
|
+
|
342
|
+
JSSpec.Example.id = 0;
|
343
|
+
JSSpec.Example.prototype.isFailure = function() {
|
344
|
+
return this.exception && this.exception.type == "failure";
|
345
|
+
};
|
346
|
+
|
347
|
+
JSSpec.Example.prototype.isError = function() {
|
348
|
+
return this.exception && !this.exception.type;
|
349
|
+
};
|
350
|
+
|
351
|
+
JSSpec.Example.prototype.getExecutor = function() {
|
352
|
+
var self = this;
|
353
|
+
var onException = function(executor, ex) {
|
354
|
+
self.exception = ex;
|
355
|
+
};
|
356
|
+
|
357
|
+
var composite = new JSSpec.CompositeExecutor();
|
358
|
+
composite.addFunction(function() {JSSpec.log.onExampleStart(self);});
|
359
|
+
composite.addExecutor(new JSSpec.Executor(this.before, null, function(exec, ex) {
|
360
|
+
self.exception = ex;
|
361
|
+
JSSpec.log.onExampleEnd(self);
|
362
|
+
}));
|
363
|
+
|
364
|
+
var targetAndAfter = new JSSpec.CompositeExecutor(null,null,true);
|
365
|
+
|
366
|
+
targetAndAfter.addExecutor(new JSSpec.Executor(this.target, null, onException));
|
367
|
+
targetAndAfter.addExecutor(new JSSpec.Executor(this.after, null, onException));
|
368
|
+
targetAndAfter.addFunction(function() {JSSpec.log.onExampleEnd(self);});
|
369
|
+
|
370
|
+
composite.addExecutor(targetAndAfter);
|
371
|
+
|
372
|
+
return composite;
|
373
|
+
};
|
374
|
+
|
375
|
+
/**
|
376
|
+
* Runner
|
377
|
+
*/
|
378
|
+
JSSpec.Runner = function(specs, logger) {
|
379
|
+
JSSpec.log = logger;
|
380
|
+
|
381
|
+
this.totalExamples = 0;
|
382
|
+
this.specs = [];
|
383
|
+
this.specsMap = {};
|
384
|
+
this.addAllSpecs(specs);
|
385
|
+
};
|
386
|
+
|
387
|
+
JSSpec.Runner.prototype.addAllSpecs = function(specs) {
|
388
|
+
for(var i = 0; i < specs.length; i++) {
|
389
|
+
this.addSpec(specs[i]);
|
390
|
+
}
|
391
|
+
};
|
392
|
+
|
393
|
+
JSSpec.Runner.prototype.addSpec = function(spec) {
|
394
|
+
this.specs.push(spec);
|
395
|
+
this.specsMap[spec.id] = spec;
|
396
|
+
this.totalExamples += spec.getExamples().length;
|
397
|
+
};
|
398
|
+
|
399
|
+
JSSpec.Runner.prototype.getSpecById = function(id) {
|
400
|
+
return this.specsMap[id];
|
401
|
+
};
|
402
|
+
|
403
|
+
JSSpec.Runner.prototype.getSpecByContext = function(context) {
|
404
|
+
for(var i = 0; i < this.specs.length; i++) {
|
405
|
+
if(this.specs[i].context == context) return this.specs[i];
|
406
|
+
}
|
407
|
+
return null;
|
408
|
+
};
|
409
|
+
|
410
|
+
JSSpec.Runner.prototype.getSpecs = function() {
|
411
|
+
return this.specs;
|
412
|
+
};
|
413
|
+
|
414
|
+
JSSpec.Runner.prototype.hasException = function() {
|
415
|
+
return this.getTotalFailures() > 0 || this.getTotalErrors() > 0;
|
416
|
+
};
|
417
|
+
|
418
|
+
JSSpec.Runner.prototype.getTotalFailures = function() {
|
419
|
+
var specs = this.specs;
|
420
|
+
var failures = 0;
|
421
|
+
for(var i = 0; i < specs.length; i++) {
|
422
|
+
failures += specs[i].getTotalFailures();
|
423
|
+
}
|
424
|
+
return failures;
|
425
|
+
};
|
426
|
+
|
427
|
+
JSSpec.Runner.prototype.getTotalErrors = function() {
|
428
|
+
var specs = this.specs;
|
429
|
+
var errors = 0;
|
430
|
+
for(var i = 0; i < specs.length; i++) {
|
431
|
+
errors += specs[i].getTotalErrors();
|
432
|
+
}
|
433
|
+
return errors;
|
434
|
+
};
|
435
|
+
|
436
|
+
|
437
|
+
JSSpec.Runner.prototype.run = function() {
|
438
|
+
JSSpec.log.onRunnerStart();
|
439
|
+
var executor = new JSSpec.CompositeExecutor(function() {JSSpec.log.onRunnerEnd()},null,true);
|
440
|
+
for(var i = 0; i < this.specs.length; i++) {
|
441
|
+
executor.addExecutor(this.specs[i].getExecutor());
|
442
|
+
}
|
443
|
+
executor.run();
|
444
|
+
};
|
445
|
+
|
446
|
+
|
447
|
+
JSSpec.Runner.prototype.rerun = function(context) {
|
448
|
+
JSSpec.runner = new JSSpec.Runner([this.getSpecByContext(context)], JSSpec.log);
|
449
|
+
JSSpec.runner.run();
|
450
|
+
};
|
451
|
+
|
452
|
+
/**
|
453
|
+
* Logger
|
454
|
+
*/
|
455
|
+
JSSpec.Logger = function() {
|
456
|
+
this.finishedExamples = 0;
|
457
|
+
this.startedAt = null;
|
458
|
+
};
|
459
|
+
|
460
|
+
JSSpec.Logger.prototype.onRunnerStart = function() {
|
461
|
+
this._title = document.title;
|
462
|
+
|
463
|
+
this.startedAt = new Date();
|
464
|
+
var container = document.getElementById('jsspec_container');
|
465
|
+
if(container) {
|
466
|
+
container.innerHTML = "";
|
467
|
+
} else {
|
468
|
+
container = document.createElement("DIV");
|
469
|
+
container.id = "jsspec_container";
|
470
|
+
document.body.appendChild(container);
|
471
|
+
}
|
472
|
+
|
473
|
+
var title = document.createElement("DIV");
|
474
|
+
title.id = "title";
|
475
|
+
title.innerHTML = [
|
476
|
+
'<h1>JSSpec</h1>',
|
477
|
+
'<ul>',
|
478
|
+
JSSpec.options.rerun ? '<li>[<a href="?" title="rerun all specs">X</a>] ' + JSSpec.util.escapeTags(decodeURIComponent(JSSpec.options.rerun)) + '</li>' : '',
|
479
|
+
' <li><span id="total_examples">' + JSSpec.runner.totalExamples + '</span> examples</li>',
|
480
|
+
' <li><span id="total_failures">0</span> failures</li>',
|
481
|
+
' <li><span id="total_errors">0</span> errors</li>',
|
482
|
+
' <li><span id="progress">0</span>% done</li>',
|
483
|
+
' <li><span id="total_elapsed">0</span> secs</li>',
|
484
|
+
'</ul>',
|
485
|
+
'<p><a href="http://jania.pe.kr/aw/moin.cgi/JSSpec">JSSpec homepage</a></p>',
|
486
|
+
].join("");
|
487
|
+
container.appendChild(title);
|
488
|
+
|
489
|
+
var list = document.createElement("DIV");
|
490
|
+
list.id = "list";
|
491
|
+
list.innerHTML = [
|
492
|
+
'<h2>List</h2>',
|
493
|
+
'<ul class="specs">',
|
494
|
+
function() {
|
495
|
+
var specs = JSSpec.runner.getSpecs();
|
496
|
+
var sb = [];
|
497
|
+
for(var i = 0; i < specs.length; i++) {
|
498
|
+
var spec = specs[i];
|
499
|
+
sb.push('<li id="spec_' + specs[i].id + '_list"><h3><a href="#spec_' + specs[i].id + '">' + JSSpec.util.escapeTags(specs[i].context) + '</a> [<a href="?rerun=' + encodeURIComponent(specs[i].context) + '">rerun</a>]</h3> </li>');
|
500
|
+
}
|
501
|
+
return sb.join("");
|
502
|
+
}(),
|
503
|
+
'</ul>'
|
504
|
+
].join("");
|
505
|
+
container.appendChild(list);
|
506
|
+
|
507
|
+
var log = document.createElement("DIV");
|
508
|
+
log.id = "log";
|
509
|
+
log.innerHTML = [
|
510
|
+
'<h2>Log</h2>',
|
511
|
+
'<ul class="specs">',
|
512
|
+
function() {
|
513
|
+
var specs = JSSpec.runner.getSpecs();
|
514
|
+
var sb = [];
|
515
|
+
for(var i = 0; i < specs.length; i++) {
|
516
|
+
var spec = specs[i];
|
517
|
+
sb.push(' <li id="spec_' + specs[i].id + '">');
|
518
|
+
sb.push(' <h3>' + JSSpec.util.escapeTags(specs[i].context) + ' [<a href="?rerun=' + encodeURIComponent(specs[i].context) + '">rerun</a>]</h3>');
|
519
|
+
sb.push(' <ul id="spec_' + specs[i].id + '_examples" class="examples">');
|
520
|
+
for(var j = 0; j < spec.examples.length; j++) {
|
521
|
+
var example = spec.examples[j];
|
522
|
+
sb.push(' <li id="example_' + example.id + '">');
|
523
|
+
sb.push(' <h4>' + JSSpec.util.escapeTags(example.name) + '</h4>');
|
524
|
+
sb.push(' <pre class="examples-code"><code>'+JSSpec.util.escapeTags(example.target.toString())+'</code></pre>');
|
525
|
+
sb.push(' </li>');
|
526
|
+
}
|
527
|
+
sb.push(' </ul>');
|
528
|
+
sb.push(' </li>');
|
529
|
+
}
|
530
|
+
return sb.join("");
|
531
|
+
}(),
|
532
|
+
'</ul>'
|
533
|
+
].join("");
|
534
|
+
|
535
|
+
container.appendChild(log);
|
536
|
+
|
537
|
+
// add event handler for toggling
|
538
|
+
var specs = JSSpec.runner.getSpecs();
|
539
|
+
var sb = [];
|
540
|
+
for(var i = 0; i < specs.length; i++) {
|
541
|
+
var spec = document.getElementById("spec_" + specs[i].id);
|
542
|
+
var title = spec.getElementsByTagName("H3")[0];
|
543
|
+
title.onclick = function(e) {
|
544
|
+
var target = document.getElementById(this.parentNode.id + "_examples");
|
545
|
+
target.style.display = target.style.display == "none" ? "block" : "none";
|
546
|
+
return true;
|
547
|
+
}
|
548
|
+
}
|
549
|
+
};
|
550
|
+
|
551
|
+
JSSpec.Logger.prototype.onRunnerEnd = function() {
|
552
|
+
if(JSSpec.runner.hasException()) {
|
553
|
+
var times = 4;
|
554
|
+
var title1 = "*" + this._title;
|
555
|
+
var title2 = "*F" + JSSpec.runner.getTotalFailures() + " E" + JSSpec.runner.getTotalErrors() + "* " + this._title;
|
556
|
+
} else {
|
557
|
+
var times = 2;
|
558
|
+
var title1 = this._title;
|
559
|
+
var title2 = "Success";
|
560
|
+
}
|
561
|
+
this.blinkTitle(times,title1,title2);
|
562
|
+
};
|
563
|
+
|
564
|
+
JSSpec.Logger.prototype.blinkTitle = function(times, title1, title2) {
|
565
|
+
var times = times * 2;
|
566
|
+
var mode = true;
|
567
|
+
|
568
|
+
var f = function() {
|
569
|
+
if(times > 0) {
|
570
|
+
document.title = mode ? title1 : title2;
|
571
|
+
mode = !mode;
|
572
|
+
times--;
|
573
|
+
window.setTimeout(f, 500);
|
574
|
+
} else {
|
575
|
+
document.title = title1;
|
576
|
+
}
|
577
|
+
};
|
578
|
+
|
579
|
+
f();
|
580
|
+
};
|
581
|
+
|
582
|
+
JSSpec.Logger.prototype.onSpecStart = function(spec) {
|
583
|
+
var spec_list = document.getElementById("spec_" + spec.id + "_list");
|
584
|
+
var spec_log = document.getElementById("spec_" + spec.id);
|
585
|
+
|
586
|
+
spec_list.className = "ongoing";
|
587
|
+
spec_log.className = "ongoing";
|
588
|
+
};
|
589
|
+
|
590
|
+
JSSpec.Logger.prototype.onSpecEnd = function(spec) {
|
591
|
+
var spec_list = document.getElementById("spec_" + spec.id + "_list");
|
592
|
+
var spec_log = document.getElementById("spec_" + spec.id);
|
593
|
+
var examples = document.getElementById("spec_" + spec.id + "_examples");
|
594
|
+
var className = spec.hasException() ? "exception" : "success";
|
595
|
+
|
596
|
+
spec_list.className = className;
|
597
|
+
spec_log.className = className;
|
598
|
+
|
599
|
+
if(JSSpec.options.autocollapse && !spec.hasException()) examples.style.display = "none";
|
600
|
+
|
601
|
+
if(spec.exception) {
|
602
|
+
spec_log.appendChild(document.createTextNode(" - " + spec.exception.message));
|
603
|
+
}
|
604
|
+
};
|
605
|
+
|
606
|
+
JSSpec.Logger.prototype.onExampleStart = function(example) {
|
607
|
+
var li = document.getElementById("example_" + example.id);
|
608
|
+
li.className = "ongoing";
|
609
|
+
};
|
610
|
+
|
611
|
+
JSSpec.Logger.prototype.onExampleEnd = function(example) {
|
612
|
+
var li = document.getElementById("example_" + example.id);
|
613
|
+
li.className = example.exception ? "exception" : "success";
|
614
|
+
|
615
|
+
if(example.exception) {
|
616
|
+
var div = document.createElement("DIV");
|
617
|
+
div.innerHTML = example.exception.message + "<p><br />" + " at " + example.exception.fileName + ", line " + example.exception.lineNumber + "</p>";
|
618
|
+
li.appendChild(div);
|
619
|
+
}
|
620
|
+
|
621
|
+
var title = document.getElementById("title");
|
622
|
+
var runner = JSSpec.runner;
|
623
|
+
|
624
|
+
title.className = runner.hasException() ? "exception" : "success";
|
625
|
+
|
626
|
+
this.finishedExamples++;
|
627
|
+
document.getElementById("total_failures").innerHTML = runner.getTotalFailures();
|
628
|
+
document.getElementById("total_errors").innerHTML = runner.getTotalErrors();
|
629
|
+
var progress = parseInt(this.finishedExamples / runner.totalExamples * 100);
|
630
|
+
document.getElementById("progress").innerHTML = progress;
|
631
|
+
document.getElementById("total_elapsed").innerHTML = (new Date().getTime() - this.startedAt.getTime()) / 1000;
|
632
|
+
|
633
|
+
document.title = progress + "%: " + this._title;
|
634
|
+
};
|
635
|
+
|
636
|
+
/**
|
637
|
+
* IncludeMatcher
|
638
|
+
*/
|
639
|
+
JSSpec.IncludeMatcher = function(actual, expected, condition) {
|
640
|
+
this.actual = actual;
|
641
|
+
this.expected = expected;
|
642
|
+
this.condition = condition;
|
643
|
+
this.match = false;
|
644
|
+
this.explaination = this.makeExplain();
|
645
|
+
};
|
646
|
+
|
647
|
+
JSSpec.IncludeMatcher.createInstance = function(actual, expected, condition) {
|
648
|
+
return new JSSpec.IncludeMatcher(actual, expected, condition);
|
649
|
+
};
|
650
|
+
|
651
|
+
JSSpec.IncludeMatcher.prototype.matches = function() {
|
652
|
+
return this.match;
|
653
|
+
};
|
654
|
+
|
655
|
+
JSSpec.IncludeMatcher.prototype.explain = function() {
|
656
|
+
return this.explaination;
|
657
|
+
};
|
658
|
+
|
659
|
+
JSSpec.IncludeMatcher.prototype.makeExplain = function() {
|
660
|
+
if(typeof this.actual.length == 'undefined') {
|
661
|
+
return this.makeExplainForNotArray();
|
662
|
+
} else {
|
663
|
+
return this.makeExplainForArray();
|
664
|
+
}
|
665
|
+
};
|
666
|
+
|
667
|
+
JSSpec.IncludeMatcher.prototype.makeExplainForNotArray = function() {
|
668
|
+
if(this.condition) {
|
669
|
+
this.match = !!this.actual[this.expected];
|
670
|
+
} else {
|
671
|
+
this.match = !this.actual[this.expected];
|
672
|
+
}
|
673
|
+
|
674
|
+
var sb = [];
|
675
|
+
sb.push('<p>actual value:</p>');
|
676
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.actual, false, this.expected) + '</p>');
|
677
|
+
sb.push('<p>should ' + (this.condition ? '' : 'not') + ' include:</p>');
|
678
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.expected) + '</p>');
|
679
|
+
return sb.join("");
|
680
|
+
};
|
681
|
+
|
682
|
+
JSSpec.IncludeMatcher.prototype.makeExplainForArray = function() {
|
683
|
+
var matches;
|
684
|
+
if(this.condition) {
|
685
|
+
for(var i = 0; i < this.actual.length; i++) {
|
686
|
+
matches = JSSpec.EqualityMatcher.createInstance(this.expected, this.actual[i]).matches();
|
687
|
+
if(matches) {
|
688
|
+
this.match = true;
|
689
|
+
break;
|
690
|
+
}
|
691
|
+
}
|
692
|
+
} else {
|
693
|
+
for(var i = 0; i < this.actual.length; i++) {
|
694
|
+
matches = JSSpec.EqualityMatcher.createInstance(this.expected, this.actual[i]).matches();
|
695
|
+
if(matches) {
|
696
|
+
this.match = false;
|
697
|
+
break;
|
698
|
+
}
|
699
|
+
}
|
700
|
+
}
|
701
|
+
|
702
|
+
if(this.match) return "";
|
703
|
+
|
704
|
+
var sb = [];
|
705
|
+
sb.push('<p>actual value:</p>');
|
706
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.actual, false, this.condition ? null : i) + '</p>');
|
707
|
+
sb.push('<p>should ' + (this.condition ? '' : 'not') + ' include:</p>');
|
708
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.expected) + '</p>');
|
709
|
+
return sb.join("");
|
710
|
+
};
|
711
|
+
|
712
|
+
/**
|
713
|
+
* PropertyLengthMatcher
|
714
|
+
*/
|
715
|
+
JSSpec.PropertyLengthMatcher = function(num, property, o, condition) {
|
716
|
+
this.num = num;
|
717
|
+
this.o = o;
|
718
|
+
this.property = property;
|
719
|
+
if((property == 'characters' || property == 'items') && typeof o.length != 'undefined') {
|
720
|
+
this.property = 'length';
|
721
|
+
}
|
722
|
+
|
723
|
+
this.condition = condition;
|
724
|
+
this.conditionMet = function(x) {
|
725
|
+
if(condition == 'exactly') return x.length == num;
|
726
|
+
if(condition == 'at least') return x.length >= num;
|
727
|
+
if(condition == 'at most') return x.length <= num;
|
728
|
+
|
729
|
+
throw "Unknown condition '" + condition + "'";
|
730
|
+
};
|
731
|
+
this.match = false;
|
732
|
+
this.explaination = this.makeExplain();
|
733
|
+
};
|
734
|
+
|
735
|
+
JSSpec.PropertyLengthMatcher.prototype.makeExplain = function() {
|
736
|
+
if(this.o._type == 'String' && this.property == 'length') {
|
737
|
+
this.match = this.conditionMet(this.o);
|
738
|
+
return this.match ? '' : this.makeExplainForString();
|
739
|
+
} else if(typeof this.o.length != 'undefined' && this.property == "length") {
|
740
|
+
this.match = this.conditionMet(this.o);
|
741
|
+
return this.match ? '' : this.makeExplainForArray();
|
742
|
+
} else if(typeof this.o[this.property] != 'undefined' && this.o[this.property] != null) {
|
743
|
+
this.match = this.conditionMet(this.o[this.property]);
|
744
|
+
return this.match ? '' : this.makeExplainForObject();
|
745
|
+
} else if(typeof this.o[this.property] == 'undefined' || this.o[this.property] == null) {
|
746
|
+
this.match = false;
|
747
|
+
return this.makeExplainForNoProperty();
|
748
|
+
}
|
749
|
+
|
750
|
+
this.match = true;
|
751
|
+
};
|
752
|
+
|
753
|
+
JSSpec.PropertyLengthMatcher.prototype.makeExplainForString = function() {
|
754
|
+
var sb = [];
|
755
|
+
|
756
|
+
var exp = this.num == 0 ?
|
757
|
+
'be an <strong>empty string</strong>' :
|
758
|
+
'have <strong>' + this.condition + ' ' + this.num + ' characters</strong>';
|
759
|
+
|
760
|
+
sb.push('<p>actual value has <strong>' + this.o.length + ' characters</strong>:</p>');
|
761
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.o) + '</p>');
|
762
|
+
sb.push('<p>but it should ' + exp + '.</p>');
|
763
|
+
|
764
|
+
return sb.join("");
|
765
|
+
};
|
766
|
+
|
767
|
+
JSSpec.PropertyLengthMatcher.prototype.makeExplainForArray = function() {
|
768
|
+
var sb = [];
|
769
|
+
|
770
|
+
var exp = this.num == 0 ?
|
771
|
+
'be an <strong>empty array</strong>' :
|
772
|
+
'have <strong>' + this.condition + ' ' + this.num + ' items</strong>';
|
773
|
+
|
774
|
+
sb.push('<p>actual value has <strong>' + this.o.length + ' items</strong>:</p>');
|
775
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.o) + '</p>');
|
776
|
+
sb.push('<p>but it should ' + exp + '.</p>');
|
777
|
+
|
778
|
+
return sb.join("");
|
779
|
+
};
|
780
|
+
|
781
|
+
JSSpec.PropertyLengthMatcher.prototype.makeExplainForObject = function() {
|
782
|
+
var sb = [];
|
783
|
+
|
784
|
+
var exp = this.num == 0 ?
|
785
|
+
'be <strong>empty</strong>' :
|
786
|
+
'have <strong>' + this.condition + ' ' + this.num + ' ' + this.property + '.</strong>';
|
787
|
+
|
788
|
+
sb.push('<p>actual value has <strong>' + this.o[this.property].length + ' ' + this.property + '</strong>:</p>');
|
789
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.o, false, this.property) + '</p>');
|
790
|
+
sb.push('<p>but it should ' + exp + '.</p>');
|
791
|
+
|
792
|
+
return sb.join("");
|
793
|
+
};
|
794
|
+
|
795
|
+
JSSpec.PropertyLengthMatcher.prototype.makeExplainForNoProperty = function() {
|
796
|
+
var sb = [];
|
797
|
+
|
798
|
+
sb.push('<p>actual value:</p>');
|
799
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.o) + '</p>');
|
800
|
+
sb.push('<p>should have <strong>' + this.condition + ' ' + this.num + ' ' + this.property + '</strong> but there\'s no such property.</p>');
|
801
|
+
|
802
|
+
return sb.join("");
|
803
|
+
};
|
804
|
+
|
805
|
+
JSSpec.PropertyLengthMatcher.prototype.matches = function() {
|
806
|
+
return this.match;
|
807
|
+
};
|
808
|
+
|
809
|
+
JSSpec.PropertyLengthMatcher.prototype.explain = function() {
|
810
|
+
return this.explaination;
|
811
|
+
};
|
812
|
+
|
813
|
+
JSSpec.PropertyLengthMatcher.createInstance = function(num, property, o, condition) {
|
814
|
+
return new JSSpec.PropertyLengthMatcher(num, property, o, condition);
|
815
|
+
};
|
816
|
+
|
817
|
+
/**
|
818
|
+
* EqualityMatcher
|
819
|
+
*/
|
820
|
+
JSSpec.EqualityMatcher = {};
|
821
|
+
|
822
|
+
JSSpec.EqualityMatcher.createInstance = function(expected, actual) {
|
823
|
+
if(expected == null || actual == null) {
|
824
|
+
return new JSSpec.NullEqualityMatcher(expected, actual);
|
825
|
+
} else if(expected._type && expected._type == actual._type) {
|
826
|
+
if(expected._type == "String") {
|
827
|
+
return new JSSpec.StringEqualityMatcher(expected, actual);
|
828
|
+
} else if(expected._type == "Date") {
|
829
|
+
return new JSSpec.DateEqualityMatcher(expected, actual);
|
830
|
+
} else if(expected._type == "Number") {
|
831
|
+
return new JSSpec.NumberEqualityMatcher(expected, actual);
|
832
|
+
} else if(expected._type == "Array") {
|
833
|
+
return new JSSpec.ArrayEqualityMatcher(expected, actual);
|
834
|
+
} else if(expected._type == "Boolean") {
|
835
|
+
return new JSSpec.BooleanEqualityMatcher(expected, actual);
|
836
|
+
}
|
837
|
+
}
|
838
|
+
|
839
|
+
return new JSSpec.ObjectEqualityMatcher(expected, actual);
|
840
|
+
};
|
841
|
+
|
842
|
+
JSSpec.EqualityMatcher.basicExplain = function(expected, actual, expectedDesc, actualDesc) {
|
843
|
+
var sb = [];
|
844
|
+
|
845
|
+
sb.push(actualDesc || '<p>actual value:</p>');
|
846
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(actual) + '</p>');
|
847
|
+
sb.push(expectedDesc || '<p>should be:</p>');
|
848
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(expected) + '</p>');
|
849
|
+
|
850
|
+
return sb.join("");
|
851
|
+
};
|
852
|
+
|
853
|
+
JSSpec.EqualityMatcher.diffExplain = function(expected, actual) {
|
854
|
+
var sb = [];
|
855
|
+
|
856
|
+
sb.push('<p>diff:</p>');
|
857
|
+
sb.push('<p style="margin-left:2em;">');
|
858
|
+
|
859
|
+
var dmp = new diff_match_patch();
|
860
|
+
var diff = dmp.diff_main(expected, actual);
|
861
|
+
dmp.diff_cleanupEfficiency(diff);
|
862
|
+
|
863
|
+
sb.push(JSSpec.util.inspect(dmp.diff_prettyHtml(diff), true));
|
864
|
+
|
865
|
+
sb.push('</p>');
|
866
|
+
|
867
|
+
return sb.join("");
|
868
|
+
};
|
869
|
+
|
870
|
+
/**
|
871
|
+
* BooleanEqualityMatcher
|
872
|
+
*/
|
873
|
+
JSSpec.BooleanEqualityMatcher = function(expected, actual) {
|
874
|
+
this.expected = expected;
|
875
|
+
this.actual = actual;
|
876
|
+
};
|
877
|
+
|
878
|
+
JSSpec.BooleanEqualityMatcher.prototype.explain = function() {
|
879
|
+
var sb = [];
|
880
|
+
|
881
|
+
sb.push('<p>actual value:</p>');
|
882
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.actual) + '</p>');
|
883
|
+
sb.push('<p>should be:</p>');
|
884
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.expected) + '</p>');
|
885
|
+
|
886
|
+
return sb.join("");
|
887
|
+
};
|
888
|
+
|
889
|
+
JSSpec.BooleanEqualityMatcher.prototype.matches = function() {
|
890
|
+
return this.expected == this.actual;
|
891
|
+
};
|
892
|
+
|
893
|
+
/**
|
894
|
+
* NullEqualityMatcher
|
895
|
+
*/
|
896
|
+
JSSpec.NullEqualityMatcher = function(expected, actual) {
|
897
|
+
this.expected = expected;
|
898
|
+
this.actual = actual;
|
899
|
+
};
|
900
|
+
|
901
|
+
JSSpec.NullEqualityMatcher.prototype.matches = function() {
|
902
|
+
return this.expected == this.actual && typeof this.expected == typeof this.actual;
|
903
|
+
};
|
904
|
+
|
905
|
+
JSSpec.NullEqualityMatcher.prototype.explain = function() {
|
906
|
+
return JSSpec.EqualityMatcher.basicExplain(this.expected, this.actual);
|
907
|
+
};
|
908
|
+
|
909
|
+
JSSpec.DateEqualityMatcher = function(expected, actual) {
|
910
|
+
this.expected = expected;
|
911
|
+
this.actual = actual;
|
912
|
+
};
|
913
|
+
|
914
|
+
JSSpec.DateEqualityMatcher.prototype.matches = function() {
|
915
|
+
return this.expected.getTime() == this.actual.getTime();
|
916
|
+
};
|
917
|
+
|
918
|
+
JSSpec.DateEqualityMatcher.prototype.explain = function() {
|
919
|
+
var sb = [];
|
920
|
+
|
921
|
+
sb.push(JSSpec.EqualityMatcher.basicExplain(this.expected, this.actual));
|
922
|
+
sb.push(JSSpec.EqualityMatcher.diffExplain(this.expected.toString(), this.actual.toString()));
|
923
|
+
|
924
|
+
return sb.join("");
|
925
|
+
};
|
926
|
+
|
927
|
+
/**
|
928
|
+
* ObjectEqualityMatcher
|
929
|
+
*/
|
930
|
+
JSSpec.ObjectEqualityMatcher = function(expected, actual) {
|
931
|
+
this.expected = expected;
|
932
|
+
this.actual = actual;
|
933
|
+
this.match = this.expected == this.actual;
|
934
|
+
this.explaination = this.makeExplain();
|
935
|
+
};
|
936
|
+
|
937
|
+
JSSpec.ObjectEqualityMatcher.prototype.matches = function() {return this.match};
|
938
|
+
|
939
|
+
JSSpec.ObjectEqualityMatcher.prototype.explain = function() {return this.explaination};
|
940
|
+
|
941
|
+
JSSpec.ObjectEqualityMatcher.prototype.makeExplain = function() {
|
942
|
+
if(this.expected == this.actual) {
|
943
|
+
this.match = true;
|
944
|
+
return "";
|
945
|
+
}
|
946
|
+
|
947
|
+
if(JSSpec.util.isDomNode(this.expected)) {
|
948
|
+
return this.makeExplainForDomNode();
|
949
|
+
}
|
950
|
+
|
951
|
+
var key, expectedHasItem, actualHasItem;
|
952
|
+
|
953
|
+
for(key in this.expected) {
|
954
|
+
expectedHasItem = this.expected[key] != null && typeof this.expected[key] != 'undefined';
|
955
|
+
actualHasItem = this.actual[key] != null && typeof this.actual[key] != 'undefined';
|
956
|
+
if(expectedHasItem && !actualHasItem) return this.makeExplainForMissingItem(key);
|
957
|
+
}
|
958
|
+
for(key in this.actual) {
|
959
|
+
expectedHasItem = this.expected[key] != null && typeof this.expected[key] != 'undefined';
|
960
|
+
actualHasItem = this.actual[key] != null && typeof this.actual[key] != 'undefined';
|
961
|
+
if(actualHasItem && !expectedHasItem) return this.makeExplainForUnknownItem(key);
|
962
|
+
}
|
963
|
+
|
964
|
+
for(key in this.expected) {
|
965
|
+
var matcher = JSSpec.EqualityMatcher.createInstance(this.expected[key], this.actual[key]);
|
966
|
+
if(!matcher.matches()) return this.makeExplainForItemMismatch(key);
|
967
|
+
}
|
968
|
+
|
969
|
+
this.match = true;
|
970
|
+
};
|
971
|
+
|
972
|
+
JSSpec.ObjectEqualityMatcher.prototype.makeExplainForDomNode = function(key) {
|
973
|
+
var sb = [];
|
974
|
+
|
975
|
+
sb.push(JSSpec.EqualityMatcher.basicExplain(this.expected, this.actual));
|
976
|
+
|
977
|
+
return sb.join("");
|
978
|
+
};
|
979
|
+
|
980
|
+
JSSpec.ObjectEqualityMatcher.prototype.makeExplainForMissingItem = function(key) {
|
981
|
+
var sb = [];
|
982
|
+
|
983
|
+
sb.push('<p>actual value has no item named <strong>' + JSSpec.util.inspect(key) + '</strong></p>');
|
984
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.actual, false, key) + '</p>');
|
985
|
+
sb.push('<p>but it should have the item whose value is <strong>' + JSSpec.util.inspect(this.expected[key]) + '</strong></p>');
|
986
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.expected, false, key) + '</p>');
|
987
|
+
|
988
|
+
return sb.join("");
|
989
|
+
};
|
990
|
+
|
991
|
+
JSSpec.ObjectEqualityMatcher.prototype.makeExplainForUnknownItem = function(key) {
|
992
|
+
var sb = [];
|
993
|
+
|
994
|
+
sb.push('<p>actual value has item named <strong>' + JSSpec.util.inspect(key) + '</strong></p>');
|
995
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.actual, false, key) + '</p>');
|
996
|
+
sb.push('<p>but there should be no such item</p>');
|
997
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.expected, false, key) + '</p>');
|
998
|
+
|
999
|
+
return sb.join("");
|
1000
|
+
};
|
1001
|
+
|
1002
|
+
JSSpec.ObjectEqualityMatcher.prototype.makeExplainForItemMismatch = function(key) {
|
1003
|
+
var sb = [];
|
1004
|
+
|
1005
|
+
sb.push('<p>actual value has an item named <strong>' + JSSpec.util.inspect(key) + '</strong> whose value is <strong>' + JSSpec.util.inspect(this.actual[key]) + '</strong></p>');
|
1006
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.actual, false, key) + '</p>');
|
1007
|
+
sb.push('<p>but it\'s value should be <strong>' + JSSpec.util.inspect(this.expected[key]) + '</strong></p>');
|
1008
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.expected, false, key) + '</p>');
|
1009
|
+
|
1010
|
+
return sb.join("");
|
1011
|
+
};
|
1012
|
+
|
1013
|
+
|
1014
|
+
|
1015
|
+
|
1016
|
+
/**
|
1017
|
+
* ArrayEqualityMatcher
|
1018
|
+
*/
|
1019
|
+
JSSpec.ArrayEqualityMatcher = function(expected, actual) {
|
1020
|
+
this.expected = expected;
|
1021
|
+
this.actual = actual;
|
1022
|
+
this.match = this.expected == this.actual;
|
1023
|
+
this.explaination = this.makeExplain();
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
JSSpec.ArrayEqualityMatcher.prototype.matches = function() {return this.match};
|
1027
|
+
|
1028
|
+
JSSpec.ArrayEqualityMatcher.prototype.explain = function() {return this.explaination};
|
1029
|
+
|
1030
|
+
JSSpec.ArrayEqualityMatcher.prototype.makeExplain = function() {
|
1031
|
+
if(this.expected.length != this.actual.length) return this.makeExplainForLengthMismatch();
|
1032
|
+
|
1033
|
+
for(var i = 0; i < this.expected.length; i++) {
|
1034
|
+
var matcher = JSSpec.EqualityMatcher.createInstance(this.expected[i], this.actual[i]);
|
1035
|
+
if(!matcher.matches()) return this.makeExplainForItemMismatch(i);
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
this.match = true;
|
1039
|
+
};
|
1040
|
+
|
1041
|
+
JSSpec.ArrayEqualityMatcher.prototype.makeExplainForLengthMismatch = function() {
|
1042
|
+
return JSSpec.EqualityMatcher.basicExplain(
|
1043
|
+
this.expected,
|
1044
|
+
this.actual,
|
1045
|
+
'<p>but it should be <strong>' + this.expected.length + '</strong></p>',
|
1046
|
+
'<p>actual value has <strong>' + this.actual.length + '</strong> items</p>'
|
1047
|
+
);
|
1048
|
+
};
|
1049
|
+
|
1050
|
+
JSSpec.ArrayEqualityMatcher.prototype.makeExplainForItemMismatch = function(index) {
|
1051
|
+
var postfix = ["th", "st", "nd", "rd", "th"][Math.min((index + 1) % 10,4)];
|
1052
|
+
|
1053
|
+
var sb = [];
|
1054
|
+
|
1055
|
+
sb.push('<p>' + (index + 1) + postfix + ' item (index ' + index + ') of actual value is <strong>' + JSSpec.util.inspect(this.actual[index]) + '</strong>:</p>');
|
1056
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.actual, false, index) + '</p>');
|
1057
|
+
sb.push('<p>but it should be <strong>' + JSSpec.util.inspect(this.expected[index]) + '</strong>:</p>');
|
1058
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.expected, false, index) + '</p>');
|
1059
|
+
|
1060
|
+
return sb.join("");
|
1061
|
+
};
|
1062
|
+
|
1063
|
+
/**
|
1064
|
+
* NumberEqualityMatcher
|
1065
|
+
*/
|
1066
|
+
JSSpec.NumberEqualityMatcher = function(expected, actual) {
|
1067
|
+
this.expected = expected;
|
1068
|
+
this.actual = actual;
|
1069
|
+
};
|
1070
|
+
|
1071
|
+
JSSpec.NumberEqualityMatcher.prototype.matches = function() {
|
1072
|
+
if(this.expected == this.actual) return true;
|
1073
|
+
};
|
1074
|
+
|
1075
|
+
JSSpec.NumberEqualityMatcher.prototype.explain = function() {
|
1076
|
+
return JSSpec.EqualityMatcher.basicExplain(this.expected, this.actual);
|
1077
|
+
};
|
1078
|
+
|
1079
|
+
/**
|
1080
|
+
* StringEqualityMatcher
|
1081
|
+
*/
|
1082
|
+
JSSpec.StringEqualityMatcher = function(expected, actual) {
|
1083
|
+
this.expected = expected;
|
1084
|
+
this.actual = actual;
|
1085
|
+
};
|
1086
|
+
|
1087
|
+
JSSpec.StringEqualityMatcher.prototype.matches = function() {
|
1088
|
+
if(this.expected == this.actual) return true;
|
1089
|
+
};
|
1090
|
+
|
1091
|
+
JSSpec.StringEqualityMatcher.prototype.explain = function() {
|
1092
|
+
var sb = [];
|
1093
|
+
|
1094
|
+
sb.push(JSSpec.EqualityMatcher.basicExplain(this.expected, this.actual));
|
1095
|
+
sb.push(JSSpec.EqualityMatcher.diffExplain(this.expected, this.actual));
|
1096
|
+
return sb.join("");
|
1097
|
+
};
|
1098
|
+
|
1099
|
+
/**
|
1100
|
+
* PatternMatcher
|
1101
|
+
*/
|
1102
|
+
JSSpec.PatternMatcher = function(actual, pattern, condition) {
|
1103
|
+
this.actual = actual;
|
1104
|
+
this.pattern = pattern;
|
1105
|
+
this.condition = condition;
|
1106
|
+
this.match = false;
|
1107
|
+
this.explaination = this.makeExplain();
|
1108
|
+
};
|
1109
|
+
|
1110
|
+
JSSpec.PatternMatcher.createInstance = function(actual, pattern, condition) {
|
1111
|
+
return new JSSpec.PatternMatcher(actual, pattern, condition);
|
1112
|
+
};
|
1113
|
+
|
1114
|
+
JSSpec.PatternMatcher.prototype.makeExplain = function() {
|
1115
|
+
var sb;
|
1116
|
+
if(this.actual == null || this.actual._type != 'String') {
|
1117
|
+
sb = [];
|
1118
|
+
sb.push('<p>actual value:</p>');
|
1119
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.actual) + '</p>');
|
1120
|
+
sb.push('<p>should ' + (this.condition ? '' : 'not') + ' match with pattern:</p>');
|
1121
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.pattern) + '</p>');
|
1122
|
+
sb.push('<p>but pattern matching cannot be performed.</p>');
|
1123
|
+
return sb.join("");
|
1124
|
+
} else {
|
1125
|
+
this.match = this.condition == !!this.actual.match(this.pattern);
|
1126
|
+
if(this.match) return "";
|
1127
|
+
|
1128
|
+
sb = [];
|
1129
|
+
sb.push('<p>actual value:</p>');
|
1130
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.actual) + '</p>');
|
1131
|
+
sb.push('<p>should ' + (this.condition ? '' : 'not') + ' match with pattern:</p>');
|
1132
|
+
sb.push('<p style="margin-left:2em;">' + JSSpec.util.inspect(this.pattern) + '</p>');
|
1133
|
+
return sb.join("");
|
1134
|
+
}
|
1135
|
+
};
|
1136
|
+
|
1137
|
+
JSSpec.PatternMatcher.prototype.matches = function() {
|
1138
|
+
return this.match;
|
1139
|
+
};
|
1140
|
+
|
1141
|
+
JSSpec.PatternMatcher.prototype.explain = function() {
|
1142
|
+
return this.explaination;
|
1143
|
+
};
|
1144
|
+
|
1145
|
+
/**
|
1146
|
+
* Domain Specific Languages
|
1147
|
+
*/
|
1148
|
+
JSSpec.DSL = {};
|
1149
|
+
|
1150
|
+
JSSpec.DSL.forString = {
|
1151
|
+
normalizeHtml: function() {
|
1152
|
+
var html = this;
|
1153
|
+
|
1154
|
+
// Uniformize quotation, turn tag names and attribute names into lower case
|
1155
|
+
html = html.replace(/<(\/?)(\w+)([^>]*?)>/img, function(str, closingMark, tagName, attrs) {
|
1156
|
+
var sortedAttrs = JSSpec.util.sortHtmlAttrs(JSSpec.util.correctHtmlAttrQuotation(attrs).toLowerCase())
|
1157
|
+
return "<" + closingMark + tagName.toLowerCase() + sortedAttrs + ">"
|
1158
|
+
});
|
1159
|
+
|
1160
|
+
// validation self-closing tags
|
1161
|
+
html = html.replace(/<(br|hr|img)([^>]*?)>/mg, function(str, tag, attrs) {
|
1162
|
+
return "<" + tag + attrs + " />";
|
1163
|
+
});
|
1164
|
+
|
1165
|
+
// append semi-colon at the end of style value
|
1166
|
+
html = html.replace(/style="(.*?)"/mg, function(str, styleStr) {
|
1167
|
+
styleStr = JSSpec.util.sortStyleEntries(styleStr.strip()); // for Safari
|
1168
|
+
if(styleStr.charAt(styleStr.length - 1) != ';') styleStr += ";"
|
1169
|
+
|
1170
|
+
return 'style="' + styleStr + '"'
|
1171
|
+
});
|
1172
|
+
|
1173
|
+
// sort style entries
|
1174
|
+
|
1175
|
+
// remove empty style attributes
|
1176
|
+
html = html.replace(/ style=";"/mg, "");
|
1177
|
+
|
1178
|
+
// remove new-lines
|
1179
|
+
html = html.replace(/\r/mg, '');
|
1180
|
+
html = html.replace(/\n/mg, '');
|
1181
|
+
|
1182
|
+
return html;
|
1183
|
+
}
|
1184
|
+
};
|
1185
|
+
|
1186
|
+
|
1187
|
+
JSSpec.DSL.describe = function(context, entries, base) {
|
1188
|
+
if(base) {
|
1189
|
+
for(var i = 0; i < JSSpec.specs.length; i++) {
|
1190
|
+
if(JSSpec.specs[i].context === base) {
|
1191
|
+
base = JSSpec.specs[i];
|
1192
|
+
break;
|
1193
|
+
}
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
for(var i = 0; i < base.examples.length; i++) {
|
1197
|
+
var example = base.examples[i];
|
1198
|
+
|
1199
|
+
if(!entries[example.name]) entries[example.name] = example.target;
|
1200
|
+
}
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
JSSpec.specs.push(new JSSpec.Spec(context, entries));
|
1204
|
+
};
|
1205
|
+
|
1206
|
+
JSSpec.DSL.value_of = function(target) {
|
1207
|
+
if(JSSpec._secondPass) return {};
|
1208
|
+
|
1209
|
+
var subject = new JSSpec.DSL.Subject(target);
|
1210
|
+
return subject;
|
1211
|
+
};
|
1212
|
+
|
1213
|
+
JSSpec.DSL.Subject = function(target) {
|
1214
|
+
this.target = target;
|
1215
|
+
};
|
1216
|
+
|
1217
|
+
JSSpec.DSL.Subject.prototype._type = 'Subject';
|
1218
|
+
|
1219
|
+
JSSpec.DSL.Subject.prototype.should_fail = function(message) {
|
1220
|
+
JSSpec._assertionFailure = {message:message};
|
1221
|
+
throw JSSpec._assertionFailure;
|
1222
|
+
};
|
1223
|
+
|
1224
|
+
JSSpec.DSL.Subject.prototype.should_be = function(expected) {
|
1225
|
+
var matcher = JSSpec.EqualityMatcher.createInstance(expected, this.target);
|
1226
|
+
if(!matcher.matches()) {
|
1227
|
+
JSSpec._assertionFailure = {message:matcher.explain()};
|
1228
|
+
throw JSSpec._assertionFailure;
|
1229
|
+
}
|
1230
|
+
};
|
1231
|
+
|
1232
|
+
JSSpec.DSL.Subject.prototype.should_not_be = function(expected) {
|
1233
|
+
// TODO JSSpec.EqualityMatcher should support 'condition'
|
1234
|
+
var matcher = JSSpec.EqualityMatcher.createInstance(expected, this.target);
|
1235
|
+
if(matcher.matches()) {
|
1236
|
+
JSSpec._assertionFailure = {message:"'" + this.target + "' should not be '" + expected + "'"};
|
1237
|
+
throw JSSpec._assertionFailure;
|
1238
|
+
}
|
1239
|
+
};
|
1240
|
+
|
1241
|
+
JSSpec.DSL.Subject.prototype.should_be_empty = function() {
|
1242
|
+
this.should_have(0, this.getType() == 'String' ? 'characters' : 'items');
|
1243
|
+
};
|
1244
|
+
|
1245
|
+
JSSpec.DSL.Subject.prototype.should_not_be_empty = function() {
|
1246
|
+
this.should_have_at_least(1, this.getType() == 'String' ? 'characters' : 'items');
|
1247
|
+
};
|
1248
|
+
|
1249
|
+
JSSpec.DSL.Subject.prototype.should_be_true = function() {
|
1250
|
+
this.should_be(true);
|
1251
|
+
};
|
1252
|
+
|
1253
|
+
JSSpec.DSL.Subject.prototype.should_be_false = function() {
|
1254
|
+
this.should_be(false);
|
1255
|
+
};
|
1256
|
+
|
1257
|
+
JSSpec.DSL.Subject.prototype.should_be_null = function() {
|
1258
|
+
this.should_be(null);
|
1259
|
+
};
|
1260
|
+
|
1261
|
+
JSSpec.DSL.Subject.prototype.should_be_undefined = function() {
|
1262
|
+
this.should_be(undefined);
|
1263
|
+
};
|
1264
|
+
|
1265
|
+
JSSpec.DSL.Subject.prototype.should_not_be_null = function() {
|
1266
|
+
this.should_not_be(null);
|
1267
|
+
};
|
1268
|
+
|
1269
|
+
JSSpec.DSL.Subject.prototype.should_not_be_undefined = function() {
|
1270
|
+
this.should_not_be(undefined);
|
1271
|
+
};
|
1272
|
+
|
1273
|
+
JSSpec.DSL.Subject.prototype._should_have = function(num, property, condition) {
|
1274
|
+
var matcher = JSSpec.PropertyLengthMatcher.createInstance(num, property, this.target, condition);
|
1275
|
+
if(!matcher.matches()) {
|
1276
|
+
JSSpec._assertionFailure = {message:matcher.explain()};
|
1277
|
+
throw JSSpec._assertionFailure;
|
1278
|
+
}
|
1279
|
+
};
|
1280
|
+
|
1281
|
+
JSSpec.DSL.Subject.prototype.should_have = function(num, property) {
|
1282
|
+
this._should_have(num, property, "exactly");
|
1283
|
+
};
|
1284
|
+
|
1285
|
+
JSSpec.DSL.Subject.prototype.should_have_exactly = function(num, property) {
|
1286
|
+
this._should_have(num, property, "exactly");
|
1287
|
+
};
|
1288
|
+
|
1289
|
+
JSSpec.DSL.Subject.prototype.should_have_at_least = function(num, property) {
|
1290
|
+
this._should_have(num, property, "at least");
|
1291
|
+
};
|
1292
|
+
|
1293
|
+
JSSpec.DSL.Subject.prototype.should_have_at_most = function(num, property) {
|
1294
|
+
this._should_have(num, property, "at most");
|
1295
|
+
};
|
1296
|
+
|
1297
|
+
JSSpec.DSL.Subject.prototype.should_include = function(expected) {
|
1298
|
+
var matcher = JSSpec.IncludeMatcher.createInstance(this.target, expected, true);
|
1299
|
+
if(!matcher.matches()) {
|
1300
|
+
JSSpec._assertionFailure = {message:matcher.explain()};
|
1301
|
+
throw JSSpec._assertionFailure;
|
1302
|
+
}
|
1303
|
+
};
|
1304
|
+
|
1305
|
+
JSSpec.DSL.Subject.prototype.should_not_include = function(expected) {
|
1306
|
+
var matcher = JSSpec.IncludeMatcher.createInstance(this.target, expected, false);
|
1307
|
+
if(!matcher.matches()) {
|
1308
|
+
JSSpec._assertionFailure = {message:matcher.explain()};
|
1309
|
+
throw JSSpec._assertionFailure;
|
1310
|
+
}
|
1311
|
+
};
|
1312
|
+
|
1313
|
+
JSSpec.DSL.Subject.prototype.should_match = function(pattern) {
|
1314
|
+
var matcher = JSSpec.PatternMatcher.createInstance(this.target, pattern, true);
|
1315
|
+
if(!matcher.matches()) {
|
1316
|
+
JSSpec._assertionFailure = {message:matcher.explain()};
|
1317
|
+
throw JSSpec._assertionFailure;
|
1318
|
+
}
|
1319
|
+
}
|
1320
|
+
JSSpec.DSL.Subject.prototype.should_not_match = function(pattern) {
|
1321
|
+
var matcher = JSSpec.PatternMatcher.createInstance(this.target, pattern, false);
|
1322
|
+
if(!matcher.matches()) {
|
1323
|
+
JSSpec._assertionFailure = {message:matcher.explain()};
|
1324
|
+
throw JSSpec._assertionFailure;
|
1325
|
+
}
|
1326
|
+
};
|
1327
|
+
|
1328
|
+
JSSpec.DSL.Subject.prototype.getType = function() {
|
1329
|
+
if(typeof this.target == 'undefined') {
|
1330
|
+
return 'undefined';
|
1331
|
+
} else if(this.target == null) {
|
1332
|
+
return 'null';
|
1333
|
+
} else if(this.target._type) {
|
1334
|
+
return this.target._type;
|
1335
|
+
} else if(JSSpec.util.isDomNode(this.target)) {
|
1336
|
+
return 'DomNode';
|
1337
|
+
} else {
|
1338
|
+
return 'object';
|
1339
|
+
}
|
1340
|
+
};
|
1341
|
+
|
1342
|
+
/**
|
1343
|
+
* Utilities
|
1344
|
+
*/
|
1345
|
+
JSSpec.util = {
|
1346
|
+
escapeTags: function(string) {
|
1347
|
+
return string.replace(/</img, '<').replace(/>/img, '>');
|
1348
|
+
},
|
1349
|
+
escapeMetastring: function(string) {
|
1350
|
+
return string.replace(/\r/img, '\\r').replace(/\n/img, '\\n').replace(/\¶\;\<BR\>/img, '\\n').replace(/\t/img, '\\t');
|
1351
|
+
},
|
1352
|
+
parseOptions: function(defaults) {
|
1353
|
+
var options = defaults;
|
1354
|
+
|
1355
|
+
var url = location.href;
|
1356
|
+
var queryIndex = url.indexOf('?');
|
1357
|
+
if(queryIndex == -1) return options;
|
1358
|
+
|
1359
|
+
var query = url.substring(queryIndex + 1).split('#')[0];
|
1360
|
+
var pairs = query.split('&');
|
1361
|
+
for(var i = 0; i < pairs.length; i++) {
|
1362
|
+
var tokens = pairs[i].split('=');
|
1363
|
+
options[tokens[0]] = tokens[1];
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
return options;
|
1367
|
+
},
|
1368
|
+
correctHtmlAttrQuotation: function(html) {
|
1369
|
+
html = html.replace(/(\w+)=['"]([^'"]+)['"]/mg,function (str, name, value) {return name + '=' + '"' + value + '"';});
|
1370
|
+
html = html.replace(/(\w+)=([^ '"]+)/mg,function (str, name, value) {return name + '=' + '"' + value + '"';});
|
1371
|
+
html = html.replace(/'/mg, '"');
|
1372
|
+
|
1373
|
+
return html;
|
1374
|
+
},
|
1375
|
+
sortHtmlAttrs: function(html) {
|
1376
|
+
var attrs = [];
|
1377
|
+
html.replace(/((\w+)="[^"]+")/mg, function(str, matched) {
|
1378
|
+
attrs.push(matched);
|
1379
|
+
});
|
1380
|
+
return attrs.length == 0 ? "" : " " + attrs.sort().join(" ");
|
1381
|
+
},
|
1382
|
+
sortStyleEntries: function(styleText) {
|
1383
|
+
var entries = styleText.split(/; /);
|
1384
|
+
return entries.sort().join("; ");
|
1385
|
+
},
|
1386
|
+
escapeHtml: function(str) {
|
1387
|
+
if(!this._div) {
|
1388
|
+
this._div = document.createElement("DIV");
|
1389
|
+
this._text = document.createTextNode('');
|
1390
|
+
this._div.appendChild(this._text);
|
1391
|
+
}
|
1392
|
+
this._text.data = str;
|
1393
|
+
return this._div.innerHTML;
|
1394
|
+
},
|
1395
|
+
isDomNode: function(o) {
|
1396
|
+
// TODO: make it more stricter
|
1397
|
+
return (typeof o.nodeName == 'string') && (typeof o.nodeType == 'number');
|
1398
|
+
},
|
1399
|
+
inspectDomPath: function(o) {
|
1400
|
+
var sb = [];
|
1401
|
+
while(o && o.nodeName != '#document' && o.parent) {
|
1402
|
+
var siblings = o.parentNode.childNodes;
|
1403
|
+
for(var i = 0; i < siblings.length; i++) {
|
1404
|
+
if(siblings[i] == o) {
|
1405
|
+
sb.push(o.nodeName + (i == 0 ? '' : '[' + i + ']'));
|
1406
|
+
break;
|
1407
|
+
}
|
1408
|
+
}
|
1409
|
+
o = o.parentNode;
|
1410
|
+
}
|
1411
|
+
return sb.join(" > ");
|
1412
|
+
},
|
1413
|
+
inspectDomNode: function(o) {
|
1414
|
+
if(o.nodeType == 1) {
|
1415
|
+
var nodeName = o.nodeName.toLowerCase();
|
1416
|
+
var sb = [];
|
1417
|
+
sb.push('<span class="dom_value">');
|
1418
|
+
sb.push("<");
|
1419
|
+
sb.push(nodeName);
|
1420
|
+
|
1421
|
+
var attrs = o.attributes;
|
1422
|
+
for(var i = 0; i < attrs.length; i++) {
|
1423
|
+
if(
|
1424
|
+
attrs[i].nodeValue &&
|
1425
|
+
attrs[i].nodeName != 'contentEditable' &&
|
1426
|
+
attrs[i].nodeName != 'style' &&
|
1427
|
+
typeof attrs[i].nodeValue != 'function'
|
1428
|
+
) sb.push(' <span class="dom_attr_name">' + attrs[i].nodeName.toLowerCase() + '</span>=<span class="dom_attr_value">"' + attrs[i].nodeValue + '"</span>');
|
1429
|
+
}
|
1430
|
+
if(o.style && o.style.cssText) {
|
1431
|
+
sb.push(' <span class="dom_attr_name">style</span>=<span class="dom_attr_value">"' + o.style.cssText + '"</span>');
|
1432
|
+
}
|
1433
|
+
sb.push('>');
|
1434
|
+
sb.push(JSSpec.util.escapeHtml(o.innerHTML));
|
1435
|
+
sb.push('</' + nodeName + '>');
|
1436
|
+
sb.push(' <span class="dom_path">(' + JSSpec.util.inspectDomPath(o) + ')</span>' );
|
1437
|
+
sb.push('</span>');
|
1438
|
+
return sb.join("");
|
1439
|
+
} else if(o.nodeType == 3) {
|
1440
|
+
return '<span class="dom_value">#text ' + o.nodeValue + '</span>';
|
1441
|
+
} else {
|
1442
|
+
return '<span class="dom_value">UnknownDomNode</span>';
|
1443
|
+
}
|
1444
|
+
},
|
1445
|
+
inspect: function(o, dontEscape, emphasisKey) {
|
1446
|
+
var sb, inspected;
|
1447
|
+
|
1448
|
+
if(typeof o == 'undefined') return '<span class="undefined_value">undefined</span>';
|
1449
|
+
if(o == null) return '<span class="null_value">null</span>';
|
1450
|
+
if(o._type == 'String') return '<span class="string_value">"' + (dontEscape ? JSSpec.util.escapeMetastring(o) : JSSpec.util.escapeHtml(JSSpec.util.escapeMetastring(o))) + '"</span>';
|
1451
|
+
|
1452
|
+
if(o._type == 'Date') {
|
1453
|
+
return '<span class="date_value">"' + o.toString() + '"</span>';
|
1454
|
+
}
|
1455
|
+
|
1456
|
+
if(o._type == 'Number') return '<span class="number_value">' + (dontEscape ? o : JSSpec.util.escapeHtml(o)) + '</span>';
|
1457
|
+
|
1458
|
+
if(o._type == 'Boolean') return '<span class="boolean_value">' + o + '</span>';
|
1459
|
+
|
1460
|
+
if(o._type == 'RegExp') return '<span class="regexp_value">' + JSSpec.util.escapeHtml(o.toString()) + '</span>';
|
1461
|
+
|
1462
|
+
if(JSSpec.util.isDomNode(o)) return JSSpec.util.inspectDomNode(o);
|
1463
|
+
|
1464
|
+
if(o._type == 'Array' || typeof o.length != 'undefined') {
|
1465
|
+
sb = [];
|
1466
|
+
for(var i = 0; i < o.length; i++) {
|
1467
|
+
inspected = JSSpec.util.inspect(o[i]);
|
1468
|
+
sb.push(i == emphasisKey ? ('<strong>' + inspected + '</strong>') : inspected);
|
1469
|
+
}
|
1470
|
+
return '<span class="array_value">[' + sb.join(', ') + ']</span>';
|
1471
|
+
}
|
1472
|
+
|
1473
|
+
// object
|
1474
|
+
sb = [];
|
1475
|
+
for(var key in o) {
|
1476
|
+
if(key == 'should') continue;
|
1477
|
+
|
1478
|
+
inspected = JSSpec.util.inspect(key) + ":" + JSSpec.util.inspect(o[key]);
|
1479
|
+
sb.push(key == emphasisKey ? ('<strong>' + inspected + '</strong>') : inspected);
|
1480
|
+
}
|
1481
|
+
return '<span class="object_value">{' + sb.join(', ') + '}</span>';
|
1482
|
+
}
|
1483
|
+
};
|
1484
|
+
|
1485
|
+
describe = JSSpec.DSL.describe;
|
1486
|
+
behavior_of = JSSpec.DSL.describe;
|
1487
|
+
value_of = JSSpec.DSL.value_of;
|
1488
|
+
expect = JSSpec.DSL.value_of; // @deprecated
|
1489
|
+
|
1490
|
+
String.prototype._type = "String";
|
1491
|
+
Number.prototype._type = "Number";
|
1492
|
+
Date.prototype._type = "Date";
|
1493
|
+
Array.prototype._type = "Array";
|
1494
|
+
Boolean.prototype._type = "Boolean";
|
1495
|
+
RegExp.prototype._type = "RegExp";
|
1496
|
+
|
1497
|
+
var targets = [Array.prototype, Date.prototype, Number.prototype, String.prototype, Boolean.prototype, RegExp.prototype];
|
1498
|
+
|
1499
|
+
String.prototype.normalizeHtml = JSSpec.DSL.forString.normalizeHtml;
|
1500
|
+
String.prototype.asHtml = String.prototype.normalizeHtml; //@deprecated
|
1501
|
+
|
1502
|
+
|
1503
|
+
|
1504
|
+
/**
|
1505
|
+
* Main
|
1506
|
+
*/
|
1507
|
+
JSSpec.defaultOptions = {
|
1508
|
+
autorun: 1,
|
1509
|
+
specIdBeginsWith: 0,
|
1510
|
+
exampleIdBeginsWith: 0,
|
1511
|
+
autocollapse: 1
|
1512
|
+
};
|
1513
|
+
JSSpec.options = JSSpec.util.parseOptions(JSSpec.defaultOptions);
|
1514
|
+
|
1515
|
+
JSSpec.Spec.id = JSSpec.options.specIdBeginsWith;
|
1516
|
+
JSSpec.Example.id = JSSpec.options.exampleIdBeginsWith;
|
1517
|
+
|
1518
|
+
|
1519
|
+
|
1520
|
+
window.onload = function() {
|
1521
|
+
if(JSSpec.specs.length > 0) {
|
1522
|
+
if(!JSSpec.options.inSuite) {
|
1523
|
+
JSSpec.runner = new JSSpec.Runner(JSSpec.specs, new JSSpec.Logger());
|
1524
|
+
if(JSSpec.options.rerun) {
|
1525
|
+
JSSpec.runner.rerun(decodeURIComponent(JSSpec.options.rerun));
|
1526
|
+
} else {
|
1527
|
+
JSSpec.runner.run();
|
1528
|
+
}
|
1529
|
+
} else {
|
1530
|
+
// in suite, send all specs to parent
|
1531
|
+
var parentWindow = window.frames.parent.window;
|
1532
|
+
for(var i = 0; i < JSSpec.specs.length; i++) {
|
1533
|
+
parentWindow.JSSpec.specs.push(JSSpec.specs[i]);
|
1534
|
+
}
|
1535
|
+
}
|
1536
|
+
} else {
|
1537
|
+
var links = document.getElementById('list').getElementsByTagName('A');
|
1538
|
+
var frameContainer = document.createElement('DIV');
|
1539
|
+
frameContainer.style.display = 'none';
|
1540
|
+
document.body.appendChild(frameContainer);
|
1541
|
+
|
1542
|
+
for(var i = 0; i < links.length; i++) {
|
1543
|
+
var frame = document.createElement('IFRAME');
|
1544
|
+
frame.src = links[i].href + '?inSuite=0&specIdBeginsWith=' + (i * 10000) + '&exampleIdBeginsWith=' + (i * 10000);
|
1545
|
+
frameContainer.appendChild(frame);
|
1546
|
+
}
|
1547
|
+
}
|
1548
|
+
}
|