guilded 1.1.0 → 2.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -4
- data/.rspec +2 -0
- data/.rvmrc +1 -1
- data/Gemfile +1 -21
- data/Guardfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +21 -0
- data/Rakefile +1 -1
- data/guilded.gemspec +23 -24
- data/lib/{generators/guilded_assets/templates → assets/javascripts}/guilded.js +0 -0
- data/lib/assets/javascripts/jquery-1.6.4.js +9046 -0
- data/lib/assets/javascripts/jquery-1.6.4.min.js +4 -0
- data/lib/assets/javascripts/jquery-1.7.1.js +9266 -0
- data/lib/assets/javascripts/jquery-1.7.1.min.js +4 -0
- data/lib/assets/javascripts/jquery-1.7.2.js +9404 -0
- data/lib/assets/javascripts/jquery-1.7.2.min.js +4 -0
- data/lib/assets/javascripts/jquery-1.8.0.js +9227 -0
- data/lib/assets/javascripts/jquery-1.8.0.min.js +2 -0
- data/lib/assets/javascripts/jquery-1.8.1.js +9301 -0
- data/lib/assets/javascripts/jquery-1.8.1.min.js +2 -0
- data/lib/assets/javascripts/jquery-1.8.2.js +9440 -0
- data/lib/assets/javascripts/jquery-1.8.2.min.js +2 -0
- data/lib/assets/javascripts/jquery-1.8.3.js +9472 -0
- data/lib/assets/javascripts/jquery-1.8.3.min.js +2 -0
- data/lib/assets/javascripts/jquery-1.9.0.js +9555 -0
- data/lib/assets/javascripts/jquery-1.9.0.min.js +4 -0
- data/lib/assets/javascripts/jquery-1.9.1.js +9597 -0
- data/lib/assets/javascripts/jquery-1.9.1.min.js +5 -0
- data/lib/guilded.rb +23 -73
- data/lib/guilded/component.rb +32 -0
- data/lib/guilded/configuration.rb +27 -0
- data/lib/guilded/data.rb +25 -0
- data/lib/guilded/engine.rb +5 -0
- data/lib/guilded/guilder.rb +27 -370
- data/lib/guilded/rails.rb +7 -4
- data/lib/guilded/rails/controller.rb +23 -0
- data/lib/guilded/rails/helpers.rb +1 -3
- data/lib/guilded/rails/view_helpers.rb +16 -112
- data/lib/guilded/version.rb +1 -1
- data/spec/guilded/component_spec.rb +13 -0
- data/spec/guilded/configuration_spec.rb +68 -0
- data/spec/guilded/data_spec.rb +29 -0
- data/spec/guilded/guilder_spec.rb +67 -63
- data/spec/guilded/rails/view_helpers_spec.rb +49 -0
- data/spec/spec_helper.rb +5 -29
- metadata +174 -122
- data/Gemfile.lock +0 -61
- data/README.rdoc +0 -204
- data/lib/generators/guilded_assets/guilded_assets_generator.rb +0 -21
- data/lib/generators/guilded_assets/templates/guilded.min.js +0 -1
- data/lib/generators/guilded_assets/templates/jquery-1.2.6.js +0 -3549
- data/lib/generators/guilded_assets/templates/jquery-1.2.6.min.js +0 -32
- data/lib/generators/guilded_assets/templates/jquery-1.3.2.js +0 -4376
- data/lib/generators/guilded_assets/templates/jquery-1.3.2.min.js +0 -19
- data/lib/generators/guilded_assets/templates/jquery-url.js +0 -199
- data/lib/generators/guilded_assets/templates/jquery-url.min.js +0 -9
- data/lib/generators/guilded_assets/templates/mootools-1.2.3.js +0 -4036
- data/lib/generators/guilded_assets/templates/mootools-1.2.3.min.js +0 -356
- data/lib/generators/guilded_assets/templates/reset-min.css +0 -7
- data/lib/generators/guilded_config/guilded_config_generator.rb +0 -11
- data/lib/generators/guilded_config/templates/guilded_config.rb +0 -16
- data/lib/guilded/component_def.rb +0 -27
- data/lib/guilded/exceptions.rb +0 -29
- data/lib/guilded/rails/active_record/human_attribute_hint.rb +0 -41
- data/lib/guilded/rails/controller_actions.rb +0 -22
- data/lib/guilded/rails/inactive_record/human_attribute_hint.rb +0 -26
- data/rails_generators/guilded_assets/guilded_assets_generator.rb +0 -23
- data/rails_generators/guilded_assets/templates/guilded.js +0 -12
- data/rails_generators/guilded_assets/templates/guilded.min.js +0 -1
- data/rails_generators/guilded_assets/templates/jquery-1.2.6.js +0 -3549
- data/rails_generators/guilded_assets/templates/jquery-1.2.6.min.js +0 -32
- data/rails_generators/guilded_assets/templates/jquery-1.3.2.js +0 -4376
- data/rails_generators/guilded_assets/templates/jquery-1.3.2.min.js +0 -19
- data/rails_generators/guilded_assets/templates/jquery-url.js +0 -199
- data/rails_generators/guilded_assets/templates/jquery-url.min.js +0 -9
- data/rails_generators/guilded_assets/templates/mootools-1.2.3.js +0 -4036
- data/rails_generators/guilded_assets/templates/mootools-1.2.3.min.js +0 -356
- data/rails_generators/guilded_assets/templates/reset-min.css +0 -7
- data/rails_generators/guilded_config/guilded_config_generator.rb +0 -11
- data/rails_generators/guilded_config/templates/guilded_config.rb +0 -16
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/generators/guilded_assets_generator_spec.rb +0 -35
- data/spec/generators/guilded_config_generator_spec.rb +0 -24
- data/spec/guilded/component_def_spec.rb +0 -24
- data/spec/guilded_spec.rb +0 -7
- data/spec/spec.opts +0 -7
- data/tasks/rails.rake +0 -8
- data/tasks/rspec.rake +0 -21
- data/test/guilded/rails/helpers_test.rb +0 -1450
- data/test/test_helper.rb +0 -39
@@ -1,19 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* jQuery JavaScript Library v1.3.2
|
3
|
-
* http://jquery.com/
|
4
|
-
*
|
5
|
-
* Copyright (c) 2009 John Resig
|
6
|
-
* Dual licensed under the MIT and GPL licenses.
|
7
|
-
* http://docs.jquery.com/License
|
8
|
-
*
|
9
|
-
* Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
|
10
|
-
* Revision: 6246
|
11
|
-
*/
|
12
|
-
(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
|
13
|
-
/*
|
14
|
-
* Sizzle CSS Selector Engine - v0.9.3
|
15
|
-
* Copyright 2009, The Dojo Foundation
|
16
|
-
* Released under the MIT, BSD, and GPL Licenses.
|
17
|
-
* More information: http://sizzlejs.com/
|
18
|
-
*/
|
19
|
-
(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},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 toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},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(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
|
@@ -1,199 +0,0 @@
|
|
1
|
-
/* ===========================================================================
|
2
|
-
*
|
3
|
-
* JQuery URL Parser
|
4
|
-
* Version 1.0
|
5
|
-
* Parses URLs and provides easy access to information within them.
|
6
|
-
*
|
7
|
-
* Author: Mark Perkins
|
8
|
-
* Author email: mark@allmarkedup.com
|
9
|
-
*
|
10
|
-
* For full documentation and more go to http://projects.allmarkedup.com/jquery_url_parser/
|
11
|
-
*
|
12
|
-
* ---------------------------------------------------------------------------
|
13
|
-
*
|
14
|
-
* CREDITS:
|
15
|
-
*
|
16
|
-
* Parser based on the Regex-based URI parser by Steven Levithan.
|
17
|
-
* For more information (including a detailed explaination of the differences
|
18
|
-
* between the 'loose' and 'strict' pasing modes) visit http://blog.stevenlevithan.com/archives/parseuri
|
19
|
-
*
|
20
|
-
* ---------------------------------------------------------------------------
|
21
|
-
*
|
22
|
-
* LICENSE:
|
23
|
-
*
|
24
|
-
* Released under a MIT License. See licence.txt that should have been supplied with this file,
|
25
|
-
* or visit http://projects.allmarkedup.com/jquery_url_parser/licence.txt
|
26
|
-
*
|
27
|
-
* ---------------------------------------------------------------------------
|
28
|
-
*/
|
29
|
-
|
30
|
-
jQuery.url = function()
|
31
|
-
{
|
32
|
-
var segments = {};
|
33
|
-
|
34
|
-
var parsed = {};
|
35
|
-
|
36
|
-
/**
|
37
|
-
* Options object. Only the URI and strictMode values can be changed via the setters below.
|
38
|
-
*/
|
39
|
-
var options = {
|
40
|
-
|
41
|
-
url : window.location, // default URI is the page in which the script is running
|
42
|
-
|
43
|
-
strictMode: false, // 'loose' parsing by default
|
44
|
-
|
45
|
-
key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], // keys available to query
|
46
|
-
|
47
|
-
q: {
|
48
|
-
name: "queryKey",
|
49
|
-
parser: /(?:^|&)([^&=]*)=?([^&]*)/g
|
50
|
-
},
|
51
|
-
|
52
|
-
parser: {
|
53
|
-
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, //less intuitive, more accurate to the specs
|
54
|
-
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs
|
55
|
-
}
|
56
|
-
|
57
|
-
};
|
58
|
-
|
59
|
-
/**
|
60
|
-
* Deals with the parsing of the URI according to the regex above.
|
61
|
-
* Written by Steven Levithan - see credits at top.
|
62
|
-
*/
|
63
|
-
var parseUri = function()
|
64
|
-
{
|
65
|
-
str = decodeURI( options.url );
|
66
|
-
|
67
|
-
var m = options.parser[ options.strictMode ? "strict" : "loose" ].exec( str );
|
68
|
-
var uri = {};
|
69
|
-
var i = 14;
|
70
|
-
|
71
|
-
while ( i-- ) {
|
72
|
-
uri[ options.key[i] ] = m[i] || "";
|
73
|
-
}
|
74
|
-
|
75
|
-
uri[ options.q.name ] = {};
|
76
|
-
uri[ options.key[12] ].replace( options.q.parser, function ( $0, $1, $2 ) {
|
77
|
-
if ($1) {
|
78
|
-
uri[options.q.name][$1] = $2;
|
79
|
-
}
|
80
|
-
});
|
81
|
-
|
82
|
-
return uri;
|
83
|
-
};
|
84
|
-
|
85
|
-
/**
|
86
|
-
* Returns the value of the passed in key from the parsed URI.
|
87
|
-
*
|
88
|
-
* @param string key The key whose value is required
|
89
|
-
*/
|
90
|
-
var key = function( key )
|
91
|
-
{
|
92
|
-
if ( ! parsed.length )
|
93
|
-
{
|
94
|
-
setUp(); // if the URI has not been parsed yet then do this first...
|
95
|
-
}
|
96
|
-
if ( key == "base" )
|
97
|
-
{
|
98
|
-
if ( parsed.port !== null && parsed.port !== "" )
|
99
|
-
{
|
100
|
-
return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/";
|
101
|
-
}
|
102
|
-
else
|
103
|
-
{
|
104
|
-
return parsed.protocol+"://"+parsed.host+"/";
|
105
|
-
}
|
106
|
-
}
|
107
|
-
|
108
|
-
return ( parsed[key] === "" ) ? null : parsed[key];
|
109
|
-
};
|
110
|
-
|
111
|
-
/**
|
112
|
-
* Returns the value of the required query string parameter.
|
113
|
-
*
|
114
|
-
* @param string item The parameter whose value is required
|
115
|
-
*/
|
116
|
-
var param = function( item )
|
117
|
-
{
|
118
|
-
if ( ! parsed.length )
|
119
|
-
{
|
120
|
-
setUp(); // if the URI has not been parsed yet then do this first...
|
121
|
-
}
|
122
|
-
return ( parsed.queryKey[item] === null ) ? null : parsed.queryKey[item];
|
123
|
-
};
|
124
|
-
|
125
|
-
/**
|
126
|
-
* 'Constructor' (not really!) function.
|
127
|
-
* Called whenever the URI changes to kick off re-parsing of the URI and splitting it up into segments.
|
128
|
-
*/
|
129
|
-
var setUp = function()
|
130
|
-
{
|
131
|
-
parsed = parseUri();
|
132
|
-
|
133
|
-
getSegments();
|
134
|
-
};
|
135
|
-
|
136
|
-
/**
|
137
|
-
* Splits up the body of the URI into segments (i.e. sections delimited by '/')
|
138
|
-
*/
|
139
|
-
var getSegments = function()
|
140
|
-
{
|
141
|
-
var p = parsed.path;
|
142
|
-
segments = []; // clear out segments array
|
143
|
-
segments = parsed.path.length == 1 ? {} : ( p.charAt( p.length - 1 ) == "/" ? p.substring( 1, p.length - 1 ) : path = p.substring( 1 ) ).split("/");
|
144
|
-
};
|
145
|
-
|
146
|
-
return {
|
147
|
-
|
148
|
-
/**
|
149
|
-
* Sets the parsing mode - either strict or loose. Set to loose by default.
|
150
|
-
*
|
151
|
-
* @param string mode The mode to set the parser to. Anything apart from a value of 'strict' will set it to loose!
|
152
|
-
*/
|
153
|
-
setMode : function( mode )
|
154
|
-
{
|
155
|
-
strictMode = mode == "strict" ? true : false;
|
156
|
-
return this;
|
157
|
-
},
|
158
|
-
|
159
|
-
/**
|
160
|
-
* Sets URI to parse if you don't want to to parse the current page's URI.
|
161
|
-
* Calling the function with no value for newUri resets it to the current page's URI.
|
162
|
-
*
|
163
|
-
* @param string newUri The URI to parse.
|
164
|
-
*/
|
165
|
-
setUrl : function( newUri )
|
166
|
-
{
|
167
|
-
options.url = newUri === undefined ? window.location : newUri;
|
168
|
-
setUp();
|
169
|
-
return this;
|
170
|
-
},
|
171
|
-
|
172
|
-
/**
|
173
|
-
* Returns the value of the specified URI segment. Segments are numbered from 1 to the number of segments.
|
174
|
-
* For example the URI http://test.com/about/company/ segment(1) would return 'about'.
|
175
|
-
*
|
176
|
-
* If no integer is passed into the function it returns the number of segments in the URI.
|
177
|
-
*
|
178
|
-
* @param int pos The position of the segment to return. Can be empty.
|
179
|
-
*/
|
180
|
-
segment : function( pos )
|
181
|
-
{
|
182
|
-
if ( ! parsed.length )
|
183
|
-
{
|
184
|
-
setUp(); // if the URI has not been parsed yet then do this first...
|
185
|
-
}
|
186
|
-
if ( pos === undefined )
|
187
|
-
{
|
188
|
-
return segments.length;
|
189
|
-
}
|
190
|
-
return ( segments[pos] === "" || segments[pos] === undefined ) ? null : segments[pos];
|
191
|
-
},
|
192
|
-
|
193
|
-
attr : key, // provides public access to private 'key' function - see above
|
194
|
-
|
195
|
-
param : param // provides public access to private 'param' function - see above
|
196
|
-
|
197
|
-
};
|
198
|
-
|
199
|
-
}();
|
@@ -1,9 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* JQuery URL Parser
|
3
|
-
* Version 1.0
|
4
|
-
* Parses URLs and provides easy access to information within them.
|
5
|
-
*
|
6
|
-
* Author: Mark Perkins
|
7
|
-
* Author email: mark@allmarkedup.com
|
8
|
-
*/
|
9
|
-
jQuery.url=function(){var segments={};var parsed={};var options={url:window.location,strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};var parseUri=function(){str=decodeURI(options.url);var m=options.parser[options.strictMode?"strict":"loose"].exec(str);var uri={};var i=14;while(i--){uri[options.key[i]]=m[i]||""}uri[options.q.name]={};uri[options.key[12]].replace(options.q.parser,function($0,$1,$2){if($1){uri[options.q.name][$1]=$2}});return uri};var key=function(key){if(!parsed.length){setUp()}if(key=="base"){if(parsed.port!==null&&parsed.port!==""){return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/"}else{return parsed.protocol+"://"+parsed.host+"/"}}return(parsed[key]==="")?null:parsed[key]};var param=function(item){if(!parsed.length){setUp()}return(parsed.queryKey[item]===null)?null:parsed.queryKey[item]};var setUp=function(){parsed=parseUri();getSegments()};var getSegments=function(){var p=parsed.path;segments=[];segments=parsed.path.length==1?{}:(p.charAt(p.length-1)=="/"?p.substring(1,p.length-1):path=p.substring(1)).split("/")};return{setMode:function(mode){strictMode=mode=="strict"?true:false;return this},setUrl:function(newUri){options.url=newUri===undefined?window.location:newUri;setUp();return this},segment:function(pos){if(!parsed.length){setUp()}if(pos===undefined){return segments.length}return(segments[pos]===""||segments[pos]===undefined)?null:segments[pos]},attr:key,param:param}}();
|
@@ -1,4036 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Script: Core.js
|
3
|
-
MooTools - My Object Oriented JavaScript Tools.
|
4
|
-
|
5
|
-
License:
|
6
|
-
MIT-style license.
|
7
|
-
|
8
|
-
Copyright:
|
9
|
-
Copyright (c) 2006-2008 [Valerio Proietti](http://mad4milk.net/).
|
10
|
-
|
11
|
-
Code & Documentation:
|
12
|
-
[The MooTools production team](http://mootools.net/developers/).
|
13
|
-
|
14
|
-
Inspiration:
|
15
|
-
- Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php)
|
16
|
-
- Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php)
|
17
|
-
*/
|
18
|
-
|
19
|
-
var MooTools = {
|
20
|
-
'version': '1.2.3',
|
21
|
-
'build': '4980aa0fb74d2f6eb80bcd9f5b8e1fd6fbb8f607'
|
22
|
-
};
|
23
|
-
|
24
|
-
var Native = function(options){
|
25
|
-
options = options || {};
|
26
|
-
var name = options.name;
|
27
|
-
var legacy = options.legacy;
|
28
|
-
var protect = options.protect;
|
29
|
-
var methods = options.implement;
|
30
|
-
var generics = options.generics;
|
31
|
-
var initialize = options.initialize;
|
32
|
-
var afterImplement = options.afterImplement || function(){};
|
33
|
-
var object = initialize || legacy;
|
34
|
-
generics = generics !== false;
|
35
|
-
|
36
|
-
object.constructor = Native;
|
37
|
-
object.$family = {name: 'native'};
|
38
|
-
if (legacy && initialize) object.prototype = legacy.prototype;
|
39
|
-
object.prototype.constructor = object;
|
40
|
-
|
41
|
-
if (name){
|
42
|
-
var family = name.toLowerCase();
|
43
|
-
object.prototype.$family = {name: family};
|
44
|
-
Native.typize(object, family);
|
45
|
-
}
|
46
|
-
|
47
|
-
var add = function(obj, name, method, force){
|
48
|
-
if (!protect || force || !obj.prototype[name]) obj.prototype[name] = method;
|
49
|
-
if (generics) Native.genericize(obj, name, protect);
|
50
|
-
afterImplement.call(obj, name, method);
|
51
|
-
return obj;
|
52
|
-
};
|
53
|
-
|
54
|
-
object.alias = function(a1, a2, a3){
|
55
|
-
if (typeof a1 == 'string'){
|
56
|
-
var pa1 = this.prototype[a1];
|
57
|
-
if ((a1 = pa1)) return add(this, a2, a1, a3);
|
58
|
-
}
|
59
|
-
for (var a in a1) this.alias(a, a1[a], a2);
|
60
|
-
return this;
|
61
|
-
};
|
62
|
-
|
63
|
-
object.implement = function(a1, a2, a3){
|
64
|
-
if (typeof a1 == 'string') return add(this, a1, a2, a3);
|
65
|
-
for (var p in a1) add(this, p, a1[p], a2);
|
66
|
-
return this;
|
67
|
-
};
|
68
|
-
|
69
|
-
if (methods) object.implement(methods);
|
70
|
-
|
71
|
-
return object;
|
72
|
-
};
|
73
|
-
|
74
|
-
Native.genericize = function(object, property, check){
|
75
|
-
if ((!check || !object[property]) && typeof object.prototype[property] == 'function') object[property] = function(){
|
76
|
-
var args = Array.prototype.slice.call(arguments);
|
77
|
-
return object.prototype[property].apply(args.shift(), args);
|
78
|
-
};
|
79
|
-
};
|
80
|
-
|
81
|
-
Native.implement = function(objects, properties){
|
82
|
-
for (var i = 0, l = objects.length; i < l; i++) objects[i].implement(properties);
|
83
|
-
};
|
84
|
-
|
85
|
-
Native.typize = function(object, family){
|
86
|
-
if (!object.type) object.type = function(item){
|
87
|
-
return ($type(item) === family);
|
88
|
-
};
|
89
|
-
};
|
90
|
-
|
91
|
-
(function(){
|
92
|
-
var natives = {'Array': Array, 'Date': Date, 'Function': Function, 'Number': Number, 'RegExp': RegExp, 'String': String};
|
93
|
-
for (var n in natives) new Native({name: n, initialize: natives[n], protect: true});
|
94
|
-
|
95
|
-
var types = {'boolean': Boolean, 'native': Native, 'object': Object};
|
96
|
-
for (var t in types) Native.typize(types[t], t);
|
97
|
-
|
98
|
-
var generics = {
|
99
|
-
'Array': ["concat", "indexOf", "join", "lastIndexOf", "pop", "push", "reverse", "shift", "slice", "sort", "splice", "toString", "unshift", "valueOf"],
|
100
|
-
'String': ["charAt", "charCodeAt", "concat", "indexOf", "lastIndexOf", "match", "replace", "search", "slice", "split", "substr", "substring", "toLowerCase", "toUpperCase", "valueOf"]
|
101
|
-
};
|
102
|
-
for (var g in generics){
|
103
|
-
for (var i = generics[g].length; i--;) Native.genericize(natives[g], generics[g][i], true);
|
104
|
-
}
|
105
|
-
})();
|
106
|
-
|
107
|
-
var Hash = new Native({
|
108
|
-
|
109
|
-
name: 'Hash',
|
110
|
-
|
111
|
-
initialize: function(object){
|
112
|
-
if ($type(object) == 'hash') object = $unlink(object.getClean());
|
113
|
-
for (var key in object) this[key] = object[key];
|
114
|
-
return this;
|
115
|
-
}
|
116
|
-
|
117
|
-
});
|
118
|
-
|
119
|
-
Hash.implement({
|
120
|
-
|
121
|
-
forEach: function(fn, bind){
|
122
|
-
for (var key in this){
|
123
|
-
if (this.hasOwnProperty(key)) fn.call(bind, this[key], key, this);
|
124
|
-
}
|
125
|
-
},
|
126
|
-
|
127
|
-
getClean: function(){
|
128
|
-
var clean = {};
|
129
|
-
for (var key in this){
|
130
|
-
if (this.hasOwnProperty(key)) clean[key] = this[key];
|
131
|
-
}
|
132
|
-
return clean;
|
133
|
-
},
|
134
|
-
|
135
|
-
getLength: function(){
|
136
|
-
var length = 0;
|
137
|
-
for (var key in this){
|
138
|
-
if (this.hasOwnProperty(key)) length++;
|
139
|
-
}
|
140
|
-
return length;
|
141
|
-
}
|
142
|
-
|
143
|
-
});
|
144
|
-
|
145
|
-
Hash.alias('forEach', 'each');
|
146
|
-
|
147
|
-
Array.implement({
|
148
|
-
|
149
|
-
forEach: function(fn, bind){
|
150
|
-
for (var i = 0, l = this.length; i < l; i++) fn.call(bind, this[i], i, this);
|
151
|
-
}
|
152
|
-
|
153
|
-
});
|
154
|
-
|
155
|
-
Array.alias('forEach', 'each');
|
156
|
-
|
157
|
-
function $A(iterable){
|
158
|
-
if (iterable.item){
|
159
|
-
var l = iterable.length, array = new Array(l);
|
160
|
-
while (l--) array[l] = iterable[l];
|
161
|
-
return array;
|
162
|
-
}
|
163
|
-
return Array.prototype.slice.call(iterable);
|
164
|
-
};
|
165
|
-
|
166
|
-
function $arguments(i){
|
167
|
-
return function(){
|
168
|
-
return arguments[i];
|
169
|
-
};
|
170
|
-
};
|
171
|
-
|
172
|
-
function $chk(obj){
|
173
|
-
return !!(obj || obj === 0);
|
174
|
-
};
|
175
|
-
|
176
|
-
function $clear(timer){
|
177
|
-
clearTimeout(timer);
|
178
|
-
clearInterval(timer);
|
179
|
-
return null;
|
180
|
-
};
|
181
|
-
|
182
|
-
function $defined(obj){
|
183
|
-
return (obj != undefined);
|
184
|
-
};
|
185
|
-
|
186
|
-
function $each(iterable, fn, bind){
|
187
|
-
var type = $type(iterable);
|
188
|
-
((type == 'arguments' || type == 'collection' || type == 'array') ? Array : Hash).each(iterable, fn, bind);
|
189
|
-
};
|
190
|
-
|
191
|
-
function $empty(){};
|
192
|
-
|
193
|
-
function $extend(original, extended){
|
194
|
-
for (var key in (extended || {})) original[key] = extended[key];
|
195
|
-
return original;
|
196
|
-
};
|
197
|
-
|
198
|
-
function $H(object){
|
199
|
-
return new Hash(object);
|
200
|
-
};
|
201
|
-
|
202
|
-
function $lambda(value){
|
203
|
-
return ($type(value) == 'function') ? value : function(){
|
204
|
-
return value;
|
205
|
-
};
|
206
|
-
};
|
207
|
-
|
208
|
-
function $merge(){
|
209
|
-
var args = Array.slice(arguments);
|
210
|
-
args.unshift({});
|
211
|
-
return $mixin.apply(null, args);
|
212
|
-
};
|
213
|
-
|
214
|
-
function $mixin(mix){
|
215
|
-
for (var i = 1, l = arguments.length; i < l; i++){
|
216
|
-
var object = arguments[i];
|
217
|
-
if ($type(object) != 'object') continue;
|
218
|
-
for (var key in object){
|
219
|
-
var op = object[key], mp = mix[key];
|
220
|
-
mix[key] = (mp && $type(op) == 'object' && $type(mp) == 'object') ? $mixin(mp, op) : $unlink(op);
|
221
|
-
}
|
222
|
-
}
|
223
|
-
return mix;
|
224
|
-
};
|
225
|
-
|
226
|
-
function $pick(){
|
227
|
-
for (var i = 0, l = arguments.length; i < l; i++){
|
228
|
-
if (arguments[i] != undefined) return arguments[i];
|
229
|
-
}
|
230
|
-
return null;
|
231
|
-
};
|
232
|
-
|
233
|
-
function $random(min, max){
|
234
|
-
return Math.floor(Math.random() * (max - min + 1) + min);
|
235
|
-
};
|
236
|
-
|
237
|
-
function $splat(obj){
|
238
|
-
var type = $type(obj);
|
239
|
-
return (type) ? ((type != 'array' && type != 'arguments') ? [obj] : obj) : [];
|
240
|
-
};
|
241
|
-
|
242
|
-
var $time = Date.now || function(){
|
243
|
-
return +new Date;
|
244
|
-
};
|
245
|
-
|
246
|
-
function $try(){
|
247
|
-
for (var i = 0, l = arguments.length; i < l; i++){
|
248
|
-
try {
|
249
|
-
return arguments[i]();
|
250
|
-
} catch(e){}
|
251
|
-
}
|
252
|
-
return null;
|
253
|
-
};
|
254
|
-
|
255
|
-
function $type(obj){
|
256
|
-
if (obj == undefined) return false;
|
257
|
-
if (obj.$family) return (obj.$family.name == 'number' && !isFinite(obj)) ? false : obj.$family.name;
|
258
|
-
if (obj.nodeName){
|
259
|
-
switch (obj.nodeType){
|
260
|
-
case 1: return 'element';
|
261
|
-
case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
|
262
|
-
}
|
263
|
-
} else if (typeof obj.length == 'number'){
|
264
|
-
if (obj.callee) return 'arguments';
|
265
|
-
else if (obj.item) return 'collection';
|
266
|
-
}
|
267
|
-
return typeof obj;
|
268
|
-
};
|
269
|
-
|
270
|
-
function $unlink(object){
|
271
|
-
var unlinked;
|
272
|
-
switch ($type(object)){
|
273
|
-
case 'object':
|
274
|
-
unlinked = {};
|
275
|
-
for (var p in object) unlinked[p] = $unlink(object[p]);
|
276
|
-
break;
|
277
|
-
case 'hash':
|
278
|
-
unlinked = new Hash(object);
|
279
|
-
break;
|
280
|
-
case 'array':
|
281
|
-
unlinked = [];
|
282
|
-
for (var i = 0, l = object.length; i < l; i++) unlinked[i] = $unlink(object[i]);
|
283
|
-
break;
|
284
|
-
default: return object;
|
285
|
-
}
|
286
|
-
return unlinked;
|
287
|
-
};
|
288
|
-
|
289
|
-
|
290
|
-
/*
|
291
|
-
Script: Browser.js
|
292
|
-
The Browser Core. Contains Browser initialization, Window and Document, and the Browser Hash.
|
293
|
-
|
294
|
-
License:
|
295
|
-
MIT-style license.
|
296
|
-
*/
|
297
|
-
|
298
|
-
var Browser = $merge({
|
299
|
-
|
300
|
-
Engine: {name: 'unknown', version: 0},
|
301
|
-
|
302
|
-
Platform: {name: (window.orientation != undefined) ? 'ipod' : (navigator.platform.match(/mac|win|linux/i) || ['other'])[0].toLowerCase()},
|
303
|
-
|
304
|
-
Features: {xpath: !!(document.evaluate), air: !!(window.runtime), query: !!(document.querySelector)},
|
305
|
-
|
306
|
-
Plugins: {},
|
307
|
-
|
308
|
-
Engines: {
|
309
|
-
|
310
|
-
presto: function(){
|
311
|
-
return (!window.opera) ? false : ((arguments.callee.caller) ? 960 : ((document.getElementsByClassName) ? 950 : 925));
|
312
|
-
},
|
313
|
-
|
314
|
-
trident: function(){
|
315
|
-
return (!window.ActiveXObject) ? false : ((window.XMLHttpRequest) ? 5 : 4);
|
316
|
-
},
|
317
|
-
|
318
|
-
webkit: function(){
|
319
|
-
return (navigator.taintEnabled) ? false : ((Browser.Features.xpath) ? ((Browser.Features.query) ? 525 : 420) : 419);
|
320
|
-
},
|
321
|
-
|
322
|
-
gecko: function(){
|
323
|
-
return (document.getBoxObjectFor == undefined) ? false : ((document.getElementsByClassName) ? 19 : 18);
|
324
|
-
}
|
325
|
-
|
326
|
-
}
|
327
|
-
|
328
|
-
}, Browser || {});
|
329
|
-
|
330
|
-
Browser.Platform[Browser.Platform.name] = true;
|
331
|
-
|
332
|
-
Browser.detect = function(){
|
333
|
-
|
334
|
-
for (var engine in this.Engines){
|
335
|
-
var version = this.Engines[engine]();
|
336
|
-
if (version){
|
337
|
-
this.Engine = {name: engine, version: version};
|
338
|
-
this.Engine[engine] = this.Engine[engine + version] = true;
|
339
|
-
break;
|
340
|
-
}
|
341
|
-
}
|
342
|
-
|
343
|
-
return {name: engine, version: version};
|
344
|
-
|
345
|
-
};
|
346
|
-
|
347
|
-
Browser.detect();
|
348
|
-
|
349
|
-
Browser.Request = function(){
|
350
|
-
return $try(function(){
|
351
|
-
return new XMLHttpRequest();
|
352
|
-
}, function(){
|
353
|
-
return new ActiveXObject('MSXML2.XMLHTTP');
|
354
|
-
});
|
355
|
-
};
|
356
|
-
|
357
|
-
Browser.Features.xhr = !!(Browser.Request());
|
358
|
-
|
359
|
-
Browser.Plugins.Flash = (function(){
|
360
|
-
var version = ($try(function(){
|
361
|
-
return navigator.plugins['Shockwave Flash'].description;
|
362
|
-
}, function(){
|
363
|
-
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
|
364
|
-
}) || '0 r0').match(/\d+/g);
|
365
|
-
return {version: parseInt(version[0] || 0 + '.' + version[1], 10) || 0, build: parseInt(version[2], 10) || 0};
|
366
|
-
})();
|
367
|
-
|
368
|
-
function $exec(text){
|
369
|
-
if (!text) return text;
|
370
|
-
if (window.execScript){
|
371
|
-
window.execScript(text);
|
372
|
-
} else {
|
373
|
-
var script = document.createElement('script');
|
374
|
-
script.setAttribute('type', 'text/javascript');
|
375
|
-
script[(Browser.Engine.webkit && Browser.Engine.version < 420) ? 'innerText' : 'text'] = text;
|
376
|
-
document.head.appendChild(script);
|
377
|
-
document.head.removeChild(script);
|
378
|
-
}
|
379
|
-
return text;
|
380
|
-
};
|
381
|
-
|
382
|
-
Native.UID = 1;
|
383
|
-
|
384
|
-
var $uid = (Browser.Engine.trident) ? function(item){
|
385
|
-
return (item.uid || (item.uid = [Native.UID++]))[0];
|
386
|
-
} : function(item){
|
387
|
-
return item.uid || (item.uid = Native.UID++);
|
388
|
-
};
|
389
|
-
|
390
|
-
var Window = new Native({
|
391
|
-
|
392
|
-
name: 'Window',
|
393
|
-
|
394
|
-
legacy: (Browser.Engine.trident) ? null: window.Window,
|
395
|
-
|
396
|
-
initialize: function(win){
|
397
|
-
$uid(win);
|
398
|
-
if (!win.Element){
|
399
|
-
win.Element = $empty;
|
400
|
-
if (Browser.Engine.webkit) win.document.createElement("iframe"); //fixes safari 2
|
401
|
-
win.Element.prototype = (Browser.Engine.webkit) ? window["[[DOMElement.prototype]]"] : {};
|
402
|
-
}
|
403
|
-
win.document.window = win;
|
404
|
-
return $extend(win, Window.Prototype);
|
405
|
-
},
|
406
|
-
|
407
|
-
afterImplement: function(property, value){
|
408
|
-
window[property] = Window.Prototype[property] = value;
|
409
|
-
}
|
410
|
-
|
411
|
-
});
|
412
|
-
|
413
|
-
Window.Prototype = {$family: {name: 'window'}};
|
414
|
-
|
415
|
-
new Window(window);
|
416
|
-
|
417
|
-
var Document = new Native({
|
418
|
-
|
419
|
-
name: 'Document',
|
420
|
-
|
421
|
-
legacy: (Browser.Engine.trident) ? null: window.Document,
|
422
|
-
|
423
|
-
initialize: function(doc){
|
424
|
-
$uid(doc);
|
425
|
-
doc.head = doc.getElementsByTagName('head')[0];
|
426
|
-
doc.html = doc.getElementsByTagName('html')[0];
|
427
|
-
if (Browser.Engine.trident && Browser.Engine.version <= 4) $try(function(){
|
428
|
-
doc.execCommand("BackgroundImageCache", false, true);
|
429
|
-
});
|
430
|
-
if (Browser.Engine.trident) doc.window.attachEvent('onunload', function() {
|
431
|
-
doc.window.detachEvent('onunload', arguments.callee);
|
432
|
-
doc.head = doc.html = doc.window = null;
|
433
|
-
});
|
434
|
-
return $extend(doc, Document.Prototype);
|
435
|
-
},
|
436
|
-
|
437
|
-
afterImplement: function(property, value){
|
438
|
-
document[property] = Document.Prototype[property] = value;
|
439
|
-
}
|
440
|
-
|
441
|
-
});
|
442
|
-
|
443
|
-
Document.Prototype = {$family: {name: 'document'}};
|
444
|
-
|
445
|
-
new Document(document);
|
446
|
-
|
447
|
-
|
448
|
-
/*
|
449
|
-
Script: Array.js
|
450
|
-
Contains Array Prototypes like each, contains, and erase.
|
451
|
-
|
452
|
-
License:
|
453
|
-
MIT-style license.
|
454
|
-
*/
|
455
|
-
|
456
|
-
Array.implement({
|
457
|
-
|
458
|
-
every: function(fn, bind){
|
459
|
-
for (var i = 0, l = this.length; i < l; i++){
|
460
|
-
if (!fn.call(bind, this[i], i, this)) return false;
|
461
|
-
}
|
462
|
-
return true;
|
463
|
-
},
|
464
|
-
|
465
|
-
filter: function(fn, bind){
|
466
|
-
var results = [];
|
467
|
-
for (var i = 0, l = this.length; i < l; i++){
|
468
|
-
if (fn.call(bind, this[i], i, this)) results.push(this[i]);
|
469
|
-
}
|
470
|
-
return results;
|
471
|
-
},
|
472
|
-
|
473
|
-
clean: function() {
|
474
|
-
return this.filter($defined);
|
475
|
-
},
|
476
|
-
|
477
|
-
indexOf: function(item, from){
|
478
|
-
var len = this.length;
|
479
|
-
for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){
|
480
|
-
if (this[i] === item) return i;
|
481
|
-
}
|
482
|
-
return -1;
|
483
|
-
},
|
484
|
-
|
485
|
-
map: function(fn, bind){
|
486
|
-
var results = [];
|
487
|
-
for (var i = 0, l = this.length; i < l; i++) results[i] = fn.call(bind, this[i], i, this);
|
488
|
-
return results;
|
489
|
-
},
|
490
|
-
|
491
|
-
some: function(fn, bind){
|
492
|
-
for (var i = 0, l = this.length; i < l; i++){
|
493
|
-
if (fn.call(bind, this[i], i, this)) return true;
|
494
|
-
}
|
495
|
-
return false;
|
496
|
-
},
|
497
|
-
|
498
|
-
associate: function(keys){
|
499
|
-
var obj = {}, length = Math.min(this.length, keys.length);
|
500
|
-
for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
|
501
|
-
return obj;
|
502
|
-
},
|
503
|
-
|
504
|
-
link: function(object){
|
505
|
-
var result = {};
|
506
|
-
for (var i = 0, l = this.length; i < l; i++){
|
507
|
-
for (var key in object){
|
508
|
-
if (object[key](this[i])){
|
509
|
-
result[key] = this[i];
|
510
|
-
delete object[key];
|
511
|
-
break;
|
512
|
-
}
|
513
|
-
}
|
514
|
-
}
|
515
|
-
return result;
|
516
|
-
},
|
517
|
-
|
518
|
-
contains: function(item, from){
|
519
|
-
return this.indexOf(item, from) != -1;
|
520
|
-
},
|
521
|
-
|
522
|
-
extend: function(array){
|
523
|
-
for (var i = 0, j = array.length; i < j; i++) this.push(array[i]);
|
524
|
-
return this;
|
525
|
-
},
|
526
|
-
|
527
|
-
getLast: function(){
|
528
|
-
return (this.length) ? this[this.length - 1] : null;
|
529
|
-
},
|
530
|
-
|
531
|
-
getRandom: function(){
|
532
|
-
return (this.length) ? this[$random(0, this.length - 1)] : null;
|
533
|
-
},
|
534
|
-
|
535
|
-
include: function(item){
|
536
|
-
if (!this.contains(item)) this.push(item);
|
537
|
-
return this;
|
538
|
-
},
|
539
|
-
|
540
|
-
combine: function(array){
|
541
|
-
for (var i = 0, l = array.length; i < l; i++) this.include(array[i]);
|
542
|
-
return this;
|
543
|
-
},
|
544
|
-
|
545
|
-
erase: function(item){
|
546
|
-
for (var i = this.length; i--; i){
|
547
|
-
if (this[i] === item) this.splice(i, 1);
|
548
|
-
}
|
549
|
-
return this;
|
550
|
-
},
|
551
|
-
|
552
|
-
empty: function(){
|
553
|
-
this.length = 0;
|
554
|
-
return this;
|
555
|
-
},
|
556
|
-
|
557
|
-
flatten: function(){
|
558
|
-
var array = [];
|
559
|
-
for (var i = 0, l = this.length; i < l; i++){
|
560
|
-
var type = $type(this[i]);
|
561
|
-
if (!type) continue;
|
562
|
-
array = array.concat((type == 'array' || type == 'collection' || type == 'arguments') ? Array.flatten(this[i]) : this[i]);
|
563
|
-
}
|
564
|
-
return array;
|
565
|
-
},
|
566
|
-
|
567
|
-
hexToRgb: function(array){
|
568
|
-
if (this.length != 3) return null;
|
569
|
-
var rgb = this.map(function(value){
|
570
|
-
if (value.length == 1) value += value;
|
571
|
-
return value.toInt(16);
|
572
|
-
});
|
573
|
-
return (array) ? rgb : 'rgb(' + rgb + ')';
|
574
|
-
},
|
575
|
-
|
576
|
-
rgbToHex: function(array){
|
577
|
-
if (this.length < 3) return null;
|
578
|
-
if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
|
579
|
-
var hex = [];
|
580
|
-
for (var i = 0; i < 3; i++){
|
581
|
-
var bit = (this[i] - 0).toString(16);
|
582
|
-
hex.push((bit.length == 1) ? '0' + bit : bit);
|
583
|
-
}
|
584
|
-
return (array) ? hex : '#' + hex.join('');
|
585
|
-
}
|
586
|
-
|
587
|
-
});
|
588
|
-
|
589
|
-
|
590
|
-
/*
|
591
|
-
Script: Function.js
|
592
|
-
Contains Function Prototypes like create, bind, pass, and delay.
|
593
|
-
|
594
|
-
License:
|
595
|
-
MIT-style license.
|
596
|
-
*/
|
597
|
-
|
598
|
-
Function.implement({
|
599
|
-
|
600
|
-
extend: function(properties){
|
601
|
-
for (var property in properties) this[property] = properties[property];
|
602
|
-
return this;
|
603
|
-
},
|
604
|
-
|
605
|
-
create: function(options){
|
606
|
-
var self = this;
|
607
|
-
options = options || {};
|
608
|
-
return function(event){
|
609
|
-
var args = options.arguments;
|
610
|
-
args = (args != undefined) ? $splat(args) : Array.slice(arguments, (options.event) ? 1 : 0);
|
611
|
-
if (options.event) args = [event || window.event].extend(args);
|
612
|
-
var returns = function(){
|
613
|
-
return self.apply(options.bind || null, args);
|
614
|
-
};
|
615
|
-
if (options.delay) return setTimeout(returns, options.delay);
|
616
|
-
if (options.periodical) return setInterval(returns, options.periodical);
|
617
|
-
if (options.attempt) return $try(returns);
|
618
|
-
return returns();
|
619
|
-
};
|
620
|
-
},
|
621
|
-
|
622
|
-
run: function(args, bind){
|
623
|
-
return this.apply(bind, $splat(args));
|
624
|
-
},
|
625
|
-
|
626
|
-
pass: function(args, bind){
|
627
|
-
return this.create({bind: bind, arguments: args});
|
628
|
-
},
|
629
|
-
|
630
|
-
bind: function(bind, args){
|
631
|
-
return this.create({bind: bind, arguments: args});
|
632
|
-
},
|
633
|
-
|
634
|
-
bindWithEvent: function(bind, args){
|
635
|
-
return this.create({bind: bind, arguments: args, event: true});
|
636
|
-
},
|
637
|
-
|
638
|
-
attempt: function(args, bind){
|
639
|
-
return this.create({bind: bind, arguments: args, attempt: true})();
|
640
|
-
},
|
641
|
-
|
642
|
-
delay: function(delay, bind, args){
|
643
|
-
return this.create({bind: bind, arguments: args, delay: delay})();
|
644
|
-
},
|
645
|
-
|
646
|
-
periodical: function(periodical, bind, args){
|
647
|
-
return this.create({bind: bind, arguments: args, periodical: periodical})();
|
648
|
-
}
|
649
|
-
|
650
|
-
});
|
651
|
-
|
652
|
-
|
653
|
-
/*
|
654
|
-
Script: Number.js
|
655
|
-
Contains Number Prototypes like limit, round, times, and ceil.
|
656
|
-
|
657
|
-
License:
|
658
|
-
MIT-style license.
|
659
|
-
*/
|
660
|
-
|
661
|
-
Number.implement({
|
662
|
-
|
663
|
-
limit: function(min, max){
|
664
|
-
return Math.min(max, Math.max(min, this));
|
665
|
-
},
|
666
|
-
|
667
|
-
round: function(precision){
|
668
|
-
precision = Math.pow(10, precision || 0);
|
669
|
-
return Math.round(this * precision) / precision;
|
670
|
-
},
|
671
|
-
|
672
|
-
times: function(fn, bind){
|
673
|
-
for (var i = 0; i < this; i++) fn.call(bind, i, this);
|
674
|
-
},
|
675
|
-
|
676
|
-
toFloat: function(){
|
677
|
-
return parseFloat(this);
|
678
|
-
},
|
679
|
-
|
680
|
-
toInt: function(base){
|
681
|
-
return parseInt(this, base || 10);
|
682
|
-
}
|
683
|
-
|
684
|
-
});
|
685
|
-
|
686
|
-
Number.alias('times', 'each');
|
687
|
-
|
688
|
-
(function(math){
|
689
|
-
var methods = {};
|
690
|
-
math.each(function(name){
|
691
|
-
if (!Number[name]) methods[name] = function(){
|
692
|
-
return Math[name].apply(null, [this].concat($A(arguments)));
|
693
|
-
};
|
694
|
-
});
|
695
|
-
Number.implement(methods);
|
696
|
-
})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
|
697
|
-
|
698
|
-
|
699
|
-
/*
|
700
|
-
Script: String.js
|
701
|
-
Contains String Prototypes like camelCase, capitalize, test, and toInt.
|
702
|
-
|
703
|
-
License:
|
704
|
-
MIT-style license.
|
705
|
-
*/
|
706
|
-
|
707
|
-
String.implement({
|
708
|
-
|
709
|
-
test: function(regex, params){
|
710
|
-
return ((typeof regex == 'string') ? new RegExp(regex, params) : regex).test(this);
|
711
|
-
},
|
712
|
-
|
713
|
-
contains: function(string, separator){
|
714
|
-
return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1;
|
715
|
-
},
|
716
|
-
|
717
|
-
trim: function(){
|
718
|
-
return this.replace(/^\s+|\s+$/g, '');
|
719
|
-
},
|
720
|
-
|
721
|
-
clean: function(){
|
722
|
-
return this.replace(/\s+/g, ' ').trim();
|
723
|
-
},
|
724
|
-
|
725
|
-
camelCase: function(){
|
726
|
-
return this.replace(/-\D/g, function(match){
|
727
|
-
return match.charAt(1).toUpperCase();
|
728
|
-
});
|
729
|
-
},
|
730
|
-
|
731
|
-
hyphenate: function(){
|
732
|
-
return this.replace(/[A-Z]/g, function(match){
|
733
|
-
return ('-' + match.charAt(0).toLowerCase());
|
734
|
-
});
|
735
|
-
},
|
736
|
-
|
737
|
-
capitalize: function(){
|
738
|
-
return this.replace(/\b[a-z]/g, function(match){
|
739
|
-
return match.toUpperCase();
|
740
|
-
});
|
741
|
-
},
|
742
|
-
|
743
|
-
escapeRegExp: function(){
|
744
|
-
return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
|
745
|
-
},
|
746
|
-
|
747
|
-
toInt: function(base){
|
748
|
-
return parseInt(this, base || 10);
|
749
|
-
},
|
750
|
-
|
751
|
-
toFloat: function(){
|
752
|
-
return parseFloat(this);
|
753
|
-
},
|
754
|
-
|
755
|
-
hexToRgb: function(array){
|
756
|
-
var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
|
757
|
-
return (hex) ? hex.slice(1).hexToRgb(array) : null;
|
758
|
-
},
|
759
|
-
|
760
|
-
rgbToHex: function(array){
|
761
|
-
var rgb = this.match(/\d{1,3}/g);
|
762
|
-
return (rgb) ? rgb.rgbToHex(array) : null;
|
763
|
-
},
|
764
|
-
|
765
|
-
stripScripts: function(option){
|
766
|
-
var scripts = '';
|
767
|
-
var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){
|
768
|
-
scripts += arguments[1] + '\n';
|
769
|
-
return '';
|
770
|
-
});
|
771
|
-
if (option === true) $exec(scripts);
|
772
|
-
else if ($type(option) == 'function') option(scripts, text);
|
773
|
-
return text;
|
774
|
-
},
|
775
|
-
|
776
|
-
substitute: function(object, regexp){
|
777
|
-
return this.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
|
778
|
-
if (match.charAt(0) == '\\') return match.slice(1);
|
779
|
-
return (object[name] != undefined) ? object[name] : '';
|
780
|
-
});
|
781
|
-
}
|
782
|
-
|
783
|
-
});
|
784
|
-
|
785
|
-
|
786
|
-
/*
|
787
|
-
Script: Hash.js
|
788
|
-
Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects.
|
789
|
-
|
790
|
-
License:
|
791
|
-
MIT-style license.
|
792
|
-
*/
|
793
|
-
|
794
|
-
Hash.implement({
|
795
|
-
|
796
|
-
has: Object.prototype.hasOwnProperty,
|
797
|
-
|
798
|
-
keyOf: function(value){
|
799
|
-
for (var key in this){
|
800
|
-
if (this.hasOwnProperty(key) && this[key] === value) return key;
|
801
|
-
}
|
802
|
-
return null;
|
803
|
-
},
|
804
|
-
|
805
|
-
hasValue: function(value){
|
806
|
-
return (Hash.keyOf(this, value) !== null);
|
807
|
-
},
|
808
|
-
|
809
|
-
extend: function(properties){
|
810
|
-
Hash.each(properties || {}, function(value, key){
|
811
|
-
Hash.set(this, key, value);
|
812
|
-
}, this);
|
813
|
-
return this;
|
814
|
-
},
|
815
|
-
|
816
|
-
combine: function(properties){
|
817
|
-
Hash.each(properties || {}, function(value, key){
|
818
|
-
Hash.include(this, key, value);
|
819
|
-
}, this);
|
820
|
-
return this;
|
821
|
-
},
|
822
|
-
|
823
|
-
erase: function(key){
|
824
|
-
if (this.hasOwnProperty(key)) delete this[key];
|
825
|
-
return this;
|
826
|
-
},
|
827
|
-
|
828
|
-
get: function(key){
|
829
|
-
return (this.hasOwnProperty(key)) ? this[key] : null;
|
830
|
-
},
|
831
|
-
|
832
|
-
set: function(key, value){
|
833
|
-
if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
|
834
|
-
return this;
|
835
|
-
},
|
836
|
-
|
837
|
-
empty: function(){
|
838
|
-
Hash.each(this, function(value, key){
|
839
|
-
delete this[key];
|
840
|
-
}, this);
|
841
|
-
return this;
|
842
|
-
},
|
843
|
-
|
844
|
-
include: function(key, value){
|
845
|
-
if (this[key] == undefined) this[key] = value;
|
846
|
-
return this;
|
847
|
-
},
|
848
|
-
|
849
|
-
map: function(fn, bind){
|
850
|
-
var results = new Hash;
|
851
|
-
Hash.each(this, function(value, key){
|
852
|
-
results.set(key, fn.call(bind, value, key, this));
|
853
|
-
}, this);
|
854
|
-
return results;
|
855
|
-
},
|
856
|
-
|
857
|
-
filter: function(fn, bind){
|
858
|
-
var results = new Hash;
|
859
|
-
Hash.each(this, function(value, key){
|
860
|
-
if (fn.call(bind, value, key, this)) results.set(key, value);
|
861
|
-
}, this);
|
862
|
-
return results;
|
863
|
-
},
|
864
|
-
|
865
|
-
every: function(fn, bind){
|
866
|
-
for (var key in this){
|
867
|
-
if (this.hasOwnProperty(key) && !fn.call(bind, this[key], key)) return false;
|
868
|
-
}
|
869
|
-
return true;
|
870
|
-
},
|
871
|
-
|
872
|
-
some: function(fn, bind){
|
873
|
-
for (var key in this){
|
874
|
-
if (this.hasOwnProperty(key) && fn.call(bind, this[key], key)) return true;
|
875
|
-
}
|
876
|
-
return false;
|
877
|
-
},
|
878
|
-
|
879
|
-
getKeys: function(){
|
880
|
-
var keys = [];
|
881
|
-
Hash.each(this, function(value, key){
|
882
|
-
keys.push(key);
|
883
|
-
});
|
884
|
-
return keys;
|
885
|
-
},
|
886
|
-
|
887
|
-
getValues: function(){
|
888
|
-
var values = [];
|
889
|
-
Hash.each(this, function(value){
|
890
|
-
values.push(value);
|
891
|
-
});
|
892
|
-
return values;
|
893
|
-
},
|
894
|
-
|
895
|
-
toQueryString: function(base){
|
896
|
-
var queryString = [];
|
897
|
-
Hash.each(this, function(value, key){
|
898
|
-
if (base) key = base + '[' + key + ']';
|
899
|
-
var result;
|
900
|
-
switch ($type(value)){
|
901
|
-
case 'object': result = Hash.toQueryString(value, key); break;
|
902
|
-
case 'array':
|
903
|
-
var qs = {};
|
904
|
-
value.each(function(val, i){
|
905
|
-
qs[i] = val;
|
906
|
-
});
|
907
|
-
result = Hash.toQueryString(qs, key);
|
908
|
-
break;
|
909
|
-
default: result = key + '=' + encodeURIComponent(value);
|
910
|
-
}
|
911
|
-
if (value != undefined) queryString.push(result);
|
912
|
-
});
|
913
|
-
|
914
|
-
return queryString.join('&');
|
915
|
-
}
|
916
|
-
|
917
|
-
});
|
918
|
-
|
919
|
-
Hash.alias({keyOf: 'indexOf', hasValue: 'contains'});
|
920
|
-
|
921
|
-
|
922
|
-
/*
|
923
|
-
Script: Event.js
|
924
|
-
Contains the Event Native, to make the event object completely crossbrowser.
|
925
|
-
|
926
|
-
License:
|
927
|
-
MIT-style license.
|
928
|
-
*/
|
929
|
-
|
930
|
-
var Event = new Native({
|
931
|
-
|
932
|
-
name: 'Event',
|
933
|
-
|
934
|
-
initialize: function(event, win){
|
935
|
-
win = win || window;
|
936
|
-
var doc = win.document;
|
937
|
-
event = event || win.event;
|
938
|
-
if (event.$extended) return event;
|
939
|
-
this.$extended = true;
|
940
|
-
var type = event.type;
|
941
|
-
var target = event.target || event.srcElement;
|
942
|
-
while (target && target.nodeType == 3) target = target.parentNode;
|
943
|
-
|
944
|
-
if (type.test(/key/)){
|
945
|
-
var code = event.which || event.keyCode;
|
946
|
-
var key = Event.Keys.keyOf(code);
|
947
|
-
if (type == 'keydown'){
|
948
|
-
var fKey = code - 111;
|
949
|
-
if (fKey > 0 && fKey < 13) key = 'f' + fKey;
|
950
|
-
}
|
951
|
-
key = key || String.fromCharCode(code).toLowerCase();
|
952
|
-
} else if (type.match(/(click|mouse|menu)/i)){
|
953
|
-
doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
|
954
|
-
var page = {
|
955
|
-
x: event.pageX || event.clientX + doc.scrollLeft,
|
956
|
-
y: event.pageY || event.clientY + doc.scrollTop
|
957
|
-
};
|
958
|
-
var client = {
|
959
|
-
x: (event.pageX) ? event.pageX - win.pageXOffset : event.clientX,
|
960
|
-
y: (event.pageY) ? event.pageY - win.pageYOffset : event.clientY
|
961
|
-
};
|
962
|
-
if (type.match(/DOMMouseScroll|mousewheel/)){
|
963
|
-
var wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3;
|
964
|
-
}
|
965
|
-
var rightClick = (event.which == 3) || (event.button == 2);
|
966
|
-
var related = null;
|
967
|
-
if (type.match(/over|out/)){
|
968
|
-
switch (type){
|
969
|
-
case 'mouseover': related = event.relatedTarget || event.fromElement; break;
|
970
|
-
case 'mouseout': related = event.relatedTarget || event.toElement;
|
971
|
-
}
|
972
|
-
if (!(function(){
|
973
|
-
while (related && related.nodeType == 3) related = related.parentNode;
|
974
|
-
return true;
|
975
|
-
}).create({attempt: Browser.Engine.gecko})()) related = false;
|
976
|
-
}
|
977
|
-
}
|
978
|
-
|
979
|
-
return $extend(this, {
|
980
|
-
event: event,
|
981
|
-
type: type,
|
982
|
-
|
983
|
-
page: page,
|
984
|
-
client: client,
|
985
|
-
rightClick: rightClick,
|
986
|
-
|
987
|
-
wheel: wheel,
|
988
|
-
|
989
|
-
relatedTarget: related,
|
990
|
-
target: target,
|
991
|
-
|
992
|
-
code: code,
|
993
|
-
key: key,
|
994
|
-
|
995
|
-
shift: event.shiftKey,
|
996
|
-
control: event.ctrlKey,
|
997
|
-
alt: event.altKey,
|
998
|
-
meta: event.metaKey
|
999
|
-
});
|
1000
|
-
}
|
1001
|
-
|
1002
|
-
});
|
1003
|
-
|
1004
|
-
Event.Keys = new Hash({
|
1005
|
-
'enter': 13,
|
1006
|
-
'up': 38,
|
1007
|
-
'down': 40,
|
1008
|
-
'left': 37,
|
1009
|
-
'right': 39,
|
1010
|
-
'esc': 27,
|
1011
|
-
'space': 32,
|
1012
|
-
'backspace': 8,
|
1013
|
-
'tab': 9,
|
1014
|
-
'delete': 46
|
1015
|
-
});
|
1016
|
-
|
1017
|
-
Event.implement({
|
1018
|
-
|
1019
|
-
stop: function(){
|
1020
|
-
return this.stopPropagation().preventDefault();
|
1021
|
-
},
|
1022
|
-
|
1023
|
-
stopPropagation: function(){
|
1024
|
-
if (this.event.stopPropagation) this.event.stopPropagation();
|
1025
|
-
else this.event.cancelBubble = true;
|
1026
|
-
return this;
|
1027
|
-
},
|
1028
|
-
|
1029
|
-
preventDefault: function(){
|
1030
|
-
if (this.event.preventDefault) this.event.preventDefault();
|
1031
|
-
else this.event.returnValue = false;
|
1032
|
-
return this;
|
1033
|
-
}
|
1034
|
-
|
1035
|
-
});
|
1036
|
-
|
1037
|
-
|
1038
|
-
/*
|
1039
|
-
Script: Class.js
|
1040
|
-
Contains the Class Function for easily creating, extending, and implementing reusable Classes.
|
1041
|
-
|
1042
|
-
License:
|
1043
|
-
MIT-style license.
|
1044
|
-
*/
|
1045
|
-
|
1046
|
-
function Class(params){
|
1047
|
-
|
1048
|
-
if (params instanceof Function) params = {initialize: params};
|
1049
|
-
|
1050
|
-
var newClass = function(){
|
1051
|
-
Object.reset(this);
|
1052
|
-
if (newClass._prototyping) return this;
|
1053
|
-
this._current = $empty;
|
1054
|
-
var value = (this.initialize) ? this.initialize.apply(this, arguments) : this;
|
1055
|
-
delete this._current; delete this.caller;
|
1056
|
-
return value;
|
1057
|
-
}.extend(this);
|
1058
|
-
|
1059
|
-
newClass.implement(params);
|
1060
|
-
|
1061
|
-
newClass.constructor = Class;
|
1062
|
-
newClass.prototype.constructor = newClass;
|
1063
|
-
|
1064
|
-
return newClass;
|
1065
|
-
|
1066
|
-
};
|
1067
|
-
|
1068
|
-
Function.prototype.protect = function(){
|
1069
|
-
this._protected = true;
|
1070
|
-
return this;
|
1071
|
-
};
|
1072
|
-
|
1073
|
-
Object.reset = function(object, key){
|
1074
|
-
|
1075
|
-
if (key == null){
|
1076
|
-
for (var p in object) Object.reset(object, p);
|
1077
|
-
return object;
|
1078
|
-
}
|
1079
|
-
|
1080
|
-
delete object[key];
|
1081
|
-
|
1082
|
-
switch ($type(object[key])){
|
1083
|
-
case 'object':
|
1084
|
-
var F = function(){};
|
1085
|
-
F.prototype = object[key];
|
1086
|
-
var i = new F;
|
1087
|
-
object[key] = Object.reset(i);
|
1088
|
-
break;
|
1089
|
-
case 'array': object[key] = $unlink(object[key]); break;
|
1090
|
-
}
|
1091
|
-
|
1092
|
-
return object;
|
1093
|
-
|
1094
|
-
};
|
1095
|
-
|
1096
|
-
new Native({name: 'Class', initialize: Class}).extend({
|
1097
|
-
|
1098
|
-
instantiate: function(F){
|
1099
|
-
F._prototyping = true;
|
1100
|
-
var proto = new F;
|
1101
|
-
delete F._prototyping;
|
1102
|
-
return proto;
|
1103
|
-
},
|
1104
|
-
|
1105
|
-
wrap: function(self, key, method){
|
1106
|
-
if (method._origin) method = method._origin;
|
1107
|
-
|
1108
|
-
return function(){
|
1109
|
-
if (method._protected && this._current == null) throw new Error('The method "' + key + '" cannot be called.');
|
1110
|
-
var caller = this.caller, current = this._current;
|
1111
|
-
this.caller = current; this._current = arguments.callee;
|
1112
|
-
var result = method.apply(this, arguments);
|
1113
|
-
this._current = current; this.caller = caller;
|
1114
|
-
return result;
|
1115
|
-
}.extend({_owner: self, _origin: method, _name: key});
|
1116
|
-
|
1117
|
-
}
|
1118
|
-
|
1119
|
-
});
|
1120
|
-
|
1121
|
-
Class.implement({
|
1122
|
-
|
1123
|
-
implement: function(key, value){
|
1124
|
-
|
1125
|
-
if ($type(key) == 'object'){
|
1126
|
-
for (var p in key) this.implement(p, key[p]);
|
1127
|
-
return this;
|
1128
|
-
}
|
1129
|
-
|
1130
|
-
var mutator = Class.Mutators[key];
|
1131
|
-
|
1132
|
-
if (mutator){
|
1133
|
-
value = mutator.call(this, value);
|
1134
|
-
if (value == null) return this;
|
1135
|
-
}
|
1136
|
-
|
1137
|
-
var proto = this.prototype;
|
1138
|
-
|
1139
|
-
switch ($type(value)){
|
1140
|
-
|
1141
|
-
case 'function':
|
1142
|
-
if (value._hidden) return this;
|
1143
|
-
proto[key] = Class.wrap(this, key, value);
|
1144
|
-
break;
|
1145
|
-
|
1146
|
-
case 'object':
|
1147
|
-
var previous = proto[key];
|
1148
|
-
if ($type(previous) == 'object') $mixin(previous, value);
|
1149
|
-
else proto[key] = $unlink(value);
|
1150
|
-
break;
|
1151
|
-
|
1152
|
-
case 'array':
|
1153
|
-
proto[key] = $unlink(value);
|
1154
|
-
break;
|
1155
|
-
|
1156
|
-
default: proto[key] = value;
|
1157
|
-
|
1158
|
-
}
|
1159
|
-
|
1160
|
-
return this;
|
1161
|
-
|
1162
|
-
}
|
1163
|
-
|
1164
|
-
});
|
1165
|
-
|
1166
|
-
Class.Mutators = {
|
1167
|
-
|
1168
|
-
Extends: function(parent){
|
1169
|
-
|
1170
|
-
this.parent = parent;
|
1171
|
-
this.prototype = Class.instantiate(parent);
|
1172
|
-
|
1173
|
-
this.implement('parent', function(){
|
1174
|
-
var name = this.caller._name, previous = this.caller._owner.parent.prototype[name];
|
1175
|
-
if (!previous) throw new Error('The method "' + name + '" has no parent.');
|
1176
|
-
return previous.apply(this, arguments);
|
1177
|
-
}.protect());
|
1178
|
-
|
1179
|
-
},
|
1180
|
-
|
1181
|
-
Implements: function(items){
|
1182
|
-
$splat(items).each(function(item){
|
1183
|
-
if (item instanceof Function) item = Class.instantiate(item);
|
1184
|
-
this.implement(item);
|
1185
|
-
}, this);
|
1186
|
-
|
1187
|
-
}
|
1188
|
-
|
1189
|
-
};
|
1190
|
-
|
1191
|
-
|
1192
|
-
/*
|
1193
|
-
Script: Class.Extras.js
|
1194
|
-
Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks.
|
1195
|
-
|
1196
|
-
License:
|
1197
|
-
MIT-style license.
|
1198
|
-
*/
|
1199
|
-
|
1200
|
-
var Chain = new Class({
|
1201
|
-
|
1202
|
-
$chain: [],
|
1203
|
-
|
1204
|
-
chain: function(){
|
1205
|
-
this.$chain.extend(Array.flatten(arguments));
|
1206
|
-
return this;
|
1207
|
-
},
|
1208
|
-
|
1209
|
-
callChain: function(){
|
1210
|
-
return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false;
|
1211
|
-
},
|
1212
|
-
|
1213
|
-
clearChain: function(){
|
1214
|
-
this.$chain.empty();
|
1215
|
-
return this;
|
1216
|
-
}
|
1217
|
-
|
1218
|
-
});
|
1219
|
-
|
1220
|
-
var Events = new Class({
|
1221
|
-
|
1222
|
-
$events: {},
|
1223
|
-
|
1224
|
-
addEvent: function(type, fn, internal){
|
1225
|
-
type = Events.removeOn(type);
|
1226
|
-
if (fn != $empty){
|
1227
|
-
this.$events[type] = this.$events[type] || [];
|
1228
|
-
this.$events[type].include(fn);
|
1229
|
-
if (internal) fn.internal = true;
|
1230
|
-
}
|
1231
|
-
return this;
|
1232
|
-
},
|
1233
|
-
|
1234
|
-
addEvents: function(events){
|
1235
|
-
for (var type in events) this.addEvent(type, events[type]);
|
1236
|
-
return this;
|
1237
|
-
},
|
1238
|
-
|
1239
|
-
fireEvent: function(type, args, delay){
|
1240
|
-
type = Events.removeOn(type);
|
1241
|
-
if (!this.$events || !this.$events[type]) return this;
|
1242
|
-
this.$events[type].each(function(fn){
|
1243
|
-
fn.create({'bind': this, 'delay': delay, 'arguments': args})();
|
1244
|
-
}, this);
|
1245
|
-
return this;
|
1246
|
-
},
|
1247
|
-
|
1248
|
-
removeEvent: function(type, fn){
|
1249
|
-
type = Events.removeOn(type);
|
1250
|
-
if (!this.$events[type]) return this;
|
1251
|
-
if (!fn.internal) this.$events[type].erase(fn);
|
1252
|
-
return this;
|
1253
|
-
},
|
1254
|
-
|
1255
|
-
removeEvents: function(events){
|
1256
|
-
var type;
|
1257
|
-
if ($type(events) == 'object'){
|
1258
|
-
for (type in events) this.removeEvent(type, events[type]);
|
1259
|
-
return this;
|
1260
|
-
}
|
1261
|
-
if (events) events = Events.removeOn(events);
|
1262
|
-
for (type in this.$events){
|
1263
|
-
if (events && events != type) continue;
|
1264
|
-
var fns = this.$events[type];
|
1265
|
-
for (var i = fns.length; i--; i) this.removeEvent(type, fns[i]);
|
1266
|
-
}
|
1267
|
-
return this;
|
1268
|
-
}
|
1269
|
-
|
1270
|
-
});
|
1271
|
-
|
1272
|
-
Events.removeOn = function(string){
|
1273
|
-
return string.replace(/^on([A-Z])/, function(full, first) {
|
1274
|
-
return first.toLowerCase();
|
1275
|
-
});
|
1276
|
-
};
|
1277
|
-
|
1278
|
-
var Options = new Class({
|
1279
|
-
|
1280
|
-
setOptions: function(){
|
1281
|
-
this.options = $merge.run([this.options].extend(arguments));
|
1282
|
-
if (!this.addEvent) return this;
|
1283
|
-
for (var option in this.options){
|
1284
|
-
if ($type(this.options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
|
1285
|
-
this.addEvent(option, this.options[option]);
|
1286
|
-
delete this.options[option];
|
1287
|
-
}
|
1288
|
-
return this;
|
1289
|
-
}
|
1290
|
-
|
1291
|
-
});
|
1292
|
-
|
1293
|
-
|
1294
|
-
/*
|
1295
|
-
Script: Element.js
|
1296
|
-
One of the most important items in MooTools. Contains the dollar function, the dollars function, and an handful of cross-browser,
|
1297
|
-
time-saver methods to let you easily work with HTML Elements.
|
1298
|
-
|
1299
|
-
License:
|
1300
|
-
MIT-style license.
|
1301
|
-
*/
|
1302
|
-
|
1303
|
-
var Element = new Native({
|
1304
|
-
|
1305
|
-
name: 'Element',
|
1306
|
-
|
1307
|
-
legacy: window.Element,
|
1308
|
-
|
1309
|
-
initialize: function(tag, props){
|
1310
|
-
var konstructor = Element.Constructors.get(tag);
|
1311
|
-
if (konstructor) return konstructor(props);
|
1312
|
-
if (typeof tag == 'string') return document.newElement(tag, props);
|
1313
|
-
return document.id(tag).set(props);
|
1314
|
-
},
|
1315
|
-
|
1316
|
-
afterImplement: function(key, value){
|
1317
|
-
Element.Prototype[key] = value;
|
1318
|
-
if (Array[key]) return;
|
1319
|
-
Elements.implement(key, function(){
|
1320
|
-
var items = [], elements = true;
|
1321
|
-
for (var i = 0, j = this.length; i < j; i++){
|
1322
|
-
var returns = this[i][key].apply(this[i], arguments);
|
1323
|
-
items.push(returns);
|
1324
|
-
if (elements) elements = ($type(returns) == 'element');
|
1325
|
-
}
|
1326
|
-
return (elements) ? new Elements(items) : items;
|
1327
|
-
});
|
1328
|
-
}
|
1329
|
-
|
1330
|
-
});
|
1331
|
-
|
1332
|
-
Element.Prototype = {$family: {name: 'element'}};
|
1333
|
-
|
1334
|
-
Element.Constructors = new Hash;
|
1335
|
-
|
1336
|
-
var IFrame = new Native({
|
1337
|
-
|
1338
|
-
name: 'IFrame',
|
1339
|
-
|
1340
|
-
generics: false,
|
1341
|
-
|
1342
|
-
initialize: function(){
|
1343
|
-
var params = Array.link(arguments, {properties: Object.type, iframe: $defined});
|
1344
|
-
var props = params.properties || {};
|
1345
|
-
var iframe = document.id(params.iframe);
|
1346
|
-
var onload = props.onload || $empty;
|
1347
|
-
delete props.onload;
|
1348
|
-
props.id = props.name = $pick(props.id, props.name, iframe ? (iframe.id || iframe.name) : 'IFrame_' + $time());
|
1349
|
-
iframe = new Element(iframe || 'iframe', props);
|
1350
|
-
var onFrameLoad = function(){
|
1351
|
-
var host = $try(function(){
|
1352
|
-
return iframe.contentWindow.location.host;
|
1353
|
-
});
|
1354
|
-
if (!host || host == window.location.host){
|
1355
|
-
var win = new Window(iframe.contentWindow);
|
1356
|
-
new Document(iframe.contentWindow.document);
|
1357
|
-
$extend(win.Element.prototype, Element.Prototype);
|
1358
|
-
}
|
1359
|
-
onload.call(iframe.contentWindow, iframe.contentWindow.document);
|
1360
|
-
};
|
1361
|
-
var contentWindow = $try(function(){
|
1362
|
-
return iframe.contentWindow;
|
1363
|
-
});
|
1364
|
-
((contentWindow && contentWindow.document.body) || window.frames[props.id]) ? onFrameLoad() : iframe.addListener('load', onFrameLoad);
|
1365
|
-
return iframe;
|
1366
|
-
}
|
1367
|
-
|
1368
|
-
});
|
1369
|
-
|
1370
|
-
var Elements = new Native({
|
1371
|
-
|
1372
|
-
initialize: function(elements, options){
|
1373
|
-
options = $extend({ddup: true, cash: true}, options);
|
1374
|
-
elements = elements || [];
|
1375
|
-
if (options.ddup || options.cash){
|
1376
|
-
var uniques = {}, returned = [];
|
1377
|
-
for (var i = 0, l = elements.length; i < l; i++){
|
1378
|
-
var el = document.id(elements[i], !options.cash);
|
1379
|
-
if (options.ddup){
|
1380
|
-
if (uniques[el.uid]) continue;
|
1381
|
-
uniques[el.uid] = true;
|
1382
|
-
}
|
1383
|
-
returned.push(el);
|
1384
|
-
}
|
1385
|
-
elements = returned;
|
1386
|
-
}
|
1387
|
-
return (options.cash) ? $extend(elements, this) : elements;
|
1388
|
-
}
|
1389
|
-
|
1390
|
-
});
|
1391
|
-
|
1392
|
-
Elements.implement({
|
1393
|
-
|
1394
|
-
filter: function(filter, bind){
|
1395
|
-
if (!filter) return this;
|
1396
|
-
return new Elements(Array.filter(this, (typeof filter == 'string') ? function(item){
|
1397
|
-
return item.match(filter);
|
1398
|
-
} : filter, bind));
|
1399
|
-
}
|
1400
|
-
|
1401
|
-
});
|
1402
|
-
|
1403
|
-
Document.implement({
|
1404
|
-
|
1405
|
-
newElement: function(tag, props){
|
1406
|
-
if (Browser.Engine.trident && props){
|
1407
|
-
['name', 'type', 'checked'].each(function(attribute){
|
1408
|
-
if (!props[attribute]) return;
|
1409
|
-
tag += ' ' + attribute + '="' + props[attribute] + '"';
|
1410
|
-
if (attribute != 'checked') delete props[attribute];
|
1411
|
-
});
|
1412
|
-
tag = '<' + tag + '>';
|
1413
|
-
}
|
1414
|
-
return document.id(this.createElement(tag)).set(props);
|
1415
|
-
},
|
1416
|
-
|
1417
|
-
newTextNode: function(text){
|
1418
|
-
return this.createTextNode(text);
|
1419
|
-
},
|
1420
|
-
|
1421
|
-
getDocument: function(){
|
1422
|
-
return this;
|
1423
|
-
},
|
1424
|
-
|
1425
|
-
getWindow: function(){
|
1426
|
-
return this.window;
|
1427
|
-
},
|
1428
|
-
|
1429
|
-
id: (function(){
|
1430
|
-
|
1431
|
-
var types = {
|
1432
|
-
|
1433
|
-
string: function(id, nocash, doc){
|
1434
|
-
id = doc.getElementById(id);
|
1435
|
-
return (id) ? types.element(id, nocash) : null;
|
1436
|
-
},
|
1437
|
-
|
1438
|
-
element: function(el, nocash){
|
1439
|
-
$uid(el);
|
1440
|
-
if (!nocash && !el.$family && !(/^object|embed$/i).test(el.tagName)){
|
1441
|
-
var proto = Element.Prototype;
|
1442
|
-
for (var p in proto) el[p] = proto[p];
|
1443
|
-
};
|
1444
|
-
return el;
|
1445
|
-
},
|
1446
|
-
|
1447
|
-
object: function(obj, nocash, doc){
|
1448
|
-
if (obj.toElement) return types.element(obj.toElement(doc), nocash);
|
1449
|
-
return null;
|
1450
|
-
}
|
1451
|
-
|
1452
|
-
};
|
1453
|
-
|
1454
|
-
types.textnode = types.whitespace = types.window = types.document = $arguments(0);
|
1455
|
-
|
1456
|
-
return function(el, nocash, doc){
|
1457
|
-
if (el && el.$family && el.uid) return el;
|
1458
|
-
var type = $type(el);
|
1459
|
-
return (types[type]) ? types[type](el, nocash, doc || document) : null;
|
1460
|
-
};
|
1461
|
-
|
1462
|
-
})()
|
1463
|
-
|
1464
|
-
});
|
1465
|
-
|
1466
|
-
if (window.$ == null) Window.implement({
|
1467
|
-
$: function(el, nc){
|
1468
|
-
return document.id(el, nc, this.document);
|
1469
|
-
}
|
1470
|
-
});
|
1471
|
-
|
1472
|
-
Window.implement({
|
1473
|
-
|
1474
|
-
$$: function(selector){
|
1475
|
-
if (arguments.length == 1 && typeof selector == 'string') return this.document.getElements(selector);
|
1476
|
-
var elements = [];
|
1477
|
-
var args = Array.flatten(arguments);
|
1478
|
-
for (var i = 0, l = args.length; i < l; i++){
|
1479
|
-
var item = args[i];
|
1480
|
-
switch ($type(item)){
|
1481
|
-
case 'element': elements.push(item); break;
|
1482
|
-
case 'string': elements.extend(this.document.getElements(item, true));
|
1483
|
-
}
|
1484
|
-
}
|
1485
|
-
return new Elements(elements);
|
1486
|
-
},
|
1487
|
-
|
1488
|
-
getDocument: function(){
|
1489
|
-
return this.document;
|
1490
|
-
},
|
1491
|
-
|
1492
|
-
getWindow: function(){
|
1493
|
-
return this;
|
1494
|
-
}
|
1495
|
-
|
1496
|
-
});
|
1497
|
-
|
1498
|
-
Native.implement([Element, Document], {
|
1499
|
-
|
1500
|
-
getElement: function(selector, nocash){
|
1501
|
-
return document.id(this.getElements(selector, true)[0] || null, nocash);
|
1502
|
-
},
|
1503
|
-
|
1504
|
-
getElements: function(tags, nocash){
|
1505
|
-
tags = tags.split(',');
|
1506
|
-
var elements = [];
|
1507
|
-
var ddup = (tags.length > 1);
|
1508
|
-
tags.each(function(tag){
|
1509
|
-
var partial = this.getElementsByTagName(tag.trim());
|
1510
|
-
(ddup) ? elements.extend(partial) : elements = partial;
|
1511
|
-
}, this);
|
1512
|
-
return new Elements(elements, {ddup: ddup, cash: !nocash});
|
1513
|
-
}
|
1514
|
-
|
1515
|
-
});
|
1516
|
-
|
1517
|
-
(function(){
|
1518
|
-
|
1519
|
-
var collected = {}, storage = {};
|
1520
|
-
var props = {input: 'checked', option: 'selected', textarea: (Browser.Engine.webkit && Browser.Engine.version < 420) ? 'innerHTML' : 'value'};
|
1521
|
-
|
1522
|
-
var get = function(uid){
|
1523
|
-
return (storage[uid] || (storage[uid] = {}));
|
1524
|
-
};
|
1525
|
-
|
1526
|
-
var clean = function(item, retain){
|
1527
|
-
if (!item) return;
|
1528
|
-
var uid = item.uid;
|
1529
|
-
if (Browser.Engine.trident){
|
1530
|
-
if (item.clearAttributes){
|
1531
|
-
var clone = retain && item.cloneNode(false);
|
1532
|
-
item.clearAttributes();
|
1533
|
-
if (clone) item.mergeAttributes(clone);
|
1534
|
-
} else if (item.removeEvents){
|
1535
|
-
item.removeEvents();
|
1536
|
-
}
|
1537
|
-
if ((/object/i).test(item.tagName)){
|
1538
|
-
for (var p in item){
|
1539
|
-
if (typeof item[p] == 'function') item[p] = $empty;
|
1540
|
-
}
|
1541
|
-
Element.dispose(item);
|
1542
|
-
}
|
1543
|
-
}
|
1544
|
-
if (!uid) return;
|
1545
|
-
collected[uid] = storage[uid] = null;
|
1546
|
-
};
|
1547
|
-
|
1548
|
-
var purge = function(){
|
1549
|
-
Hash.each(collected, clean);
|
1550
|
-
if (Browser.Engine.trident) $A(document.getElementsByTagName('object')).each(clean);
|
1551
|
-
if (window.CollectGarbage) CollectGarbage();
|
1552
|
-
collected = storage = null;
|
1553
|
-
};
|
1554
|
-
|
1555
|
-
var walk = function(element, walk, start, match, all, nocash){
|
1556
|
-
var el = element[start || walk];
|
1557
|
-
var elements = [];
|
1558
|
-
while (el){
|
1559
|
-
if (el.nodeType == 1 && (!match || Element.match(el, match))){
|
1560
|
-
if (!all) return document.id(el, nocash);
|
1561
|
-
elements.push(el);
|
1562
|
-
}
|
1563
|
-
el = el[walk];
|
1564
|
-
}
|
1565
|
-
return (all) ? new Elements(elements, {ddup: false, cash: !nocash}) : null;
|
1566
|
-
};
|
1567
|
-
|
1568
|
-
var attributes = {
|
1569
|
-
'html': 'innerHTML',
|
1570
|
-
'class': 'className',
|
1571
|
-
'for': 'htmlFor',
|
1572
|
-
'defaultValue': 'defaultValue',
|
1573
|
-
'text': (Browser.Engine.trident || (Browser.Engine.webkit && Browser.Engine.version < 420)) ? 'innerText' : 'textContent'
|
1574
|
-
};
|
1575
|
-
var bools = ['compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', 'disabled', 'readonly', 'multiple', 'selected', 'noresize', 'defer'];
|
1576
|
-
var camels = ['value', 'type', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan', 'frameBorder', 'maxLength', 'readOnly', 'rowSpan', 'tabIndex', 'useMap'];
|
1577
|
-
|
1578
|
-
bools = bools.associate(bools);
|
1579
|
-
|
1580
|
-
Hash.extend(attributes, bools);
|
1581
|
-
Hash.extend(attributes, camels.associate(camels.map(String.toLowerCase)));
|
1582
|
-
|
1583
|
-
var inserters = {
|
1584
|
-
|
1585
|
-
before: function(context, element){
|
1586
|
-
if (element.parentNode) element.parentNode.insertBefore(context, element);
|
1587
|
-
},
|
1588
|
-
|
1589
|
-
after: function(context, element){
|
1590
|
-
if (!element.parentNode) return;
|
1591
|
-
var next = element.nextSibling;
|
1592
|
-
(next) ? element.parentNode.insertBefore(context, next) : element.parentNode.appendChild(context);
|
1593
|
-
},
|
1594
|
-
|
1595
|
-
bottom: function(context, element){
|
1596
|
-
element.appendChild(context);
|
1597
|
-
},
|
1598
|
-
|
1599
|
-
top: function(context, element){
|
1600
|
-
var first = element.firstChild;
|
1601
|
-
(first) ? element.insertBefore(context, first) : element.appendChild(context);
|
1602
|
-
}
|
1603
|
-
|
1604
|
-
};
|
1605
|
-
|
1606
|
-
inserters.inside = inserters.bottom;
|
1607
|
-
|
1608
|
-
Hash.each(inserters, function(inserter, where){
|
1609
|
-
|
1610
|
-
where = where.capitalize();
|
1611
|
-
|
1612
|
-
Element.implement('inject' + where, function(el){
|
1613
|
-
inserter(this, document.id(el, true));
|
1614
|
-
return this;
|
1615
|
-
});
|
1616
|
-
|
1617
|
-
Element.implement('grab' + where, function(el){
|
1618
|
-
inserter(document.id(el, true), this);
|
1619
|
-
return this;
|
1620
|
-
});
|
1621
|
-
|
1622
|
-
});
|
1623
|
-
|
1624
|
-
Element.implement({
|
1625
|
-
|
1626
|
-
set: function(prop, value){
|
1627
|
-
switch ($type(prop)){
|
1628
|
-
case 'object':
|
1629
|
-
for (var p in prop) this.set(p, prop[p]);
|
1630
|
-
break;
|
1631
|
-
case 'string':
|
1632
|
-
var property = Element.Properties.get(prop);
|
1633
|
-
(property && property.set) ? property.set.apply(this, Array.slice(arguments, 1)) : this.setProperty(prop, value);
|
1634
|
-
}
|
1635
|
-
return this;
|
1636
|
-
},
|
1637
|
-
|
1638
|
-
get: function(prop){
|
1639
|
-
var property = Element.Properties.get(prop);
|
1640
|
-
return (property && property.get) ? property.get.apply(this, Array.slice(arguments, 1)) : this.getProperty(prop);
|
1641
|
-
},
|
1642
|
-
|
1643
|
-
erase: function(prop){
|
1644
|
-
var property = Element.Properties.get(prop);
|
1645
|
-
(property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop);
|
1646
|
-
return this;
|
1647
|
-
},
|
1648
|
-
|
1649
|
-
setProperty: function(attribute, value){
|
1650
|
-
var key = attributes[attribute];
|
1651
|
-
if (value == undefined) return this.removeProperty(attribute);
|
1652
|
-
if (key && bools[attribute]) value = !!value;
|
1653
|
-
(key) ? this[key] = value : this.setAttribute(attribute, '' + value);
|
1654
|
-
return this;
|
1655
|
-
},
|
1656
|
-
|
1657
|
-
setProperties: function(attributes){
|
1658
|
-
for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]);
|
1659
|
-
return this;
|
1660
|
-
},
|
1661
|
-
|
1662
|
-
getProperty: function(attribute){
|
1663
|
-
var key = attributes[attribute];
|
1664
|
-
var value = (key) ? this[key] : this.getAttribute(attribute, 2);
|
1665
|
-
return (bools[attribute]) ? !!value : (key) ? value : value || null;
|
1666
|
-
},
|
1667
|
-
|
1668
|
-
getProperties: function(){
|
1669
|
-
var args = $A(arguments);
|
1670
|
-
return args.map(this.getProperty, this).associate(args);
|
1671
|
-
},
|
1672
|
-
|
1673
|
-
removeProperty: function(attribute){
|
1674
|
-
var key = attributes[attribute];
|
1675
|
-
(key) ? this[key] = (key && bools[attribute]) ? false : '' : this.removeAttribute(attribute);
|
1676
|
-
return this;
|
1677
|
-
},
|
1678
|
-
|
1679
|
-
removeProperties: function(){
|
1680
|
-
Array.each(arguments, this.removeProperty, this);
|
1681
|
-
return this;
|
1682
|
-
},
|
1683
|
-
|
1684
|
-
hasClass: function(className){
|
1685
|
-
return this.className.contains(className, ' ');
|
1686
|
-
},
|
1687
|
-
|
1688
|
-
addClass: function(className){
|
1689
|
-
if (!this.hasClass(className)) this.className = (this.className + ' ' + className).clean();
|
1690
|
-
return this;
|
1691
|
-
},
|
1692
|
-
|
1693
|
-
removeClass: function(className){
|
1694
|
-
this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1');
|
1695
|
-
return this;
|
1696
|
-
},
|
1697
|
-
|
1698
|
-
toggleClass: function(className){
|
1699
|
-
return this.hasClass(className) ? this.removeClass(className) : this.addClass(className);
|
1700
|
-
},
|
1701
|
-
|
1702
|
-
adopt: function(){
|
1703
|
-
Array.flatten(arguments).each(function(element){
|
1704
|
-
element = document.id(element, true);
|
1705
|
-
if (element) this.appendChild(element);
|
1706
|
-
}, this);
|
1707
|
-
return this;
|
1708
|
-
},
|
1709
|
-
|
1710
|
-
appendText: function(text, where){
|
1711
|
-
return this.grab(this.getDocument().newTextNode(text), where);
|
1712
|
-
},
|
1713
|
-
|
1714
|
-
grab: function(el, where){
|
1715
|
-
inserters[where || 'bottom'](document.id(el, true), this);
|
1716
|
-
return this;
|
1717
|
-
},
|
1718
|
-
|
1719
|
-
inject: function(el, where){
|
1720
|
-
inserters[where || 'bottom'](this, document.id(el, true));
|
1721
|
-
return this;
|
1722
|
-
},
|
1723
|
-
|
1724
|
-
replaces: function(el){
|
1725
|
-
el = document.id(el, true);
|
1726
|
-
el.parentNode.replaceChild(this, el);
|
1727
|
-
return this;
|
1728
|
-
},
|
1729
|
-
|
1730
|
-
wraps: function(el, where){
|
1731
|
-
el = document.id(el, true);
|
1732
|
-
return this.replaces(el).grab(el, where);
|
1733
|
-
},
|
1734
|
-
|
1735
|
-
getPrevious: function(match, nocash){
|
1736
|
-
return walk(this, 'previousSibling', null, match, false, nocash);
|
1737
|
-
},
|
1738
|
-
|
1739
|
-
getAllPrevious: function(match, nocash){
|
1740
|
-
return walk(this, 'previousSibling', null, match, true, nocash);
|
1741
|
-
},
|
1742
|
-
|
1743
|
-
getNext: function(match, nocash){
|
1744
|
-
return walk(this, 'nextSibling', null, match, false, nocash);
|
1745
|
-
},
|
1746
|
-
|
1747
|
-
getAllNext: function(match, nocash){
|
1748
|
-
return walk(this, 'nextSibling', null, match, true, nocash);
|
1749
|
-
},
|
1750
|
-
|
1751
|
-
getFirst: function(match, nocash){
|
1752
|
-
return walk(this, 'nextSibling', 'firstChild', match, false, nocash);
|
1753
|
-
},
|
1754
|
-
|
1755
|
-
getLast: function(match, nocash){
|
1756
|
-
return walk(this, 'previousSibling', 'lastChild', match, false, nocash);
|
1757
|
-
},
|
1758
|
-
|
1759
|
-
getParent: function(match, nocash){
|
1760
|
-
return walk(this, 'parentNode', null, match, false, nocash);
|
1761
|
-
},
|
1762
|
-
|
1763
|
-
getParents: function(match, nocash){
|
1764
|
-
return walk(this, 'parentNode', null, match, true, nocash);
|
1765
|
-
},
|
1766
|
-
|
1767
|
-
getSiblings: function(match, nocash) {
|
1768
|
-
return this.getParent().getChildren(match, nocash).erase(this);
|
1769
|
-
},
|
1770
|
-
|
1771
|
-
getChildren: function(match, nocash){
|
1772
|
-
return walk(this, 'nextSibling', 'firstChild', match, true, nocash);
|
1773
|
-
},
|
1774
|
-
|
1775
|
-
getWindow: function(){
|
1776
|
-
return this.ownerDocument.window;
|
1777
|
-
},
|
1778
|
-
|
1779
|
-
getDocument: function(){
|
1780
|
-
return this.ownerDocument;
|
1781
|
-
},
|
1782
|
-
|
1783
|
-
getElementById: function(id, nocash){
|
1784
|
-
var el = this.ownerDocument.getElementById(id);
|
1785
|
-
if (!el) return null;
|
1786
|
-
for (var parent = el.parentNode; parent != this; parent = parent.parentNode){
|
1787
|
-
if (!parent) return null;
|
1788
|
-
}
|
1789
|
-
return document.id(el, nocash);
|
1790
|
-
},
|
1791
|
-
|
1792
|
-
getSelected: function(){
|
1793
|
-
return new Elements($A(this.options).filter(function(option){
|
1794
|
-
return option.selected;
|
1795
|
-
}));
|
1796
|
-
},
|
1797
|
-
|
1798
|
-
getComputedStyle: function(property){
|
1799
|
-
if (this.currentStyle) return this.currentStyle[property.camelCase()];
|
1800
|
-
var computed = this.getDocument().defaultView.getComputedStyle(this, null);
|
1801
|
-
return (computed) ? computed.getPropertyValue([property.hyphenate()]) : null;
|
1802
|
-
},
|
1803
|
-
|
1804
|
-
toQueryString: function(){
|
1805
|
-
var queryString = [];
|
1806
|
-
this.getElements('input, select, textarea', true).each(function(el){
|
1807
|
-
if (!el.name || el.disabled || el.type == 'submit' || el.type == 'reset' || el.type == 'file') return;
|
1808
|
-
var value = (el.tagName.toLowerCase() == 'select') ? Element.getSelected(el).map(function(opt){
|
1809
|
-
return opt.value;
|
1810
|
-
}) : ((el.type == 'radio' || el.type == 'checkbox') && !el.checked) ? null : el.value;
|
1811
|
-
$splat(value).each(function(val){
|
1812
|
-
if (typeof val != 'undefined') queryString.push(el.name + '=' + encodeURIComponent(val));
|
1813
|
-
});
|
1814
|
-
});
|
1815
|
-
return queryString.join('&');
|
1816
|
-
},
|
1817
|
-
|
1818
|
-
clone: function(contents, keepid){
|
1819
|
-
contents = contents !== false;
|
1820
|
-
var clone = this.cloneNode(contents);
|
1821
|
-
var clean = function(node, element){
|
1822
|
-
if (!keepid) node.removeAttribute('id');
|
1823
|
-
if (Browser.Engine.trident){
|
1824
|
-
node.clearAttributes();
|
1825
|
-
node.mergeAttributes(element);
|
1826
|
-
node.removeAttribute('uid');
|
1827
|
-
if (node.options){
|
1828
|
-
var no = node.options, eo = element.options;
|
1829
|
-
for (var j = no.length; j--;) no[j].selected = eo[j].selected;
|
1830
|
-
}
|
1831
|
-
}
|
1832
|
-
var prop = props[element.tagName.toLowerCase()];
|
1833
|
-
if (prop && element[prop]) node[prop] = element[prop];
|
1834
|
-
};
|
1835
|
-
|
1836
|
-
if (contents){
|
1837
|
-
var ce = clone.getElementsByTagName('*'), te = this.getElementsByTagName('*');
|
1838
|
-
for (var i = ce.length; i--;) clean(ce[i], te[i]);
|
1839
|
-
}
|
1840
|
-
|
1841
|
-
clean(clone, this);
|
1842
|
-
return document.id(clone);
|
1843
|
-
},
|
1844
|
-
|
1845
|
-
destroy: function(){
|
1846
|
-
Element.empty(this);
|
1847
|
-
Element.dispose(this);
|
1848
|
-
clean(this, true);
|
1849
|
-
return null;
|
1850
|
-
},
|
1851
|
-
|
1852
|
-
empty: function(){
|
1853
|
-
$A(this.childNodes).each(function(node){
|
1854
|
-
Element.destroy(node);
|
1855
|
-
});
|
1856
|
-
return this;
|
1857
|
-
},
|
1858
|
-
|
1859
|
-
dispose: function(){
|
1860
|
-
return (this.parentNode) ? this.parentNode.removeChild(this) : this;
|
1861
|
-
},
|
1862
|
-
|
1863
|
-
hasChild: function(el){
|
1864
|
-
el = document.id(el, true);
|
1865
|
-
if (!el) return false;
|
1866
|
-
if (Browser.Engine.webkit && Browser.Engine.version < 420) return $A(this.getElementsByTagName(el.tagName)).contains(el);
|
1867
|
-
return (this.contains) ? (this != el && this.contains(el)) : !!(this.compareDocumentPosition(el) & 16);
|
1868
|
-
},
|
1869
|
-
|
1870
|
-
match: function(tag){
|
1871
|
-
return (!tag || (tag == this) || (Element.get(this, 'tag') == tag));
|
1872
|
-
}
|
1873
|
-
|
1874
|
-
});
|
1875
|
-
|
1876
|
-
Native.implement([Element, Window, Document], {
|
1877
|
-
|
1878
|
-
addListener: function(type, fn){
|
1879
|
-
if (type == 'unload'){
|
1880
|
-
var old = fn, self = this;
|
1881
|
-
fn = function(){
|
1882
|
-
self.removeListener('unload', fn);
|
1883
|
-
old();
|
1884
|
-
};
|
1885
|
-
} else {
|
1886
|
-
collected[this.uid] = this;
|
1887
|
-
}
|
1888
|
-
if (this.addEventListener) this.addEventListener(type, fn, false);
|
1889
|
-
else this.attachEvent('on' + type, fn);
|
1890
|
-
return this;
|
1891
|
-
},
|
1892
|
-
|
1893
|
-
removeListener: function(type, fn){
|
1894
|
-
if (this.removeEventListener) this.removeEventListener(type, fn, false);
|
1895
|
-
else this.detachEvent('on' + type, fn);
|
1896
|
-
return this;
|
1897
|
-
},
|
1898
|
-
|
1899
|
-
retrieve: function(property, dflt){
|
1900
|
-
var storage = get(this.uid), prop = storage[property];
|
1901
|
-
if (dflt != undefined && prop == undefined) prop = storage[property] = dflt;
|
1902
|
-
return $pick(prop);
|
1903
|
-
},
|
1904
|
-
|
1905
|
-
store: function(property, value){
|
1906
|
-
var storage = get(this.uid);
|
1907
|
-
storage[property] = value;
|
1908
|
-
return this;
|
1909
|
-
},
|
1910
|
-
|
1911
|
-
eliminate: function(property){
|
1912
|
-
var storage = get(this.uid);
|
1913
|
-
delete storage[property];
|
1914
|
-
return this;
|
1915
|
-
}
|
1916
|
-
|
1917
|
-
});
|
1918
|
-
|
1919
|
-
window.addListener('unload', purge);
|
1920
|
-
|
1921
|
-
})();
|
1922
|
-
|
1923
|
-
Element.Properties = new Hash;
|
1924
|
-
|
1925
|
-
Element.Properties.style = {
|
1926
|
-
|
1927
|
-
set: function(style){
|
1928
|
-
this.style.cssText = style;
|
1929
|
-
},
|
1930
|
-
|
1931
|
-
get: function(){
|
1932
|
-
return this.style.cssText;
|
1933
|
-
},
|
1934
|
-
|
1935
|
-
erase: function(){
|
1936
|
-
this.style.cssText = '';
|
1937
|
-
}
|
1938
|
-
|
1939
|
-
};
|
1940
|
-
|
1941
|
-
Element.Properties.tag = {
|
1942
|
-
|
1943
|
-
get: function(){
|
1944
|
-
return this.tagName.toLowerCase();
|
1945
|
-
}
|
1946
|
-
|
1947
|
-
};
|
1948
|
-
|
1949
|
-
Element.Properties.html = (function(){
|
1950
|
-
var wrapper = document.createElement('div');
|
1951
|
-
|
1952
|
-
var translations = {
|
1953
|
-
table: [1, '<table>', '</table>'],
|
1954
|
-
select: [1, '<select>', '</select>'],
|
1955
|
-
tbody: [2, '<table><tbody>', '</tbody></table>'],
|
1956
|
-
tr: [3, '<table><tbody><tr>', '</tr></tbody></table>']
|
1957
|
-
};
|
1958
|
-
translations.thead = translations.tfoot = translations.tbody;
|
1959
|
-
|
1960
|
-
var html = {
|
1961
|
-
set: function(){
|
1962
|
-
var html = Array.flatten(arguments).join('');
|
1963
|
-
var wrap = Browser.Engine.trident && translations[this.get('tag')];
|
1964
|
-
if (wrap){
|
1965
|
-
var first = wrapper;
|
1966
|
-
first.innerHTML = wrap[1] + html + wrap[2];
|
1967
|
-
for (var i = wrap[0]; i--;) first = first.firstChild;
|
1968
|
-
this.empty().adopt(first.childNodes);
|
1969
|
-
} else {
|
1970
|
-
this.innerHTML = html;
|
1971
|
-
}
|
1972
|
-
}
|
1973
|
-
};
|
1974
|
-
|
1975
|
-
html.erase = html.set;
|
1976
|
-
|
1977
|
-
return html;
|
1978
|
-
})();
|
1979
|
-
|
1980
|
-
if (Browser.Engine.webkit && Browser.Engine.version < 420) Element.Properties.text = {
|
1981
|
-
get: function(){
|
1982
|
-
if (this.innerText) return this.innerText;
|
1983
|
-
var temp = this.ownerDocument.newElement('div', {html: this.innerHTML}).inject(this.ownerDocument.body);
|
1984
|
-
var text = temp.innerText;
|
1985
|
-
temp.destroy();
|
1986
|
-
return text;
|
1987
|
-
}
|
1988
|
-
};
|
1989
|
-
|
1990
|
-
|
1991
|
-
/*
|
1992
|
-
Script: Element.Event.js
|
1993
|
-
Contains Element methods for dealing with events, and custom Events.
|
1994
|
-
|
1995
|
-
License:
|
1996
|
-
MIT-style license.
|
1997
|
-
*/
|
1998
|
-
|
1999
|
-
Element.Properties.events = {set: function(events){
|
2000
|
-
this.addEvents(events);
|
2001
|
-
}};
|
2002
|
-
|
2003
|
-
Native.implement([Element, Window, Document], {
|
2004
|
-
|
2005
|
-
addEvent: function(type, fn){
|
2006
|
-
var events = this.retrieve('events', {});
|
2007
|
-
events[type] = events[type] || {'keys': [], 'values': []};
|
2008
|
-
if (events[type].keys.contains(fn)) return this;
|
2009
|
-
events[type].keys.push(fn);
|
2010
|
-
var realType = type, custom = Element.Events.get(type), condition = fn, self = this;
|
2011
|
-
if (custom){
|
2012
|
-
if (custom.onAdd) custom.onAdd.call(this, fn);
|
2013
|
-
if (custom.condition){
|
2014
|
-
condition = function(event){
|
2015
|
-
if (custom.condition.call(this, event)) return fn.call(this, event);
|
2016
|
-
return true;
|
2017
|
-
};
|
2018
|
-
}
|
2019
|
-
realType = custom.base || realType;
|
2020
|
-
}
|
2021
|
-
var defn = function(){
|
2022
|
-
return fn.call(self);
|
2023
|
-
};
|
2024
|
-
var nativeEvent = Element.NativeEvents[realType];
|
2025
|
-
if (nativeEvent){
|
2026
|
-
if (nativeEvent == 2){
|
2027
|
-
defn = function(event){
|
2028
|
-
event = new Event(event, self.getWindow());
|
2029
|
-
if (condition.call(self, event) === false) event.stop();
|
2030
|
-
};
|
2031
|
-
}
|
2032
|
-
this.addListener(realType, defn);
|
2033
|
-
}
|
2034
|
-
events[type].values.push(defn);
|
2035
|
-
return this;
|
2036
|
-
},
|
2037
|
-
|
2038
|
-
removeEvent: function(type, fn){
|
2039
|
-
var events = this.retrieve('events');
|
2040
|
-
if (!events || !events[type]) return this;
|
2041
|
-
var pos = events[type].keys.indexOf(fn);
|
2042
|
-
if (pos == -1) return this;
|
2043
|
-
events[type].keys.splice(pos, 1);
|
2044
|
-
var value = events[type].values.splice(pos, 1)[0];
|
2045
|
-
var custom = Element.Events.get(type);
|
2046
|
-
if (custom){
|
2047
|
-
if (custom.onRemove) custom.onRemove.call(this, fn);
|
2048
|
-
type = custom.base || type;
|
2049
|
-
}
|
2050
|
-
return (Element.NativeEvents[type]) ? this.removeListener(type, value) : this;
|
2051
|
-
},
|
2052
|
-
|
2053
|
-
addEvents: function(events){
|
2054
|
-
for (var event in events) this.addEvent(event, events[event]);
|
2055
|
-
return this;
|
2056
|
-
},
|
2057
|
-
|
2058
|
-
removeEvents: function(events){
|
2059
|
-
var type;
|
2060
|
-
if ($type(events) == 'object'){
|
2061
|
-
for (type in events) this.removeEvent(type, events[type]);
|
2062
|
-
return this;
|
2063
|
-
}
|
2064
|
-
var attached = this.retrieve('events');
|
2065
|
-
if (!attached) return this;
|
2066
|
-
if (!events){
|
2067
|
-
for (type in attached) this.removeEvents(type);
|
2068
|
-
this.eliminate('events');
|
2069
|
-
} else if (attached[events]){
|
2070
|
-
while (attached[events].keys[0]) this.removeEvent(events, attached[events].keys[0]);
|
2071
|
-
attached[events] = null;
|
2072
|
-
}
|
2073
|
-
return this;
|
2074
|
-
},
|
2075
|
-
|
2076
|
-
fireEvent: function(type, args, delay){
|
2077
|
-
var events = this.retrieve('events');
|
2078
|
-
if (!events || !events[type]) return this;
|
2079
|
-
events[type].keys.each(function(fn){
|
2080
|
-
fn.create({'bind': this, 'delay': delay, 'arguments': args})();
|
2081
|
-
}, this);
|
2082
|
-
return this;
|
2083
|
-
},
|
2084
|
-
|
2085
|
-
cloneEvents: function(from, type){
|
2086
|
-
from = document.id(from);
|
2087
|
-
var fevents = from.retrieve('events');
|
2088
|
-
if (!fevents) return this;
|
2089
|
-
if (!type){
|
2090
|
-
for (var evType in fevents) this.cloneEvents(from, evType);
|
2091
|
-
} else if (fevents[type]){
|
2092
|
-
fevents[type].keys.each(function(fn){
|
2093
|
-
this.addEvent(type, fn);
|
2094
|
-
}, this);
|
2095
|
-
}
|
2096
|
-
return this;
|
2097
|
-
}
|
2098
|
-
|
2099
|
-
});
|
2100
|
-
|
2101
|
-
Element.NativeEvents = {
|
2102
|
-
click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons
|
2103
|
-
mousewheel: 2, DOMMouseScroll: 2, //mouse wheel
|
2104
|
-
mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement
|
2105
|
-
keydown: 2, keypress: 2, keyup: 2, //keyboard
|
2106
|
-
focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, //form elements
|
2107
|
-
load: 1, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window
|
2108
|
-
error: 1, abort: 1, scroll: 1 //misc
|
2109
|
-
};
|
2110
|
-
|
2111
|
-
(function(){
|
2112
|
-
|
2113
|
-
var $check = function(event){
|
2114
|
-
var related = event.relatedTarget;
|
2115
|
-
if (related == undefined) return true;
|
2116
|
-
if (related === false) return false;
|
2117
|
-
return ($type(this) != 'document' && related != this && related.prefix != 'xul' && !this.hasChild(related));
|
2118
|
-
};
|
2119
|
-
|
2120
|
-
Element.Events = new Hash({
|
2121
|
-
|
2122
|
-
mouseenter: {
|
2123
|
-
base: 'mouseover',
|
2124
|
-
condition: $check
|
2125
|
-
},
|
2126
|
-
|
2127
|
-
mouseleave: {
|
2128
|
-
base: 'mouseout',
|
2129
|
-
condition: $check
|
2130
|
-
},
|
2131
|
-
|
2132
|
-
mousewheel: {
|
2133
|
-
base: (Browser.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel'
|
2134
|
-
}
|
2135
|
-
|
2136
|
-
});
|
2137
|
-
|
2138
|
-
})();
|
2139
|
-
|
2140
|
-
|
2141
|
-
/*
|
2142
|
-
Script: Element.Style.js
|
2143
|
-
Contains methods for interacting with the styles of Elements in a fashionable way.
|
2144
|
-
|
2145
|
-
License:
|
2146
|
-
MIT-style license.
|
2147
|
-
*/
|
2148
|
-
|
2149
|
-
Element.Properties.styles = {set: function(styles){
|
2150
|
-
this.setStyles(styles);
|
2151
|
-
}};
|
2152
|
-
|
2153
|
-
Element.Properties.opacity = {
|
2154
|
-
|
2155
|
-
set: function(opacity, novisibility){
|
2156
|
-
if (!novisibility){
|
2157
|
-
if (opacity == 0){
|
2158
|
-
if (this.style.visibility != 'hidden') this.style.visibility = 'hidden';
|
2159
|
-
} else {
|
2160
|
-
if (this.style.visibility != 'visible') this.style.visibility = 'visible';
|
2161
|
-
}
|
2162
|
-
}
|
2163
|
-
if (!this.currentStyle || !this.currentStyle.hasLayout) this.style.zoom = 1;
|
2164
|
-
if (Browser.Engine.trident) this.style.filter = (opacity == 1) ? '' : 'alpha(opacity=' + opacity * 100 + ')';
|
2165
|
-
this.style.opacity = opacity;
|
2166
|
-
this.store('opacity', opacity);
|
2167
|
-
},
|
2168
|
-
|
2169
|
-
get: function(){
|
2170
|
-
return this.retrieve('opacity', 1);
|
2171
|
-
}
|
2172
|
-
|
2173
|
-
};
|
2174
|
-
|
2175
|
-
Element.implement({
|
2176
|
-
|
2177
|
-
setOpacity: function(value){
|
2178
|
-
return this.set('opacity', value, true);
|
2179
|
-
},
|
2180
|
-
|
2181
|
-
getOpacity: function(){
|
2182
|
-
return this.get('opacity');
|
2183
|
-
},
|
2184
|
-
|
2185
|
-
setStyle: function(property, value){
|
2186
|
-
switch (property){
|
2187
|
-
case 'opacity': return this.set('opacity', parseFloat(value));
|
2188
|
-
case 'float': property = (Browser.Engine.trident) ? 'styleFloat' : 'cssFloat';
|
2189
|
-
}
|
2190
|
-
property = property.camelCase();
|
2191
|
-
if ($type(value) != 'string'){
|
2192
|
-
var map = (Element.Styles.get(property) || '@').split(' ');
|
2193
|
-
value = $splat(value).map(function(val, i){
|
2194
|
-
if (!map[i]) return '';
|
2195
|
-
return ($type(val) == 'number') ? map[i].replace('@', Math.round(val)) : val;
|
2196
|
-
}).join(' ');
|
2197
|
-
} else if (value == String(Number(value))){
|
2198
|
-
value = Math.round(value);
|
2199
|
-
}
|
2200
|
-
this.style[property] = value;
|
2201
|
-
return this;
|
2202
|
-
},
|
2203
|
-
|
2204
|
-
getStyle: function(property){
|
2205
|
-
switch (property){
|
2206
|
-
case 'opacity': return this.get('opacity');
|
2207
|
-
case 'float': property = (Browser.Engine.trident) ? 'styleFloat' : 'cssFloat';
|
2208
|
-
}
|
2209
|
-
property = property.camelCase();
|
2210
|
-
var result = this.style[property];
|
2211
|
-
if (!$chk(result)){
|
2212
|
-
result = [];
|
2213
|
-
for (var style in Element.ShortStyles){
|
2214
|
-
if (property != style) continue;
|
2215
|
-
for (var s in Element.ShortStyles[style]) result.push(this.getStyle(s));
|
2216
|
-
return result.join(' ');
|
2217
|
-
}
|
2218
|
-
result = this.getComputedStyle(property);
|
2219
|
-
}
|
2220
|
-
if (result){
|
2221
|
-
result = String(result);
|
2222
|
-
var color = result.match(/rgba?\([\d\s,]+\)/);
|
2223
|
-
if (color) result = result.replace(color[0], color[0].rgbToHex());
|
2224
|
-
}
|
2225
|
-
if (Browser.Engine.presto || (Browser.Engine.trident && !$chk(parseInt(result, 10)))){
|
2226
|
-
if (property.test(/^(height|width)$/)){
|
2227
|
-
var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0;
|
2228
|
-
values.each(function(value){
|
2229
|
-
size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt();
|
2230
|
-
}, this);
|
2231
|
-
return this['offset' + property.capitalize()] - size + 'px';
|
2232
|
-
}
|
2233
|
-
if ((Browser.Engine.presto) && String(result).test('px')) return result;
|
2234
|
-
if (property.test(/(border(.+)Width|margin|padding)/)) return '0px';
|
2235
|
-
}
|
2236
|
-
return result;
|
2237
|
-
},
|
2238
|
-
|
2239
|
-
setStyles: function(styles){
|
2240
|
-
for (var style in styles) this.setStyle(style, styles[style]);
|
2241
|
-
return this;
|
2242
|
-
},
|
2243
|
-
|
2244
|
-
getStyles: function(){
|
2245
|
-
var result = {};
|
2246
|
-
Array.flatten(arguments).each(function(key){
|
2247
|
-
result[key] = this.getStyle(key);
|
2248
|
-
}, this);
|
2249
|
-
return result;
|
2250
|
-
}
|
2251
|
-
|
2252
|
-
});
|
2253
|
-
|
2254
|
-
Element.Styles = new Hash({
|
2255
|
-
left: '@px', top: '@px', bottom: '@px', right: '@px',
|
2256
|
-
width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px',
|
2257
|
-
backgroundColor: 'rgb(@, @, @)', backgroundPosition: '@px @px', color: 'rgb(@, @, @)',
|
2258
|
-
fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)',
|
2259
|
-
margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',
|
2260
|
-
borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',
|
2261
|
-
zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@'
|
2262
|
-
});
|
2263
|
-
|
2264
|
-
Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}};
|
2265
|
-
|
2266
|
-
['Top', 'Right', 'Bottom', 'Left'].each(function(direction){
|
2267
|
-
var Short = Element.ShortStyles;
|
2268
|
-
var All = Element.Styles;
|
2269
|
-
['margin', 'padding'].each(function(style){
|
2270
|
-
var sd = style + direction;
|
2271
|
-
Short[style][sd] = All[sd] = '@px';
|
2272
|
-
});
|
2273
|
-
var bd = 'border' + direction;
|
2274
|
-
Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)';
|
2275
|
-
var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color';
|
2276
|
-
Short[bd] = {};
|
2277
|
-
Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px';
|
2278
|
-
Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@';
|
2279
|
-
Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)';
|
2280
|
-
});
|
2281
|
-
|
2282
|
-
|
2283
|
-
/*
|
2284
|
-
Script: Element.Dimensions.js
|
2285
|
-
Contains methods to work with size, scroll, or positioning of Elements and the window object.
|
2286
|
-
|
2287
|
-
License:
|
2288
|
-
MIT-style license.
|
2289
|
-
|
2290
|
-
Credits:
|
2291
|
-
- Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html).
|
2292
|
-
- Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html).
|
2293
|
-
*/
|
2294
|
-
|
2295
|
-
(function(){
|
2296
|
-
|
2297
|
-
Element.implement({
|
2298
|
-
|
2299
|
-
scrollTo: function(x, y){
|
2300
|
-
if (isBody(this)){
|
2301
|
-
this.getWindow().scrollTo(x, y);
|
2302
|
-
} else {
|
2303
|
-
this.scrollLeft = x;
|
2304
|
-
this.scrollTop = y;
|
2305
|
-
}
|
2306
|
-
return this;
|
2307
|
-
},
|
2308
|
-
|
2309
|
-
getSize: function(){
|
2310
|
-
if (isBody(this)) return this.getWindow().getSize();
|
2311
|
-
return {x: this.offsetWidth, y: this.offsetHeight};
|
2312
|
-
},
|
2313
|
-
|
2314
|
-
getScrollSize: function(){
|
2315
|
-
if (isBody(this)) return this.getWindow().getScrollSize();
|
2316
|
-
return {x: this.scrollWidth, y: this.scrollHeight};
|
2317
|
-
},
|
2318
|
-
|
2319
|
-
getScroll: function(){
|
2320
|
-
if (isBody(this)) return this.getWindow().getScroll();
|
2321
|
-
return {x: this.scrollLeft, y: this.scrollTop};
|
2322
|
-
},
|
2323
|
-
|
2324
|
-
getScrolls: function(){
|
2325
|
-
var element = this, position = {x: 0, y: 0};
|
2326
|
-
while (element && !isBody(element)){
|
2327
|
-
position.x += element.scrollLeft;
|
2328
|
-
position.y += element.scrollTop;
|
2329
|
-
element = element.parentNode;
|
2330
|
-
}
|
2331
|
-
return position;
|
2332
|
-
},
|
2333
|
-
|
2334
|
-
getOffsetParent: function(){
|
2335
|
-
var element = this;
|
2336
|
-
if (isBody(element)) return null;
|
2337
|
-
if (!Browser.Engine.trident) return element.offsetParent;
|
2338
|
-
while ((element = element.parentNode) && !isBody(element)){
|
2339
|
-
if (styleString(element, 'position') != 'static') return element;
|
2340
|
-
}
|
2341
|
-
return null;
|
2342
|
-
},
|
2343
|
-
|
2344
|
-
getOffsets: function(){
|
2345
|
-
if (this.getBoundingClientRect){
|
2346
|
-
var bound = this.getBoundingClientRect(),
|
2347
|
-
html = document.id(this.getDocument().documentElement),
|
2348
|
-
scroll = html.getScroll(),
|
2349
|
-
isFixed = (styleString(this, 'position') == 'fixed');
|
2350
|
-
return {
|
2351
|
-
x: parseInt(bound.left, 10) + ((isFixed) ? 0 : scroll.x) - html.clientLeft,
|
2352
|
-
y: parseInt(bound.top, 10) + ((isFixed) ? 0 : scroll.y) - html.clientTop
|
2353
|
-
};
|
2354
|
-
}
|
2355
|
-
|
2356
|
-
var element = this, position = {x: 0, y: 0};
|
2357
|
-
if (isBody(this)) return position;
|
2358
|
-
|
2359
|
-
while (element && !isBody(element)){
|
2360
|
-
position.x += element.offsetLeft;
|
2361
|
-
position.y += element.offsetTop;
|
2362
|
-
|
2363
|
-
if (Browser.Engine.gecko){
|
2364
|
-
if (!borderBox(element)){
|
2365
|
-
position.x += leftBorder(element);
|
2366
|
-
position.y += topBorder(element);
|
2367
|
-
}
|
2368
|
-
var parent = element.parentNode;
|
2369
|
-
if (parent && styleString(parent, 'overflow') != 'visible'){
|
2370
|
-
position.x += leftBorder(parent);
|
2371
|
-
position.y += topBorder(parent);
|
2372
|
-
}
|
2373
|
-
} else if (element != this && Browser.Engine.webkit){
|
2374
|
-
position.x += leftBorder(element);
|
2375
|
-
position.y += topBorder(element);
|
2376
|
-
}
|
2377
|
-
|
2378
|
-
element = element.offsetParent;
|
2379
|
-
}
|
2380
|
-
if (Browser.Engine.gecko && !borderBox(this)){
|
2381
|
-
position.x -= leftBorder(this);
|
2382
|
-
position.y -= topBorder(this);
|
2383
|
-
}
|
2384
|
-
return position;
|
2385
|
-
},
|
2386
|
-
|
2387
|
-
getPosition: function(relative){
|
2388
|
-
if (isBody(this)) return {x: 0, y: 0};
|
2389
|
-
var offset = this.getOffsets(), scroll = this.getScrolls();
|
2390
|
-
var position = {x: offset.x - scroll.x, y: offset.y - scroll.y};
|
2391
|
-
var relativePosition = (relative && (relative = document.id(relative))) ? relative.getPosition() : {x: 0, y: 0};
|
2392
|
-
return {x: position.x - relativePosition.x, y: position.y - relativePosition.y};
|
2393
|
-
},
|
2394
|
-
|
2395
|
-
getCoordinates: function(element){
|
2396
|
-
if (isBody(this)) return this.getWindow().getCoordinates();
|
2397
|
-
var position = this.getPosition(element), size = this.getSize();
|
2398
|
-
var obj = {left: position.x, top: position.y, width: size.x, height: size.y};
|
2399
|
-
obj.right = obj.left + obj.width;
|
2400
|
-
obj.bottom = obj.top + obj.height;
|
2401
|
-
return obj;
|
2402
|
-
},
|
2403
|
-
|
2404
|
-
computePosition: function(obj){
|
2405
|
-
return {left: obj.x - styleNumber(this, 'margin-left'), top: obj.y - styleNumber(this, 'margin-top')};
|
2406
|
-
},
|
2407
|
-
|
2408
|
-
setPosition: function(obj){
|
2409
|
-
return this.setStyles(this.computePosition(obj));
|
2410
|
-
}
|
2411
|
-
|
2412
|
-
});
|
2413
|
-
|
2414
|
-
|
2415
|
-
Native.implement([Document, Window], {
|
2416
|
-
|
2417
|
-
getSize: function(){
|
2418
|
-
if (Browser.Engine.presto || Browser.Engine.webkit) {
|
2419
|
-
var win = this.getWindow();
|
2420
|
-
return {x: win.innerWidth, y: win.innerHeight};
|
2421
|
-
}
|
2422
|
-
var doc = getCompatElement(this);
|
2423
|
-
return {x: doc.clientWidth, y: doc.clientHeight};
|
2424
|
-
},
|
2425
|
-
|
2426
|
-
getScroll: function(){
|
2427
|
-
var win = this.getWindow(), doc = getCompatElement(this);
|
2428
|
-
return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop};
|
2429
|
-
},
|
2430
|
-
|
2431
|
-
getScrollSize: function(){
|
2432
|
-
var doc = getCompatElement(this), min = this.getSize();
|
2433
|
-
return {x: Math.max(doc.scrollWidth, min.x), y: Math.max(doc.scrollHeight, min.y)};
|
2434
|
-
},
|
2435
|
-
|
2436
|
-
getPosition: function(){
|
2437
|
-
return {x: 0, y: 0};
|
2438
|
-
},
|
2439
|
-
|
2440
|
-
getCoordinates: function(){
|
2441
|
-
var size = this.getSize();
|
2442
|
-
return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x};
|
2443
|
-
}
|
2444
|
-
|
2445
|
-
});
|
2446
|
-
|
2447
|
-
// private methods
|
2448
|
-
|
2449
|
-
var styleString = Element.getComputedStyle;
|
2450
|
-
|
2451
|
-
function styleNumber(element, style){
|
2452
|
-
return styleString(element, style).toInt() || 0;
|
2453
|
-
};
|
2454
|
-
|
2455
|
-
function borderBox(element){
|
2456
|
-
return styleString(element, '-moz-box-sizing') == 'border-box';
|
2457
|
-
};
|
2458
|
-
|
2459
|
-
function topBorder(element){
|
2460
|
-
return styleNumber(element, 'border-top-width');
|
2461
|
-
};
|
2462
|
-
|
2463
|
-
function leftBorder(element){
|
2464
|
-
return styleNumber(element, 'border-left-width');
|
2465
|
-
};
|
2466
|
-
|
2467
|
-
function isBody(element){
|
2468
|
-
return (/^(?:body|html)$/i).test(element.tagName);
|
2469
|
-
};
|
2470
|
-
|
2471
|
-
function getCompatElement(element){
|
2472
|
-
var doc = element.getDocument();
|
2473
|
-
return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
|
2474
|
-
};
|
2475
|
-
|
2476
|
-
})();
|
2477
|
-
|
2478
|
-
//aliases
|
2479
|
-
Element.alias('setPosition', 'position'); //compatability
|
2480
|
-
|
2481
|
-
Native.implement([Window, Document, Element], {
|
2482
|
-
|
2483
|
-
getHeight: function(){
|
2484
|
-
return this.getSize().y;
|
2485
|
-
},
|
2486
|
-
|
2487
|
-
getWidth: function(){
|
2488
|
-
return this.getSize().x;
|
2489
|
-
},
|
2490
|
-
|
2491
|
-
getScrollTop: function(){
|
2492
|
-
return this.getScroll().y;
|
2493
|
-
},
|
2494
|
-
|
2495
|
-
getScrollLeft: function(){
|
2496
|
-
return this.getScroll().x;
|
2497
|
-
},
|
2498
|
-
|
2499
|
-
getScrollHeight: function(){
|
2500
|
-
return this.getScrollSize().y;
|
2501
|
-
},
|
2502
|
-
|
2503
|
-
getScrollWidth: function(){
|
2504
|
-
return this.getScrollSize().x;
|
2505
|
-
},
|
2506
|
-
|
2507
|
-
getTop: function(){
|
2508
|
-
return this.getPosition().y;
|
2509
|
-
},
|
2510
|
-
|
2511
|
-
getLeft: function(){
|
2512
|
-
return this.getPosition().x;
|
2513
|
-
}
|
2514
|
-
|
2515
|
-
});
|
2516
|
-
|
2517
|
-
|
2518
|
-
/*
|
2519
|
-
Script: Selectors.js
|
2520
|
-
Adds advanced CSS Querying capabilities for targeting elements. Also includes pseudoselectors support.
|
2521
|
-
|
2522
|
-
License:
|
2523
|
-
MIT-style license.
|
2524
|
-
*/
|
2525
|
-
|
2526
|
-
Native.implement([Document, Element], {
|
2527
|
-
|
2528
|
-
getElements: function(expression, nocash){
|
2529
|
-
expression = expression.split(',');
|
2530
|
-
var items, local = {};
|
2531
|
-
for (var i = 0, l = expression.length; i < l; i++){
|
2532
|
-
var selector = expression[i], elements = Selectors.Utils.search(this, selector, local);
|
2533
|
-
if (i != 0 && elements.item) elements = $A(elements);
|
2534
|
-
items = (i == 0) ? elements : (items.item) ? $A(items).concat(elements) : items.concat(elements);
|
2535
|
-
}
|
2536
|
-
return new Elements(items, {ddup: (expression.length > 1), cash: !nocash});
|
2537
|
-
}
|
2538
|
-
|
2539
|
-
});
|
2540
|
-
|
2541
|
-
Element.implement({
|
2542
|
-
|
2543
|
-
match: function(selector){
|
2544
|
-
if (!selector || (selector == this)) return true;
|
2545
|
-
var tagid = Selectors.Utils.parseTagAndID(selector);
|
2546
|
-
var tag = tagid[0], id = tagid[1];
|
2547
|
-
if (!Selectors.Filters.byID(this, id) || !Selectors.Filters.byTag(this, tag)) return false;
|
2548
|
-
var parsed = Selectors.Utils.parseSelector(selector);
|
2549
|
-
return (parsed) ? Selectors.Utils.filter(this, parsed, {}) : true;
|
2550
|
-
}
|
2551
|
-
|
2552
|
-
});
|
2553
|
-
|
2554
|
-
var Selectors = {Cache: {nth: {}, parsed: {}}};
|
2555
|
-
|
2556
|
-
Selectors.RegExps = {
|
2557
|
-
id: (/#([\w-]+)/),
|
2558
|
-
tag: (/^(\w+|\*)/),
|
2559
|
-
quick: (/^(\w+|\*)$/),
|
2560
|
-
splitter: (/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),
|
2561
|
-
combined: (/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)
|
2562
|
-
};
|
2563
|
-
|
2564
|
-
Selectors.Utils = {
|
2565
|
-
|
2566
|
-
chk: function(item, uniques){
|
2567
|
-
if (!uniques) return true;
|
2568
|
-
var uid = $uid(item);
|
2569
|
-
if (!uniques[uid]) return uniques[uid] = true;
|
2570
|
-
return false;
|
2571
|
-
},
|
2572
|
-
|
2573
|
-
parseNthArgument: function(argument){
|
2574
|
-
if (Selectors.Cache.nth[argument]) return Selectors.Cache.nth[argument];
|
2575
|
-
var parsed = argument.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);
|
2576
|
-
if (!parsed) return false;
|
2577
|
-
var inta = parseInt(parsed[1], 10);
|
2578
|
-
var a = (inta || inta === 0) ? inta : 1;
|
2579
|
-
var special = parsed[2] || false;
|
2580
|
-
var b = parseInt(parsed[3], 10) || 0;
|
2581
|
-
if (a != 0){
|
2582
|
-
b--;
|
2583
|
-
while (b < 1) b += a;
|
2584
|
-
while (b >= a) b -= a;
|
2585
|
-
} else {
|
2586
|
-
a = b;
|
2587
|
-
special = 'index';
|
2588
|
-
}
|
2589
|
-
switch (special){
|
2590
|
-
case 'n': parsed = {a: a, b: b, special: 'n'}; break;
|
2591
|
-
case 'odd': parsed = {a: 2, b: 0, special: 'n'}; break;
|
2592
|
-
case 'even': parsed = {a: 2, b: 1, special: 'n'}; break;
|
2593
|
-
case 'first': parsed = {a: 0, special: 'index'}; break;
|
2594
|
-
case 'last': parsed = {special: 'last-child'}; break;
|
2595
|
-
case 'only': parsed = {special: 'only-child'}; break;
|
2596
|
-
default: parsed = {a: (a - 1), special: 'index'};
|
2597
|
-
}
|
2598
|
-
|
2599
|
-
return Selectors.Cache.nth[argument] = parsed;
|
2600
|
-
},
|
2601
|
-
|
2602
|
-
parseSelector: function(selector){
|
2603
|
-
if (Selectors.Cache.parsed[selector]) return Selectors.Cache.parsed[selector];
|
2604
|
-
var m, parsed = {classes: [], pseudos: [], attributes: []};
|
2605
|
-
while ((m = Selectors.RegExps.combined.exec(selector))){
|
2606
|
-
var cn = m[1], an = m[2], ao = m[3], av = m[5], pn = m[6], pa = m[7];
|
2607
|
-
if (cn){
|
2608
|
-
parsed.classes.push(cn);
|
2609
|
-
} else if (pn){
|
2610
|
-
var parser = Selectors.Pseudo.get(pn);
|
2611
|
-
if (parser) parsed.pseudos.push({parser: parser, argument: pa});
|
2612
|
-
else parsed.attributes.push({name: pn, operator: '=', value: pa});
|
2613
|
-
} else if (an){
|
2614
|
-
parsed.attributes.push({name: an, operator: ao, value: av});
|
2615
|
-
}
|
2616
|
-
}
|
2617
|
-
if (!parsed.classes.length) delete parsed.classes;
|
2618
|
-
if (!parsed.attributes.length) delete parsed.attributes;
|
2619
|
-
if (!parsed.pseudos.length) delete parsed.pseudos;
|
2620
|
-
if (!parsed.classes && !parsed.attributes && !parsed.pseudos) parsed = null;
|
2621
|
-
return Selectors.Cache.parsed[selector] = parsed;
|
2622
|
-
},
|
2623
|
-
|
2624
|
-
parseTagAndID: function(selector){
|
2625
|
-
var tag = selector.match(Selectors.RegExps.tag);
|
2626
|
-
var id = selector.match(Selectors.RegExps.id);
|
2627
|
-
return [(tag) ? tag[1] : '*', (id) ? id[1] : false];
|
2628
|
-
},
|
2629
|
-
|
2630
|
-
filter: function(item, parsed, local){
|
2631
|
-
var i;
|
2632
|
-
if (parsed.classes){
|
2633
|
-
for (i = parsed.classes.length; i--; i){
|
2634
|
-
var cn = parsed.classes[i];
|
2635
|
-
if (!Selectors.Filters.byClass(item, cn)) return false;
|
2636
|
-
}
|
2637
|
-
}
|
2638
|
-
if (parsed.attributes){
|
2639
|
-
for (i = parsed.attributes.length; i--; i){
|
2640
|
-
var att = parsed.attributes[i];
|
2641
|
-
if (!Selectors.Filters.byAttribute(item, att.name, att.operator, att.value)) return false;
|
2642
|
-
}
|
2643
|
-
}
|
2644
|
-
if (parsed.pseudos){
|
2645
|
-
for (i = parsed.pseudos.length; i--; i){
|
2646
|
-
var psd = parsed.pseudos[i];
|
2647
|
-
if (!Selectors.Filters.byPseudo(item, psd.parser, psd.argument, local)) return false;
|
2648
|
-
}
|
2649
|
-
}
|
2650
|
-
return true;
|
2651
|
-
},
|
2652
|
-
|
2653
|
-
getByTagAndID: function(ctx, tag, id){
|
2654
|
-
if (id){
|
2655
|
-
var item = (ctx.getElementById) ? ctx.getElementById(id, true) : Element.getElementById(ctx, id, true);
|
2656
|
-
return (item && Selectors.Filters.byTag(item, tag)) ? [item] : [];
|
2657
|
-
} else {
|
2658
|
-
return ctx.getElementsByTagName(tag);
|
2659
|
-
}
|
2660
|
-
},
|
2661
|
-
|
2662
|
-
search: function(self, expression, local){
|
2663
|
-
var splitters = [];
|
2664
|
-
|
2665
|
-
var selectors = expression.trim().replace(Selectors.RegExps.splitter, function(m0, m1, m2){
|
2666
|
-
splitters.push(m1);
|
2667
|
-
return ':)' + m2;
|
2668
|
-
}).split(':)');
|
2669
|
-
|
2670
|
-
var items, filtered, item;
|
2671
|
-
|
2672
|
-
for (var i = 0, l = selectors.length; i < l; i++){
|
2673
|
-
|
2674
|
-
var selector = selectors[i];
|
2675
|
-
|
2676
|
-
if (i == 0 && Selectors.RegExps.quick.test(selector)){
|
2677
|
-
items = self.getElementsByTagName(selector);
|
2678
|
-
continue;
|
2679
|
-
}
|
2680
|
-
|
2681
|
-
var splitter = splitters[i - 1];
|
2682
|
-
|
2683
|
-
var tagid = Selectors.Utils.parseTagAndID(selector);
|
2684
|
-
var tag = tagid[0], id = tagid[1];
|
2685
|
-
|
2686
|
-
if (i == 0){
|
2687
|
-
items = Selectors.Utils.getByTagAndID(self, tag, id);
|
2688
|
-
} else {
|
2689
|
-
var uniques = {}, found = [];
|
2690
|
-
for (var j = 0, k = items.length; j < k; j++) found = Selectors.Getters[splitter](found, items[j], tag, id, uniques);
|
2691
|
-
items = found;
|
2692
|
-
}
|
2693
|
-
|
2694
|
-
var parsed = Selectors.Utils.parseSelector(selector);
|
2695
|
-
|
2696
|
-
if (parsed){
|
2697
|
-
filtered = [];
|
2698
|
-
for (var m = 0, n = items.length; m < n; m++){
|
2699
|
-
item = items[m];
|
2700
|
-
if (Selectors.Utils.filter(item, parsed, local)) filtered.push(item);
|
2701
|
-
}
|
2702
|
-
items = filtered;
|
2703
|
-
}
|
2704
|
-
|
2705
|
-
}
|
2706
|
-
|
2707
|
-
return items;
|
2708
|
-
|
2709
|
-
}
|
2710
|
-
|
2711
|
-
};
|
2712
|
-
|
2713
|
-
Selectors.Getters = {
|
2714
|
-
|
2715
|
-
' ': function(found, self, tag, id, uniques){
|
2716
|
-
var items = Selectors.Utils.getByTagAndID(self, tag, id);
|
2717
|
-
for (var i = 0, l = items.length; i < l; i++){
|
2718
|
-
var item = items[i];
|
2719
|
-
if (Selectors.Utils.chk(item, uniques)) found.push(item);
|
2720
|
-
}
|
2721
|
-
return found;
|
2722
|
-
},
|
2723
|
-
|
2724
|
-
'>': function(found, self, tag, id, uniques){
|
2725
|
-
var children = Selectors.Utils.getByTagAndID(self, tag, id);
|
2726
|
-
for (var i = 0, l = children.length; i < l; i++){
|
2727
|
-
var child = children[i];
|
2728
|
-
if (child.parentNode == self && Selectors.Utils.chk(child, uniques)) found.push(child);
|
2729
|
-
}
|
2730
|
-
return found;
|
2731
|
-
},
|
2732
|
-
|
2733
|
-
'+': function(found, self, tag, id, uniques){
|
2734
|
-
while ((self = self.nextSibling)){
|
2735
|
-
if (self.nodeType == 1){
|
2736
|
-
if (Selectors.Utils.chk(self, uniques) && Selectors.Filters.byTag(self, tag) && Selectors.Filters.byID(self, id)) found.push(self);
|
2737
|
-
break;
|
2738
|
-
}
|
2739
|
-
}
|
2740
|
-
return found;
|
2741
|
-
},
|
2742
|
-
|
2743
|
-
'~': function(found, self, tag, id, uniques){
|
2744
|
-
while ((self = self.nextSibling)){
|
2745
|
-
if (self.nodeType == 1){
|
2746
|
-
if (!Selectors.Utils.chk(self, uniques)) break;
|
2747
|
-
if (Selectors.Filters.byTag(self, tag) && Selectors.Filters.byID(self, id)) found.push(self);
|
2748
|
-
}
|
2749
|
-
}
|
2750
|
-
return found;
|
2751
|
-
}
|
2752
|
-
|
2753
|
-
};
|
2754
|
-
|
2755
|
-
Selectors.Filters = {
|
2756
|
-
|
2757
|
-
byTag: function(self, tag){
|
2758
|
-
return (tag == '*' || (self.tagName && self.tagName.toLowerCase() == tag));
|
2759
|
-
},
|
2760
|
-
|
2761
|
-
byID: function(self, id){
|
2762
|
-
return (!id || (self.id && self.id == id));
|
2763
|
-
},
|
2764
|
-
|
2765
|
-
byClass: function(self, klass){
|
2766
|
-
return (self.className && self.className.contains(klass, ' '));
|
2767
|
-
},
|
2768
|
-
|
2769
|
-
byPseudo: function(self, parser, argument, local){
|
2770
|
-
return parser.call(self, argument, local);
|
2771
|
-
},
|
2772
|
-
|
2773
|
-
byAttribute: function(self, name, operator, value){
|
2774
|
-
var result = Element.prototype.getProperty.call(self, name);
|
2775
|
-
if (!result) return (operator == '!=');
|
2776
|
-
if (!operator || value == undefined) return true;
|
2777
|
-
switch (operator){
|
2778
|
-
case '=': return (result == value);
|
2779
|
-
case '*=': return (result.contains(value));
|
2780
|
-
case '^=': return (result.substr(0, value.length) == value);
|
2781
|
-
case '$=': return (result.substr(result.length - value.length) == value);
|
2782
|
-
case '!=': return (result != value);
|
2783
|
-
case '~=': return result.contains(value, ' ');
|
2784
|
-
case '|=': return result.contains(value, '-');
|
2785
|
-
}
|
2786
|
-
return false;
|
2787
|
-
}
|
2788
|
-
|
2789
|
-
};
|
2790
|
-
|
2791
|
-
Selectors.Pseudo = new Hash({
|
2792
|
-
|
2793
|
-
// w3c pseudo selectors
|
2794
|
-
|
2795
|
-
checked: function(){
|
2796
|
-
return this.checked;
|
2797
|
-
},
|
2798
|
-
|
2799
|
-
empty: function(){
|
2800
|
-
return !(this.innerText || this.textContent || '').length;
|
2801
|
-
},
|
2802
|
-
|
2803
|
-
not: function(selector){
|
2804
|
-
return !Element.match(this, selector);
|
2805
|
-
},
|
2806
|
-
|
2807
|
-
contains: function(text){
|
2808
|
-
return (this.innerText || this.textContent || '').contains(text);
|
2809
|
-
},
|
2810
|
-
|
2811
|
-
'first-child': function(){
|
2812
|
-
return Selectors.Pseudo.index.call(this, 0);
|
2813
|
-
},
|
2814
|
-
|
2815
|
-
'last-child': function(){
|
2816
|
-
var element = this;
|
2817
|
-
while ((element = element.nextSibling)){
|
2818
|
-
if (element.nodeType == 1) return false;
|
2819
|
-
}
|
2820
|
-
return true;
|
2821
|
-
},
|
2822
|
-
|
2823
|
-
'only-child': function(){
|
2824
|
-
var prev = this;
|
2825
|
-
while ((prev = prev.previousSibling)){
|
2826
|
-
if (prev.nodeType == 1) return false;
|
2827
|
-
}
|
2828
|
-
var next = this;
|
2829
|
-
while ((next = next.nextSibling)){
|
2830
|
-
if (next.nodeType == 1) return false;
|
2831
|
-
}
|
2832
|
-
return true;
|
2833
|
-
},
|
2834
|
-
|
2835
|
-
'nth-child': function(argument, local){
|
2836
|
-
argument = (argument == undefined) ? 'n' : argument;
|
2837
|
-
var parsed = Selectors.Utils.parseNthArgument(argument);
|
2838
|
-
if (parsed.special != 'n') return Selectors.Pseudo[parsed.special].call(this, parsed.a, local);
|
2839
|
-
var count = 0;
|
2840
|
-
local.positions = local.positions || {};
|
2841
|
-
var uid = $uid(this);
|
2842
|
-
if (!local.positions[uid]){
|
2843
|
-
var self = this;
|
2844
|
-
while ((self = self.previousSibling)){
|
2845
|
-
if (self.nodeType != 1) continue;
|
2846
|
-
count ++;
|
2847
|
-
var position = local.positions[$uid(self)];
|
2848
|
-
if (position != undefined){
|
2849
|
-
count = position + count;
|
2850
|
-
break;
|
2851
|
-
}
|
2852
|
-
}
|
2853
|
-
local.positions[uid] = count;
|
2854
|
-
}
|
2855
|
-
return (local.positions[uid] % parsed.a == parsed.b);
|
2856
|
-
},
|
2857
|
-
|
2858
|
-
// custom pseudo selectors
|
2859
|
-
|
2860
|
-
index: function(index){
|
2861
|
-
var element = this, count = 0;
|
2862
|
-
while ((element = element.previousSibling)){
|
2863
|
-
if (element.nodeType == 1 && ++count > index) return false;
|
2864
|
-
}
|
2865
|
-
return (count == index);
|
2866
|
-
},
|
2867
|
-
|
2868
|
-
even: function(argument, local){
|
2869
|
-
return Selectors.Pseudo['nth-child'].call(this, '2n+1', local);
|
2870
|
-
},
|
2871
|
-
|
2872
|
-
odd: function(argument, local){
|
2873
|
-
return Selectors.Pseudo['nth-child'].call(this, '2n', local);
|
2874
|
-
},
|
2875
|
-
|
2876
|
-
selected: function(){
|
2877
|
-
return this.selected;
|
2878
|
-
},
|
2879
|
-
|
2880
|
-
enabled: function(){
|
2881
|
-
return (this.disabled === false);
|
2882
|
-
}
|
2883
|
-
|
2884
|
-
});
|
2885
|
-
|
2886
|
-
|
2887
|
-
/*
|
2888
|
-
Script: Domready.js
|
2889
|
-
Contains the domready custom event.
|
2890
|
-
|
2891
|
-
License:
|
2892
|
-
MIT-style license.
|
2893
|
-
*/
|
2894
|
-
|
2895
|
-
Element.Events.domready = {
|
2896
|
-
|
2897
|
-
onAdd: function(fn){
|
2898
|
-
if (Browser.loaded) fn.call(this);
|
2899
|
-
}
|
2900
|
-
|
2901
|
-
};
|
2902
|
-
|
2903
|
-
(function(){
|
2904
|
-
|
2905
|
-
var domready = function(){
|
2906
|
-
if (Browser.loaded) return;
|
2907
|
-
Browser.loaded = true;
|
2908
|
-
window.fireEvent('domready');
|
2909
|
-
document.fireEvent('domready');
|
2910
|
-
};
|
2911
|
-
|
2912
|
-
if (Browser.Engine.trident){
|
2913
|
-
var temp = document.createElement('div');
|
2914
|
-
(function(){
|
2915
|
-
($try(function(){
|
2916
|
-
temp.doScroll(); // Technique by Diego Perini
|
2917
|
-
return document.id(temp).inject(document.body).set('html', 'temp').dispose();
|
2918
|
-
})) ? domready() : arguments.callee.delay(50);
|
2919
|
-
})();
|
2920
|
-
} else if (Browser.Engine.webkit && Browser.Engine.version < 525){
|
2921
|
-
(function(){
|
2922
|
-
(['loaded', 'complete'].contains(document.readyState)) ? domready() : arguments.callee.delay(50);
|
2923
|
-
})();
|
2924
|
-
} else {
|
2925
|
-
window.addEvent('load', domready);
|
2926
|
-
document.addEvent('DOMContentLoaded', domready);
|
2927
|
-
}
|
2928
|
-
|
2929
|
-
})();
|
2930
|
-
|
2931
|
-
|
2932
|
-
/*
|
2933
|
-
Script: JSON.js
|
2934
|
-
JSON encoder and decoder.
|
2935
|
-
|
2936
|
-
License:
|
2937
|
-
MIT-style license.
|
2938
|
-
|
2939
|
-
See Also:
|
2940
|
-
<http://www.json.org/>
|
2941
|
-
*/
|
2942
|
-
|
2943
|
-
var JSON = new Hash({
|
2944
|
-
|
2945
|
-
$specialChars: {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'},
|
2946
|
-
|
2947
|
-
$replaceChars: function(chr){
|
2948
|
-
return JSON.$specialChars[chr] || '\\u00' + Math.floor(chr.charCodeAt() / 16).toString(16) + (chr.charCodeAt() % 16).toString(16);
|
2949
|
-
},
|
2950
|
-
|
2951
|
-
encode: function(obj){
|
2952
|
-
switch ($type(obj)){
|
2953
|
-
case 'string':
|
2954
|
-
return '"' + obj.replace(/[\x00-\x1f\\"]/g, JSON.$replaceChars) + '"';
|
2955
|
-
case 'array':
|
2956
|
-
return '[' + String(obj.map(JSON.encode).clean()) + ']';
|
2957
|
-
case 'object': case 'hash':
|
2958
|
-
var string = [];
|
2959
|
-
Hash.each(obj, function(value, key){
|
2960
|
-
var json = JSON.encode(value);
|
2961
|
-
if (json) string.push(JSON.encode(key) + ':' + json);
|
2962
|
-
});
|
2963
|
-
return '{' + string + '}';
|
2964
|
-
case 'number': case 'boolean': return String(obj);
|
2965
|
-
case false: return 'null';
|
2966
|
-
}
|
2967
|
-
return null;
|
2968
|
-
},
|
2969
|
-
|
2970
|
-
decode: function(string, secure){
|
2971
|
-
if ($type(string) != 'string' || !string.length) return null;
|
2972
|
-
if (secure && !(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) return null;
|
2973
|
-
return eval('(' + string + ')');
|
2974
|
-
}
|
2975
|
-
|
2976
|
-
});
|
2977
|
-
|
2978
|
-
Native.implement([Hash, Array, String, Number], {
|
2979
|
-
|
2980
|
-
toJSON: function(){
|
2981
|
-
return JSON.encode(this);
|
2982
|
-
}
|
2983
|
-
|
2984
|
-
});
|
2985
|
-
|
2986
|
-
|
2987
|
-
/*
|
2988
|
-
Script: Cookie.js
|
2989
|
-
Class for creating, loading, and saving browser Cookies.
|
2990
|
-
|
2991
|
-
License:
|
2992
|
-
MIT-style license.
|
2993
|
-
|
2994
|
-
Credits:
|
2995
|
-
Based on the functions by Peter-Paul Koch (http://quirksmode.org).
|
2996
|
-
*/
|
2997
|
-
|
2998
|
-
var Cookie = new Class({
|
2999
|
-
|
3000
|
-
Implements: Options,
|
3001
|
-
|
3002
|
-
options: {
|
3003
|
-
path: false,
|
3004
|
-
domain: false,
|
3005
|
-
duration: false,
|
3006
|
-
secure: false,
|
3007
|
-
document: document
|
3008
|
-
},
|
3009
|
-
|
3010
|
-
initialize: function(key, options){
|
3011
|
-
this.key = key;
|
3012
|
-
this.setOptions(options);
|
3013
|
-
},
|
3014
|
-
|
3015
|
-
write: function(value){
|
3016
|
-
value = encodeURIComponent(value);
|
3017
|
-
if (this.options.domain) value += '; domain=' + this.options.domain;
|
3018
|
-
if (this.options.path) value += '; path=' + this.options.path;
|
3019
|
-
if (this.options.duration){
|
3020
|
-
var date = new Date();
|
3021
|
-
date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000);
|
3022
|
-
value += '; expires=' + date.toGMTString();
|
3023
|
-
}
|
3024
|
-
if (this.options.secure) value += '; secure';
|
3025
|
-
this.options.document.cookie = this.key + '=' + value;
|
3026
|
-
return this;
|
3027
|
-
},
|
3028
|
-
|
3029
|
-
read: function(){
|
3030
|
-
var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)');
|
3031
|
-
return (value) ? decodeURIComponent(value[1]) : null;
|
3032
|
-
},
|
3033
|
-
|
3034
|
-
dispose: function(){
|
3035
|
-
new Cookie(this.key, $merge(this.options, {duration: -1})).write('');
|
3036
|
-
return this;
|
3037
|
-
}
|
3038
|
-
|
3039
|
-
});
|
3040
|
-
|
3041
|
-
Cookie.write = function(key, value, options){
|
3042
|
-
return new Cookie(key, options).write(value);
|
3043
|
-
};
|
3044
|
-
|
3045
|
-
Cookie.read = function(key){
|
3046
|
-
return new Cookie(key).read();
|
3047
|
-
};
|
3048
|
-
|
3049
|
-
Cookie.dispose = function(key, options){
|
3050
|
-
return new Cookie(key, options).dispose();
|
3051
|
-
};
|
3052
|
-
|
3053
|
-
|
3054
|
-
/*
|
3055
|
-
Script: Swiff.js
|
3056
|
-
Wrapper for embedding SWF movies. Supports (and fixes) External Interface Communication.
|
3057
|
-
|
3058
|
-
License:
|
3059
|
-
MIT-style license.
|
3060
|
-
|
3061
|
-
Credits:
|
3062
|
-
Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject.
|
3063
|
-
*/
|
3064
|
-
|
3065
|
-
var Swiff = new Class({
|
3066
|
-
|
3067
|
-
Implements: [Options],
|
3068
|
-
|
3069
|
-
options: {
|
3070
|
-
id: null,
|
3071
|
-
height: 1,
|
3072
|
-
width: 1,
|
3073
|
-
container: null,
|
3074
|
-
properties: {},
|
3075
|
-
params: {
|
3076
|
-
quality: 'high',
|
3077
|
-
allowScriptAccess: 'always',
|
3078
|
-
wMode: 'transparent',
|
3079
|
-
swLiveConnect: true
|
3080
|
-
},
|
3081
|
-
callBacks: {},
|
3082
|
-
vars: {}
|
3083
|
-
},
|
3084
|
-
|
3085
|
-
toElement: function(){
|
3086
|
-
return this.object;
|
3087
|
-
},
|
3088
|
-
|
3089
|
-
initialize: function(path, options){
|
3090
|
-
this.instance = 'Swiff_' + $time();
|
3091
|
-
|
3092
|
-
this.setOptions(options);
|
3093
|
-
options = this.options;
|
3094
|
-
var id = this.id = options.id || this.instance;
|
3095
|
-
var container = document.id(options.container);
|
3096
|
-
|
3097
|
-
Swiff.CallBacks[this.instance] = {};
|
3098
|
-
|
3099
|
-
var params = options.params, vars = options.vars, callBacks = options.callBacks;
|
3100
|
-
var properties = $extend({height: options.height, width: options.width}, options.properties);
|
3101
|
-
|
3102
|
-
var self = this;
|
3103
|
-
|
3104
|
-
for (var callBack in callBacks){
|
3105
|
-
Swiff.CallBacks[this.instance][callBack] = (function(option){
|
3106
|
-
return function(){
|
3107
|
-
return option.apply(self.object, arguments);
|
3108
|
-
};
|
3109
|
-
})(callBacks[callBack]);
|
3110
|
-
vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
|
3111
|
-
}
|
3112
|
-
|
3113
|
-
params.flashVars = Hash.toQueryString(vars);
|
3114
|
-
if (Browser.Engine.trident){
|
3115
|
-
properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
|
3116
|
-
params.movie = path;
|
3117
|
-
} else {
|
3118
|
-
properties.type = 'application/x-shockwave-flash';
|
3119
|
-
properties.data = path;
|
3120
|
-
}
|
3121
|
-
var build = '<object id="' + id + '"';
|
3122
|
-
for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
|
3123
|
-
build += '>';
|
3124
|
-
for (var param in params){
|
3125
|
-
if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
|
3126
|
-
}
|
3127
|
-
build += '</object>';
|
3128
|
-
this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
|
3129
|
-
},
|
3130
|
-
|
3131
|
-
replaces: function(element){
|
3132
|
-
element = document.id(element, true);
|
3133
|
-
element.parentNode.replaceChild(this.toElement(), element);
|
3134
|
-
return this;
|
3135
|
-
},
|
3136
|
-
|
3137
|
-
inject: function(element){
|
3138
|
-
document.id(element, true).appendChild(this.toElement());
|
3139
|
-
return this;
|
3140
|
-
},
|
3141
|
-
|
3142
|
-
remote: function(){
|
3143
|
-
return Swiff.remote.apply(Swiff, [this.toElement()].extend(arguments));
|
3144
|
-
}
|
3145
|
-
|
3146
|
-
});
|
3147
|
-
|
3148
|
-
Swiff.CallBacks = {};
|
3149
|
-
|
3150
|
-
Swiff.remote = function(obj, fn){
|
3151
|
-
var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
|
3152
|
-
return eval(rs);
|
3153
|
-
};
|
3154
|
-
|
3155
|
-
|
3156
|
-
/*
|
3157
|
-
Script: Fx.js
|
3158
|
-
Contains the basic animation logic to be extended by all other Fx Classes.
|
3159
|
-
|
3160
|
-
License:
|
3161
|
-
MIT-style license.
|
3162
|
-
*/
|
3163
|
-
|
3164
|
-
var Fx = new Class({
|
3165
|
-
|
3166
|
-
Implements: [Chain, Events, Options],
|
3167
|
-
|
3168
|
-
options: {
|
3169
|
-
/*
|
3170
|
-
onStart: $empty,
|
3171
|
-
onCancel: $empty,
|
3172
|
-
onComplete: $empty,
|
3173
|
-
*/
|
3174
|
-
fps: 50,
|
3175
|
-
unit: false,
|
3176
|
-
duration: 500,
|
3177
|
-
link: 'ignore'
|
3178
|
-
},
|
3179
|
-
|
3180
|
-
initialize: function(options){
|
3181
|
-
this.subject = this.subject || this;
|
3182
|
-
this.setOptions(options);
|
3183
|
-
this.options.duration = Fx.Durations[this.options.duration] || this.options.duration.toInt();
|
3184
|
-
var wait = this.options.wait;
|
3185
|
-
if (wait === false) this.options.link = 'cancel';
|
3186
|
-
},
|
3187
|
-
|
3188
|
-
getTransition: function(){
|
3189
|
-
return function(p){
|
3190
|
-
return -(Math.cos(Math.PI * p) - 1) / 2;
|
3191
|
-
};
|
3192
|
-
},
|
3193
|
-
|
3194
|
-
step: function(){
|
3195
|
-
var time = $time();
|
3196
|
-
if (time < this.time + this.options.duration){
|
3197
|
-
var delta = this.transition((time - this.time) / this.options.duration);
|
3198
|
-
this.set(this.compute(this.from, this.to, delta));
|
3199
|
-
} else {
|
3200
|
-
this.set(this.compute(this.from, this.to, 1));
|
3201
|
-
this.complete();
|
3202
|
-
}
|
3203
|
-
},
|
3204
|
-
|
3205
|
-
set: function(now){
|
3206
|
-
return now;
|
3207
|
-
},
|
3208
|
-
|
3209
|
-
compute: function(from, to, delta){
|
3210
|
-
return Fx.compute(from, to, delta);
|
3211
|
-
},
|
3212
|
-
|
3213
|
-
check: function(){
|
3214
|
-
if (!this.timer) return true;
|
3215
|
-
switch (this.options.link){
|
3216
|
-
case 'cancel': this.cancel(); return true;
|
3217
|
-
case 'chain': this.chain(this.caller.bind(this, arguments)); return false;
|
3218
|
-
}
|
3219
|
-
return false;
|
3220
|
-
},
|
3221
|
-
|
3222
|
-
start: function(from, to){
|
3223
|
-
if (!this.check(from, to)) return this;
|
3224
|
-
this.from = from;
|
3225
|
-
this.to = to;
|
3226
|
-
this.time = 0;
|
3227
|
-
this.transition = this.getTransition();
|
3228
|
-
this.startTimer();
|
3229
|
-
this.onStart();
|
3230
|
-
return this;
|
3231
|
-
},
|
3232
|
-
|
3233
|
-
complete: function(){
|
3234
|
-
if (this.stopTimer()) this.onComplete();
|
3235
|
-
return this;
|
3236
|
-
},
|
3237
|
-
|
3238
|
-
cancel: function(){
|
3239
|
-
if (this.stopTimer()) this.onCancel();
|
3240
|
-
return this;
|
3241
|
-
},
|
3242
|
-
|
3243
|
-
onStart: function(){
|
3244
|
-
this.fireEvent('start', this.subject);
|
3245
|
-
},
|
3246
|
-
|
3247
|
-
onComplete: function(){
|
3248
|
-
this.fireEvent('complete', this.subject);
|
3249
|
-
if (!this.callChain()) this.fireEvent('chainComplete', this.subject);
|
3250
|
-
},
|
3251
|
-
|
3252
|
-
onCancel: function(){
|
3253
|
-
this.fireEvent('cancel', this.subject).clearChain();
|
3254
|
-
},
|
3255
|
-
|
3256
|
-
pause: function(){
|
3257
|
-
this.stopTimer();
|
3258
|
-
return this;
|
3259
|
-
},
|
3260
|
-
|
3261
|
-
resume: function(){
|
3262
|
-
this.startTimer();
|
3263
|
-
return this;
|
3264
|
-
},
|
3265
|
-
|
3266
|
-
stopTimer: function(){
|
3267
|
-
if (!this.timer) return false;
|
3268
|
-
this.time = $time() - this.time;
|
3269
|
-
this.timer = $clear(this.timer);
|
3270
|
-
return true;
|
3271
|
-
},
|
3272
|
-
|
3273
|
-
startTimer: function(){
|
3274
|
-
if (this.timer) return false;
|
3275
|
-
this.time = $time() - this.time;
|
3276
|
-
this.timer = this.step.periodical(Math.round(1000 / this.options.fps), this);
|
3277
|
-
return true;
|
3278
|
-
}
|
3279
|
-
|
3280
|
-
});
|
3281
|
-
|
3282
|
-
Fx.compute = function(from, to, delta){
|
3283
|
-
return (to - from) * delta + from;
|
3284
|
-
};
|
3285
|
-
|
3286
|
-
Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000};
|
3287
|
-
|
3288
|
-
|
3289
|
-
/*
|
3290
|
-
Script: Fx.CSS.js
|
3291
|
-
Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements.
|
3292
|
-
|
3293
|
-
License:
|
3294
|
-
MIT-style license.
|
3295
|
-
*/
|
3296
|
-
|
3297
|
-
Fx.CSS = new Class({
|
3298
|
-
|
3299
|
-
Extends: Fx,
|
3300
|
-
|
3301
|
-
//prepares the base from/to object
|
3302
|
-
|
3303
|
-
prepare: function(element, property, values){
|
3304
|
-
values = $splat(values);
|
3305
|
-
var values1 = values[1];
|
3306
|
-
if (!$chk(values1)){
|
3307
|
-
values[1] = values[0];
|
3308
|
-
values[0] = element.getStyle(property);
|
3309
|
-
}
|
3310
|
-
var parsed = values.map(this.parse);
|
3311
|
-
return {from: parsed[0], to: parsed[1]};
|
3312
|
-
},
|
3313
|
-
|
3314
|
-
//parses a value into an array
|
3315
|
-
|
3316
|
-
parse: function(value){
|
3317
|
-
value = $lambda(value)();
|
3318
|
-
value = (typeof value == 'string') ? value.split(' ') : $splat(value);
|
3319
|
-
return value.map(function(val){
|
3320
|
-
val = String(val);
|
3321
|
-
var found = false;
|
3322
|
-
Fx.CSS.Parsers.each(function(parser, key){
|
3323
|
-
if (found) return;
|
3324
|
-
var parsed = parser.parse(val);
|
3325
|
-
if ($chk(parsed)) found = {value: parsed, parser: parser};
|
3326
|
-
});
|
3327
|
-
found = found || {value: val, parser: Fx.CSS.Parsers.String};
|
3328
|
-
return found;
|
3329
|
-
});
|
3330
|
-
},
|
3331
|
-
|
3332
|
-
//computes by a from and to prepared objects, using their parsers.
|
3333
|
-
|
3334
|
-
compute: function(from, to, delta){
|
3335
|
-
var computed = [];
|
3336
|
-
(Math.min(from.length, to.length)).times(function(i){
|
3337
|
-
computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser});
|
3338
|
-
});
|
3339
|
-
computed.$family = {name: 'fx:css:value'};
|
3340
|
-
return computed;
|
3341
|
-
},
|
3342
|
-
|
3343
|
-
//serves the value as settable
|
3344
|
-
|
3345
|
-
serve: function(value, unit){
|
3346
|
-
if ($type(value) != 'fx:css:value') value = this.parse(value);
|
3347
|
-
var returned = [];
|
3348
|
-
value.each(function(bit){
|
3349
|
-
returned = returned.concat(bit.parser.serve(bit.value, unit));
|
3350
|
-
});
|
3351
|
-
return returned;
|
3352
|
-
},
|
3353
|
-
|
3354
|
-
//renders the change to an element
|
3355
|
-
|
3356
|
-
render: function(element, property, value, unit){
|
3357
|
-
element.setStyle(property, this.serve(value, unit));
|
3358
|
-
},
|
3359
|
-
|
3360
|
-
//searches inside the page css to find the values for a selector
|
3361
|
-
|
3362
|
-
search: function(selector){
|
3363
|
-
if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector];
|
3364
|
-
var to = {};
|
3365
|
-
Array.each(document.styleSheets, function(sheet, j){
|
3366
|
-
var href = sheet.href;
|
3367
|
-
if (href && href.contains('://') && !href.contains(document.domain)) return;
|
3368
|
-
var rules = sheet.rules || sheet.cssRules;
|
3369
|
-
Array.each(rules, function(rule, i){
|
3370
|
-
if (!rule.style) return;
|
3371
|
-
var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){
|
3372
|
-
return m.toLowerCase();
|
3373
|
-
}) : null;
|
3374
|
-
if (!selectorText || !selectorText.test('^' + selector + '$')) return;
|
3375
|
-
Element.Styles.each(function(value, style){
|
3376
|
-
if (!rule.style[style] || Element.ShortStyles[style]) return;
|
3377
|
-
value = String(rule.style[style]);
|
3378
|
-
to[style] = (value.test(/^rgb/)) ? value.rgbToHex() : value;
|
3379
|
-
});
|
3380
|
-
});
|
3381
|
-
});
|
3382
|
-
return Fx.CSS.Cache[selector] = to;
|
3383
|
-
}
|
3384
|
-
|
3385
|
-
});
|
3386
|
-
|
3387
|
-
Fx.CSS.Cache = {};
|
3388
|
-
|
3389
|
-
Fx.CSS.Parsers = new Hash({
|
3390
|
-
|
3391
|
-
Color: {
|
3392
|
-
parse: function(value){
|
3393
|
-
if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true);
|
3394
|
-
return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false;
|
3395
|
-
},
|
3396
|
-
compute: function(from, to, delta){
|
3397
|
-
return from.map(function(value, i){
|
3398
|
-
return Math.round(Fx.compute(from[i], to[i], delta));
|
3399
|
-
});
|
3400
|
-
},
|
3401
|
-
serve: function(value){
|
3402
|
-
return value.map(Number);
|
3403
|
-
}
|
3404
|
-
},
|
3405
|
-
|
3406
|
-
Number: {
|
3407
|
-
parse: parseFloat,
|
3408
|
-
compute: Fx.compute,
|
3409
|
-
serve: function(value, unit){
|
3410
|
-
return (unit) ? value + unit : value;
|
3411
|
-
}
|
3412
|
-
},
|
3413
|
-
|
3414
|
-
String: {
|
3415
|
-
parse: $lambda(false),
|
3416
|
-
compute: $arguments(1),
|
3417
|
-
serve: $arguments(0)
|
3418
|
-
}
|
3419
|
-
|
3420
|
-
});
|
3421
|
-
|
3422
|
-
|
3423
|
-
/*
|
3424
|
-
Script: Fx.Tween.js
|
3425
|
-
Formerly Fx.Style, effect to transition any CSS property for an element.
|
3426
|
-
|
3427
|
-
License:
|
3428
|
-
MIT-style license.
|
3429
|
-
*/
|
3430
|
-
|
3431
|
-
Fx.Tween = new Class({
|
3432
|
-
|
3433
|
-
Extends: Fx.CSS,
|
3434
|
-
|
3435
|
-
initialize: function(element, options){
|
3436
|
-
this.element = this.subject = document.id(element);
|
3437
|
-
this.parent(options);
|
3438
|
-
},
|
3439
|
-
|
3440
|
-
set: function(property, now){
|
3441
|
-
if (arguments.length == 1){
|
3442
|
-
now = property;
|
3443
|
-
property = this.property || this.options.property;
|
3444
|
-
}
|
3445
|
-
this.render(this.element, property, now, this.options.unit);
|
3446
|
-
return this;
|
3447
|
-
},
|
3448
|
-
|
3449
|
-
start: function(property, from, to){
|
3450
|
-
if (!this.check(property, from, to)) return this;
|
3451
|
-
var args = Array.flatten(arguments);
|
3452
|
-
this.property = this.options.property || args.shift();
|
3453
|
-
var parsed = this.prepare(this.element, this.property, args);
|
3454
|
-
return this.parent(parsed.from, parsed.to);
|
3455
|
-
}
|
3456
|
-
|
3457
|
-
});
|
3458
|
-
|
3459
|
-
Element.Properties.tween = {
|
3460
|
-
|
3461
|
-
set: function(options){
|
3462
|
-
var tween = this.retrieve('tween');
|
3463
|
-
if (tween) tween.cancel();
|
3464
|
-
return this.eliminate('tween').store('tween:options', $extend({link: 'cancel'}, options));
|
3465
|
-
},
|
3466
|
-
|
3467
|
-
get: function(options){
|
3468
|
-
if (options || !this.retrieve('tween')){
|
3469
|
-
if (options || !this.retrieve('tween:options')) this.set('tween', options);
|
3470
|
-
this.store('tween', new Fx.Tween(this, this.retrieve('tween:options')));
|
3471
|
-
}
|
3472
|
-
return this.retrieve('tween');
|
3473
|
-
}
|
3474
|
-
|
3475
|
-
};
|
3476
|
-
|
3477
|
-
Element.implement({
|
3478
|
-
|
3479
|
-
tween: function(property, from, to){
|
3480
|
-
this.get('tween').start(arguments);
|
3481
|
-
return this;
|
3482
|
-
},
|
3483
|
-
|
3484
|
-
fade: function(how){
|
3485
|
-
var fade = this.get('tween'), o = 'opacity', toggle;
|
3486
|
-
how = $pick(how, 'toggle');
|
3487
|
-
switch (how){
|
3488
|
-
case 'in': fade.start(o, 1); break;
|
3489
|
-
case 'out': fade.start(o, 0); break;
|
3490
|
-
case 'show': fade.set(o, 1); break;
|
3491
|
-
case 'hide': fade.set(o, 0); break;
|
3492
|
-
case 'toggle':
|
3493
|
-
var flag = this.retrieve('fade:flag', this.get('opacity') == 1);
|
3494
|
-
fade.start(o, (flag) ? 0 : 1);
|
3495
|
-
this.store('fade:flag', !flag);
|
3496
|
-
toggle = true;
|
3497
|
-
break;
|
3498
|
-
default: fade.start(o, arguments);
|
3499
|
-
}
|
3500
|
-
if (!toggle) this.eliminate('fade:flag');
|
3501
|
-
return this;
|
3502
|
-
},
|
3503
|
-
|
3504
|
-
highlight: function(start, end){
|
3505
|
-
if (!end){
|
3506
|
-
end = this.retrieve('highlight:original', this.getStyle('background-color'));
|
3507
|
-
end = (end == 'transparent') ? '#fff' : end;
|
3508
|
-
}
|
3509
|
-
var tween = this.get('tween');
|
3510
|
-
tween.start('background-color', start || '#ffff88', end).chain(function(){
|
3511
|
-
this.setStyle('background-color', this.retrieve('highlight:original'));
|
3512
|
-
tween.callChain();
|
3513
|
-
}.bind(this));
|
3514
|
-
return this;
|
3515
|
-
}
|
3516
|
-
|
3517
|
-
});
|
3518
|
-
|
3519
|
-
|
3520
|
-
/*
|
3521
|
-
Script: Fx.Morph.js
|
3522
|
-
Formerly Fx.Styles, effect to transition any number of CSS properties for an element using an object of rules, or CSS based selector rules.
|
3523
|
-
|
3524
|
-
License:
|
3525
|
-
MIT-style license.
|
3526
|
-
*/
|
3527
|
-
|
3528
|
-
Fx.Morph = new Class({
|
3529
|
-
|
3530
|
-
Extends: Fx.CSS,
|
3531
|
-
|
3532
|
-
initialize: function(element, options){
|
3533
|
-
this.element = this.subject = document.id(element);
|
3534
|
-
this.parent(options);
|
3535
|
-
},
|
3536
|
-
|
3537
|
-
set: function(now){
|
3538
|
-
if (typeof now == 'string') now = this.search(now);
|
3539
|
-
for (var p in now) this.render(this.element, p, now[p], this.options.unit);
|
3540
|
-
return this;
|
3541
|
-
},
|
3542
|
-
|
3543
|
-
compute: function(from, to, delta){
|
3544
|
-
var now = {};
|
3545
|
-
for (var p in from) now[p] = this.parent(from[p], to[p], delta);
|
3546
|
-
return now;
|
3547
|
-
},
|
3548
|
-
|
3549
|
-
start: function(properties){
|
3550
|
-
if (!this.check(properties)) return this;
|
3551
|
-
if (typeof properties == 'string') properties = this.search(properties);
|
3552
|
-
var from = {}, to = {};
|
3553
|
-
for (var p in properties){
|
3554
|
-
var parsed = this.prepare(this.element, p, properties[p]);
|
3555
|
-
from[p] = parsed.from;
|
3556
|
-
to[p] = parsed.to;
|
3557
|
-
}
|
3558
|
-
return this.parent(from, to);
|
3559
|
-
}
|
3560
|
-
|
3561
|
-
});
|
3562
|
-
|
3563
|
-
Element.Properties.morph = {
|
3564
|
-
|
3565
|
-
set: function(options){
|
3566
|
-
var morph = this.retrieve('morph');
|
3567
|
-
if (morph) morph.cancel();
|
3568
|
-
return this.eliminate('morph').store('morph:options', $extend({link: 'cancel'}, options));
|
3569
|
-
},
|
3570
|
-
|
3571
|
-
get: function(options){
|
3572
|
-
if (options || !this.retrieve('morph')){
|
3573
|
-
if (options || !this.retrieve('morph:options')) this.set('morph', options);
|
3574
|
-
this.store('morph', new Fx.Morph(this, this.retrieve('morph:options')));
|
3575
|
-
}
|
3576
|
-
return this.retrieve('morph');
|
3577
|
-
}
|
3578
|
-
|
3579
|
-
};
|
3580
|
-
|
3581
|
-
Element.implement({
|
3582
|
-
|
3583
|
-
morph: function(props){
|
3584
|
-
this.get('morph').start(props);
|
3585
|
-
return this;
|
3586
|
-
}
|
3587
|
-
|
3588
|
-
});
|
3589
|
-
|
3590
|
-
|
3591
|
-
/*
|
3592
|
-
Script: Fx.Transitions.js
|
3593
|
-
Contains a set of advanced transitions to be used with any of the Fx Classes.
|
3594
|
-
|
3595
|
-
License:
|
3596
|
-
MIT-style license.
|
3597
|
-
|
3598
|
-
Credits:
|
3599
|
-
Easing Equations by Robert Penner, <http://www.robertpenner.com/easing/>, modified and optimized to be used with MooTools.
|
3600
|
-
*/
|
3601
|
-
|
3602
|
-
Fx.implement({
|
3603
|
-
|
3604
|
-
getTransition: function(){
|
3605
|
-
var trans = this.options.transition || Fx.Transitions.Sine.easeInOut;
|
3606
|
-
if (typeof trans == 'string'){
|
3607
|
-
var data = trans.split(':');
|
3608
|
-
trans = Fx.Transitions;
|
3609
|
-
trans = trans[data[0]] || trans[data[0].capitalize()];
|
3610
|
-
if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')];
|
3611
|
-
}
|
3612
|
-
return trans;
|
3613
|
-
}
|
3614
|
-
|
3615
|
-
});
|
3616
|
-
|
3617
|
-
Fx.Transition = function(transition, params){
|
3618
|
-
params = $splat(params);
|
3619
|
-
return $extend(transition, {
|
3620
|
-
easeIn: function(pos){
|
3621
|
-
return transition(pos, params);
|
3622
|
-
},
|
3623
|
-
easeOut: function(pos){
|
3624
|
-
return 1 - transition(1 - pos, params);
|
3625
|
-
},
|
3626
|
-
easeInOut: function(pos){
|
3627
|
-
return (pos <= 0.5) ? transition(2 * pos, params) / 2 : (2 - transition(2 * (1 - pos), params)) / 2;
|
3628
|
-
}
|
3629
|
-
});
|
3630
|
-
};
|
3631
|
-
|
3632
|
-
Fx.Transitions = new Hash({
|
3633
|
-
|
3634
|
-
linear: $arguments(0)
|
3635
|
-
|
3636
|
-
});
|
3637
|
-
|
3638
|
-
Fx.Transitions.extend = function(transitions){
|
3639
|
-
for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]);
|
3640
|
-
};
|
3641
|
-
|
3642
|
-
Fx.Transitions.extend({
|
3643
|
-
|
3644
|
-
Pow: function(p, x){
|
3645
|
-
return Math.pow(p, x[0] || 6);
|
3646
|
-
},
|
3647
|
-
|
3648
|
-
Expo: function(p){
|
3649
|
-
return Math.pow(2, 8 * (p - 1));
|
3650
|
-
},
|
3651
|
-
|
3652
|
-
Circ: function(p){
|
3653
|
-
return 1 - Math.sin(Math.acos(p));
|
3654
|
-
},
|
3655
|
-
|
3656
|
-
Sine: function(p){
|
3657
|
-
return 1 - Math.sin((1 - p) * Math.PI / 2);
|
3658
|
-
},
|
3659
|
-
|
3660
|
-
Back: function(p, x){
|
3661
|
-
x = x[0] || 1.618;
|
3662
|
-
return Math.pow(p, 2) * ((x + 1) * p - x);
|
3663
|
-
},
|
3664
|
-
|
3665
|
-
Bounce: function(p){
|
3666
|
-
var value;
|
3667
|
-
for (var a = 0, b = 1; 1; a += b, b /= 2){
|
3668
|
-
if (p >= (7 - 4 * a) / 11){
|
3669
|
-
value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2);
|
3670
|
-
break;
|
3671
|
-
}
|
3672
|
-
}
|
3673
|
-
return value;
|
3674
|
-
},
|
3675
|
-
|
3676
|
-
Elastic: function(p, x){
|
3677
|
-
return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x[0] || 1) / 3);
|
3678
|
-
}
|
3679
|
-
|
3680
|
-
});
|
3681
|
-
|
3682
|
-
['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
|
3683
|
-
Fx.Transitions[transition] = new Fx.Transition(function(p){
|
3684
|
-
return Math.pow(p, [i + 2]);
|
3685
|
-
});
|
3686
|
-
});
|
3687
|
-
|
3688
|
-
|
3689
|
-
/*
|
3690
|
-
Script: Request.js
|
3691
|
-
Powerful all purpose Request Class. Uses XMLHTTPRequest.
|
3692
|
-
|
3693
|
-
License:
|
3694
|
-
MIT-style license.
|
3695
|
-
*/
|
3696
|
-
|
3697
|
-
var Request = new Class({
|
3698
|
-
|
3699
|
-
Implements: [Chain, Events, Options],
|
3700
|
-
|
3701
|
-
options: {/*
|
3702
|
-
onRequest: $empty,
|
3703
|
-
onComplete: $empty,
|
3704
|
-
onCancel: $empty,
|
3705
|
-
onSuccess: $empty,
|
3706
|
-
onFailure: $empty,
|
3707
|
-
onException: $empty,*/
|
3708
|
-
url: '',
|
3709
|
-
data: '',
|
3710
|
-
headers: {
|
3711
|
-
'X-Requested-With': 'XMLHttpRequest',
|
3712
|
-
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
|
3713
|
-
},
|
3714
|
-
async: true,
|
3715
|
-
format: false,
|
3716
|
-
method: 'post',
|
3717
|
-
link: 'ignore',
|
3718
|
-
isSuccess: null,
|
3719
|
-
emulation: true,
|
3720
|
-
urlEncoded: true,
|
3721
|
-
encoding: 'utf-8',
|
3722
|
-
evalScripts: false,
|
3723
|
-
evalResponse: false,
|
3724
|
-
noCache: false
|
3725
|
-
},
|
3726
|
-
|
3727
|
-
initialize: function(options){
|
3728
|
-
this.xhr = new Browser.Request();
|
3729
|
-
this.setOptions(options);
|
3730
|
-
this.options.isSuccess = this.options.isSuccess || this.isSuccess;
|
3731
|
-
this.headers = new Hash(this.options.headers);
|
3732
|
-
},
|
3733
|
-
|
3734
|
-
onStateChange: function(){
|
3735
|
-
if (this.xhr.readyState != 4 || !this.running) return;
|
3736
|
-
this.running = false;
|
3737
|
-
this.status = 0;
|
3738
|
-
$try(function(){
|
3739
|
-
this.status = this.xhr.status;
|
3740
|
-
}.bind(this));
|
3741
|
-
this.xhr.onreadystatechange = $empty;
|
3742
|
-
if (this.options.isSuccess.call(this, this.status)){
|
3743
|
-
this.response = {text: this.xhr.responseText, xml: this.xhr.responseXML};
|
3744
|
-
this.success(this.response.text, this.response.xml);
|
3745
|
-
} else {
|
3746
|
-
this.response = {text: null, xml: null};
|
3747
|
-
this.failure();
|
3748
|
-
}
|
3749
|
-
},
|
3750
|
-
|
3751
|
-
isSuccess: function(){
|
3752
|
-
return ((this.status >= 200) && (this.status < 300));
|
3753
|
-
},
|
3754
|
-
|
3755
|
-
processScripts: function(text){
|
3756
|
-
if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return $exec(text);
|
3757
|
-
return text.stripScripts(this.options.evalScripts);
|
3758
|
-
},
|
3759
|
-
|
3760
|
-
success: function(text, xml){
|
3761
|
-
this.onSuccess(this.processScripts(text), xml);
|
3762
|
-
},
|
3763
|
-
|
3764
|
-
onSuccess: function(){
|
3765
|
-
this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain();
|
3766
|
-
},
|
3767
|
-
|
3768
|
-
failure: function(){
|
3769
|
-
this.onFailure();
|
3770
|
-
},
|
3771
|
-
|
3772
|
-
onFailure: function(){
|
3773
|
-
this.fireEvent('complete').fireEvent('failure', this.xhr);
|
3774
|
-
},
|
3775
|
-
|
3776
|
-
setHeader: function(name, value){
|
3777
|
-
this.headers.set(name, value);
|
3778
|
-
return this;
|
3779
|
-
},
|
3780
|
-
|
3781
|
-
getHeader: function(name){
|
3782
|
-
return $try(function(){
|
3783
|
-
return this.xhr.getResponseHeader(name);
|
3784
|
-
}.bind(this));
|
3785
|
-
},
|
3786
|
-
|
3787
|
-
check: function(){
|
3788
|
-
if (!this.running) return true;
|
3789
|
-
switch (this.options.link){
|
3790
|
-
case 'cancel': this.cancel(); return true;
|
3791
|
-
case 'chain': this.chain(this.caller.bind(this, arguments)); return false;
|
3792
|
-
}
|
3793
|
-
return false;
|
3794
|
-
},
|
3795
|
-
|
3796
|
-
send: function(options){
|
3797
|
-
if (!this.check(options)) return this;
|
3798
|
-
this.running = true;
|
3799
|
-
|
3800
|
-
var type = $type(options);
|
3801
|
-
if (type == 'string' || type == 'element') options = {data: options};
|
3802
|
-
|
3803
|
-
var old = this.options;
|
3804
|
-
options = $extend({data: old.data, url: old.url, method: old.method}, options);
|
3805
|
-
var data = options.data, url = options.url, method = options.method.toLowerCase();
|
3806
|
-
|
3807
|
-
switch ($type(data)){
|
3808
|
-
case 'element': data = document.id(data).toQueryString(); break;
|
3809
|
-
case 'object': case 'hash': data = Hash.toQueryString(data);
|
3810
|
-
}
|
3811
|
-
|
3812
|
-
if (this.options.format){
|
3813
|
-
var format = 'format=' + this.options.format;
|
3814
|
-
data = (data) ? format + '&' + data : format;
|
3815
|
-
}
|
3816
|
-
|
3817
|
-
if (this.options.emulation && !['get', 'post'].contains(method)){
|
3818
|
-
var _method = '_method=' + method;
|
3819
|
-
data = (data) ? _method + '&' + data : _method;
|
3820
|
-
method = 'post';
|
3821
|
-
}
|
3822
|
-
|
3823
|
-
if (this.options.urlEncoded && method == 'post'){
|
3824
|
-
var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : '';
|
3825
|
-
this.headers.set('Content-type', 'application/x-www-form-urlencoded' + encoding);
|
3826
|
-
}
|
3827
|
-
|
3828
|
-
if (this.options.noCache){
|
3829
|
-
var noCache = 'noCache=' + new Date().getTime();
|
3830
|
-
data = (data) ? noCache + '&' + data : noCache;
|
3831
|
-
}
|
3832
|
-
|
3833
|
-
var trimPosition = url.lastIndexOf('/');
|
3834
|
-
if (trimPosition > -1 && (trimPosition = url.indexOf('#')) > -1) url = url.substr(0, trimPosition);
|
3835
|
-
|
3836
|
-
if (data && method == 'get'){
|
3837
|
-
url = url + (url.contains('?') ? '&' : '?') + data;
|
3838
|
-
data = null;
|
3839
|
-
}
|
3840
|
-
|
3841
|
-
this.xhr.open(method.toUpperCase(), url, this.options.async);
|
3842
|
-
|
3843
|
-
this.xhr.onreadystatechange = this.onStateChange.bind(this);
|
3844
|
-
|
3845
|
-
this.headers.each(function(value, key){
|
3846
|
-
try {
|
3847
|
-
this.xhr.setRequestHeader(key, value);
|
3848
|
-
} catch (e){
|
3849
|
-
this.fireEvent('exception', [key, value]);
|
3850
|
-
}
|
3851
|
-
}, this);
|
3852
|
-
|
3853
|
-
this.fireEvent('request');
|
3854
|
-
this.xhr.send(data);
|
3855
|
-
if (!this.options.async) this.onStateChange();
|
3856
|
-
return this;
|
3857
|
-
},
|
3858
|
-
|
3859
|
-
cancel: function(){
|
3860
|
-
if (!this.running) return this;
|
3861
|
-
this.running = false;
|
3862
|
-
this.xhr.abort();
|
3863
|
-
this.xhr.onreadystatechange = $empty;
|
3864
|
-
this.xhr = new Browser.Request();
|
3865
|
-
this.fireEvent('cancel');
|
3866
|
-
return this;
|
3867
|
-
}
|
3868
|
-
|
3869
|
-
});
|
3870
|
-
|
3871
|
-
(function(){
|
3872
|
-
|
3873
|
-
var methods = {};
|
3874
|
-
['get', 'post', 'put', 'delete', 'GET', 'POST', 'PUT', 'DELETE'].each(function(method){
|
3875
|
-
methods[method] = function(){
|
3876
|
-
var params = Array.link(arguments, {url: String.type, data: $defined});
|
3877
|
-
return this.send($extend(params, {method: method}));
|
3878
|
-
};
|
3879
|
-
});
|
3880
|
-
|
3881
|
-
Request.implement(methods);
|
3882
|
-
|
3883
|
-
})();
|
3884
|
-
|
3885
|
-
Element.Properties.send = {
|
3886
|
-
|
3887
|
-
set: function(options){
|
3888
|
-
var send = this.retrieve('send');
|
3889
|
-
if (send) send.cancel();
|
3890
|
-
return this.eliminate('send').store('send:options', $extend({
|
3891
|
-
data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action')
|
3892
|
-
}, options));
|
3893
|
-
},
|
3894
|
-
|
3895
|
-
get: function(options){
|
3896
|
-
if (options || !this.retrieve('send')){
|
3897
|
-
if (options || !this.retrieve('send:options')) this.set('send', options);
|
3898
|
-
this.store('send', new Request(this.retrieve('send:options')));
|
3899
|
-
}
|
3900
|
-
return this.retrieve('send');
|
3901
|
-
}
|
3902
|
-
|
3903
|
-
};
|
3904
|
-
|
3905
|
-
Element.implement({
|
3906
|
-
|
3907
|
-
send: function(url){
|
3908
|
-
var sender = this.get('send');
|
3909
|
-
sender.send({data: this, url: url || sender.options.url});
|
3910
|
-
return this;
|
3911
|
-
}
|
3912
|
-
|
3913
|
-
});
|
3914
|
-
|
3915
|
-
|
3916
|
-
/*
|
3917
|
-
Script: Request.HTML.js
|
3918
|
-
Extends the basic Request Class with additional methods for interacting with HTML responses.
|
3919
|
-
|
3920
|
-
License:
|
3921
|
-
MIT-style license.
|
3922
|
-
*/
|
3923
|
-
|
3924
|
-
Request.HTML = new Class({
|
3925
|
-
|
3926
|
-
Extends: Request,
|
3927
|
-
|
3928
|
-
options: {
|
3929
|
-
update: false,
|
3930
|
-
append: false,
|
3931
|
-
evalScripts: true,
|
3932
|
-
filter: false
|
3933
|
-
},
|
3934
|
-
|
3935
|
-
processHTML: function(text){
|
3936
|
-
var match = text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
|
3937
|
-
text = (match) ? match[1] : text;
|
3938
|
-
|
3939
|
-
var container = new Element('div');
|
3940
|
-
|
3941
|
-
return $try(function(){
|
3942
|
-
var root = '<root>' + text + '</root>', doc;
|
3943
|
-
if (Browser.Engine.trident){
|
3944
|
-
doc = new ActiveXObject('Microsoft.XMLDOM');
|
3945
|
-
doc.async = false;
|
3946
|
-
doc.loadXML(root);
|
3947
|
-
} else {
|
3948
|
-
doc = new DOMParser().parseFromString(root, 'text/xml');
|
3949
|
-
}
|
3950
|
-
root = doc.getElementsByTagName('root')[0];
|
3951
|
-
if (!root) return null;
|
3952
|
-
for (var i = 0, k = root.childNodes.length; i < k; i++){
|
3953
|
-
var child = Element.clone(root.childNodes[i], true, true);
|
3954
|
-
if (child) container.grab(child);
|
3955
|
-
}
|
3956
|
-
return container;
|
3957
|
-
}) || container.set('html', text);
|
3958
|
-
},
|
3959
|
-
|
3960
|
-
success: function(text){
|
3961
|
-
var options = this.options, response = this.response;
|
3962
|
-
|
3963
|
-
response.html = text.stripScripts(function(script){
|
3964
|
-
response.javascript = script;
|
3965
|
-
});
|
3966
|
-
|
3967
|
-
var temp = this.processHTML(response.html);
|
3968
|
-
|
3969
|
-
response.tree = temp.childNodes;
|
3970
|
-
response.elements = temp.getElements('*');
|
3971
|
-
|
3972
|
-
if (options.filter) response.tree = response.elements.filter(options.filter);
|
3973
|
-
if (options.update) document.id(options.update).empty().set('html', response.html);
|
3974
|
-
else if (options.append) document.id(options.append).adopt(temp.getChildren());
|
3975
|
-
if (options.evalScripts) $exec(response.javascript);
|
3976
|
-
|
3977
|
-
this.onSuccess(response.tree, response.elements, response.html, response.javascript);
|
3978
|
-
}
|
3979
|
-
|
3980
|
-
});
|
3981
|
-
|
3982
|
-
Element.Properties.load = {
|
3983
|
-
|
3984
|
-
set: function(options){
|
3985
|
-
var load = this.retrieve('load');
|
3986
|
-
if (load) load.cancel();
|
3987
|
-
return this.eliminate('load').store('load:options', $extend({data: this, link: 'cancel', update: this, method: 'get'}, options));
|
3988
|
-
},
|
3989
|
-
|
3990
|
-
get: function(options){
|
3991
|
-
if (options || ! this.retrieve('load')){
|
3992
|
-
if (options || !this.retrieve('load:options')) this.set('load', options);
|
3993
|
-
this.store('load', new Request.HTML(this.retrieve('load:options')));
|
3994
|
-
}
|
3995
|
-
return this.retrieve('load');
|
3996
|
-
}
|
3997
|
-
|
3998
|
-
};
|
3999
|
-
|
4000
|
-
Element.implement({
|
4001
|
-
|
4002
|
-
load: function(){
|
4003
|
-
this.get('load').send(Array.link(arguments, {data: Object.type, url: String.type}));
|
4004
|
-
return this;
|
4005
|
-
}
|
4006
|
-
|
4007
|
-
});
|
4008
|
-
|
4009
|
-
|
4010
|
-
/*
|
4011
|
-
Script: Request.JSON.js
|
4012
|
-
Extends the basic Request Class with additional methods for sending and receiving JSON data.
|
4013
|
-
|
4014
|
-
License:
|
4015
|
-
MIT-style license.
|
4016
|
-
*/
|
4017
|
-
|
4018
|
-
Request.JSON = new Class({
|
4019
|
-
|
4020
|
-
Extends: Request,
|
4021
|
-
|
4022
|
-
options: {
|
4023
|
-
secure: true
|
4024
|
-
},
|
4025
|
-
|
4026
|
-
initialize: function(options){
|
4027
|
-
this.parent(options);
|
4028
|
-
this.headers.extend({'Accept': 'application/json', 'X-Request': 'JSON'});
|
4029
|
-
},
|
4030
|
-
|
4031
|
-
success: function(text){
|
4032
|
-
this.response.json = JSON.decode(text, this.options.secure);
|
4033
|
-
this.onSuccess(this.response.json, text);
|
4034
|
-
}
|
4035
|
-
|
4036
|
-
});
|