avalon-rails 1.3.9.1 → 1.3.9.1.20150212184918

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,135 +1,3 @@
1
- (function(q,Z){"object"===typeof module&&"object"===typeof module.exports?module.exports=q.document?Z(q,!0):function(q){if(!q.document)throw Error("Avalon requires a window with a document");return Z(q)}:Z(q)})("undefined"!==typeof window?window:this,function(q,Z){function y(){q.console&&avalon.config.debug&&Function.apply.call(console.log,console,arguments)}function A(){}function S(b,c){"string"===typeof b&&(b=b.match(w)||[]);for(var d={},e=void 0!==c?c:1,f=0,g=b.length;f<g;f++)d[b[f]]=e;return d}
2
- function qa(b){function c(e,f){d.push(e)>b&&delete c[d.shift()];return c[e]=f}var d=[];return c}function Wa(b){return Wb.test(V.call(b))}function Xa(b,c){b=Math.floor(b)||0;return 0>b?Math.max(c+b,0):Math.min(b,c)}function Xb(b){if(!b)return!1;var c=b.length;if(c===c>>>0){c=V.call(b).slice(8,-1);if(/(?:regexp|string|function|window|global)$/i.test(c))return!1;if("Array"===c)return!0;try{return!1==={}.propertyIsEnumerable.call(b,"length")?/^\s?function/.test(b.item||b.callee):!0}catch(d){return!b.eval}}return!1}
3
- function $(b,c,d){b="for(var "+b+"i=0,n = this.length; i < n; i++){"+c.replace("_","((i in this) && fn.call(scope,this[i],i,this))")+"}"+d;return Function("fn,scope",b)}function Ya(b,c){try{for(;c=c.parentNode;)if(c===b)return!0;return!1}catch(d){return!1}}function Za(){return(new XMLSerializer).serializeToString(this)}function Yb(b){var c={},d;for(d in b)c[d]=b[d];d=c.target=b.srcElement;0===b.type.indexOf("key")?c.which=null!=b.charCode?b.charCode:b.keyCode:Zb.test(b.type)&&(d=d.ownerDocument||
4
- p,d="BackCompat"===d.compatMode?d.body:d.documentElement,c.pageX=b.clientX+(d.scrollLeft>>0)-(d.clientLeft>>0),c.pageY=b.clientY+(d.scrollTop>>0)-(d.clientTop>>0),c.wheelDeltaY=c.wheelDelta,c.wheelDeltaX=0);c.timeStamp=new Date-0;c.originalEvent=b;c.preventDefault=function(){b.returnValue=!1};c.stopPropagation=function(){b.cancelBubble=!0};return c}function t(b){for(var c in b)if(M.call(b,c)){var d=b[c];if("function"===typeof t.plugins[c])t.plugins[c](d);else"object"===typeof t[c]?avalon.mix(t[c],
5
- d):t[c]=d}return this}function $b(b,c,d){if(T(c)||c&&c.nodeType||-1!==d.indexOf(b)||-1!==ra.indexOf(b))return!1;c=d.$special;return b&&"$"===b.charAt(0)&&!c[b]?!1:!0}function ac(b,c,d,e){switch(b.type){case 0:var f=b.get;b=b.set;if(T(b)){var g=e.$events,h=g[c];g[c]=[];b.call(e,d);g[c]=h}return f.call(e);case 1:return d;case 2:return d!==e.$model[c]&&(c=b.svmodel=bc(e,c,d,b.valueType),d=c.$model,(c=sa[c.$id])&&c()),d}}function K(b,c,d){if(Array.isArray(b)){var e=b.concat();b.length=0;c=cc(b);c.pushArray(e);
6
- return c}if("number"===typeof b.nodeType||b.$id&&b.$events)return b;Array.isArray(b.$skipArray)||(b.$skipArray=[]);b.$skipArray.$special=c||{};var f={};d=d||{};var g={},h={},k=[];for(e in b)(function(c,e){d[c]=e;if($b(c,e,b.$skipArray)){g[c]=[];var l=avalon.type(e),s=function(b){var c=s._name,d=this,e=d.$model,f=e[c],g=d.$events;if(arguments.length){if(!ta){if(1!==s.type&&(b=ac(s,c,b,d),!s.type))return;$a(f,b)||(e[c]=b,g.$digest?s.pedding||(s.pedding=!0,setTimeout(function(){ka(g[c]);d.$events&&D.$fire.call(d,
7
- c,e[c],f);s.pedding=!1})):(ka(g[c]),d.$events&&D.$fire.call(d,c,b,f)))}}else{if(0===s.type)return b=s.get.call(d),f!==b&&(e[c]=b,g.$digest?s.pedding||(s.pedding=!0,setTimeout(function(){d.$events&&D.$fire.call(d,c,e[c],f);s.pedding=!1})):d.$events&&D.$fire.call(d,c,b,f)),b;ec(g[c]);return s.svmodel||f}};"object"===l&&T(e.get)&&2>=Object.keys(e).length?(s.set=e.set,s.get=e.get,s.type=0,k.push(function(){var b={evaluator:function(){b.type=new Date-0;b.element=null;d[c]=s.get.call(f)},element:G,type:new Date-
8
- 0,handler:A,args:[]};ba[C]=b;s.call(f);delete ba[C]})):ab.test(l)?(s.type=2,s.valueType=l,k.push(function(){var b=K(e,0,d[c]);s.svmodel=b;b.$events[L]=g[c]})):s.type=1;s._name=c;h[c]=s}})(e,b[e]);ra.forEach(function(c){delete b[c];delete d[c]});var f=ua(f,fc(h),b),l;for(l in b)h[l]||(f[l]=b[l]);f.$id=N();f.$model=d;f.$events=g;for(e in D)c=D[e],z||(c=c.bind(f)),f[e]=c;va?Object.defineProperty(f,"hasOwnProperty",{value:function(b){return b in this.$model},writable:!1,enumerable:!1,configurable:!0}):
9
- f.hasOwnProperty=function(b){return b in f.$model};k.forEach(function(b){b()});return f}function bc(b,c,d,e){var f=b[c];if("array"===e){if(!Array.isArray(d)||f===d)return f;f._.$unwatch();f.clear();f._.$watch();f.pushArray(d.concat());return f}var g=b.$events[c];if(b=f.$events.$withProxyPool)wa(b,"with"),f.$events.$withProxyPool=null;var h=K(d);h.$events[L]=g;sa[h.$id]=function(b){for(;b=g.shift();)(function(b){avalon.nextTick(function(){b.type&&(b.rollback&&b.rollback(),v[b.type](b,b.vmodels))})})(b);
10
- delete sa[h.$id]};return h}function cc(b){var c=[];c.$id=N();c.$model=b;c.$events={};c.$events[L]=[];c._=K({length:b.length});c._.$watch("length",function(b,d){c.$fire("length",b,d)});for(var d in D)c[d]=D[d];avalon.mix(c,bb);return c}function W(b,c,d,e,f,g,h){for(var k=this.length,l=2;--l;){switch(b){case "add":var m=this.$model.slice(c,c+d).map(function(b){return ab.test(avalon.type(b))?b.$id?b:K(b,0,b):b});xa.apply(this,[c,0].concat(m));this._fire("add",c,d);break;case "del":var n=this._splice(c,
11
- d);this._fire("del",c,d)}f&&(b=f,c=g,d=h,l=2,f=0)}this._fire("index",e);this.length!==k&&(this._.length=this.length);return n}function ya(b,c){for(var d={},e=0,f=c.length;e<f;e++){d[e]=b[e];var g=c[e];g in d?(b[e]=d[g],delete d[g]):b[e]=b[g]}}function za(b){ba[C]=b;avalon.openComputedCollect=!0;var c=b.evaluator;if(c)try{var d=gc.test(b.type)?b:c.apply(0,b.args);b.handler(d,b.element,b)}catch(e){delete b.evaluator,c=b.element,3===c.nodeType&&(d=c.parentNode,t.commentInterpolate?d.replaceChild(p.createComment(b.value),
12
- c):c.data=O+b.value+P)}avalon.openComputedCollect=!1;delete ba[C]}function ec(b){var c=ba[C];b&&(c&&avalon.Array.ensure(b,c)&&c.element)&&Aa(c,b)}function Aa(b,c){b.$uuid=b.$uuid||N();c.$uuid=c.$uuid||N();var d={data:b,list:c,$$uuid:b.$uuid+c.$uuid};Q[d.$$uuid]||(Q[d.$$uuid]=1,Q.push(d))}function cb(b){b.element=null;b.rollback&&b.rollback();for(var c in b)b[c]=null}function hc(b){try{if(!b.parentNode)return!0}catch(c){return!0}return b.msRetain?0:1===b.nodeType?"number"===typeof b.sourceIndex?0===
13
- b.sourceIndex:!B.contains(b):!avalon.contains(B,b)}function db(){for(var b=Q.length,c=b,d=0,e,f=[],g={},h={};e=Q[--b];){var k=e.data;e=k.type;g[e]?g[e]++:(g[e]=1,f.push(e))}var l=!1;f.forEach(function(b){eb[b]!==g[b]&&(h[b]=1,l=!0)});b=c;if(l)for(;e=Q[--b];)k=e.data,void 0!==k.element&&(h[k.type]&&hc(k.element))&&(d++,Q.splice(b,1),delete Q[e.$$uuid],avalon.Array.remove(e.list,k),cb(k),e.data=e.list=null);eb=g;fb=new Date}function ka(b){if(b&&b.length){444<new Date-fb&&"object"===typeof b[0]&&db();
14
- for(var c=la.call(arguments,1),d=b.length,e;e=b[--d];){var f=e.element;f&&f.parentNode&&(e.$repeat?e.handler.apply(e,c):"on"!==e.type&&e.handler((e.evaluator||A).apply(0,e.args||[]),f,e))}}}function gb(b){var c=b.nodeName;return c.toLowerCase()===c&&b.scopeName&&""===b.outerText}function ic(b){"url(#default#VML)"!==b.currentStyle.behavior&&(b.style.behavior="url(#default#VML)",b.style.display="inline-block",b.style.zoom=1)}function ma(b,c,d){var e=setTimeout(function(){var f=b.innerHTML;clearTimeout(e);
15
- f===d?c():ma(b,c,f)})}function hb(b,c){var d=b.getAttribute("avalonctrl")||c.$id;b.setAttribute("avalonctrl",d);c.$events.expr=b.tagName+'[avalonctrl="'+d+'"]'}function Ba(b,c){for(var d=0,e;e=b[d++];)e.vmodels=c,v[e.type](e,c),e.evaluator&&(e.element&&1===e.element.nodeType)&&e.element.removeAttribute(e.name);b.length=0}function jc(b,c){return b.priority-c.priority}function ib(b,c,d){var e=b.getAttribute("ms-skip");if(!b.getAttributeNode)return y("warning "+b.tagName+" no getAttributeNode method");
16
- var f=b.getAttributeNode("ms-important");d=b.getAttributeNode("ms-controller");if("string"!==typeof e){if(d=f||d){e=avalon.vmodels[d.value];if(!e)return;c=d===f?[e]:[e].concat(c);f=d.name;b.removeAttribute(f);avalon(b).removeClass(f);hb(b,e)}jb(b,c)}}function kc(b,c){for(var d=b.firstChild;d;){var e=d.nextSibling;kb(d,d.nodeType,c);d=e}}function na(b,c){for(var d=0,e;e=b[d++];)kb(e,e.nodeType,c)}function kb(b,c,d){1===c?ib(b,d):3===c&&ca.test(b.data)?lb(b,d):t.commentInterpolate&&(8===c&&!ca.test(b.nodeValue))&&
17
- lb(b,d)}function jb(b,c){for(var d=mb?mb(b):avalon.slice(b.attributes),e=[],f={},g,h=0,k;k=d[h++];)if(k.specified&&(g=k.name.match(nb))){var l=g[1],m=g[2]||"",n=k.value;k=k.name;f[k]=n;lc[l]?(m=l,l="on"):mc[l]&&(y("ms-"+l+"\u5df2\u7ecf\u88ab\u5e9f\u5f03,\u8bf7\u4f7f\u7528ms-attr-*\u4ee3\u66ff"),"enabled"===l&&(l="disabled",n="!("+n+")"),m=l,l="attr",b.removeAttribute(k),k="ms-attr-"+m,b.setAttribute(k,n),g=[k],f[k]=n);if("function"===typeof v[l]){var r={type:l,param:m,element:b,name:g[0],value:n,
18
- priority:l in ob?ob[l]:10*l.charCodeAt(0)+(Number(m)||0)};if("html"===l||"text"===l)m=Ca(n),avalon.mix(r,m),r.filters=r.filters.replace(pb,function(){r.type="html";r.group=1;return""});"ms-if-loop"===k&&(r.priority+=100);c.length&&(e.push(r),"widget"===l&&(b.msData=b.msData||f))}}e.sort(jc);f["ms-attr-checked"]&&f["ms-duplex"]&&y("warning!\u4e00\u4e2a\u5143\u7d20\u4e0a\u4e0d\u80fd\u540c\u65f6\u5b9a\u4e49ms-attr-checked\u4e0ems-duplex");d=!0;for(h=0;r=e[h];h++){l=r.type;if(nc.test(l))return Ba(e.slice(0,
19
- h+1),c);d&&(d=!oc.test(l))}Ba(e,c);d&&(!pc[b.tagName]&&qb.test(b.innerHTML.replace(qc,"<").replace(rc,">")))&&(rb&&rb(b),kc(b,c))}function Ca(b){if(0<b.indexOf("|")){var c=b.replace(sc,"\u1122\u3344").indexOf("|");if(-1<c)return{filters:b.slice(c),value:b.slice(0,c),expr:!0}}return{value:b,filters:"",expr:!0}}function Da(b){var c=[],d;d=0;var e;do{e=b.indexOf(O,d);if(-1===e)break;(d=b.slice(d,e))&&c.push({value:d,filters:"",expr:!1});d=e+O.length;e=b.indexOf(P,d);if(-1===e)break;(d=b.slice(d,e))&&
20
- c.push(Ca(d));d=e+P.length}while(1);(d=b.slice(d))&&c.push({value:d,expr:!1,filters:""});return c}function lb(b,c){var d=[];if(8===b.nodeType)var e=Ca(b.nodeValue),f=[e];else f=Da(b.data);if(f.length){for(var g=0;e=f[g++];){var h=p.createTextNode(e.value);e.expr&&(e.type="text",e.element=h,e.filters=e.filters.replace(pb,function(){e.type="html";e.group=1;return""}),d.push(e));X.appendChild(h)}b.parentNode.replaceChild(X,b);d.length&&Ba(d,c)}}function sb(b){return b.replace(/([a-z\d])([A-Z]+)/g,"$1-$2").toLowerCase()}
21
- function oa(b){return 0>b.indexOf("-")&&0>b.indexOf("_")?b:b.replace(/[-_][^-_]/g,function(b){return b.charAt(1).toUpperCase()})}function tb(b){if(!("classList"in b)){b.classList={node:b};for(var c in ub)b.classList[c.slice(1)]=ub[c]}return b.classList}function vb(b){try{if("object"===typeof b)return b;b="true"===b?!0:"false"===b?!1:"null"===b?null:+b+""===b?+b:tc.test(b)?avalon.parseJSON(b):b}catch(c){}return b}function wb(b,c){if(0>=b.offsetWidth){if(uc.test(x["@:get"](b,"display"))){var d={node:b},
22
- e;for(e in xb)d[e]=b.style[e],b.style[e]=xb[e];c.push(d)}(d=b.parentNode)&&1===d.nodeType&&wb(d,c)}}function vc(b,c,d,e){for(var f=[],g=" = "+d+".",h=b.length,k;k=b[--h];)c.hasOwnProperty(k)&&(f.push(k+g+k),e.vars.push(k),"duplex"===e.type&&(b.get=d+"."+k),b.splice(h,1));return f}function yb(b){for(var c=[],d={},e=0;e<b.length;e++){var f=b[e],g=f&&"string"===typeof f.$id?f.$id:f;d[g]||(d[g]=c.push(f))}return c}function wc(b,c){c=c.replace(xc,"").replace(yc,function(){return"],|"}).replace(zc,function(b,
23
- c){return"["+zb(c)}).replace(Ac,function(){return'"],["'}).replace(Bc,function(){return'",'})+"]";return"return avalon.filters.$filter("+b+", "+c+")"}function Ab(b,c,d){var e=d.type,f=d.filters||"",g=c.map(function(b){return String(b.$id).replace(Cc,"$1")})+b+e+f,h=Dc(b).concat(),k=[],l=[],m=[],n="";c=yb(c);d.vars=[];for(var n=0,r=c.length;n<r;n++)if(h.length){var s="vm"+C+"_"+n;l.push(s);m.push(c[n]);k.push.apply(k,vc(h,c[n],s,d))}if(k.length||"duplex"!==e)if("duplex"!==e&&(-1<b.indexOf("||")||-1<
24
- b.indexOf("&&"))&&d.vars.forEach(function(c){b=b.replace(RegExp("\\b"+c+"(?:\\.\\w+|\\[\\w+\\])+","ig"),function(d,e){var f=d.charAt(c.length),g=R?b.slice(e+d.length):RegExp.rightContext,g=/^\s*\(/.test(g);if("."===f||"["===f||g){f="var"+String(Math.random()).replace(/^0\./,"");if(g){g=d.split(".");if(2<g.length){var h=g.pop();k.push(f+" = "+g.join("."));return f+"."+h}return d}k.push(f+" = "+d);return f}return d})}),d.args=m,c=Ea[g])d.evaluator=c;else{(n=k.join(", "))&&(n="var "+n);if(/\S/.test(f)){if(!/text|html/.test(d.type))throw Error("ms-"+
25
- d.type+"\u4e0d\u652f\u6301\u8fc7\u6ee4\u5668");b="\nvar ret"+C+" = "+b+";\r\n";b+=wc("ret"+C,f)}else{if("duplex"===e){e="'use strict';\nreturn function(vvv){\n\t"+n+";\n\tif(!arguments.length){\n\t\treturn "+b+"\n\t}\n\t"+(!Ec.test(b)?h.get:b)+"= vvv;\n} ";try{c=Function.apply(A,l.concat(e)),d.evaluator=Ea(g,c)}catch(aa){y("debug: parse error,"+aa.message)}return}"on"===e?(b=-1===b.indexOf("(")?b+".call(this, $event)":b.replace("(",".call(this,"),l.push("$event"),b="\nreturn "+b+";",f=b.lastIndexOf("\nreturn"),
26
- e=b.slice(0,f),f=b.slice(f),b=e+"\n"+f):b="\nreturn "+b+";"}try{c=Function.apply(A,l.concat("'use strict';\n"+n+b)),d.evaluator=Ea(g,c)}catch(dc){y("debug: parse error,"+dc.message)}finally{h=textBuffer=l=null}}}function I(b,c,d,e,f){Array.isArray(e)&&(b=e.map(function(b){return b.expr?"("+b.value+")":zb(b.value)}).join(" + "));Ab(b,c,d);d.evaluator&&!f&&(d.handler=E[d.handlerName||d.type],za(d))}function da(b,c){var d="_"+b;if(!da[d]){var e=p.createElement(b);B.appendChild(e);c=z?getComputedStyle(e,
27
- null).display:e.currentStyle.display;B.removeChild(e);da[d]=c}return da[d]}function Fa(b){return null==b?"":b}function Fc(b,c,d,e){c.param.replace(/\w+/g,function(e){(e=avalon.duplexHooks[e])&&"function"===typeof e[d]&&(b=e[d](b,c))});return b}function Gc(){for(var b=ea.length-1;0<=b;b--)!1===(0,ea[b])()&&ea.splice(b,1);ea.length||clearInterval(Bb)}function Cb(b,c,d,e){var f=b.template.cloneNode(!0),g=avalon.slice(f.childNodes);d.$stamp&&f.insertBefore(d.$stamp,f.firstChild);c.appendChild(f);b=[d].concat(b.vmodels);
28
- e.push({nodes:g,vmodels:b})}function Db(b,c){var d=b.proxies[c];return d?d.$stamp:b.element}function Ga(b,c,d){for(;;){var e=c.previousSibling;if(!e)break;e.parentNode.removeChild(e);d&&d.call(e);if(e===b)break}}function Hc(b){var c={$host:[],$outer:{},$stamp:1,$index:0,$first:!1,$last:!1,$remove:avalon.noop};c[b]={get:function(){return this.$host[this.$index]},set:function(b){this.$host.set(this.$index,b)}};var c=K(c,{$last:1,$first:1,$index:1}),d=c.$events;d[b]=d.$first=d.$last=d.$index;c.$id=N("$proxy$each");
29
- return c}function Ic(b,c){for(var d=c.param||"el",e,f=0,g=pa.length;f<g;f++){var h=pa[f];h&&h.hasOwnProperty(d)&&(e=h,pa.splice(f,1))}e||(e=Hc(d));var k=c.$repeat,d=k.length-1;e.$index=b;e.$first=0===b;e.$last=b===d;e.$host=k;e.$outer=c.$outer;e.$stamp=c.clone.cloneNode(!1);e.$remove=function(){return k.removeAt(e.$index)};return e}function Jc(){var b=K({$key:"",$outer:{},$host:{},$val:{get:function(){return this.$host[this.$key]},set:function(b){this.$host[this.$key]=b}}},{$val:1});b.$id=N("$proxy$with");
30
- return b}function Kc(b,c){var d=Eb.pop();d||(d=Jc());var e=c.$repeat;d.$key=b;d.$host=e;d.$outer=c.$outer;e.$events?d.$events.$val=e.$events[b]:d.$events={};return d}function wa(b,c){var d="each"===c?pa:Eb;avalon.each(b,function(b,c){if(c.$events){for(var g in c.$events)Array.isArray(c.$events[g])&&(c.$events[g].forEach(function(b){"object"===typeof b&&cb(b)}),c.$events[g].length=0);c.$host=c.$outer={};d.unshift(c)>t.maxRepeatSize&&d.pop()}});"each"===c&&(b.length=0)}function Fb(b,c,d,e){b=(b+"").replace(/[^0-9+\-Ee.]/g,
31
- "");b=!isFinite(+b)?0:+b;c=!isFinite(+c)?0:Math.abs(c);e="undefined"===typeof e?",":e;d="undefined"===typeof d?".":d;var f="",f=function(b,c){var d=Math.pow(10,c);return""+(Math.round(b*d)/d).toFixed(c)},f=(c?f(b,c):""+Math.round(b)).split(".");3<f[0].length&&(f[0]=f[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,e));if((f[1]||"").length<c)f[1]=f[1]||"",f[1]+=Array(c-f[1].length+1).join("0");return f.join(d)}function U(){p.body&&(F?(u["ready!"].state=2,F.checkDeps()):Gb.forEach(function(b){b(avalon)}),U=A)}
32
- function Hb(){try{B.doScroll("left"),U()}catch(b){setTimeout(Hb)}}var C=new Date-0,p=q.document,G=p.getElementsByTagName("head")[0],fa=G.insertBefore(document.createElement("avalon"),G.firstChild);fa.innerHTML="X<style id='avalonStyle'>.avalonHide{ display: none!important }</style>";fa.setAttribute("ms-skip","1");var Ib=/\[native code\]/,L="$"+C,Lc=q.require,Mc=q.define,ta=!1,w=/[^, ]+/g,ab=/^(?:object|array)$/,Ha=/^\[object SVG\w*Element\]$/,Wb=/^\[object (?:Window|DOMWindow|global)\]$/,Ia=Object.prototype,
33
- M=Ia.hasOwnProperty,V=Ia.toString,J=Array.prototype,la=J.slice,ba={},z=q.dispatchEvent,B=p.documentElement,X=p.createDocumentFragment(),ga=p.createElement("div"),Jb={};"Boolean Number String Function Array Date RegExp Object Error".replace(w,function(b){Jb["[object "+b+"]"]=b.toLowerCase()});var N=function(b){return((b||"avalon")+Math.random()+Math.random()).replace(/0\./g,"")},R=function(){if(q.VBArray){var b=document.documentMode;return b?b:q.XMLHttpRequest?7:6}return 0}();avalon=function(b){return new avalon.init(b)};
34
- avalon.init=function(b){this[0]=this.element=b};avalon.fn=avalon.prototype=avalon.init.prototype;avalon.type=function(b){return null==b?String(b):"object"===typeof b||"function"===typeof b?Jb[V.call(b)]||"object":typeof b};var T="object"===typeof alert?function(b){try{return/^\s*\bfunction\b/.test(b+"")}catch(c){return!1}}:function(b){return"[object Function]"==V.call(b)};avalon.isFunction=T;avalon.isWindow=function(b){return!b?!1:b==b.document&&b.document!=b};Wa(q)&&(avalon.isWindow=Wa);for(var Nc in avalon({}))break;
35
- var Oc="0"!==Nc;avalon.isPlainObject=function(b,c){if(!b||"object"!==avalon.type(b)||b.nodeType||avalon.isWindow(b))return!1;try{if(b.constructor&&!M.call(b,"constructor")&&!M.call(b.constructor.prototype,"isPrototypeOf"))return!1}catch(d){return!1}if(Oc)for(c in b)return M.call(b,c);for(c in b);return void 0===c||M.call(b,c)};Ib.test(Object.getPrototypeOf)&&(avalon.isPlainObject=function(b){return"[object Object]"===V.call(b)&&Object.getPrototypeOf(b)===Ia});avalon.mix=avalon.fn.mix=function(){var b,
36
- c,d,e,f,g=arguments[0]||{},h=1,k=arguments.length,l=!1;"boolean"===typeof g&&(l=g,g=arguments[1]||{},h++);"object"!==typeof g&&!T(g)&&(g={});h===k&&(g=this,h--);for(;h<k;h++)if(null!=(b=arguments[h]))for(c in b){d=g[c];try{e=b[c]}catch(m){continue}g!==e&&(l&&e&&(avalon.isPlainObject(e)||(f=Array.isArray(e)))?(f?(f=!1,d=d&&Array.isArray(d)?d:[]):d=d&&avalon.isPlainObject(d)?d:{},g[c]=avalon.mix(l,d,e)):void 0!==e&&(g[c]=e))}return g};avalon.mix({rword:w,subscribers:L,version:1.391,ui:{},log:y,slice:z?
37
- function(b,c,d){return la.call(b,c,d)}:function(b,c,d){var e=[],f=b.length;void 0===d&&(d=f);if("number"===typeof d&&isFinite(d)){c=Xa(c,f);d=Xa(d,f);for(f=c;f<d;++f)e[f-c]=b[f]}return e},noop:A,error:function(b,c){throw new (c||Error)(b);},oneObject:S,range:function(b,c,d){d||(d=1);null==c&&(c=b||0,b=0);var e=-1;c=Math.max(0,Math.ceil((c-b)/d));for(var f=Array(c);++e<c;)f[e]=b,b+=d;return f},eventHooks:{},bind:function(b,c,d,e){var f=avalon.eventHooks[c];"object"===typeof f&&(c=f.type,f.deel&&(d=
38
- f.deel(b,d)));f=z?d:function(c){d.call(b,Yb(c))};z?b.addEventListener(c,f,!!e):b.attachEvent("on"+c,f);return f},unbind:function(b,c,d,e){var f=avalon.eventHooks[c];d=d||A;"object"===typeof f&&(c=f.type);z?b.removeEventListener(c,d,!!e):b.detachEvent("on"+c,d)},css:function(b,c,d){b instanceof avalon&&(b=b[0]);var e=/[_-]/.test(c)?oa(c):c;c=avalon.cssName(e)||e;if(void 0===d||"boolean"===typeof d)return e=x[e+":get"]||x["@:get"],"background"===c&&(c="backgroundColor"),b=e(b,c),!0===d?parseFloat(b)||
39
- 0:b;""===d?b.style[c]="":null==d||d!==d||(isFinite(d)&&!avalon.cssNumber[e]&&(d+="px"),e=x[e+":set"]||x["@:set"],e(b,c,d))},each:function(b,c){if(b){var d=0;if(Xb(b))for(var e=b.length;d<e&&!1!==c(d,b[d]);d++);else for(d in b)if(b.hasOwnProperty(d)&&!1===c(d,b[d]))break}},getWidgetData:function(b,c){var d=avalon(b).data(),e={},f;for(f in d)0===f.indexOf(c)&&(e[f.replace(c,"").replace(/\w/,function(b){return b.toLowerCase()})]=d[f]);return e},Array:{ensure:function(b,c){if(-1===b.indexOf(c))return b.push(c)},
40
- removeAt:function(b,c){return!!b.splice(c,1).length},remove:function(b,c){var d=b.indexOf(c);return~d?avalon.Array.removeAt(b,d):!1}}});var v=avalon.bindingHandlers={},E=avalon.bindingExecutors={};avalon.nextTick=q.setImmediate?setImmediate.bind(q):function(b){setTimeout(b,0)};if(!"\u53f8\u5f92\u6b63\u7f8e".trim){var Pc=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;String.prototype.trim=function(){return this.replace(Pc,"")}}var Qc=!{toString:null}.propertyIsEnumerable("toString"),Rc=function(){}.propertyIsEnumerable("prototype"),
41
- Kb="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),Sc=Kb.length;Object.keys||(Object.keys=function(b){var c=[],d=Rc&&"function"===typeof b;if("string"===typeof b||b&&b.callee)for(d=0;d<b.length;++d)c.push(String(d));else for(var e in b)!(d&&"prototype"===e)&&M.call(b,e)&&c.push(String(e));if(Qc){d=(d=b.constructor)&&d.prototype===b;for(e=0;e<Sc;e++){var f=Kb[e];!(d&&"constructor"===f)&&M.call(b,f)&&c.push(f)}}return c});Array.isArray||(Array.isArray=
42
- function(b){return"[object Array]"===V.call(b)});A.bind||(Function.prototype.bind=function(b){if(2>arguments.length&&void 0===b)return this;var c=this,d=arguments;return function(){var e=[],f;for(f=1;f<d.length;f++)e.push(d[f]);for(f=0;f<arguments.length;f++)e.push(arguments[f]);return c.apply(b,e)}});Ib.test([].map)||avalon.mix(J,{indexOf:function(b,c){var d=this.length,e=~~c;for(0>e&&(e+=d);e<d;e++)if(this[e]===b)return e;return-1},lastIndexOf:function(b,c){var d=this.length,e=null==c?d-1:c;for(0>
43
- e&&(e=Math.max(0,d+e));0<=e;e--)if(this[e]===b)return e;return-1},forEach:$("","_",""),filter:$("r=[],j=0,","if(_)r[j++]=this[i]","return r"),map:$("r=[],","r[i]=_","return r"),some:$("","if(_)return true","return false"),every:$("","if(!_)return false","return true")});avalon.contains=Ya;B.contains||(Node.prototype.contains=function(b){return!!(this.compareDocumentPosition(b)&16)});p.contains||(p.contains=function(b){return Ya(p,b)});if(q.SVGElement){var Lb=p.createElementNS("http://www.w3.org/2000/svg",
44
- "svg");Lb.innerHTML='<circle cx="50" cy="50" r="40" fill="red" />';if(!Ha.test(Lb.firstChild)){var Ja=function(b,c){if(b&&b.childNodes)for(var d=b.childNodes,e=0,f;f=d[e++];)if(f.tagName){var g=p.createElementNS("http://www.w3.org/2000/svg",f.tagName.toLowerCase());J.forEach.call(f.attributes,function(b){g.setAttribute(b.name,b.value)});Ja(f,g);c.appendChild(g)}};Object.defineProperties(SVGElement.prototype,{outerHTML:{enumerable:!0,configurable:!0,get:Za,set:function(b){var c=this.tagName.toLowerCase(),
45
- d=this.parentNode;b=avalon.parseHTML(b);"svg"===c?d.insertBefore(b,this):(c=p.createDocumentFragment(),Ja(b,c),d.insertBefore(c,this));d.removeChild(this)}},innerHTML:{enumerable:!0,configurable:!0,get:function(){var b=RegExp("</"+this.nodeName+">$","i");return this.outerHTML.replace(RegExp("<"+this.nodeName+'\\b(?:(["\'])[^"]*?(\\1)|[^>])*>',"i"),"").replace(b,"")},set:function(b){avalon.clearHTML&&(avalon.clearHTML(this),b=avalon.parseHTML(b),Ja(b,this))}}})}}!B.outerHTML&&q.HTMLElement&&HTMLElement.prototype.__defineGetter__("outerHTML",
46
- Za);var Zb=/^(?:mouse|contextmenu|drag)|click/,ha=avalon.eventHooks;"onmouseenter"in B||avalon.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(b,c){ha[b]={type:c,deel:function(c,e){return function(f){var g=f.relatedTarget;if(!g||g!==c&&!(c.compareDocumentPosition(g)&16))return delete f.type,f.type=b,e.call(c,f)}}}});avalon.each({AnimationEvent:"animationend",WebKitAnimationEvent:"webkitAnimationEnd"},function(b,c){q[b]&&!ha.animationend&&(ha.animationend={type:c})});"oninput"in p.createElement("input")||
47
- (ha.input={type:"propertychange",deel:function(b,c){return function(d){if("value"===d.propertyName)return d.type="input",c.call(b,d)}}});if(void 0===p.onmousewheel){var Mb=void 0!==p.onwheel?"wheel":"DOMMouseScroll",Tc="wheel"===Mb?"deltaY":"detail";ha.mousewheel={type:Mb,deel:function(b,c){return function(d){d.wheelDeltaY=d.wheelDelta=0<d[Tc]?-120:120;d.wheelDeltaX=0;Object.defineProperty&&Object.defineProperty(d,"type",{value:"mousewheel"});c.call(b,d)}}}}var O,P,ca,Nb,qb,Ob=/[-.*+?^${}()|[\]\/\\]/g,
48
- F=A,ia={loader:function(b){q.define=b?F.define:Mc;q.require=b?F:Lc},interpolate:function(b){O=b[0];P=b[1];if(O===P)throw new SyntaxError("openTag!==closeTag");if("\x3c!--,--\x3e"===b+"")t.commentInterpolate=!0;else{b=O+"test"+P;ga.innerHTML=b;if(ga.innerHTML!==b&&-1<ga.innerHTML.indexOf("&lt;"))throw new SyntaxError("\u6b64\u5b9a\u754c\u7b26\u4e0d\u5408\u6cd5");ga.innerHTML=""}b=(O+"").replace(Ob,"\\$&");var c=(P+"").replace(Ob,"\\$&");ca=RegExp(b+"(.*?)"+c);Nb=RegExp(b+"(.*?)"+c,"g");qb=RegExp(b+
49
- ".*?"+c+"|\\sms-")}};t.debug=!0;t.plugins=ia;t.plugins.interpolate(["{{","}}"]);t.paths={};t.shim={};t.maxRepeatSize=100;avalon.config=t;var D={$watch:function(b,c){if("function"===typeof c){var d=this.$events[b];d?d.push(c):this.$events[b]=[c]}else this.$events=this.$watch.backup;return this},$unwatch:function(b,c){var d=arguments.length;if(0===d)this.$watch.backup=this.$events,this.$events={};else if(1===d)this.$events[b]=[];else for(var d=this.$events[b]||[],e=d.length;0>~--e;)if(d[e]===c)return d.splice(e,
50
- 1);return this},$fire:function(b){var c;/^(\w+)!(\S+)$/.test(b)&&(c=RegExp.$1,b=RegExp.$2);var d=this.$events,e=la.call(arguments,1),f=[b].concat(e);if("all"===c)for(var g in avalon.vmodels){var h=avalon.vmodels[g];h!==this&&h.$fire.apply(h,f)}else if("up"===c||"down"===c){var k=d.expr?Pb(d.expr):[];if(0!==k.length){for(g in avalon.vmodels)h=avalon.vmodels[g],h!==this&&h.$events.expr&&(e=Pb(h.$events.expr),0!==e.length&&Array.prototype.forEach.call(e,function(b){Array.prototype.forEach.call(k,function(d){if("down"===
51
- c?d.contains(b):b.contains(d))b._avalon=h})}));g=p.getElementsByTagName("*");var l=[];Array.prototype.forEach.call(g,function(b){b._avalon&&(l.push(b._avalon),b._avalon="",b.removeAttribute("_avalon"))});"up"===c&&l.reverse();for(g=0;(e=l[g++])&&!1!==e.$fire.apply(e,f););}}else{f=d[b]||[];d=d.$all||[];g=0;for(var m;m=f[g++];)T(m)&&m.apply(this,e);for(g=0;m=d[g++];)T(m)&&m.apply(this,arguments)}}},Uc=/(\w+)\[(avalonctrl)="(\S+)"\]/,Pb=p.querySelectorAll?function(b){return p.querySelectorAll(b)}:function(b){b=
52
- b.match(Uc);for(var c=p.getElementsByTagName(b[1]),d=[],e=0,f;f=c[e++];)f.getAttribute(b[2])===b[3]&&d.push(f);return d},Qb=avalon.vmodels={};avalon.define=function(b,c){var d=b.$id||b;d||y("warning: vm\u5fc5\u987b\u6307\u5b9a$id");Qb[d]&&y("warning: "+d+" \u5df2\u7ecf\u5b58\u5728\u4e8eavalon.vmodels\u4e2d");if("object"===typeof b)var e=K(b);else e={$watch:A},c(e),e=K(e),ta=!0,c(e),ta=!1;e.$id=d;return Qb[d]=e};var ra="$id,$watch,$unwatch,$fire,$events,$model,$skipArray".match(w),sa={},Ka=Object.defineProperty,
53
- va=!0;try{Ka({},"_",{value:"x"});var ua=Object.defineProperties}catch(Bd){va=!1}var $a=Object.is||function(b,c){return 0===b&&0===c?1/b===1/c:b!==b?c!==c:b===c},fc=z?function(b){var c={},d;for(d in b)c[d]={get:b[d],set:b[d],enumerable:!0,configurable:!0};return c}:function(b){return b};if(!va&&("__defineGetter__"in avalon&&(Ka=function(b,c,d){"value"in d&&(b[c]=d.value);"get"in d&&b.__defineGetter__(c,d.get);"set"in d&&b.__defineSetter__(c,d.set);return b},ua=function(b,c){for(var d in c)c.hasOwnProperty(d)&&
54
- Ka(b,d,c[d]);return b}),R)){q.execScript('Function parseVB(code)\n\tExecuteGlobal(code)\nEnd Function\nDim VBClassBodies\nSet VBClassBodies=CreateObject("Scripting.Dictionary")\nFunction findOrDefineVBClass(name,body)\n\tDim found\n\tfound=""\n\tFor Each key in VBClassBodies\n\t\tIf body=VBClassBodies.Item(key) Then\n\t\t\tfound=key\n\t\t\tExit For\n\t\tEnd If\n\tnext\n\tIf found="" Then\n\t\tparseVB("Class " + name + body)\n\t\tVBClassBodies.Add name, body\n\t\tfound=name\n\tEnd If\n\tfindOrDefineVBClass=found\nEnd Function',
55
- "VBScript");var Vc=function(b,c,d,e){var f=c[d];if(4===arguments.length)f.call(b,e);else return f.call(b)},ua=function(b,c,d){var e="VBClass"+setTimeout("1"),f=[];f.push("\r\n\tPrivate [__data__], [__proxy__]","\tPublic Default Function [__const__](d, p)","\t\tSet [__data__] = d: set [__proxy__] = p","\t\tSet [__const__] = Me","\tEnd Function");for(b in d)c.hasOwnProperty(b)||f.push("\tPublic ["+b+"]");ra.forEach(function(b){c.hasOwnProperty(b)||f.push("\tPublic ["+b+"]")});f.push("\tPublic [hasOwnProperty]");
56
- for(b in c)f.push("\tPublic Property Let ["+b+"](val"+C+")",'\t\tCall [__proxy__](Me,[__data__], "'+b+'", val'+C+")","\tEnd Property","\tPublic Property Set ["+b+"](val"+C+")",'\t\tCall [__proxy__](Me,[__data__], "'+b+'", val'+C+")","\tEnd Property","\tPublic Property Get ["+b+"]","\tOn Error Resume Next","\t\tSet["+b+'] = [__proxy__](Me,[__data__],"'+b+'")',"\tIf Err.Number <> 0 Then","\t\t["+b+'] = [__proxy__](Me,[__data__],"'+b+'")',"\tEnd If","\tOn Error Goto 0","\tEnd Property");f.push("End Class");
57
- b=f.join("\r\n");b=q.findOrDefineVBClass(e,b);b===e&&q.parseVB(["Function "+e+"Factory(a, b)","\tDim o","\tSet o = (New "+e+")(a, b)","\tSet "+e+"Factory = o","End Function"].join("\r\n"));return q[b+"Factory"](c,Vc)}}var xa=J.splice,bb={_splice:xa,_fire:function(b,c,d){ka(this.$events[L],b,c,d)},size:function(){return this._.length},pushArray:function(b){var c=b.length,d=this.length;c&&(J.push.apply(this.$model,b),W.call(this,"add",d,c,d));return c+d},push:function(){var b,c=arguments.length;for(b=
58
- 0;b<c;b++);return this.pushArray(arguments)},unshift:function(){var b=arguments.length,c=this.length;b&&(J.unshift.apply(this.$model,arguments),W.call(this,"add",0,b,0));return b+c},shift:function(){if(this.length){var b=this.$model.shift();W.call(this,"del",0,1,0);return b}},pop:function(){var b=this.length;if(b){var c=this.$model.pop();W.call(this,"del",b-1,1,Math.max(0,b-2));return c}},splice:function(b){var c=arguments.length,d=[],e,f=xa.apply(this.$model,arguments);f.length&&(d.push("del",b,
59
- f.length,0),e=!0);2<c&&(e?d.splice(3,1,0,"add",b,c-2):d.push("add",b,c-2,0),e=!0);return e?W.apply(this,d):[]},contains:function(b){return-1!==this.indexOf(b)},remove:function(b){return this.removeAt(this.indexOf(b))},removeAt:function(b){return 0<=b?(this.$model.splice(b,1),W.call(this,"del",b,1,0)):[]},clear:function(){this.$model.length=this.length=this._.length=0;this._fire("clear",0);return this},removeAll:function(b){if(Array.isArray(b))b.forEach(function(b){this.remove(b)},this);else if("function"===
60
- typeof b)for(var c=this.length-1;0<=c;c--)b(this[c],c)&&this.removeAt(c);else this.clear()},ensure:function(b){this.contains(b)||this.push(b);return this},set:function(b,c){if(0<=b){var d=avalon.type(c);c&&c.$model&&(c=c.$model);var e=this[b];if("object"===d)for(var f in c)e.hasOwnProperty(f)&&(e[f]=c[f]);else"array"===d?e.clear().push.apply(e,c):e!==c&&(this[b]=c,this.$model[b]=c,this._fire("set",b,c))}return this}};"sort,reverse".replace(w,function(b){bb[b]=function(){var c=this.$model,d=c.concat(),
61
- e=Math.random(),f=[],g;J[b].apply(c,arguments);for(var h=0,k=d.length;h<k;h++){var l=c[h];$a(l,d[h])?f.push(h):(g=d.indexOf(l),f.push(g),d[g]=e,g=!0)}g&&(ya(this,f),this._fire("move",f),this._fire("index",0));return this}});var gc=/^(duplex|on)$/,Q=avalon.$$subscribers=[],fb=new Date,eb={},H={area:[1,"<map>"],param:[1,"<object>"],col:[2,"<table><tbody></tbody><colgroup>","</table>"],legend:[1,"<fieldset>"],option:[1,"<select multiple='multiple'>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>",
62
- "</tbody></table>"],th:[3,"<table><tbody><tr>","</tr></tbody></table>"],td:[3,"<table><tbody><tr>"],g:[1,'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">',"</svg>"],_default:z?[0,""]:[1,"X<div>"]};H.optgroup=H.option;H.tbody=H.tfoot=H.colgroup=H.caption=H.thead;"circle,defs,ellipse,image,line,path,polygon,polyline,rect,symbol,text,use".replace(w,function(b){H[b]=H.g});var Wc=/<([\w:]+)/,Xc=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
63
- Rb=z?/[^\d\D]/:/(<(?:script|link|style|meta|noscript))/ig,Yc=S(["","text/javascript","text/ecmascript","application/ecmascript","application/javascript"]),Zc=/<(?:tb|td|tf|th|tr|col|opt|leg|cap|area)/,$c=p.createElement("script");avalon.parseHTML=function(b){if("string"!==typeof b)return p.createDocumentFragment();b=b.replace(Xc,"<$1></$2>").trim();var c=(Wc.exec(b)||["",""])[1].toLowerCase(),d=H[c]||H._default,c=X.cloneNode(!1),e=ga,f;z||(b=b.replace(Rb,"<br class=msNoScope>$1"));e.innerHTML=d[1]+
64
- b+(d[2]||"");b=e.getElementsByTagName("script");if(b.length)for(var g=0,h;h=b[g++];)Yc[h.type]&&(f=$c.cloneNode(!1),J.forEach.call(h.attributes,function(b){b&&b.specified&&(f[b.name]=b.value,f.setAttribute(b.name,b.value))}),f.text=h.text,h.parentNode.replaceChild(f,h));for(g=d[0];g--;e=e.lastChild);if(!z){b=e.getElementsByTagName("br");for(d=b.length;h=b[--d];)"msNoScope"===h.className&&h.parentNode.removeChild(h);b=e.all;for(g=0;h=b[g++];)gb(h)&&ic(h)}for(;d=e.firstChild;)c.appendChild(d);return c};
65
- avalon.innerHTML=function(b,c){if(!z&&!Rb.test(c)&&!Zc.test(c))try{b.innerHTML=c;return}catch(d){}var e=this.parseHTML(c);this.clearHTML(b).appendChild(e)};avalon.clearHTML=function(b){for(b.textContent="";b.firstChild;)b.removeChild(b.firstChild);return b};avalon.scan=function(b,c,d){b=b||B;c=c?[].concat(c):[];ib(b,c)};var pc=S("AREA,BASE,BASEFONT,BR,COL,COMMAND,EMBED,HR,IMG,INPUT,LINK,META,PARAM,SOURCE,TRACK,WBR,NOSCRIPT,SCRIPT,STYLE,TEXTAREA"),ja=function(b,c,d){if(b=b.getAttribute(c)){c=0;for(var e;e=
66
- d[c++];)if(e.hasOwnProperty(b)&&"function"===typeof e[b])return e[b]}},rb=R&&q.MutationObserver?function(b){for(var c=b.firstChild,d;c;){var e=c.nextSibling;3===c.nodeType?d?(d.nodeValue+=c.nodeValue,b.removeChild(c)):d=c:d=null;c=e}}:0,nb=/ms-(\w+)-?(.*)/,ob={"if":10,repeat:90,data:100,widget:110,each:1400,"with":1500,duplex:2E3,on:3E3},lc=S("animationend,blur,change,input,click,dblclick,focus,keydown,keypress,keyup,mousedown,mouseenter,mouseleave,mousemove,mouseout,mouseover,mouseup,scan,scroll,submit"),
67
- mc=S("value,title,alt,checked,selected,disabled,readonly,enabled"),nc=/^if|widget|repeat$/,oc=/^each|with|html|include$/;if(!"1"[0])var La=qa(512),ad=/\s+(ms-[^=\s]+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,bd=/^['"]/,cd=/<\w+\b(?:(["'])[^"]*?(\1)|[^>])*>/i,dd=/&amp;/g,mb=function(b){b=b.outerHTML;if("</"===b.slice(0,2)||!b.trim())return[];b=b.match(cd)[0];var c=[],d,e;if(La[b])return La[b];for(;d=ad.exec(b);)(e=d[2])&&(e=(bd.test(e)?e.slice(1,-1):e).replace(dd,"&")),d=d[1].toLowerCase(),d.match(nb),c.push({name:d,
68
- specified:!0,value:e||""});return La(b,c)};var pb=/\|\s*html\s*/,sc=/\|\|/g,qc=/&lt;/g,rc=/&gt;/g,ub={_toString:function(){var b=this.node.className;return("string"===typeof b?b:b.baseVal).split(/\s+/).join(" ")},_contains:function(b){return-1<(" "+this+" ").indexOf(" "+b+" ")},_add:function(b){this.contains(b)||this._set(this+" "+b)},_remove:function(b){this._set((" "+this+" ").replace(" "+b+" "," "))},__set:function(b){b=b.trim();var c=this.node;Ha.test(c)?c.setAttribute("class",b):c.className=
69
- b}};"add,remove".replace(w,function(b){avalon.fn[b+"Class"]=function(c){var d=this[0];c&&("string"===typeof c&&d&&1===d.nodeType)&&c.replace(/\S+/g,function(c){tb(d)[b](c)});return this}});avalon.fn.mix({hasClass:function(b){var c=this[0]||{};return 1===c.nodeType&&tb(c).contains(b)},toggleClass:function(b,c){for(var d,e=0,f=b.split(/\s+/),g="boolean"===typeof c;d=f[e++];)this[(g?c:!this.hasClass(d))?"addClass":"removeClass"](d);return this},attr:function(b,c){return 2===arguments.length?(this[0].setAttribute(b,
70
- c),this):this[0].getAttribute(b)},data:function(b,c){b="data-"+sb(b||"");switch(arguments.length){case 2:return this.attr(b,c),this;case 1:var d=this.attr(b);return vb(d);case 0:var e={};J.forEach.call(this[0].attributes,function(c){c&&(b=c.name,b.indexOf("data-")||(b=oa(b.slice(5)),e[b]=vb(c.value)))});return e}},removeData:function(b){b="data-"+sb(b);this[0].removeAttribute(b);return this},css:function(b,c){if(avalon.isPlainObject(b))for(var d in b)avalon.css(this,d,b[d]);else var e=avalon.css(this,
71
- b,c);return void 0!==e?e:this},position:function(){var b,c,d=this[0],e={top:0,left:0};if(d)return"fixed"===this.css("position")?c=d.getBoundingClientRect():(b=this.offsetParent(),c=this.offset(),"HTML"!==b[0].tagName&&(e=b.offset()),e.top+=avalon.css(b[0],"borderTopWidth",!0),e.left+=avalon.css(b[0],"borderLeftWidth",!0)),{top:c.top-e.top-avalon.css(d,"marginTop",!0),left:c.left-e.left-avalon.css(d,"marginLeft",!0)}},offsetParent:function(){for(var b=this[0].offsetParent;b&&"static"===avalon.css(b,
72
- "position");)b=b.offsetParent;return avalon(b)},bind:function(b,c,d){if(this[0])return avalon.bind(this[0],b,c,d)},unbind:function(b,c,d){this[0]&&avalon.unbind(this[0],b,c,d);return this},val:function(b){var c=this[0];if(c&&1===c.nodeType){var d=0===arguments.length,e=d?":get":":set",f=Ma,g;g=c.tagName.toLowerCase();g="input"===g&&/checkbox|radio/.test(c.type)?"checked":g;if(e=f[g+e])var h=e(c,b);else{if(d)return(c.value||"").replace(/\r/g,"");c.value=b}}return d?h:this}});var tc=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
73
- ed=/^[\],:{}\s]*$/,fd=/(?:^|:|,)(?:\s*\[)+/g,gd=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,hd=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g;avalon.parseJSON=q.JSON?JSON.parse:function(b){if("string"===typeof b){if((b=b.trim())&&ed.test(b.replace(gd,"@").replace(hd,"]").replace(fd,"")))return(new Function("return "+b))();avalon.error("Invalid JSON: "+b)}return b};avalon.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){avalon.fn[b]=function(d){var e=this[0]||{},f=
74
- e.window&&e.document?e:9===e.nodeType?e.defaultView||e.parentWindow:!1,g="scrollTop"===b;if(arguments.length)f?f.scrollTo(!g?d:avalon(f).scrollLeft(),g?d:avalon(f).scrollTop()):e[b]=d;else return f?c in f?f[c]:B[b]:e[b]}});var x=avalon.cssHooks={},Sb=["","-webkit-","-o-","-moz-","-ms-"],Na={"float":z?"cssFloat":"styleFloat"};avalon.cssNumber=S("columnCount,order,fillOpacity,fontWeight,lineHeight,opacity,orphans,widows,zIndex,zoom");avalon.cssName=function(b,c,d){if(Na[b])return Na[b];c=c||B.style;
75
- for(var e=0,f=Sb.length;e<f;e++)if(d=oa(Sb[e]+b),d in c)return Na[b]=d;return null};x["@:set"]=function(b,c,d){try{b.style[c]=d}catch(e){}};if(q.getComputedStyle)x["@:get"]=function(b,c){if(!b||!b.style)throw Error("getComputedStyle\u8981\u6c42\u4f20\u5165\u4e00\u4e2a\u8282\u70b9 "+b);var d,e=getComputedStyle(b,null);e&&(d="filter"===c?e.getPropertyValue(c):e[c],""===d&&(d=b.style[c]));return d},x["opacity:get"]=function(b){b=x["@:get"](b,"opacity");return""===b?"1":b};else{var id=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
76
- jd=/^(top|right|bottom|left)$/,Tb=/alpha\([^)]*\)/i,Oa=!!q.XDomainRequest,kd={thin:Oa?"1px":"2px",medium:Oa?"3px":"4px",thick:Oa?"5px":"6px"};x["@:get"]=function(b,c){var d=b.currentStyle,e=d[c];if(id.test(e)&&!jd.test(e)){var f=b.style,g=f.left,h=b.runtimeStyle.left;b.runtimeStyle.left=d.left;f.left="fontSize"===c?"1em":e||0;e=f.pixelLeft+"px";f.left=g;b.runtimeStyle.left=h}"medium"===e&&(c=c.replace("Width","Style"),"none"===d[c]&&(e="0px"));return""===e?"auto":kd[e]||e};x["opacity:set"]=function(b,
77
- c,d){b=b.style;d=isFinite(d)&&1>=d?"alpha(opacity="+100*d+")":"";c=b.filter||"";b.zoom=1;b.filter=(Tb.test(c)?c.replace(Tb,d):c+" "+d).trim();b.filter||b.removeAttribute("filter")};x["opacity:get"]=function(b){b=b.filters.alpha||b.filters["DXImageTransform.Microsoft.Alpha"];return(b&&b.enabled?b.opacity:100)/100+""}}"top,left".replace(w,function(b){x[b+":get"]=function(c){var d=x["@:get"](c,b);return/px$/.test(d)?d:avalon(c).position()[b]+"px"}});var xb={position:"absolute",visibility:"hidden",display:"block"},
78
- uc=/^(none|table(?!-c[ea]).+)/;"Width,Height".replace(w,function(b){var c=b.toLowerCase(),d="client"+b,e="scroll"+b,f="offset"+b;x[c+":get"]=function(c,d,e){var l=-4;"number"===typeof e&&(l=e);d="Width"===b?["Left","Right"]:["Top","Bottom"];e=c[f];if(2===l)return e+avalon.css(c,"margin"+d[0],!0)+avalon.css(c,"margin"+d[1],!0);0>l&&(e=e-avalon.css(c,"border"+d[0]+"Width",!0)-avalon.css(c,"border"+d[1]+"Width",!0));-4===l&&(e=e-avalon.css(c,"padding"+d[0],!0)-avalon.css(c,"padding"+d[1],!0));return e};
79
- x[c+"&get"]=function(b){var d=[];wb(b,d);for(var e=x[c+":get"](b),f=0,m;m=d[f++];){b=m.node;for(var n in m)"string"===typeof m[n]&&(b.style[n]=m[n])}return e};avalon.fn[c]=function(g){var h=this[0];if(0===arguments.length){if(h.setTimeout)return h["inner"+b]||h.document.documentElement[d];if(9===h.nodeType){var k=h.documentElement;return Math.max(h.body[e],k[e],h.body[f],k[f],k[d])}return x[c+"&get"](h)}return this.css(c,g)};avalon.fn["inner"+b]=function(){return x[c+":get"](this[0],void 0,-2)};avalon.fn["outer"+
80
- b]=function(b){return x[c+":get"](this[0],void 0,!0===b?2:0)}});avalon.fn.offset=function(){var b=this[0],c={left:0,top:0};if(!b||!b.tagName||!b.ownerDocument)return c;var d=b.ownerDocument,e=d.body,f=d.documentElement,d=d.defaultView||d.parentWindow;if(!avalon.contains(f,b))return c;b.getBoundingClientRect&&(c=b.getBoundingClientRect());var b=f.clientTop||e.clientTop,g=f.clientLeft||e.clientLeft,h=Math.max(d.pageYOffset||0,f.scrollTop,e.scrollTop),e=Math.max(d.pageXOffset||0,f.scrollLeft,e.scrollLeft);
81
- return{top:c.top+h-b,left:c.left+e-g}};var ld=/^<option(?:\s+\w+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s+value[\s=]/i,Ma={"option:get":R?function(b){return ld.test(b.outerHTML)?b.value:b.text.trim()}:function(b){return b.value},"select:get":function(b,c){for(var d,e=b.options,f=b.selectedIndex,g=Ma["option:get"],h="select-one"===b.type||0>f,k=h?null:[],l=h?f+1:e.length,m=0>f?l:h?f:0;m<l;m++)if(d=e[m],(d.selected||m===f)&&!d.disabled){c=g(d);if(h)return c;k.push(c)}return k},"select:set":function(b,
82
- c,d){c=[].concat(c);for(var e=Ma["option:get"],f=0,g;g=b.options[f++];)if(g.selected=-1<c.indexOf(e(g)))d=!0;d||(b.selectedIndex=-1)}},md={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},zb=q.JSON&&JSON.stringify||function(b){return'"'+b.replace(/[\\\"\x00-\x1f]/g,function(b){var d=md[b];return"string"===typeof d?d:"\\u"+("0000"+b.charCodeAt(0).toString(16)).slice(-4)})+'"'},nd=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|[\s\t\n]*\.[\s\t\n]*[$\w\.]+/g,
83
- od=/[^\w$]+/g,pd=RegExp(""+("\\b"+"break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined".replace(/,/g,"\\b|\\b")+"\\b"),"g"),qd=/\b\d[^,]*/g,
84
- rd=/^,+|,+$/g,Pa=qa(512),Dc=function(b){var c=","+b.trim();if(Pa[c])return Pa[c];b=b.replace(nd,"").replace(od,",").replace(pd,"").replace(qd,"").replace(rd,"").split(/^$|,+/);return Pa(c,yb(b))},Ea=qa(128),Ec=/\w\[.*\]|\w\.\w/,Cc=/(\$proxy\$[a-z]+)\d+$/,xc=/\)\s*$/,yc=/\)\s*\|/g,zc=/\|\s*([$\w]+)/g,Ac=/"\s*\["/g,Bc=/"\s*\(/g;avalon.parseExprProxy=I;var Qa={};"autofocus,autoplay,async,allowTransparency,checked,controls,declare,disabled,defer,defaultChecked,defaultSelectedcontentEditable,isMap,loop,multiple,noHref,noResize,noShade,open,readOnly,selected".replace(w,
85
- function(b){Qa[b.toLowerCase()]=b});var Ra={"accept-charset":"acceptCharset","char":"ch",charoff:"chOff","class":"className","for":"htmlFor","http-equiv":"httpEquiv"};"accessKey,bgColor,cellPadding,cellSpacing,codeBase,codeType,colSpan,dateTime,defaultValue,frameBorder,longDesc,maxLength,marginWidth,marginHeight,rowSpan,tabIndex,useMap,vSpace,valueType,vAlign".replace(w,function(b){Ra[b.toLowerCase()]=b});var sd=/<noscript.*?>(?:[\s\S]+?)<\/noscript>/img,td=/<noscript.*?>([\s\S]+?)<\/noscript>/im,
86
- Sa=function(){return new (q.XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP")},Ta=avalon.templateCache={};v.attr=function(b,c){var d=b.value.trim(),e=!0;-1<d.indexOf(O)&&2<d.indexOf(P)&&(e=!1,ca.test(d)&&(""===RegExp.rightContext&&""===RegExp.leftContext)&&(e=!0,d=RegExp.$1));if("include"===b.type){var f=b.element;b.includeRendered=ja(f,"data-include-rendered",c);b.includeLoaded=ja(f,"data-include-loaded",c);var g=b.includeReplaced=!!avalon(f).data("includeReplace");b.startInclude=p.createComment("ms-include");
87
- b.endInclude=p.createComment("ms-include-end");g?(b.element=b.startInclude,f.parentNode.insertBefore(b.startInclude,f),f.parentNode.insertBefore(b.endInclude,f.nextSibling)):(f.insertBefore(b.startInclude,f.firstChild),f.appendChild(b.endInclude))}b.handlerName="attr";I(d,c,b,e?0:Da(b.value))};E.attr=function(b,c,d){var e=d.type,f=d.param;if("css"===e)avalon(c).css(f,b);else if("attr"===e){if(Qa[f]&&(e=Qa[f],"boolean"===typeof c[e]))return c[e]=!!b;!z&&Ra[f]&&(f=Ra[f]);if(!1===b||null===b||void 0===
88
- b)return c.removeAttribute(f);(Ha.test(c)?0:p.namespaces&&gb(c)||f in c.cloneNode(!1))?c[f]=b:c.setAttribute(f,b)}else if("include"===e&&b){var g=d.vmodels,h=d.includeRendered,k=d.includeLoaded,l=d.includeReplaced?c.parentNode:c,m=function(b){k&&(b=k.apply(l,[b].concat(g)));for(h&&ma(l,function(){h.call(l)},NaN);;){var c=d.startInclude.nextSibling;if(c&&c!==d.endInclude)l.removeChild(c);else break}b=avalon.parseHTML(b);c=avalon.slice(b.childNodes);l.insertBefore(b,d.endInclude);na(c,g)};if("src"===
89
- d.param)if(Ta[b])avalon.nextTick(function(){m(Ta[b])});else{var n=Sa();n.onreadystatechange=function(){if(4===n.readyState){var c=n.status;if(200<=c&&300>c||304===c||1223===c)m(Ta[b]=n.responseText)}};n.open("GET",b,!0);"withCredentials"in n&&(n.withCredentials=!0);n.setRequestHeader("X-Requested-With","XMLHttpRequest");n.send(null)}else{var r=b&&1===b.nodeType?b:p.getElementById(b);if(r){if("NOSCRIPT"===r.tagName&&!r.innerHTML&&!r.fixIE78){n=Sa();n.open("GET",location,!1);n.send(null);c=p.getElementsByTagName("noscript");
90
- for(var f=(n.responseText||"").match(sd)||[],e=f.length,s=0;s<e;s++){var aa=c[s];aa&&(aa.style.display="none",aa.fixIE78=(f[s].match(td)||["","&nbsp;"])[1])}}avalon.nextTick(function(){m(r.fixIE78||r.value||r.innerText||r.innerHTML)})}}}else{if(!B.hasAttribute&&"string"===typeof b&&("src"===e||"href"===e))b=b.replace(/&amp;/g,"&");c[e]=b;q.chrome&&"EMBED"===c.tagName&&(f=c.parentNode,e=document.createComment("ms-src"),f.replaceChild(e,c),f.replaceChild(c,e))}};"title,alt,src,value,css,include,href".replace(w,
91
- function(b){v[b]=v.attr});v["class"]=function(b,c){var d=b.param,e=b.value;b.handlerName="class";if(!d||isFinite(d)){b.param="";var f=e.replace(Nb,function(b){return b.replace(/./g,"0")}).indexOf(":");if(-1===f)d=e;else if(d=e.slice(0,f),e=e.slice(f+1),Ab(e,c,b),b.evaluator)b._evaluator=b.evaluator,b._args=b.args;else return y("debug: ms-class '"+(e||"").trim()+"' \u4e0d\u5b58\u5728\u4e8eVM\u4e2d"),!1;e=ca.test(d);e||(b.immobileClass=d);I("",c,b,e?Da(d):0)}else b.immobileClass=b.oldStyle=b.param,
92
- I(e,c,b)};E["class"]=function(b,c,d){var e=avalon(c),f=d.type;if("class"===f&&d.oldStyle)e.toggleClass(d.oldStyle,!!b);else switch(d.toggleClass=d._evaluator?!!d._evaluator.apply(c,d._args):!0,d.newClass=d.immobileClass||b,d.oldClass&&d.newClass!==d.oldClass&&e.removeClass(d.oldClass),d.oldClass=d.newClass,f){case "class":e.toggleClass(d.newClass,d.toggleClass);break;case "hover":case "active":if(!d.hasBindEvent){var g="mouseenter",h="mouseleave";if("active"===f){c.tabIndex=c.tabIndex||-1;var g="mousedown",
93
- h="mouseup",k=e.bind("mouseleave",function(){d.toggleClass&&e.removeClass(d.newClass)})}var l=e.bind(g,function(){d.toggleClass&&e.addClass(d.newClass)}),m=e.bind(h,function(){d.toggleClass&&e.removeClass(d.newClass)});d.rollback=function(){e.unbind("mouseleave",k);e.unbind(g,l);e.unbind(h,m)};d.hasBindEvent=!0}}};"hover,active".replace(w,function(b){v[b]=v["class"]});E.data=function(b,c,d){d="data-"+d.param;b&&"object"===typeof b?c[d]=b:c.setAttribute(d,String(b))};E.text=function(b,c){b=null==b?
94
- "":b;if(3===c.nodeType)try{c.data=b}catch(d){}else"textContent"in c?c.textContent=b:c.innerText=b};E.html=function(b,c,d){b=null==b?"":b;var e="group"in d,f=e?c.parentNode:c;if(f){if(11!==b.nodeType)if(1===b.nodeType||b.item){var g=1===b.nodeType?b.childNodes:b.item?b:[];for(b=X.cloneNode(!0);g[0];)b.appendChild(g[0])}else b=avalon.parseHTML(b);var h=p.createComment("ms-html");if(e){f.insertBefore(h,c);for(var g=d.group,k=1;k<g;){var l=c.nextSibling;l&&(f.removeChild(l),k++)}f.removeChild(c);d.element=
95
- h}else avalon.clearHTML(f).appendChild(h);e&&(d.group=b.childNodes.length||1);g=avalon.slice(b.childNodes);g[0]&&(h.parentNode&&h.parentNode.replaceChild(b,h),e&&(d.element=g[0]));na(g,d.vmodels)}};v["if"]=v.data=v.text=v.html=function(b,c){I(b.value,c,b)};E["if"]=function(b,c,d){b?(8===c.nodeType&&(c.parentNode.replaceChild(d.template,c),c=d.element=d.template),c.getAttribute(d.name)&&(c.removeAttribute(d.name),jb(c,d.vmodels)),d.rollback=null):1===c.nodeType&&(b=d.element=p.createComment("ms-if"),
96
- c.parentNode.replaceChild(b,c),d.template=c,fa.appendChild(c),d.rollback=function(){c.parentNode===fa&&fa.removeChild(c)})};avalon.parseDisplay=da;v.visible=function(b,c){var d=avalon(b.element),e=d.css("display");if("none"===e){var f=d[0].style,g=/visibility/i.test(f.cssText),h=d.css("visibility");f.display="";f.visibility="hidden";e=d.css("display");"none"===e&&(e=da(d[0].nodeName));f.visibility=g?h:""}b.display=e;I(b.value,c,b)};E.visible=function(b,c,d){c.style.display=b?d.display:"none"};var Ub=
97
- /\(([^)]*)\)/;v.on=function(b,c){var d=b.value;b.type="on";var e=b.param.replace(/-\d+$/,"");if("function"===typeof v.on[e+"Hook"])v.on[e+"Hook"](b);if(0<d.indexOf("(")&&-1<d.indexOf(")")&&(e=(d.match(Ub)||["",""])[1].trim(),""===e||"$event"===e))d=d.replace(Ub,"");I(d,c,b)};E.on=function(b,c,d){b=function(b){return(d.evaluator||A).apply(this,d.args.concat(b))};var e=d.param.replace(/-\d+$/,"");if("scan"===e)b.call(c,{type:e});else if("function"===typeof d.specialBind)d.specialBind(c,b);else var f=
98
- avalon.bind(c,e,b);d.rollback=function(){"function"===typeof d.specialUnbind?d.specialUnbind():avalon.unbind(c,e,f)}};v.widget=function(b,c){var d=b.value.match(w),e=b.element,f=d[0],g=d[1];if(!g||"$"===g)g=N(f);var d=d[2]||f,h=avalon.ui[f];if("function"===typeof h){c=e.vmodels||c;for(var k=0,l;l=c[k++];)if(l.hasOwnProperty(d)&&"object"===typeof l[d]){var m=l[d],m=m.$model||m;break}m&&(k=m[f+"Id"],"string"===typeof k&&(g=k));k=avalon.getWidgetData(e,f);b.value=[f,g,d].join();b[f+"Id"]=g;b.evaluator=
99
- A;e.msData["ms-widget-id"]=g;var n=b[f+"Options"]=avalon.mix({},h.defaults,m||{},k);e.removeAttribute("ms-widget");var r=h(e,b,c)||{};r.$id?(avalon.vmodels[g]=r,hb(e,r),r.hasOwnProperty("$init")&&r.$init(function(){avalon.scan(e,[r].concat(c));"function"===typeof n.onInit&&n.onInit.call(e,r,n,c)}),b.rollback=function(){try{r.widgetElement=null,r.$remove()}catch(b){}e.msData={};delete avalon.vmodels[r.$id]},Aa(b,ud),q.chrome&&e.addEventListener("DOMNodeRemovedFromDocument",function(){setTimeout(db)})):
100
- avalon.scan(e,c)}else c.length&&(e.vmodels=c)};var ud=[],Y=v.duplex=function(b,c){var d=b.element,e;I(b.value,c,b,0,1);b.changed=ja(d,"data-duplex-changed",c)||A;if(b.evaluator&&b.args){var f=[],g=S("string,number,boolean,checked");"radio"===d.type&&""===b.param&&(b.param="checked");d.msData&&(d.msData["ms-duplex"]=b.value);b.param.replace(/\w+/g,function(c){/^(checkbox|radio)$/.test(d.type)&&/^(radio|checked)$/.test(c)&&("radio"===c&&y("ms-duplex-radio\u5df2\u7ecf\u66f4\u540d\u4e3ams-duplex-checked"),
101
- c="checked",b.isChecked=!0);"bool"===c?(c="boolean",y("ms-duplex-bool\u5df2\u7ecf\u66f4\u540d\u4e3ams-duplex-boolean")):"text"===c&&(c="string",y("ms-duplex-text\u5df2\u7ecf\u66f4\u540d\u4e3ams-duplex-string"));g[c]&&(e=!0);avalon.Array.ensure(f,c)});e||f.push("string");b.param=f.join("-");b.bound=function(c,e){d.addEventListener?d.addEventListener(c,e,!1):d.attachEvent("on"+c,e);var f=b.rollback;b.rollback=function(){d.avalonSetter=null;avalon.unbind(d,c,e);f&&f()}};for(var h in avalon.vmodels)avalon.vmodels[h].$fire("avalon-ms-duplex-init",
102
- b);(b.pipe||(b.pipe=Fc))(null,b,"init");h=d.tagName;Y[h]&&Y[h](d,b.evaluator.apply(null,b.args),b)}};avalon.duplexHooks={checked:{get:function(b,c){return!c.element.oldValue}},string:{get:function(b){return b},set:Fa},"boolean":{get:function(b){return"true"===b},set:Fa},number:{get:function(b){return isFinite(b)?parseFloat(b)||0:b},set:Fa}};var Bb,ea=[];avalon.tick=function(b){1===ea.push(b)&&(Bb=setInterval(Gc,60))};var Vb=A;new function(){try{var b={},c=HTMLInputElement.prototype,d=HTMLTextAreaElement.prototype,
103
- e=function(c){avalon.contains(B,this)&&(b[this.tagName].call(this,c),this.avalonSetter&&this.avalonSetter())};Object.getOwnPropertyNames(HTMLInputElement.prototype);b.INPUT=Object.getOwnPropertyDescriptor(c,"value").set;Object.defineProperty(c,"value",{set:e});b.TEXTAREA=Object.getOwnPropertyDescriptor(d,"value").set;Object.defineProperty(d,"value",{set:e})}catch(f){Vb=avalon.tick}};R&&avalon.bind(p,"selectionchange",function(b){(b=p.activeElement)&&"function"===typeof b.avalonSetter&&b.avalonSetter()});
104
- Y.INPUT=function(b,c,d){function e(b){d.changed.call(this,b,d)}function f(){n=!0}function g(){n=!1}function h(){if(!n){var f=b.oldValue=b.value,f=d.pipe(f,d,"get");!1!==m.data("duplex-observe")&&(c(f),e.call(b,f),m.data("duplex-focus")&&avalon.nextTick(function(){b.focus()}))}}var k=b.type,l=d.bound,m=avalon(b),n=!1;d.handler=function(){var e=d.pipe(c(),d,"set")+"";e!==b.oldValue&&(b.value=e)};if(d.isChecked||"radio"===b.type){var r=6===R,h=function(){if(!1!==m.data("duplex-observe")){var f=d.pipe(b.value,
105
- d,"get");c(f);e.call(b,f)}};d.handler=function(){var e=c(),f=d.isChecked?!!e:e+""===b.value;b.oldValue=f;r?setTimeout(function(){b.defaultChecked=f;b.checked=f},31):b.checked=f};l("click",h)}else if("checkbox"===k)h=function(){if(!1!==m.data("duplex-observe")){var f=b.checked?"ensure":"remove",g=c();Array.isArray(g)||(y("ms-duplex\u5e94\u7528\u4e8echeckbox\u4e0a\u8981\u5bf9\u5e94\u4e00\u4e2a\u6570\u7ec4"),g=[g]);avalon.Array[f](g,d.pipe(b.value,d,"get"));e.call(b,g)}},d.handler=function(){var e=[].concat(c());
106
- b.checked=-1<e.indexOf(d.pipe(b.value,d,"get"))},l(z?"change":"click",h);else{k=b.getAttribute("data-duplex-event")||b.getAttribute("data-event")||"input";b.attributes["data-event"]&&y("data-event\u6307\u4ee4\u5df2\u7ecf\u5e9f\u5f03\uff0c\u8bf7\u6539\u7528data-duplex-event");var s=function(b){setTimeout(function(){h(b)})};k.replace(w,function(b){switch(b){case "input":R?(8<R?l("input",h):l("propertychange",function(b){"value"===b.propertyName&&h()}),l("dragend",s)):(l("input",h),l("compositionstart",
107
- f),l("compositionend",g),l("DOMAutoComplete",h));break;default:l(b,h)}})}/text|password/.test(b.type)&&Vb(function(){if(B.contains(b))b.value!==b.oldValue&&h();else if(!b.msRetain)return!1});b.avalonSetter=h;b.oldValue=b.value;za(d);e.call(b,b.value)};Y.TEXTAREA=Y.INPUT;Y.SELECT=function(b,c,d){var e=avalon(b);d.handler=function(){var d=c(),d=d&&d.$model||d;Array.isArray(d)?b.multiple||y("ms-duplex\u5728<select multiple=true>\u4e0a\u8981\u6c42\u5bf9\u5e94\u4e00\u4e2a\u6570\u7ec4"):b.multiple&&y("ms-duplex\u5728<select multiple=false>\u4e0d\u80fd\u5bf9\u5e94\u4e00\u4e2a\u6570\u7ec4");
108
- d=Array.isArray(d)?d.map(String):d+"";d+""!==b.oldValue&&(e.val(d),b.oldValue=d+"")};d.bound("change",function(){if(!1!==e.data("duplex-observe")){var f=e.val(),f=Array.isArray(f)?f.map(function(b){return d.pipe(b,d,"get")}):d.pipe(f,d,"get");f+""!==b.oldValue&&c(f);d.changed.call(b,f,d)}});ma(b,function(){za(d);d.changed.call(b,c(),d)},NaN)};v.repeat=function(b,c){var d=b.type;I(b.value,c,b,0,1);b.proxies=[];var e=!1;try{var f=b.$repeat=b.evaluator.apply(0,b.args||[]),g=avalon.type(f);"object"!==
109
- g&&"array"!==g&&(e=!0,avalon.log("warning:"+b.value+"\u5bf9\u5e94\u7c7b\u578b\u4e0d\u6b63\u786e"))}catch(h){e=!0,avalon.log("warning:"+b.value+"\u7f16\u8bd1\u51fa\u9519")}var k=b.value.split(".")||[];if(1<k.length){k.pop();for(var l=k[0],k=0,m;m=c[k++];)if(m&&m.hasOwnProperty(l)){k=m[l].$events||{};k[L]=k[L]||[];k[L].push(b);break}}k=b.element;k.removeAttribute(b.name);b.sortedCallback=ja(k,"data-with-sorted",c);b.renderedCallback=ja(k,"data-"+d+"-rendered",c);l=N(d);m=b.element=p.createComment(l+
110
- ":end");b.clone=p.createComment(l);X.appendChild(m);"each"===d||"with"===d?(b.template=k.innerHTML.trim(),avalon.clearHTML(k).appendChild(m)):(b.template=k.outerHTML.trim(),k.parentNode.replaceChild(m,k));b.template=avalon.parseHTML(b.template);b.rollback=function(){var c=b.element;if(c){E.repeat.call(b,"clear");var d=c.parentNode,e=b.template,f=e.firstChild;d.replaceChild(e,c);(c=b.$stamp)&&c.parentNode&&c.parentNode.removeChild(c);b.element="repeat"===b.type?f:d}};if(!e){b.handler=E.repeat;b.$outer=
111
- {};d="$key";e="$val";Array.isArray(f)&&(d="$first",e="$last");for(k=0;l=c[k++];)if(l.hasOwnProperty(d)&&l.hasOwnProperty(e)){b.$outer=l;break}d=f.$events;(e=(d||{})[L])&&avalon.Array.ensure(e,b)&&Aa(b,e);"object"===g?(b.$with=!0,g=!d?{}:d.$withProxyPool||(d.$withProxyPool={}),b.handler("append",f,g)):f.length&&b.handler("add",0,f.length)}};E.repeat=function(b,c,d){if(b){var e=this.element,f=e.parentNode,g=this.proxies,h=X.cloneNode(!1);switch(b){case "add":for(var e=c+d,k=this.$repeat.length-1,k=
112
- [],l=Db(this,c),m=c;m<e;m++){var n=Ic(m,this);g.splice(m,0,n);Cb(this,h,n,k)}f.insertBefore(h,l);for(m=0;h=k[m++];)na(h.nodes,h.vmodels),h.nodes=h.vmodels=null;break;case "del":l=g[c].$stamp;e=Db(this,c+d);Ga(l,e);h=g.splice(c,d);wa(h,"each");break;case "clear":if(h=this.$stamp||g[0])l=h.$stamp||h,Ga(l,e);wa(g,"each");break;case "move":var l=g[0].$stamp,r=l.nodeValue,s=[],p=[];Ga(l,e,function(){p.unshift(this);this.nodeValue===r&&(s.unshift(p),p=[])});ya(g,c);for(ya(s,c);p=s.shift();)for(;k=p.shift();)h.appendChild(k);
113
- f.insertBefore(h,e);break;case "index":for(k=g.length-1;d=g[c];c++)d.$index=c,d.$first=0===c,d.$last=c===k;return;case "set":(n=g[c])&&ka(n.$events.$index);return;case "append":g=d;l=[];k=[];for(n in c)c.hasOwnProperty(n)&&"hasOwnProperty"!==n&&l.push(n);this.sortedCallback&&(m=this.sortedCallback.call(f,l))&&(Array.isArray(m)&&m.length)&&(l=m);for(m=0;n=l[m++];)"hasOwnProperty"!==n&&(g[n]||(g[n]=Kc(n,this)),Cb(this,h,g[n],k));m=this.$stamp=this.clone;f.insertBefore(m,e);f.insertBefore(h,e);for(m=
114
- 0;h=k[m++];)na(h.nodes,h.vmodels),h.nodes=h.vmodels=null}"clear"===b&&(b="del");var q=this.renderedCallback||A,t=arguments;ma(f,function(){q.apply(f,t);f.oldValue&&"SELECT"===f.tagName&&avalon(f).val(f.oldValue.split(","))},NaN)}};"with,each".replace(w,function(b){v[b]=v.repeat});var pa=[],Eb=[],vd=/<script[^>]*>([\S\s]*?)<\/script\s*>/gim,wd=/\s+(on[^=\s]+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,xd=/<\w+\b(?:(["'])[^"]*?(\1)|[^>])*>/ig,yd={a:/\b(href)\=("javascript[^"]*"|'javascript[^']*')/ig,img:/\b(src)\=("javascript[^"]*"|'javascript[^']*')/ig,
115
- form:/\b(action)\=("javascript[^"]*"|'javascript[^']*')/ig},zd=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ad=/([^\#-~| |!])/g,Ua=avalon.filters={uppercase:function(b){return b.toUpperCase()},lowercase:function(b){return b.toLowerCase()},truncate:function(b,c,d){c=c||30;d=void 0===d?"...":d;return b.length>c?b.slice(0,c-d.length)+d:String(b)},$filter:function(b){for(var c=1,d=arguments.length;c<d;c++){var e=arguments[c],f=avalon.filters[e.shift()];"function"===typeof f&&(e=[b].concat(e),b=f.apply(null,e))}return b},
116
- camelize:oa,sanitize:function(b){return b.replace(vd,"").replace(xd,function(b,d){var e=b.toLowerCase().match(/<(\w+)\s/);e&&(e=yd[e[1]])&&(b=b.replace(e,function(b,c,d){b=d.charAt(0);return c+"="+b+"javascript:void(0)"+b}));return b.replace(wd," ").replace(/\s+/g," ")})},escape:function(b){return String(b).replace(/&/g,"&amp;").replace(zd,function(b){var d=b.charCodeAt(0);b=b.charCodeAt(1);return"&#"+(1024*(d-55296)+(b-56320)+65536)+";"}).replace(Ad,function(b){return"&#"+b.charCodeAt(0)+";"}).replace(/</g,
117
- "&lt;").replace(/>/g,"&gt;")},currency:function(b,c,d){return(c||"\uffe5")+Fb(b,isFinite(d)?d:2)},number:function(b,c){return Fb(b,isFinite(c)?c:3)}};new function(){function b(b,c,d){var e="";0>b&&(e="-",b=-b);for(b=""+b;b.length<c;)b="0"+b;d&&(b=b.substr(b.length-c));return e+b}function c(c,d,e,f){return function(g){g=g["get"+c]();if(0<e||g>-e)g+=e;0===g&&-12===e&&(g=12);return b(g,d,f)}}function d(b,c){return function(d,e){var f=d["get"+b](),g=(c?"SHORT"+b:b).toUpperCase();return e[g][f]}}function e(b){var c;
118
- if(c=b.match(k)){b=new Date(0);var d=0,e=0,f=c[8]?b.setUTCFullYear:b.setFullYear,g=c[8]?b.setUTCHours:b.setHours;c[9]&&(d=parseInt(c[9]+c[10],10),e=parseInt(c[9]+c[11],10));f.call(b,parseInt(c[1],10),parseInt(c[2],10)-1,parseInt(c[3],10));d=parseInt(c[4]||0,10)-d;e=parseInt(c[5]||0,10)-e;f=parseInt(c[6]||0,10);c=Math.round(1E3*parseFloat("0."+(c[7]||0)));g.call(b,d,e,f,c)}return b}var f={yyyy:c("FullYear",4),yy:c("FullYear",2,0,!0),y:c("FullYear",1),MMMM:d("Month"),MMM:d("Month",!0),MM:c("Month",
119
- 2,1),M:c("Month",1,1),dd:c("Date",2),d:c("Date",1),HH:c("Hours",2),H:c("Hours",1),hh:c("Hours",2,-12),h:c("Hours",1,-12),mm:c("Minutes",2),m:c("Minutes",1),ss:c("Seconds",2),s:c("Seconds",1),sss:c("Milliseconds",3),EEEE:d("Day"),EEE:d("Day",!0),a:function(b,c){return 12>b.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(c){c=-1*c.getTimezoneOffset();return c=(0<=c?"+":"")+(b(Math[0<c?"floor":"ceil"](c/60),2)+b(Math.abs(c%60),2))}},g=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,
120
- h=/^\d+$/,k=/^(\d{4})-?(\d+)-?(\d+)(?:T(\d+)(?::?(\d+)(?::?(\d+)(?:\.(\d+))?)?)?(Z|([+-])(\d+):?(\d+))?)?$/,l=/^(\d+)\D(\d+)\D(\d+)/;Ua.date=function(b,c){var d=Ua.date.locate,k="",m=[],p,q;c=c||"mediumDate";c=d[c]||c;"string"===typeof b&&(h.test(b)?b=parseInt(b,10):(b=b.trim().replace(l,function(b,c,d,e){return(4===e.length?[e,c,d]:[c,d,e]).join("-")}),b=e(b)),b=new Date(b));"number"===typeof b&&(b=new Date(b));if("date"===avalon.type(b)){for(;c;)(q=g.exec(c))?(m=m.concat(q.slice(1)),c=m.pop()):
121
- (m.push(c),c=null);m.forEach(function(c){p=f[c];k+=p?p(b,d):c.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return k}};var m={AMPMS:{"0":"\u4e0a\u5348",1:"\u4e0b\u5348"},DAY:{"0":"\u661f\u671f\u65e5",1:"\u661f\u671f\u4e00",2:"\u661f\u671f\u4e8c",3:"\u661f\u671f\u4e09",4:"\u661f\u671f\u56db",5:"\u661f\u671f\u4e94",6:"\u661f\u671f\u516d"},MONTH:{"0":"1\u6708",1:"2\u6708",2:"3\u6708",3:"4\u6708",4:"5\u6708",5:"6\u6708",6:"7\u6708",7:"8\u6708",8:"9\u6708",9:"10\u6708",10:"11\u6708",11:"12\u6708"},SHORTDAY:{"0":"\u5468\u65e5",
122
- 1:"\u5468\u4e00",2:"\u5468\u4e8c",3:"\u5468\u4e09",4:"\u5468\u56db",5:"\u5468\u4e94",6:"\u5468\u516d"},fullDate:"y\u5e74M\u6708d\u65e5EEEE",longDate:"y\u5e74M\u6708d\u65e5",medium:"yyyy-M-d H:mm:ss",mediumDate:"yyyy-M-d",mediumTime:"H:mm:ss","short":"yy-M-d ah:mm",shortDate:"yy-M-d",shortTime:"ah:mm"};m.SHORTMONTH=m.MONTH;Ua.date.locate=m};var u=avalon.modules={"ready!":{exports:avalon},avalon:{exports:avalon,state:2}};u.exports=u.avalon;new function(){function b(c,d){for(var e in c)if("\u53f8\u5f92\u6b63\u7f8e"===
123
- c[e]&&2!==u[e].state&&(e===d||b(u[e].deps,d)))return!0}function c(b,c,d){var f=e(b.src);b.onload=b.onreadystatechange=b.onerror=null;if(c||d&&!u[f].state)setTimeout(function(){G.removeChild(b);b=null}),y("debug: \u52a0\u8f7d "+f+" \u5931\u8d25"+c+" "+!u[f].state);else return!0}function d(){var b=w.length,c;a:for(;c=w[--b];){var e=u[c];c=e.deps;for(var f in c)if(M.call(c,f)&&2!==u[f].state)continue a;if(2!==e.state){w.splice(b,1);c=e.id;var g=e.args,e=e.factory,h=Object(u[c]);h.state=2;for(var k=0,
124
- l=[],m=void 0;m=g[k++];)"exports"===m?(m=h.exports||(h.exports={}),l.push(m)):l.push(u[m].exports);g=e.apply(q,l);void 0!==g&&(u[c].exports=g);d()}}}function e(b){return(b||"").replace(J,"")}function f(b){return b?b.substr(0,b.lastIndexOf("/")):t.baseUrl?t.baseUrl:t.loaderUrl}function g(b){var c;try{a.b.c()}catch(d){c=d.stack,!c&&q.opera&&(c=(String(d).match(/of linked script \S+/g)||[]).join(" "))}if(c)return c=c.split(/[@ ]/g).pop(),c="("===c[0]?c.slice(1,-1):c.replace(/\s/,""),c.replace(/(:\d+)?:\d+$/i,
125
- "");for(var e=(b?p:G).getElementsByTagName("script"),f=e.length;c=e[--f];)if((b||c.className===L)&&"interactive"===c.readyState)return b="1"[0]?c.src:c.getAttribute("src",4),c.className=b}function h(b,c,d){if("ready!"===b||u[b]&&2===u[b].state)return b;var e="js";b=b.replace(/^(\w+)\!/,function(b,c){e=c;return""});var g=ia[e]||A,h="",k=b.replace(J,function(b){h=b;return""}),l="";"js"===e&&(b=k=k.replace(/\.js$/i,""),l=".js");var m=0;r(k,t.paths,function(c,d){b=b.replace(d,c);m=1});m||r(k,t.packages,
126
- function(c,d,e){b=b.replace(e.name,e.location)});d&&r(d,t.map,function(c){r(b,c,function(c,d){b=b.replace(d,c)})});/^(?:[a-z]+:)?\/\//i.test(String(b))||(b=v(/\w/.test(b.charAt(0))?f():c,b));b+=l+h;r(k,t.urlArgs,function(c){b+=(-1===b.indexOf("?")?"?":"&")+c});return g(b,t.shim[k])}function k(b,e,f){var g=p.createElement("script");g.className=L;g[z?"onload":"onreadystatechange"]=function(){if(z||/loaded|complete/i.test(g.readyState)){var h=B.pop();h&&h.require(e);f&&f();c(g,!1,!z)&&(y("debug: \u5df2\u6210\u529f\u52a0\u8f7d "+
127
- b),w.push(e),d())}};g.onerror=function(){c(g,!0)};g.src=b;G.insertBefore(g,G.firstChild);y("debug: \u6b63\u51c6\u5907\u52a0\u8f7d "+b)}function l(b,c,d){var e=[],f;for(f in b)if(b.hasOwnProperty(f)){var g={name:f,val:b[f]};e.push(g);g.reg="*"===f&&c?/^/:RegExp("^"+f+"(/|$)");d&&"*"!==f&&(g.reg=RegExp("/"+f.replace(/^\//,"")+"(/|$)"))}e.sort(s);return e}function m(b){return function(){var c;b.init&&(c=b.init.apply(q,arguments));return c||b.exports&&x(b.exports)}}function n(b,c,d,e,f){return{id:b,state:c||
128
- 1,factory:d||A,deps:e||{},args:f||[]}}function r(b,c,d){c=c||[];for(var e=0,f;f=c[e++];)if(f.reg.test(b))return d(f.val,f.name,f),!1}function s(b,c){var d=b.name,e=c.name;return"*"===e?-1:"*"===d?1:e.length-d.length}function v(b,c){"/"!==b.charAt(b.length-1)&&(b+="/");if("./"===c.slice(0,2))return b+c.slice(2);if(".."===c.slice(0,2)){for(b+=c;K.test(b);)b=b.replace(K,"");return b}return"/"===c.slice(0,1)?b+c.slice(1):b+c}function x(b){if(!b)return b;var c=q;b.split(".").forEach(function(b){c=c[b]});
129
- return c}var w=[],B=[];F=avalon.require=function(b,c,e){Array.isArray(b)||avalon.error("require\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u5fc5\u987b\u662f\u4f9d\u8d56\u5217\u6570,\u7c7b\u578b\u4e3a\u6570\u7ec4 "+b);var g=[],k={},l=e||"callback"+setTimeout("1"),m=e&&e.replace(/\.js$/i,"");e=f(e);b.forEach(function(b){if((b=h(b,e,m))&&!k[b])g.push(b),k[b]="\u53f8\u5f92\u6b63\u7f8e"});b=u[l];if(!b||2!==b.state)u[l]=n(l,1,c,k,g);b||w.push(l);d()};F.define=function(c,d,f){var h=la.call(arguments);if("string"===
130
- typeof c)var k=h.shift();"function"===typeof h[0]&&h.unshift([]);var l=u[k]&&1<=u[k].state?k:e(g());f=h[1];f.id=k;!u[l]&&k&&(u[l]=n(l,1,f));f.require=function(c){h.push(c);var d=!0;try{d=b(u[c].deps,c)}catch(e){}d&&avalon.error(c+"\u6a21\u5757\u4e0e\u4e4b\u524d\u7684\u6a21\u5757\u5b58\u5728\u5faa\u73af\u4f9d\u8d56\uff0c\u8bf7\u4e0d\u8981\u76f4\u63a5\u7528script\u6807\u7b7e\u5f15\u5165"+c+"\u6a21\u5757");delete f.require;F.apply(null,h)};l?f.require(l):B.push(f)};F.config=t;F.define.amd=u;var C=t["orig.paths"]=
131
- {},E=t["orig.map"]={},H=t.packages=[],I=t["orig.args"]={};avalon.mix(ia,{paths:function(b){avalon.mix(C,b);t.paths=l(C)},map:function(b){avalon.mix(E,b);b=l(E,1,1);avalon.each(b,function(b,c){c.val=l(c.val)});t.map=b},packages:function(b){b=b.concat(H);for(var c={},d=[],e=0,f;f=b[e++];){f="string"===typeof f?{name:f}:f;var g=f.name;if(!c[g]){var h=f.location?f.location:v(g,f.main||"main"),h=h.replace(/\.js$/i,"");d.push(f);c[g]=f.location=h;f.reg=RegExp("^"+g+"(/|$)")}}t.packages=d.sort()},urlArgs:function(b){"string"===
132
- typeof b&&(b={"*":b});avalon.mix(I,b);t.urlArgs=l(I,1)},baseUrl:function(b){if(!/^(?:[a-z]+:)?\/\//i.test(String(b))){var c=G.getElementsByTagName("base")[0];c&&G.removeChild(c);var d=p.createElement("a");d.href=b;b="1"[0]?d.href:d.getAttribute("href",4);c&&G.insertBefore(c,G.firstChild)}t.baseUrl=b},shim:function(b){for(var c in b){var d=b[c];Array.isArray(d)&&(d=b[c]={deps:d});if(!d.exportsFn&&(d.exports||d.init))d.exportsFn=m(d)}t.shim=b},js:function(b,c){var d=e(b);if(!u[d]){var f=u[d]=n(d);c?
133
- F(c.deps||[],function(){var e=avalon.slice(arguments);k(b,d,function(){f.state=2;c.exportsFn&&(f.exports=c.exportsFn.apply(0,e));F.checkDeps()})}):k(b,d)}return d},css:function(b){var c=e(b);if(!p.getElementById(c)){var d=p.createElement("link");d.rel="stylesheet";d.href=b;d.id=c;G.insertBefore(d,G.firstChild)}},text:function(b){var c=e(b);u[c]={};var d=Sa();d.onreadystatechange=function(){if(4===d.readyState){var e=d.status;399<e&&600>e?avalon.error(b+" \u5bf9\u5e94\u8d44\u6e90\u4e0d\u5b58\u5728\u6216\u6ca1\u6709\u5f00\u542f CORS"):
134
- (u[c].state=2,u[c].exports=d.responseText,F.checkDeps())}};d.open("GET",b,!0);"withCredentials"in d&&(d.withCredentials=!0);d.setRequestHeader("X-Requested-With","XMLHttpRequest");d.send();return c}});ia.css.ext=".css";ia.js.ext=".js";F.checkDeps=d;var J=/(\?[^#]*)$/,K=/\/\w+\/\.\./,D=g(!0);D||(D=p.scripts[p.scripts.length-1].src);D=e(D);t.loaderUrl=D.slice(0,D.lastIndexOf("/")+1)};var Gb=[];if("complete"===p.readyState)setTimeout(U);else if(z)p.addEventListener("DOMContentLoaded",U);else{p.attachEvent("onreadystatechange",
135
- function(){"complete"===p.readyState&&U()});var Va;try{Va=null!=q.frameElement}catch(Cd){Va=!0}B.doScroll&&!Va&&Hb()}avalon.bind(q,"load",U);avalon.ready=function(b){F?F(["ready!"],b):U===A?b(avalon):Gb.push(b)};avalon.config({loader:!0});avalon.ready(function(){avalon.scan(p.body)});"function"===typeof define&&define.amd&&define("avalon",[],function(){return avalon});avalon.noConflict=function(b){b&&q.avalon===avalon&&(q.avalon=avalon);return avalon};void 0===Z&&(q.avalon=avalon);return avalon});
1
+ !function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("Avalon requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function r(){e.console&&avalon.config.debug&&Function.apply.call(console.log,console,arguments)}function o(){}function i(e,t){"string"==typeof e&&(e=e.match(St)||[]);for(var n={},r=void 0!==t?t:1,a=0,o=e.length;o>a;a++)n[e[a]]=r;return n}function l(e){function t(r,a){return n.push(r)>e&&delete t[n.shift()],t[r]=a}var n=[];return t}function s(){if(e.VBArray){var t=document.documentMode;return t?t:e.XMLHttpRequest?7:6}return 0}function c(e){return jt.test(Dt.call(e))}function u(e,t){return e=Math.floor(e)||0,0>e?Math.max(t+e,0):Math.min(e,t)}function f(e){if(!e)return!1;var t=e.length;if(t===t>>>0){var n=Dt.call(e).slice(8,-1);if(/(?:regexp|string|function|window|global)$/i.test(n))return!1;if("Array"===n)return!0;try{return{}.propertyIsEnumerable.call(e,"length")===!1?/^\s?function/.test(e.item||e.callee):!0}catch(r){return!e.window}}return!1}function p(e,t,n){var r="for(var "+e+"i=0,n = this.length; i < n; i++){"+t.replace("_","((i in this) && fn.call(scope,this[i],i,this))")+"}"+n;return Function("fn,scope",r)}function d(e,t){try{for(;t=t.parentNode;)if(t===e)return!0;return!1}catch(n){return!1}}function v(){return(new XMLSerializer).serializeToString(this)}function h(e,t){if(e&&e.childNodes)for(var n,r=e.childNodes,a=0;n=r[a++];)if(n.tagName){var o=Ct.createElementNS(an,n.tagName.toLowerCase());Ft.forEach.call(n.attributes,function(e){o.setAttribute(e.name,e.value)}),h(n,o),t.appendChild(o)}}function m(e){var t={};for(var n in e)t[n]=e[n];var r=t.target=e.srcElement;if(0===e.type.indexOf("key"))t.which=null!=e.charCode?e.charCode:e.keyCode;else if(ln.test(e.type)){var a=r.ownerDocument||Ct,o="BackCompat"===a.compatMode?a.body:a.documentElement;t.pageX=e.clientX+(o.scrollLeft>>0)-(o.clientLeft>>0),t.pageY=e.clientY+(o.scrollTop>>0)-(o.clientTop>>0),t.wheelDeltaY=t.wheelDelta,t.wheelDeltaX=0}return t.timeStamp=new Date-0,t.originalEvent=e,t.preventDefault=function(){e.returnValue=!1},t.stopPropagation=function(){e.cancelBubble=!0},t}function g(e){for(var t in e)if(Pt.call(e,t)){var n=e[t];"function"==typeof g.plugins[t]?g.plugins[t](n):"object"==typeof g[t]?avalon.mix(g[t],n):g[t]=n}return this}function y(e){return(e+"").replace(mn,"\\$&")}function b(e,t,n){if(Yt(t)||t&&t.nodeType)return!1;if(-1!==n.indexOf(e))return!1;if(-1!==Cn.indexOf(e))return!1;var r=n.$special;return e&&"$"===e.charAt(0)&&!r[e]?!1:!0}function x(e,t,n,r){switch(e.type){case 0:var a=e.get,o=e.set;if(Yt(o)){var i=r.$events,l=i[t];i[t]=[],o.call(r,n),i[t]=l}return a.call(r);case 1:return n;case 2:if(n!==r.$model[t]){var s=e.svmodel=C(r,t,n,e.valueType);n=s.$model;var c=Tn[s.$id];c&&c()}return n}}function $(e,t,n){if(Array.isArray(e)){var r=e.concat();e.length=0;var a=E(e);return a.pushArray(r),a}if("number"==typeof e.nodeType)return e;if(e.$id&&e.$events)return e;Array.isArray(e.$skipArray)||(e.$skipArray=[]),e.$skipArray.$special=t||{};var i={};n=n||{};var l={},s={},c=[];for(var u in e)!function(t,r){if(n[t]=r,b(t,r,e.$skipArray)){l[t]=[];var a=avalon.type(r),u=function(e){var t=u._name,n=this,r=n.$model,a=r[t],o=n.$events;return arguments.length?void(_t||(1===u.type||(e=x(u,t,e,n),u.type))&&(Mn(a,e)||(r[t]=e,o.$digest?u.pedding||(u.pedding=!0,setTimeout(function(){j(o[t]),w(n,t,r[t],a),u.pedding=!1})):(j(o[t]),w(n,t,e,a))))):0===u.type?(e=u.get.call(n),a!==e&&(r[t]=e,o.$digest?u.pedding||(u.pedding=!0,setTimeout(function(){w(n,t,r[t],a),u.pedding=!1})):w(n,t,e,a)),e):(M(o[t]),u.svmodel||a)};"object"===a&&Yt(r.get)&&Object.keys(r).length<=2?(u.set=r.set,u.get=r.get,u.type=0,c.push(function(){var e={evaluator:function(){e.type=Math.random(),e.element=null,n[t]=u.get.call(i)},element:Tt,type:Math.random(),handler:o,args:[]};It[wt]=e,u.call(i),delete It[wt]})):Nt.test(a)?(u.type=2,u.valueType=a,c.push(function(){var e=$(r,0,n[t]);u.svmodel=e,e.$events[kt]=l[t]})):u.type=1,u._name=t,s[t]=u}}(u,e[u]);Cn.forEach(function(t){delete e[t],delete n[t]}),i=kn(i,_n(s),e);for(var f in e)s[f]||(i[f]=e[f]);i.$id=Xt(),i.$model=n,i.$events=l;for(u in bn){var p=bn[u];Rt||(p=p.bind(i)),i[u]=p}return An?Object.defineProperty(i,"hasOwnProperty",{value:function(e){return e in this.$model},writable:!1,enumerable:!1,configurable:!0}):i.hasOwnProperty=function(e){return e in i.$model},c.forEach(function(e){e()}),i}function w(e,t,n,r){e.$events&&bn.$fire.call(e,t,n,r)}function C(e,t,n,r){var a=e[t];if("array"===r)return Array.isArray(n)&&a!==n?(a._.$unwatch(),a.clear(),a._.$watch(),a.pushArray(n.concat()),a):a;var o=e.$events[t],i=a.$events.$withProxyPool;i&&(gt(i,"with"),a.$events.$withProxyPool=null);var l=$(n);return l.$events[kt]=o,Tn[l.$id]=function(e){for(;e=o.shift();)!function(e){avalon.nextTick(function(){e.type&&(e.rollback&&e.rollback(),Zt[e.type](e,e.vmodels))})}(e);delete Tn[l.$id]},l}function T(e,t,n,r){var a=t[n];return 4!==arguments.length?a.call(e):void a.call(e,r)}function E(e){var t=[];t.$id=Xt(),t.$model=e,t.$events={},t.$events[kt]=[],t._=$({length:e.length}),t._.$watch("length",function(e,n){t.$fire("length",e,n)});for(var n in bn)t[n]=bn[n];return avalon.mix(t,Nn),t}function A(e,t,n,r,a,o,i){for(var l=this.length,s=2;--s;){switch(e){case"add":var c=this.$model.slice(t,t+n).map(function(e){return Nt.test(avalon.type(e))?e.$id?e:$(e,0,e):e});Sn.apply(this,[t,0].concat(c)),this._fire("add",t,n);break;case"del":var u=this._splice(t,n);this._fire("del",t,n)}a&&(e=a,t=o,n=i,s=2,a=0)}return this._fire("index",r),this.length!==l&&(this._.length=this.length),u}function k(e,t){for(var n={},r=0,a=t.length;a>r;r++){n[r]=e[r];var o=t[r];o in n?(e[r]=n[o],delete n[o]):e[r]=e[o]}}function O(e){It[wt]=e,avalon.openComputedCollect=!0;var t=e.evaluator;if(t)try{var n=Ln.test(e.type)?e:t.apply(0,e.args);e.handler(n,e.element,e)}catch(r){delete e.evaluator;var a=e.element;if(3===a.nodeType){var o=a.parentNode;g.commentInterpolate?o.replaceChild(Ct.createComment(e.value),a):a.data=fn+e.value+pn}}avalon.openComputedCollect=!1,delete It[wt]}function M(e){var t=It[wt];e&&t&&avalon.Array.ensure(e,t)&&t.element&&_(t,e)}function _(e,t){e.$uuid=e.$uuid||Xt(),t.$uuid=t.$uuid||Xt();var n={data:e,list:t,$$uuid:e.$uuid+t.$uuid};jn[n.$$uuid]||(jn[n.$$uuid]=1,jn.push(n))}function S(e){e.element=null,e.rollback&&e.rollback();for(var t in e)e[t]=null}function N(e){try{if(!e.parentNode)return!0}catch(t){return!0}return e.msRetain?0:1===e.nodeType?"number"==typeof e.sourceIndex?0===e.sourceIndex:!Vt.contains(e):!avalon.contains(Vt,e)}function L(){for(var e,t=jn.length,n=t,r=0,a=[],o={},i={};e=jn[--t];){var l=e.data,s=l.type;o[s]?o[s]++:(o[s]=1,a.push(s))}var c=!1;if(a.forEach(function(e){Pn[e]!==o[e]&&(i[e]=1,c=!0)}),t=n,c)for(;e=jn[--t];)l=e.data,void 0!==l.element&&i[l.type]&&N(l.element)&&(r++,jn.splice(t,1),delete jn[e.$$uuid],avalon.Array.remove(e.list,l),S(l),e.data=e.list=null);Pn=o,Hn=new Date}function j(e){if(e&&e.length){new Date-Hn>444&&"object"==typeof e[0]&&L();for(var t,n=Bt.call(arguments,1),r=e.length;t=e[--r];){var a=t.element;if(a&&a.parentNode)if(t.$repeat)t.handler.apply(t,n);else if("on"!==t.type){var i=t.evaluator||o;t.handler(i.apply(0,t.args||[]),a,t)}}}}function H(e){var t=e.nodeName;return t.toLowerCase()===t&&e.scopeName&&""===e.outerText}function P(e){"url(#default#VML)"!==e.currentStyle.behavior&&(e.style.behavior="url(#default#VML)",e.style.display="inline-block",e.style.zoom=1)}function D(e,t,n){var r=setTimeout(function(){var a=e.innerHTML;clearTimeout(r),a===n?t():D(e,t,a)})}function F(e,t){var n=e.getAttribute("avalonctrl")||t.$id;e.setAttribute("avalonctrl",n),t.$events.expr=e.tagName+'[avalonctrl="'+n+'"]'}function B(e,t){for(var n,r=0;n=e[r++];)n.vmodels=t,Zt[n.type](n,t),n.evaluator&&n.element&&1===n.element.nodeType&&n.element.removeAttribute(n.name);e.length=0}function I(e,t){return e.priority-t.priority}function R(e,t){for(var n,a,o=ar?ar(e):avalon.slice(e.attributes),i=[],l={},s=0;a=o[s++];)if(a.specified&&(n=a.name.match(zn))){var c=n[1],u=n[2]||"",f=a.value,p=a.name;if(l[p]=f,Gn[c]?(u=c,c="on"):Jn[c]&&(r("ms-"+c+"已经被废弃,请使用ms-attr-*代替"),"enabled"===c&&(c="disabled",f="!("+f+")"),u=c,c="attr",e.removeAttribute(p),p="ms-attr-"+u,e.setAttribute(p,f),n=[p],l[p]=f),"function"==typeof Zt[c]){var d={type:c,param:u,element:e,name:n[0],value:f,priority:c in Yn?Yn[c]:10*c.charCodeAt(0)+(Number(u)||0)};if("html"===c||"text"===c){var v=X(f);avalon.mix(d,v),d.filters=d.filters.replace(or,function(){return d.type="html",d.group=1,""})}"ms-if-loop"===p&&(d.priority+=100),t.length&&(i.push(d),"widget"===c&&(e.msData=e.msData||l))}}i.sort(I),l["ms-attr-checked"]&&l["ms-duplex"]&&r("warning!一个元素上不能同时定义ms-attr-checked与ms-duplex");var h=!0;for(s=0;d=i[s];s++){if(c=d.type,Zn.test(c))return B(i.slice(0,s+1),t);h&&(h=!Qn.test(c))}B(i,t),h&&!Wn[e.tagName]&&hn.test(e.innerHTML.replace(lr,"<").replace(sr,">"))&&(Xn&&Xn(e),V(e,t))}function V(e,t){for(var n=e.firstChild;n;){var r=n.nextSibling;W(n,n.nodeType,t),n=r}}function U(e,t){for(var n,r=0;n=e[r++];)W(n,n.nodeType,t)}function W(e,t,n){1===t?q(e,n):3===t&&dn.test(e.data)?Y(e,n):g.commentInterpolate&&8===t&&!dn.test(e.nodeValue)&&Y(e,n)}function q(e,t,n){var a=e.getAttribute("ms-skip");if(!e.getAttributeNode)return r("warning "+e.tagName+" no getAttributeNode method");var o=e.getAttributeNode("ms-important"),i=e.getAttributeNode("ms-controller");if("string"!=typeof a){if(n=o||i){var l=avalon.vmodels[n.value];if(!l)return;t=n===o?[l]:[l].concat(t);var s=n.name;e.removeAttribute(s),avalon(e).removeClass(s),F(e,l)}R(e,t)}}function X(e){if(e.indexOf("|")>0){var t=e.replace(rstringLiteral,function(e){return Math.pow(10,e.length)}),n=t.replace(ir,"ᄢ㍄").indexOf("|");if(n>-1)return{filters:e.slice(n),value:e.slice(0,n),expr:!0}}return{value:e,filters:"",expr:!0}}function z(e){for(var t,n,r=[],a=0;;){if(n=e.indexOf(fn,a),-1===n)break;if(t=e.slice(a,n),t&&r.push({value:t,filters:"",expr:!1}),a=n+fn.length,n=e.indexOf(pn,a),-1===n)break;t=e.slice(a,n),t&&r.push(X(t)),a=n+pn.length}return t=e.slice(a),t&&r.push({value:t,expr:!1,filters:""}),r}function Y(e,t){var n=[];if(8===e.nodeType)var r=X(e.nodeValue),a=[r];else a=z(e.data);if(a.length){for(var o=0;r=a[o++];){var i=Ct.createTextNode(r.value);r.expr&&(r.type="text",r.element=i,r.filters=r.filters.replace(or,function(){return r.type="html",r.group=1,""}),n.push(r)),Ut.appendChild(i)}e.parentNode.replaceChild(Ut,e),n.length&&B(n,t)}}function G(e){return e.replace(/([a-z\d])([A-Z]+)/g,"$1-$2").toLowerCase()}function J(e){return e.indexOf("-")<0&&e.indexOf("_")<0?e:e.replace(/[-_][^-_]/g,function(e){return e.charAt(1).toUpperCase()})}function Z(e){if(!("classList"in e)){e.classList={node:e};for(var t in cr)e.classList[t.slice(1)]=cr[t]}return e.classList}function Q(e){try{if("object"==typeof e)return e;e="true"===e?!0:"false"===e?!1:"null"===e?null:+e+""===e?+e:ur.test(e)?avalon.parseJSON(e):e}catch(t){}return e}function K(e){return e.window&&e.document?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}function et(e,t){if(e.offsetWidth<=0){if(Er.test(hr["@:get"](e,"display"))){var n={node:e};for(var r in Tr)n[r]=e.style[r],e.style[r]=Tr[r];t.push(n)}var a=e.parentNode;a&&1===a.nodeType&&et(a,t)}}function tt(e){var t=e.tagName.toLowerCase();return"input"===t&&/checkbox|radio/.test(e.type)?"checked":t}function nt(e,t,n,r){for(var a,o=[],i=" = "+n+".",l=e.length;a=e[--l];)t.hasOwnProperty(a)&&(o.push(a+i+a),r.vars.push(a),"duplex"===r.type&&(e.get=n+"."+a),e.splice(l,1));return o}function rt(e){for(var t=[],n={},r=0;r<e.length;r++){var a=e[r],o=a&&"string"==typeof a.$id?a.$id:a;n[o]||(n[o]=t.push(a))}return t}function at(e,t){return t=t.replace(Rr,"").replace(Vr,function(){return"],|"}).replace(Ur,function(e,t){return"["+Mr(t)}).replace(Wr,function(){return'"],["'}).replace(qr,function(){return'",'})+"]","return avalon.filters.$filter("+e+", "+t+")"}function ot(e,t,n){var a=n.type,i=n.filters||"",l=t.map(function(e){return String(e.$id).replace(Ir,"$1")})+e+a+i,s=Dr(e).concat(),c=[],u=[],f=[],p="";t=rt(t),n.vars=[];for(var d=0,v=t.length;v>d;d++)if(s.length){var h="vm"+wt+"_"+d;u.push(h),f.push(t[d]),c.push.apply(c,nt(s,t[d],h,n))}if(c.length||"duplex"!==a){"duplex"!==a&&(e.indexOf("||")>-1||e.indexOf("&&")>-1)&&n.vars.forEach(function(t){var n=new RegExp("\\b"+t+"(?:\\.\\w+|\\[\\w+\\])+","ig");e=e.replace(n,function(n){var r=n.charAt(t.length),a=zt?e.slice(arguments[1]+n.length):RegExp.rightContext,o=/^\s*\(/.test(a);if("."===r||"["===r||o){var i="var"+String(Math.random()).replace(/^0\./,"");if(o){var l=n.split(".");if(l.length>2){var s=l.pop();return c.push(i+" = "+l.join(".")),i+"."+s}return n}return c.push(i+" = "+n),i}return n})}),n.args=f;var m=Fr[l];if(m)return void(n.evaluator=m);if(p=c.join(", "),p&&(p="var "+p),/\S/.test(i)){if(!/text|html/.test(n.type))throw Error("ms-"+n.type+"不支持过滤器");e="\nvar ret"+wt+" = "+e+";\r\n",e+=at("ret"+wt,i)}else{if("duplex"===a){var g="'use strict';\nreturn function(vvv){\n "+p+";\n if(!arguments.length){\n return "+e+"\n }\n "+(Br.test(e)?e:s.get)+"= vvv;\n} ";try{m=Function.apply(o,u.concat(g)),n.evaluator=Fr(l,m)}catch(y){r("debug: parse error,"+y.message)}return}if("on"===a){-1===e.indexOf("(")?e+=".call(this, $event)":e=e.replace("(",".call(this,"),u.push("$event"),e="\nreturn "+e+";";var b=e.lastIndexOf("\nreturn"),x=e.slice(0,b),$=e.slice(b);e=x+"\n"+$}else e="\nreturn "+e+";"}try{m=Function.apply(o,u.concat("'use strict';\n"+p+e)),n.evaluator=Fr(l,m)}catch(y){r("debug: parse error,"+y.message)}finally{s=textBuffer=u=null}}}function it(e,t,n,r,a){Array.isArray(r)&&(e=r.map(function(e){return e.expr?"("+e.value+")":Mr(e.value)}).join(" + ")),ot(e,t,n),n.evaluator&&!a&&(n.handler=Qt[n.handlerName||n.type],O(n))}function lt(e){return null==e?"":e}function st(e,t,n){return t.param.replace(/\w+/g,function(r){var a=avalon.duplexHooks[r];a&&"function"==typeof a[n]&&(e=a[n](e,t))}),e}function ct(){for(var e=na.length-1;e>=0;e--){var t=na[e];t()===!1&&na.splice(e,1)}na.length||clearInterval(ta)}function ut(e,t,n,r){var a=e.template.cloneNode(!0),o=avalon.slice(a.childNodes);n.$stamp&&a.insertBefore(n.$stamp,a.firstChild),t.appendChild(a);var i=[n].concat(e.vmodels),l={nodes:o,vmodels:i};r.push(l)}function ft(e,t){var n=e.proxies[t];return n?n.$stamp:e.element}function pt(e,t,n){for(;;){var r=t.previousSibling;if(!r)break;if(r.parentNode.removeChild(r),n&&n.call(r),r===e)break}}function dt(e){var t={$host:[],$outer:{},$stamp:1,$index:0,$first:!1,$last:!1,$remove:avalon.noop};t[e]={get:function(){return this.$host[this.$index]},set:function(e){this.$host.set(this.$index,e)}};var n={$last:1,$first:1,$index:1},r=$(t,n),a=r.$events;return a[e]=a.$first=a.$last=a.$index,r.$id=Xt("$proxy$each"),r}function vt(e,t){for(var n,r=t.param||"el",a=0,o=oa.length;o>a;a++){var i=oa[a];i&&i.hasOwnProperty(r)&&(n=i,oa.splice(a,1))}n||(n=dt(r));var l=t.$repeat,s=l.length-1;return n.$index=e,n.$first=0===e,n.$last=e===s,n.$host=l,n.$outer=t.$outer,n.$stamp=t.clone.cloneNode(!1),n.$remove=function(){return l.removeAt(n.$index)},n}function ht(){var e=$({$key:"",$outer:{},$host:{},$val:{get:function(){return this.$host[this.$key]},set:function(e){this.$host[this.$key]=e}}},{$val:1});return e.$id=Xt("$proxy$with"),e}function mt(e,t){var n=ia.pop();n||(n=ht());var r=t.$repeat;return n.$key=e,n.$host=r,n.$outer=t.$outer,r.$events?n.$events.$val=r.$events[e]:n.$events={},n}function gt(e,t){var n="each"===t?oa:ia;avalon.each(e,function(e,t){if(t.$events){for(var r in t.$events)Array.isArray(t.$events[r])&&(t.$events[r].forEach(function(e){"object"==typeof e&&S(e)}),t.$events[r].length=0);t.$host=t.$outer={},n.unshift(t)>g.maxRepeatSize&&n.pop()}}),"each"===t&&(e.length=0)}function yt(e,t){var n="_"+e;if(!yt[n]){var r=Ct.createElement(e);Vt.appendChild(r),t=Rt?getComputedStyle(r,null).display:r.currentStyle.display,Vt.removeChild(r),yt[n]=t}return yt[n]}function bt(e,t,n,r){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");var a=isFinite(+e)?+e:0,o=isFinite(+t)?Math.abs(t):0,i="undefined"==typeof r?",":r,l="undefined"==typeof n?".":n,s="",c=function(e,t){var n=Math.pow(10,t);return""+(Math.round(e*n)/n).toFixed(t)};return s=(o?c(a,o):""+Math.round(a)).split("."),s[0].length>3&&(s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,i)),(s[1]||"").length<o&&(s[1]=s[1]||"",s[1]+=new Array(o-s[1].length+1).join("0")),s.join(l)}function xt(){Ct.body&&(gn&&(ha["domReady!"].state=4,gn.checkDeps()),ma.forEach(function(e){e(avalon)}),xt=o)}function $t(){try{Vt.doScroll("left"),xt()}catch(e){setTimeout($t)}}var wt=new Date-0,Ct=e.document,Tt=Ct.getElementsByTagName("head")[0],Et=Tt.insertBefore(document.createElement("avalon"),Tt.firstChild);Et.innerHTML="X<style id='avalonStyle'>.avalonHide{ display: none!important }</style>",Et.setAttribute("ms-skip","1"),Et.className="avalonHide";var At=/\[native code\]/,kt="$"+wt,Ot=e.require,Mt=e.define,_t=!1,St=/[^, ]+/g,Nt=/^(?:object|array)$/,Lt=/^\[object SVG\w*Element\]$/,jt=/^\[object (?:Window|DOMWindow|global)\]$/,Ht=Object.prototype,Pt=Ht.hasOwnProperty,Dt=Ht.toString,Ft=Array.prototype,Bt=Ft.slice,It={},Rt=e.dispatchEvent,Vt=Ct.documentElement,Ut=Ct.createDocumentFragment(),Wt=Ct.createElement("div"),qt={};"Boolean Number String Function Array Date RegExp Object Error".replace(St,function(e){qt["[object "+e+"]"]=e.toLowerCase()});var Xt=function(e){return e=e||"avalon",(e+Math.random()+Math.random()).replace(/0\./g,"")},zt=s();avalon=function(e){return new avalon.init(e)},avalon.init=function(e){this[0]=this.element=e},avalon.fn=avalon.prototype=avalon.init.prototype,avalon.type=function(e){return null==e?String(e):"object"==typeof e||"function"==typeof e?qt[Dt.call(e)]||"object":typeof e};var Yt="object"==typeof alert?function(e){try{return/^\s*\bfunction\b/.test(e+"")}catch(t){return!1}}:function(e){return"[object Function]"===Dt.call(e)};avalon.isFunction=Yt,avalon.isWindow=function(e){return e?e==e.document&&e.document!=e:!1},c(e)&&(avalon.isWindow=c);var Gt;for(Gt in avalon({}))break;var Jt="0"!==Gt;avalon.isPlainObject=function(e,t){if(!e||"object"!==avalon.type(e)||e.nodeType||avalon.isWindow(e))return!1;try{if(e.constructor&&!Pt.call(e,"constructor")&&!Pt.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(Jt)for(t in e)return Pt.call(e,t);for(t in e);return void 0===t||Pt.call(e,t)},At.test(Object.getPrototypeOf)&&(avalon.isPlainObject=function(e){return"[object Object]"===Dt.call(e)&&Object.getPrototypeOf(e)===Ht}),avalon.mix=avalon.fn.mix=function(){var e,t,n,r,a,o,i=arguments[0]||{},l=1,s=arguments.length,c=!1;for("boolean"==typeof i&&(c=i,i=arguments[1]||{},l++),"object"==typeof i||Yt(i)||(i={}),l===s&&(i=this,l--);s>l;l++)if(null!=(e=arguments[l]))for(t in e){n=i[t];try{r=e[t]}catch(u){continue}i!==r&&(c&&r&&(avalon.isPlainObject(r)||(a=Array.isArray(r)))?(a?(a=!1,o=n&&Array.isArray(n)?n:[]):o=n&&avalon.isPlainObject(n)?n:{},i[t]=avalon.mix(c,o,r)):void 0!==r&&(i[t]=r))}return i},avalon.mix({rword:St,subscribers:kt,version:1.391,ui:{},log:r,slice:Rt?function(e,t,n){return Bt.call(e,t,n)}:function(e,t,n){var r=[],a=e.length;if(void 0===n&&(n=a),"number"==typeof n&&isFinite(n)){t=u(t,a),n=u(n,a);for(var o=t;n>o;++o)r[o-t]=e[o]}return r},noop:o,error:function(e,t){throw new(t||Error)(e)},oneObject:i,range:function(e,t,n){n||(n=1),null==t&&(t=e||0,e=0);for(var r=-1,a=Math.max(0,Math.ceil((t-e)/n)),o=new Array(a);++r<a;)o[r]=e,e+=n;return o},eventHooks:{},bind:function(e,t,n,r){var a=avalon.eventHooks,o=a[t];"object"==typeof o&&(t=o.type,o.deel&&(n=o.deel(e,n)));var i=Rt?n:function(t){n.call(e,m(t))};return Rt?e.addEventListener(t,i,!!r):e.attachEvent("on"+t,i),i},unbind:function(e,t,n,r){var a=avalon.eventHooks,i=a[t],l=n||o;"object"==typeof i&&(t=i.type),Rt?e.removeEventListener(t,l,!!r):e.detachEvent("on"+t,l)},css:function(e,t,n){e instanceof avalon&&(e=e[0]);var r,a=/[_-]/.test(t)?J(t):t;if(t=avalon.cssName(a)||a,void 0===n||"boolean"==typeof n){r=hr[a+":get"]||hr["@:get"],"background"===t&&(t="backgroundColor");var o=r(e,t);return n===!0?parseFloat(o)||0:o}if(""===n)e.style[t]="";else{if(null==n||n!==n)return;isFinite(n)&&!avalon.cssNumber[a]&&(n+="px"),r=hr[a+":set"]||hr["@:set"],r(e,t,n)}},each:function(e,t){if(e){var n=0;if(f(e))for(var r=e.length;r>n&&t(n,e[n])!==!1;n++);else for(n in e)if(e.hasOwnProperty(n)&&t(n,e[n])===!1)break}},getWidgetData:function(e,t){var n=avalon(e).data(),r={};for(var a in n)0===a.indexOf(t)&&(r[a.replace(t,"").replace(/\w/,function(e){return e.toLowerCase()})]=n[a]);return r},Array:{ensure:function(e,t){return-1===e.indexOf(t)?e.push(t):void 0},removeAt:function(e,t){return!!e.splice(t,1).length},remove:function(e,t){var n=e.indexOf(t);return~n?avalon.Array.removeAt(e,n):!1}}});var Zt=avalon.bindingHandlers={},Qt=avalon.bindingExecutors={};if(avalon.nextTick=e.setImmediate?setImmediate.bind(e):function(e){setTimeout(e,0)},!"司徒正美".trim){var Kt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;String.prototype.trim=function(){return this.replace(Kt,"")}}var en=!{toString:null}.propertyIsEnumerable("toString"),tn=function(){}.propertyIsEnumerable("prototype"),nn=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],rn=nn.length;if(Object.keys||(Object.keys=function(e){var t=[],n=tn&&"function"==typeof e;if("string"==typeof e||e&&e.callee)for(var r=0;r<e.length;++r)t.push(String(r));else for(var a in e)n&&"prototype"===a||!Pt.call(e,a)||t.push(String(a));if(en)for(var o=e.constructor,i=o&&o.prototype===e,l=0;rn>l;l++){var s=nn[l];i&&"constructor"===s||!Pt.call(e,s)||t.push(s)}return t}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Dt.call(e)}),o.bind||(Function.prototype.bind=function(e){if(arguments.length<2&&void 0===e)return this;var t=this,n=arguments;return function(){var r,a=[];for(r=1;r<n.length;r++)a.push(n[r]);for(r=0;r<arguments.length;r++)a.push(arguments[r]);return t.apply(e,a)}}),At.test([].map)||avalon.mix(Ft,{indexOf:function(e,t){var n=this.length,r=~~t;for(0>r&&(r+=n);n>r;r++)if(this[r]===e)return r;return-1},lastIndexOf:function(e,t){var n=this.length,r=null==t?n-1:t;for(0>r&&(r=Math.max(0,n+r));r>=0;r--)if(this[r]===e)return r;return-1},forEach:p("","_",""),filter:p("r=[],j=0,","if(_)r[j++]=this[i]","return r"),map:p("r=[],","r[i]=_","return r"),some:p("","if(_)return true","return false"),every:p("","if(!_)return false","return true")}),avalon.contains=d,Vt.contains||(Node.prototype.contains=function(e){return!!(16&this.compareDocumentPosition(e))}),Ct.contains||(Ct.contains=function(e){return d(Ct,e)}),e.SVGElement){var an="http://www.w3.org/2000/svg",on=Ct.createElementNS(an,"svg");on.innerHTML='<circle cx="50" cy="50" r="40" fill="red" />',Lt.test(on.firstChild)||Object.defineProperties(SVGElement.prototype,{outerHTML:{enumerable:!0,configurable:!0,get:v,set:function(e){var t=this.tagName.toLowerCase(),n=this.parentNode,r=avalon.parseHTML(e);if("svg"===t)n.insertBefore(r,this);else{var a=Ct.createDocumentFragment();h(r,a),n.insertBefore(a,this)}n.removeChild(this)}},innerHTML:{enumerable:!0,configurable:!0,get:function(){var e=this.outerHTML,t=new RegExp("<"+this.nodeName+'\\b(?:(["\'])[^"]*?(\\1)|[^>])*>',"i"),n=new RegExp("</"+this.nodeName+">$","i");return e.replace(t,"").replace(n,"")},set:function(e){if(avalon.clearHTML){avalon.clearHTML(this);var t=avalon.parseHTML(e);h(t,this)}}}})}!Vt.outerHTML&&e.HTMLElement&&HTMLElement.prototype.__defineGetter__("outerHTML",v);var ln=/^(?:mouse|contextmenu|drag)|click/,sn=avalon.eventHooks;if("onmouseenter"in Vt||avalon.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){sn[e]={type:t,deel:function(t,n){return function(r){var a=r.relatedTarget;return a&&(a===t||16&t.compareDocumentPosition(a))?void 0:(delete r.type,r.type=e,n.call(t,r))}}}}),avalon.each({AnimationEvent:"animationend",WebKitAnimationEvent:"webkitAnimationEnd"},function(t,n){e[t]&&!sn.animationend&&(sn.animationend={type:n})}),"oninput"in Ct.createElement("input")||(sn.input={type:"propertychange",deel:function(e,t){return function(n){return"value"===n.propertyName?(n.type="input",t.call(e,n)):void 0}}}),void 0===Ct.onmousewheel){var cn=void 0!==Ct.onwheel?"wheel":"DOMMouseScroll",un="wheel"===cn?"deltaY":"detail";sn.mousewheel={type:cn,deel:function(e,t){return function(n){n.wheelDeltaY=n.wheelDelta=n[un]>0?-120:120,n.wheelDeltaX=0,Object.defineProperty&&Object.defineProperty(n,"type",{value:"mousewheel"}),t.call(e,n)}}}}var fn,pn,dn,vn,hn,mn=/[-.*+?^${}()|[\]\/\\]/g,gn=o,yn={loader:function(t){e.define=t?gn.define:Mt,e.require=t?gn:Ot},interpolate:function(e){if(fn=e[0],pn=e[1],fn===pn)throw new SyntaxError("openTag!==closeTag");if(e+""=="<!--,-->")g.commentInterpolate=!0;else{var t=fn+"test"+pn;if(Wt.innerHTML=t,Wt.innerHTML!==t&&Wt.innerHTML.indexOf("&lt;")>-1)throw new SyntaxError("此定界符不合法");Wt.innerHTML=""}var n=y(fn),r=y(pn);dn=new RegExp(n+"(.*?)"+r),vn=new RegExp(n+"(.*?)"+r,"g"),hn=new RegExp(n+".*?"+r+"|\\sms-")}};g.debug=!0,g.plugins=yn,g.plugins.interpolate(["{{","}}"]),g.paths={},g.shim={},g.maxRepeatSize=100,avalon.config=g;var bn={$watch:function(e,t){if("function"==typeof t){var n=this.$events[e];n?n.push(t):this.$events[e]=[t]}else this.$events=this.$watch.backup;return this},$unwatch:function(e,t){var n=arguments.length;if(0===n)this.$watch.backup=this.$events,this.$events={};else if(1===n)this.$events[e]=[];else for(var r=this.$events[e]||[],a=r.length;~--a<0;)if(r[a]===t)return r.splice(a,1);return this},$fire:function(e){var t,n,r,a;/^(\w+)!(\S+)$/.test(e)&&(t=RegExp.$1,e=RegExp.$2);var o=this.$events,i=Bt.call(arguments,1),l=[e].concat(i);if("all"===t)for(n in avalon.vmodels)r=avalon.vmodels[n],r!==this&&r.$fire.apply(r,l);else if("up"===t||"down"===t){var s=o.expr?$n(o.expr):[];if(0===s.length)return;for(n in avalon.vmodels)if(r=avalon.vmodels[n],r!==this&&r.$events.expr){var c=$n(r.$events.expr);if(0===c.length)continue;Array.prototype.forEach.call(c,function(e){Array.prototype.forEach.call(s,function(n){var a="down"===t?n.contains(e):e.contains(n);a&&(e._avalon=r)})})}var u=Ct.getElementsByTagName("*"),f=[];for(Array.prototype.forEach.call(u,function(e){e._avalon&&(f.push(e._avalon),e._avalon="",e.removeAttribute("_avalon"))}),"up"===t&&f.reverse(),n=0;(a=f[n++])&&a.$fire.apply(a,l)!==!1;);}else{var p=o[e]||[],d=o.$all||[];for(n=0;a=p[n++];)Yt(a)&&a.apply(this,i);for(n=0;a=d[n++];)Yt(a)&&a.apply(this,arguments)}}},xn=/(\w+)\[(avalonctrl)="(\S+)"\]/,$n=Ct.querySelectorAll?function(e){return Ct.querySelectorAll(e)}:function(e){for(var t,n=e.match(xn),r=Ct.getElementsByTagName(n[1]),a=[],o=0;t=r[o++];)t.getAttribute(n[2])===n[3]&&a.push(t);return a},wn=avalon.vmodels={};avalon.define=function(e,t){var n=e.$id||e;if(n||r("warning: vm必须指定$id"),wn[n]&&r("warning: "+n+" 已经存在于avalon.vmodels中"),"object"==typeof e)var a=$(e);else{var i={$watch:o};t(i),a=$(i),_t=!0,t(a),_t=!1}return a.$id=n,wn[n]=a};var Cn=String("$id,$watch,$unwatch,$fire,$events,$model,$skipArray").match(St),Tn={},En=Object.defineProperty,An=!0;try{En({},"_",{value:"x"});var kn=Object.defineProperties}catch(On){An=!1}var Mn=Object.is||function(e,t){return 0===e&&0===t?1/e===1/t:e!==e?t!==t:e===t},_n=Rt?function(e){var t={};for(var n in e)t[n]={get:e[n],set:e[n],enumerable:!0,configurable:!0};return t}:function(e){return e};An||("__defineGetter__"in avalon&&(En=function(e,t,n){return"value"in n&&(e[t]=n.value),"get"in n&&e.__defineGetter__(t,n.get),"set"in n&&e.__defineSetter__(t,n.set),e},kn=function(e,t){for(var n in t)t.hasOwnProperty(n)&&En(e,n,t[n]);return e}),zt&&(e.execScript(["Function parseVB(code)"," ExecuteGlobal(code)","End Function","Dim VBClassBodies",'Set VBClassBodies=CreateObject("Scripting.Dictionary")',"Function findOrDefineVBClass(name,body)"," Dim found",' found=""'," For Each key in VBClassBodies"," If body=VBClassBodies.Item(key) Then"," found=key"," Exit For"," End If"," next",' If found="" Then',' parseVB("Class " + name + body)'," VBClassBodies.Add name, body"," found=name"," End If"," findOrDefineVBClass=found","End Function"].join("\n"),"VBScript"),kn=function(t,n,r){var a="VBClass"+setTimeout("1"),o=[];o.push("\r\n Private [__data__], [__proxy__]"," Public Default Function [__const__](d, p)"," Set [__data__] = d: set [__proxy__] = p"," Set [__const__] = Me"," End Function");for(t in r)n.hasOwnProperty(t)||o.push(" Public ["+t+"]");Cn.forEach(function(e){n.hasOwnProperty(e)||o.push(" Public ["+e+"]")}),o.push(" Public [hasOwnProperty]");for(t in n)o.push(" Public Property Let ["+t+"](val"+wt+")",' Call [__proxy__](Me,[__data__], "'+t+'", val'+wt+")"," End Property"," Public Property Set ["+t+"](val"+wt+")",' Call [__proxy__](Me,[__data__], "'+t+'", val'+wt+")"," End Property"," Public Property Get ["+t+"]"," On Error Resume Next"," Set["+t+'] = [__proxy__](Me,[__data__],"'+t+'")'," If Err.Number <> 0 Then"," ["+t+'] = [__proxy__](Me,[__data__],"'+t+'")'," End If"," On Error Goto 0"," End Property");o.push("End Class");var i=o.join("\r\n"),l=e.findOrDefineVBClass(a,i);l===a&&e.parseVB(["Function "+a+"Factory(a, b)"," Dim o"," Set o = (New "+a+")(a, b)"," Set "+a+"Factory = o","End Function"].join("\r\n"));var s=e[l+"Factory"](n,T);return s}));var Sn=Ft.splice,Nn={_splice:Sn,_fire:function(e,t,n){j(this.$events[kt],e,t,n)},size:function(){return this._.length},pushArray:function(e){var t=e.length,n=this.length;return t&&(Ft.push.apply(this.$model,e),A.call(this,"add",n,t,n)),t+n},push:function(){var e,t=[],n=arguments.length;for(e=0;n>e;e++)t[e]=arguments[e];return this.pushArray(arguments)},unshift:function(){var e=arguments.length,t=this.length;return e&&(Ft.unshift.apply(this.$model,arguments),A.call(this,"add",0,e,0)),e+t},shift:function(){if(this.length){var e=this.$model.shift();return A.call(this,"del",0,1,0),e}},pop:function(){var e=this.length;if(e){var t=this.$model.pop();return A.call(this,"del",e-1,1,Math.max(0,e-2)),t}},splice:function(e){var t,n=arguments.length,r=[],a=Sn.apply(this.$model,arguments);return a.length&&(r.push("del",e,a.length,0),t=!0),n>2&&(t?r.splice(3,1,0,"add",e,n-2):r.push("add",e,n-2,0),t=!0),t?A.apply(this,r):[]},contains:function(e){return-1!==this.indexOf(e)},remove:function(e){return this.removeAt(this.indexOf(e))},removeAt:function(e){return e>=0?(this.$model.splice(e,1),A.call(this,"del",e,1,0)):[]},clear:function(){return this.$model.length=this.length=this._.length=0,this._fire("clear",0),this},removeAll:function(e){if(Array.isArray(e))e.forEach(function(e){this.remove(e)},this);else if("function"==typeof e)for(var t=this.length-1;t>=0;t--){var n=this[t];e(n,t)&&this.removeAt(t)}else this.clear()},ensure:function(e){return this.contains(e)||this.push(e),this},set:function(e,t){if(e>=0){var n=avalon.type(t);t&&t.$model&&(t=t.$model);var r=this[e];if("object"===n)for(var a in t)r.hasOwnProperty(a)&&(r[a]=t[a]);else"array"===n?r.clear().push.apply(r,t):r!==t&&(this[e]=t,this.$model[e]=t,this._fire("set",e,t))}return this}};"sort,reverse".replace(St,function(e){Nn[e]=function(){var t,n=this.$model,r=n.concat(),a=Math.random(),o=[];Ft[e].apply(n,arguments);for(var i=0,l=r.length;l>i;i++){var s=n[i],c=r[i];if(Mn(s,c))o.push(i);else{var u=r.indexOf(s);o.push(u),r[u]=a,t=!0}}return t&&(k(this,o),this._fire("move",o),this._fire("index",0)),this}});var Ln=/^(duplex|on)$/,jn=avalon.$$subscribers=[],Hn=new Date,Pn={},Dn={area:[1,"<map>"],param:[1,"<object>"],col:[2,"<table><tbody></tbody><colgroup>","</table>"],legend:[1,"<fieldset>"],option:[1,"<select multiple='multiple'>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],th:[3,"<table><tbody><tr>","</tr></tbody></table>"],td:[3,"<table><tbody><tr>"],g:[1,'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">',"</svg>"],_default:Rt?[0,""]:[1,"X<div>"]};Dn.optgroup=Dn.option,Dn.tbody=Dn.tfoot=Dn.colgroup=Dn.caption=Dn.thead,String("circle,defs,ellipse,image,line,path,polygon,polyline,rect,symbol,text,use").replace(St,function(e){Dn[e]=Dn.g
2
+ });var Fn=/<([\w:]+)/,Bn=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,In=Rt?/[^\d\D]/:/(<(?:script|link|style|meta|noscript))/gi,Rn=i(["","text/javascript","text/ecmascript","application/ecmascript","application/javascript"]),Vn=/<(?:tb|td|tf|th|tr|col|opt|leg|cap|area)/,Un=Ct.createElement("script");avalon.parseHTML=function(e){if("string"!=typeof e)return Ct.createDocumentFragment();e=e.replace(Bn,"<$1></$2>").trim();var t,r,a=(Fn.exec(e)||["",""])[1].toLowerCase(),o=Dn[a]||Dn._default,i=Ut.cloneNode(!1),l=Wt;Rt||(e=e.replace(In,"<br class=msNoScope>$1")),l.innerHTML=o[1]+e+(o[2]||"");var s=l.getElementsByTagName("script");if(s.length)for(var c,u=0;c=s[u++];)Rn[c.type]&&(r=Un.cloneNode(!1),Ft.forEach.call(c.attributes,function(e){e&&e.specified&&(r[e.name]=e.value,r.setAttribute(e.name,e.value))}),r.text=c.text,c.parentNode.replaceChild(r,c));for(u=o[0];u--;l=l.lastChild);if(!Rt){for(s=l.getElementsByTagName("br"),n=s.length;c=s[--n];)"msNoScope"===c.className&&c.parentNode.removeChild(c);for(s=l.all,u=0;c=s[u++];)H(c)&&P(c)}for(;t=l.firstChild;)i.appendChild(t);return i},avalon.innerHTML=function(e,t){if(!Rt&&!In.test(t)&&!Vn.test(t))try{return void(e.innerHTML=t)}catch(n){}var r=this.parseHTML(t);this.clearHTML(e).appendChild(r)},avalon.clearHTML=function(e){for(e.textContent="";e.firstChild;)e.removeChild(e.firstChild);return e},avalon.scan=function(e,t){e=e||Vt;var n=t?[].concat(t):[];q(e,n)};var Wn=i("area,base,basefont,br,col,command,embed,hr,img,input,link,meta,param,source,track,wbr,noscript,script,style,textarea".toUpperCase()),qn=function(e,t,n){var r=e.getAttribute(t);if(r)for(var a,o=0;a=n[o++];)if(a.hasOwnProperty(r)&&"function"==typeof a[r])return a[r]},Xn=zt&&e.MutationObserver?function(e){for(var t,n=e.firstChild;n;){var r=n.nextSibling;3===n.nodeType?t?(t.nodeValue+=n.nodeValue,e.removeChild(n)):t=n:t=null,n=r}}:0,zn=/ms-(\w+)-?(.*)/,Yn={"if":10,repeat:90,data:100,widget:110,each:1400,"with":1500,duplex:2e3,on:3e3},Gn=i("animationend,blur,change,input,click,dblclick,focus,keydown,keypress,keyup,mousedown,mouseenter,mouseleave,mousemove,mouseout,mouseover,mouseup,scan,scroll,submit"),Jn=i("value,title,alt,checked,selected,disabled,readonly,enabled"),Zn=/^if|widget|repeat$/,Qn=/^each|with|html|include$/;if(!"1"[0])var Kn=l(512),er=/\s+(ms-[^=\s]+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,tr=/^['"]/,nr=/<\w+\b(?:(["'])[^"]*?(\1)|[^>])*>/i,rr=/&amp;/g,ar=function(e){var t=e.outerHTML;if("</"===t.slice(0,2)||!t.trim())return[];var n,r,a,o=t.match(nr)[0],i=[];if(Kn[o])return Kn[o];for(;r=er.exec(o);){a=r[2],a&&(a=(tr.test(a)?a.slice(1,-1):a).replace(rr,"&"));var l=r[1].toLowerCase();n=l.match(zn);var s={name:l,specified:!0,value:a||""};i.push(s)}return Kn(o,i)};var or=/\|\s*html\s*/,ir=/\|\|/g,lr=/&lt;/g,sr=/&gt;/g;rstringLiteral=/(['"])(\\\1|.)+?\1/g;var cr={_toString:function(){var e=this.node,t=e.className,n="string"==typeof t?t:t.baseVal;return n.split(/\s+/).join(" ")},_contains:function(e){return(" "+this+" ").indexOf(" "+e+" ")>-1},_add:function(e){this.contains(e)||this._set(this+" "+e)},_remove:function(e){this._set((" "+this+" ").replace(" "+e+" "," "))},__set:function(e){e=e.trim();var t=this.node;Lt.test(t)?t.setAttribute("class",e):t.className=e}};"add,remove".replace(St,function(e){avalon.fn[e+"Class"]=function(t){var n=this[0];return t&&"string"==typeof t&&n&&1===n.nodeType&&t.replace(/\S+/g,function(t){Z(n)[e](t)}),this}}),avalon.fn.mix({hasClass:function(e){var t=this[0]||{};return 1===t.nodeType&&Z(t).contains(e)},toggleClass:function(e,t){for(var n,r=0,a=e.split(/\s+/),o="boolean"==typeof t;n=a[r++];){var i=o?t:!this.hasClass(n);this[i?"addClass":"removeClass"](n)}return this},attr:function(e,t){return 2===arguments.length?(this[0].setAttribute(e,t),this):this[0].getAttribute(e)},data:function(e,t){switch(e="data-"+G(e||""),arguments.length){case 2:return this.attr(e,t),this;case 1:var n=this.attr(e);return Q(n);case 0:var r={};return Ft.forEach.call(this[0].attributes,function(t){t&&(e=t.name,e.indexOf("data-")||(e=J(e.slice(5)),r[e]=Q(t.value)))}),r}},removeData:function(e){return e="data-"+G(e),this[0].removeAttribute(e),this},css:function(e,t){if(avalon.isPlainObject(e))for(var n in e)avalon.css(this,n,e[n]);else var r=avalon.css(this,e,t);return void 0!==r?r:this},position:function(){var e,t,n=this[0],r={top:0,left:0};if(n)return"fixed"===this.css("position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),"HTML"!==e[0].tagName&&(r=e.offset()),r.top+=avalon.css(e[0],"borderTopWidth",!0),r.left+=avalon.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-avalon.css(n,"marginTop",!0),left:t.left-r.left-avalon.css(n,"marginLeft",!0)}},offsetParent:function(){for(var e=this[0].offsetParent;e&&"static"===avalon.css(e,"position");)e=e.offsetParent;return avalon(e)},bind:function(e,t,n){return this[0]?avalon.bind(this[0],e,t,n):void 0},unbind:function(e,t,n){return this[0]&&avalon.unbind(this[0],e,t,n),this},val:function(e){var t=this[0];if(t&&1===t.nodeType){var n=0===arguments.length,r=n?":get":":set",a=kr[tt(t)+r];if(a)var o=a(t,e);else{if(n)return(t.value||"").replace(/\r/g,"");t.value=e}}return n?o:this}});var ur=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,fr=/^[\],:{}\s]*$/,pr=/(?:^|:|,)(?:\s*\[)+/g,dr=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,vr=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g;avalon.parseJSON=e.JSON?JSON.parse:function(e){if("string"==typeof e){if(e=e.trim(),e&&fr.test(e.replace(dr,"@").replace(vr,"]").replace(pr,"")))return new Function("return "+e)();avalon.error("Invalid JSON: "+e)}return e},avalon.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){avalon.fn[e]=function(n){var r=this[0]||{},a=K(r),o="scrollTop"===e;return arguments.length?void(a?a.scrollTo(o?avalon(a).scrollLeft():n,o?n:avalon(a).scrollTop()):r[e]=n):a?t in a?a[t]:Vt[e]:r[e]}});var hr=avalon.cssHooks={},mr=["","-webkit-","-o-","-moz-","-ms-"],gr={"float":Rt?"cssFloat":"styleFloat"};if(avalon.cssNumber=i("columnCount,order,fillOpacity,fontWeight,lineHeight,opacity,orphans,widows,zIndex,zoom"),avalon.cssName=function(e,t,n){if(gr[e])return gr[e];t=t||Vt.style;for(var r=0,a=mr.length;a>r;r++)if(n=J(mr[r]+e),n in t)return gr[e]=n;return null},hr["@:set"]=function(e,t,n){try{e.style[t]=n}catch(r){}},e.getComputedStyle)hr["@:get"]=function(e,t){if(!e||!e.style)throw new Error("getComputedStyle要求传入一个节点 "+e);var n,r=getComputedStyle(e,null);return r&&(n="filter"===t?r.getPropertyValue(t):r[t],""===n&&(n=e.style[t])),n},hr["opacity:get"]=function(e){var t=hr["@:get"](e,"opacity");return""===t?"1":t};else{var yr=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,br=/^(top|right|bottom|left)$/,xr=/alpha\([^)]*\)/i,$r=!!e.XDomainRequest,wr="DXImageTransform.Microsoft.Alpha",Cr={thin:$r?"1px":"2px",medium:$r?"3px":"4px",thick:$r?"5px":"6px"};hr["@:get"]=function(e,t){var n=e.currentStyle,r=n[t];if(yr.test(r)&&!br.test(r)){var a=e.style,o=a.left,i=e.runtimeStyle.left;e.runtimeStyle.left=n.left,a.left="fontSize"===t?"1em":r||0,r=a.pixelLeft+"px",a.left=o,e.runtimeStyle.left=i}return"medium"===r&&(t=t.replace("Width","Style"),"none"===n[t]&&(r="0px")),""===r?"auto":Cr[r]||r},hr["opacity:set"]=function(e,t,n){var r=e.style,a=isFinite(n)&&1>=n?"alpha(opacity="+100*n+")":"",o=r.filter||"";r.zoom=1,r.filter=(xr.test(o)?o.replace(xr,a):o+" "+a).trim(),r.filter||r.removeAttribute("filter")},hr["opacity:get"]=function(e){var t=e.filters.alpha||e.filters[wr],n=t&&t.enabled?t.opacity:100;return n/100+""}}"top,left".replace(St,function(e){hr[e+":get"]=function(t){var n=hr["@:get"](t,e);return/px$/.test(n)?n:avalon(t).position()[e]+"px"}});var Tr={position:"absolute",visibility:"hidden",display:"block"},Er=/^(none|table(?!-c[ea]).+)/;"Width,Height".replace(St,function(e){var t=e.toLowerCase(),n="client"+e,r="scroll"+e,a="offset"+e;hr[t+":get"]=function(t,n,r){var o=-4;"number"==typeof r&&(o=r),n="Width"===e?["Left","Right"]:["Top","Bottom"];var i=t[a];return 2===o?i+avalon.css(t,"margin"+n[0],!0)+avalon.css(t,"margin"+n[1],!0):(0>o&&(i=i-avalon.css(t,"border"+n[0]+"Width",!0)-avalon.css(t,"border"+n[1]+"Width",!0)),-4===o&&(i=i-avalon.css(t,"padding"+n[0],!0)-avalon.css(t,"padding"+n[1],!0)),i)},hr[t+"&get"]=function(e){var n=[];et(e,n);for(var r,a=hr[t+":get"](e),o=0;r=n[o++];){e=r.node;for(var i in r)"string"==typeof r[i]&&(e.style[i]=r[i])}return a},avalon.fn[t]=function(o){var i=this[0];if(0===arguments.length){if(i.setTimeout)return i["inner"+e]||i.document.documentElement[n];if(9===i.nodeType){var l=i.documentElement;return Math.max(i.body[r],l[r],i.body[a],l[a],l[n])}return hr[t+"&get"](i)}return this.css(t,o)},avalon.fn["inner"+e]=function(){return hr[t+":get"](this[0],void 0,-2)},avalon.fn["outer"+e]=function(e){return hr[t+":get"](this[0],void 0,e===!0?2:0)}}),avalon.fn.offset=function(){var e=this[0],t={left:0,top:0};if(!e||!e.tagName||!e.ownerDocument)return t;var n=e.ownerDocument,r=n.body,a=n.documentElement,o=n.defaultView||n.parentWindow;if(!avalon.contains(a,e))return t;e.getBoundingClientRect&&(t=e.getBoundingClientRect());var i=a.clientTop||r.clientTop,l=a.clientLeft||r.clientLeft,s=Math.max(o.pageYOffset||0,a.scrollTop,r.scrollTop),c=Math.max(o.pageXOffset||0,a.scrollLeft,r.scrollLeft);return{top:t.top+s-i,left:t.left+c-l}};var Ar=/^<option(?:\s+\w+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s+value[\s=]/i,kr={"option:get":zt?function(e){return Ar.test(e.outerHTML)?e.value:e.text.trim()}:function(e){return e.value},"select:get":function(e,t){for(var n,r=e.options,a=e.selectedIndex,o=kr["option:get"],i="select-one"===e.type||0>a,l=i?null:[],s=i?a+1:r.length,c=0>a?s:i?a:0;s>c;c++)if(n=r[c],(n.selected||c===a)&&!n.disabled){if(t=o(n),i)return t;l.push(t)}return l},"select:set":function(e,t,n){t=[].concat(t);for(var r,a=kr["option:get"],o=0;r=e.options[o++];)(r.selected=t.indexOf(a(r))>-1)&&(n=!0);n||(e.selectedIndex=-1)}},Or={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},Mr=e.JSON&&JSON.stringify||function(e){return'"'+e.replace(/[\\\"\x00-\x1f]/g,function(e){var t=Or[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"'},_r="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",Sr=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|[\s\t\n]*\.[\s\t\n]*[$\w\.]+/g,Nr=/[^\w$]+/g,Lr=new RegExp(["\\b"+_r.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),jr=/\b\d[^,]*/g,Hr=/^,+|,+$/g,Pr=l(512),Dr=function(e){var t=","+e.trim();if(Pr[t])return Pr[t];var n=e.replace(Sr,"").replace(Nr,",").replace(Lr,"").replace(jr,"").replace(Hr,"").split(/^$|,+/);return Pr(t,rt(n))},Fr=l(128),Br=/\w\[.*\]|\w\.\w/,Ir=/(\$proxy\$[a-z]+)\d+$/,Rr=/\)\s*$/,Vr=/\)\s*\|/g,Ur=/\|\s*([$\w]+)/g,Wr=/"\s*\["/g,qr=/"\s*\(/g;avalon.parseExprProxy=it;var Xr="autofocus,autoplay,async,allowTransparency,checked,controls,declare,disabled,defer,defaultChecked,defaultSelectedcontentEditable,isMap,loop,multiple,noHref,noResize,noShade,open,readOnly,selected",zr={};Xr.replace(St,function(e){zr[e.toLowerCase()]=e});var Yr={"accept-charset":"acceptCharset","char":"ch",charoff:"chOff","class":"className","for":"htmlFor","http-equiv":"httpEquiv"},Gr="accessKey,bgColor,cellPadding,cellSpacing,codeBase,codeType,colSpan,dateTime,defaultValue,frameBorder,longDesc,maxLength,marginWidth,marginHeight,rowSpan,tabIndex,useMap,vSpace,valueType,vAlign";Gr.replace(St,function(e){Yr[e.toLowerCase()]=e});var Jr=/<noscript.*?>(?:[\s\S]+?)<\/noscript>/gim,Zr=/<noscript.*?>([\s\S]+?)<\/noscript>/im,Qr=function(){return new(e.XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP")},Kr=avalon.templateCache={};Zt.attr=function(e,t){var n=e.value.trim(),r=!0;if(n.indexOf(fn)>-1&&n.indexOf(pn)>2&&(r=!1,dn.test(n)&&""===RegExp.rightContext&&""===RegExp.leftContext&&(r=!0,n=RegExp.$1)),"include"===e.type){var a=e.element;e.includeRendered=qn(a,"data-include-rendered",t),e.includeLoaded=qn(a,"data-include-loaded",t);var o=e.includeReplaced=!!avalon(a).data("includeReplace");e.startInclude=Ct.createComment("ms-include"),e.endInclude=Ct.createComment("ms-include-end"),o?(e.element=e.startInclude,a.parentNode.insertBefore(e.startInclude,a),a.parentNode.insertBefore(e.endInclude,a.nextSibling)):(a.insertBefore(e.startInclude,a.firstChild),a.appendChild(e.endInclude))}e.handlerName="attr",it(n,t,e,r?0:z(e.value))},Qt.attr=function(t,n,r){var a=r.type,o=r.param;if("css"===a)avalon(n).css(o,t);else if("attr"===a){if(zr[o]){var i=zr[o];if("boolean"==typeof n[i])return n[i]=!!t}var l=t===!1||null===t||void 0===t;if(!Rt&&Yr[o]&&(o=Yr[o]),l)return n.removeAttribute(o);var s=Lt.test(n)?!1:Ct.namespaces&&H(n)?!0:o in n.cloneNode(!1);s?n[o]=t:n.setAttribute(o,t)}else if("include"===a&&t){var c=r.vmodels,u=r.includeRendered,f=r.includeLoaded,p=r.includeReplaced,d=p?n.parentNode:n,v=function(e){for(f&&(e=f.apply(d,[e].concat(c))),u&&D(d,function(){u.call(d)},0/0);;){var t=r.startInclude.nextSibling;if(!t||t===r.endInclude)break;d.removeChild(t)}var n=avalon.parseHTML(e),a=avalon.slice(n.childNodes);d.insertBefore(n,r.endInclude),U(a,c)};if("src"===r.param)if(Kr[t])avalon.nextTick(function(){v(Kr[t])});else{var h=Qr();h.onreadystatechange=function(){if(4===h.readyState){var e=h.status;(e>=200&&300>e||304===e||1223===e)&&v(Kr[t]=h.responseText)}},h.open("GET",t,!0),"withCredentials"in h&&(h.withCredentials=!0),h.setRequestHeader("X-Requested-With","XMLHttpRequest"),h.send(null)}else{var m=t&&1===t.nodeType?t:Ct.getElementById(t);if(m){if("NOSCRIPT"===m.tagName&&!m.innerHTML&&!m.fixIE78){h=Qr(),h.open("GET",location,!1),h.send(null);for(var g=Ct.getElementsByTagName("noscript"),y=(h.responseText||"").match(Jr)||[],b=y.length,x=0;b>x;x++){var $=g[x];$&&($.style.display="none",$.fixIE78=(y[x].match(Zr)||["","&nbsp;"])[1])}}avalon.nextTick(function(){v(m.fixIE78||m.value||m.innerText||m.innerHTML)})}}}else if(Vt.hasAttribute||"string"!=typeof t||"src"!==a&&"href"!==a||(t=t.replace(/&amp;/g,"&")),n[a]=t,e.chrome&&"EMBED"===n.tagName){var w=n.parentNode,C=document.createComment("ms-src");w.replaceChild(C,n),w.replaceChild(n,C)}},"title,alt,src,value,css,include,href".replace(St,function(e){Zt[e]=Zt.attr}),Zt["class"]=function(e,t){var n,a=e.param,o=e.value;if(e.handlerName="class",!a||isFinite(a)){e.param="";var i=o.replace(vn,function(e){return e.replace(/./g,"0")}),l=i.indexOf(":");if(-1===l)var s=o;else{if(s=o.slice(0,l),n=o.slice(l+1),ot(n,t,e),!e.evaluator)return r("debug: ms-class '"+(n||"").trim()+"' 不存在于VM中"),!1;e._evaluator=e.evaluator,e._args=e.args}var c=dn.test(s);c||(e.immobileClass=s),it("",t,e,c?z(s):0)}else e.immobileClass=e.oldStyle=e.param,it(o,t,e)},Qt["class"]=function(e,t,n){var r=avalon(t),a=n.type;if("class"===a&&n.oldStyle)r.toggleClass(n.oldStyle,!!e);else switch(n.toggleClass=n._evaluator?!!n._evaluator.apply(t,n._args):!0,n.newClass=n.immobileClass||e,n.oldClass&&n.newClass!==n.oldClass&&r.removeClass(n.oldClass),n.oldClass=n.newClass,a){case"class":r.toggleClass(n.newClass,n.toggleClass);break;case"hover":case"active":if(!n.hasBindEvent){var o="mouseenter",i="mouseleave";if("active"===a){t.tabIndex=t.tabIndex||-1,o="mousedown",i="mouseup";var l=r.bind("mouseleave",function(){n.toggleClass&&r.removeClass(n.newClass)})}var s=r.bind(o,function(){n.toggleClass&&r.addClass(n.newClass)}),c=r.bind(i,function(){n.toggleClass&&r.removeClass(n.newClass)});n.rollback=function(){r.unbind("mouseleave",l),r.unbind(o,s),r.unbind(i,c)},n.hasBindEvent=!0}}},"hover,active".replace(St,function(e){Zt[e]=Zt["class"]}),Qt.data=function(e,t,n){var r="data-"+n.param;e&&"object"==typeof e?t[r]=e:t.setAttribute(r,String(e))};var ea=Zt.duplex=function(e,t){var n,a=e.element;if(it(e.value,t,e,0,1),e.changed=qn(a,"data-duplex-changed",t)||o,e.evaluator&&e.args){var l=[],s=i("string,number,boolean,checked");"radio"===a.type&&""===e.param&&(e.param="checked"),a.msData&&(a.msData["ms-duplex"]=e.value),e.param.replace(/\w+/g,function(t){/^(checkbox|radio)$/.test(a.type)&&/^(radio|checked)$/.test(t)&&("radio"===t&&r("ms-duplex-radio已经更名为ms-duplex-checked"),t="checked",e.isChecked=!0),"bool"===t?(t="boolean",r("ms-duplex-bool已经更名为ms-duplex-boolean")):"text"===t&&(t="string",r("ms-duplex-text已经更名为ms-duplex-string")),s[t]&&(n=!0),avalon.Array.ensure(l,t)}),n||l.push("string"),e.param=l.join("-"),e.bound=function(t,n){a.addEventListener?a.addEventListener(t,n,!1):a.attachEvent("on"+t,n);var r=e.rollback;e.rollback=function(){a.avalonSetter=null,avalon.unbind(a,t,n),r&&r()}};for(var c in avalon.vmodels){var u=avalon.vmodels[c];u.$fire("avalon-ms-duplex-init",e)}var f=e.pipe||(e.pipe=st);f(null,e,"init");var p=a.tagName;ea[p]&&ea[p](a,e.evaluator.apply(null,e.args),e)}};avalon.duplexHooks={checked:{get:function(e,t){return!t.element.oldValue}},string:{get:function(e){return e},set:lt},"boolean":{get:function(e){return"true"===e},set:lt},number:{get:function(e){return isFinite(e)?parseFloat(e)||0:e},set:lt}};var ta,na=[];avalon.tick=function(e){1===na.push(e)&&(ta=setInterval(ct,60))};var ra=o;!new function(){function e(e){avalon.contains(Vt,this)&&(t[this.tagName].call(this,e),this.avalonSetter&&this.avalonSetter())}try{var t={},n=HTMLInputElement.prototype,r=HTMLTextAreaElement.prototype,a=HTMLInputElement.prototype;Object.getOwnPropertyNames(a),t.INPUT=Object.getOwnPropertyDescriptor(n,"value").set,Object.defineProperty(n,"value",{set:e}),t.TEXTAREA=Object.getOwnPropertyDescriptor(r,"value").set,Object.defineProperty(r,"value",{set:e})}catch(o){ra=avalon.tick}},zt&&avalon.bind(Ct,"selectionchange",function(){var e=Ct.activeElement;e&&"function"==typeof e.avalonSetter&&e.avalonSetter()}),ea.INPUT=function(e,t,n){function a(e){n.changed.call(this,e,n)}function o(){p=!0}function i(){p=!1}function l(){if(!p){var r=e.oldValue=e.value,o=n.pipe(r,n,"get");f.data("duplex-observe")!==!1&&(t(o),a.call(e,o),f.data("duplex-focus")&&avalon.nextTick(function(){e.focus()}))}}function s(e){setTimeout(function(){l(e)})}var c=e.type,u=n.bound,f=avalon(e),p=!1;if(n.handler=function(){var r=n.pipe(t(),n,"set")+"";r!==e.oldValue&&(e.value=r)},n.isChecked||"radio"===e.type){var d=6===zt;l=function(){if(f.data("duplex-observe")!==!1){var r=n.pipe(e.value,n,"get");t(r),a.call(e,r)}},n.handler=function(){var r=t(),a=n.isChecked?!!r:r+""===e.value;e.oldValue=a,d?setTimeout(function(){e.defaultChecked=a,e.checked=a},31):e.checked=a},u("click",l)}else if("checkbox"===c)l=function(){if(f.data("duplex-observe")!==!1){var o=e.checked?"ensure":"remove",i=t();Array.isArray(i)||(r("ms-duplex应用于checkbox上要对应一个数组"),i=[i]),avalon.Array[o](i,n.pipe(e.value,n,"get")),a.call(e,i)}},n.handler=function(){var r=[].concat(t());e.checked=r.indexOf(n.pipe(e.value,n,"get"))>-1},u(Rt?"change":"click",l);else{var v=e.getAttribute("data-duplex-event")||e.getAttribute("data-event")||"input";e.attributes["data-event"]&&r("data-event指令已经废弃,请改用data-duplex-event"),v.replace(St,function(e){switch(e){case"input":zt?(zt>8?u("input",l):u("propertychange",function(e){"value"===e.propertyName&&l()}),u("dragend",s)):(u("input",l),u("compositionstart",o),u("compositionend",i),u("DOMAutoComplete",l));break;default:u(e,l)}})}/text|password/.test(e.type)&&ra(function(){if(Vt.contains(e))e.value!==e.oldValue&&l();else if(!e.msRetain)return!1}),e.avalonSetter=l,e.oldValue=e.value,O(n),a.call(e,e.value)},ea.TEXTAREA=ea.INPUT,ea.SELECT=function(e,t,n){function a(){if(o.data("duplex-observe")!==!1){var r=o.val();r=Array.isArray(r)?r.map(function(e){return n.pipe(e,n,"get")}):n.pipe(r,n,"get"),r+""!==e.oldValue&&t(r),n.changed.call(e,r,n)}}var o=avalon(e);n.handler=function(){var n=t();n=n&&n.$model||n,Array.isArray(n)?e.multiple||r("ms-duplex在<select multiple=true>上要求对应一个数组"):e.multiple&&r("ms-duplex在<select multiple=false>不能对应一个数组"),n=Array.isArray(n)?n.map(String):n+"",n+""!==e.oldValue&&(o.val(n),e.oldValue=n+"")},n.bound("change",a),D(e,function(){O(n),n.changed.call(e,t(),n)},0/0)},Qt.html=function(e,t,n){e=null==e?"":e;var r="group"in n,a=r?t.parentNode:t;if(a){if(11===e.nodeType)var o=e;else if(1===e.nodeType||e.item){var i=1===e.nodeType?e.childNodes:e.item?e:[];for(o=Ut.cloneNode(!0);i[0];)o.appendChild(i[0])}else o=avalon.parseHTML(e);var l=Ct.createComment("ms-html");if(r){a.insertBefore(l,t);for(var s=n.group,c=1;s>c;){var u=t.nextSibling;u&&(a.removeChild(u),c++)}a.removeChild(t),n.element=l}else avalon.clearHTML(a).appendChild(l);r&&(n.group=o.childNodes.length||1),i=avalon.slice(o.childNodes),i[0]&&(l.parentNode&&l.parentNode.replaceChild(o,l),r&&(n.element=i[0])),U(i,n.vmodels)}},Zt["if"]=Zt.data=Zt.text=Zt.html=function(e,t){it(e.value,t,e)},Qt["if"]=function(e,t,n){if(e)8===t.nodeType&&(t.parentNode.replaceChild(n.template,t),t=n.element=n.template),t.getAttribute(n.name)&&(t.removeAttribute(n.name),R(t,n.vmodels)),n.rollback=null;else if(1===t.nodeType){var r=n.element=Ct.createComment("ms-if");t.parentNode.replaceChild(r,t),n.template=t,Et.appendChild(t),n.rollback=function(){t.parentNode===Et&&Et.removeChild(t)}}};var aa=/\(([^)]*)\)/;Zt.on=function(e,t){var n=e.value;e.type="on";var r=e.param.replace(/-\d+$/,"");if("function"==typeof Zt.on[r+"Hook"]&&Zt.on[r+"Hook"](e),n.indexOf("(")>0&&n.indexOf(")")>-1){var a=(n.match(aa)||["",""])[1].trim();(""===a||"$event"===a)&&(n=n.replace(aa,""))}it(n,t,e)},Qt.on=function(e,t,n){e=function(e){var t=n.evaluator||o;return t.apply(this,n.args.concat(e))};var r=n.param.replace(/-\d+$/,"");if("scan"===r)e.call(t,{type:r});else if("function"==typeof n.specialBind)n.specialBind(t,e);else var a=avalon.bind(t,r,e);n.rollback=function(){"function"==typeof n.specialUnbind?n.specialUnbind():avalon.unbind(t,r,a)}},Zt.repeat=function(e,t){var n=e.type;it(e.value,t,e,0,1),e.proxies=[];var r=!1;try{var a=e.$repeat=e.evaluator.apply(0,e.args||[]),o=avalon.type(a);"object"!==o&&"array"!==o&&(r=!0,avalon.log("warning:"+e.value+"对应类型不正确"))}catch(i){r=!0,avalon.log("warning:"+e.value+"编译出错")}var l=e.value.split(".")||[];if(l.length>1){l.pop();for(var s,c=l[0],u=0;s=t[u++];)if(s&&s.hasOwnProperty(c)){var f=s[c].$events||{};f[kt]=f[kt]||[],f[kt].push(e);break}}var p=e.element;p.removeAttribute(e.name),e.sortedCallback=qn(p,"data-with-sorted",t),e.renderedCallback=qn(p,"data-"+n+"-rendered",t);var d=Xt(n),v=e.element=Ct.createComment(d+":end");if(e.clone=Ct.createComment(d),Ut.appendChild(v),"each"===n||"with"===n?(e.template=p.innerHTML.trim(),avalon.clearHTML(p).appendChild(v)):(e.template=p.outerHTML.trim(),p.parentNode.replaceChild(v,p)),e.template=avalon.parseHTML(e.template),e.rollback=function(){var t=e.element;if(t){Qt.repeat.call(e,"clear");var n=t.parentNode,r=e.template,a=r.firstChild;n.replaceChild(r,t);var o=e.$stamp;o&&o.parentNode&&o.parentNode.removeChild(o),a=e.element="repeat"===e.type?a:n}},!r){e.handler=Qt.repeat,e.$outer={};var h="$key",m="$val";for(Array.isArray(a)&&(h="$first",m="$last"),u=0;s=t[u++];)if(s.hasOwnProperty(h)&&s.hasOwnProperty(m)){e.$outer=s;break}var g=a.$events,y=(g||{})[kt];if(y&&avalon.Array.ensure(y,e)&&_(e,y),"object"===o){e.$with=!0;var b=g?g.$withProxyPool||(g.$withProxyPool={}):{};e.handler("append",a,b)}else a.length&&e.handler("add",0,a.length)}},Qt.repeat=function(e,t,n){if(e){var r=this,a=r.element,i=a.parentNode,l=r.proxies,s=Ut.cloneNode(!1);switch(e){case"add":for(var c,u=t+n,f=r.$repeat,p=f.length-1,d=[],v=ft(r,t),h=t;u>h;h++){var m=vt(h,r);l.splice(h,0,m),ut(r,s,m,d)}for(i.insertBefore(s,v),h=0;c=d[h++];)U(c.nodes,c.vmodels),c.nodes=c.vmodels=null;break;case"del":v=l[t].$stamp,a=ft(r,t+n),pt(v,a);var g=l.splice(t,n);gt(g,"each");break;case"clear":var y=r.$stamp||l[0];y&&(v=y.$stamp||y,pt(v,a)),gt(l,"each");break;case"move":v=l[0].$stamp;var b,x=v.nodeValue,$=[],w=[];for(pt(v,a,function(){w.unshift(this),this.nodeValue===x&&($.unshift(w),w=[])}),k(l,t),k($,t);w=$.shift();)for(;b=w.shift();)s.appendChild(b);i.insertBefore(s,a);break;case"index":for(p=l.length-1;n=l[t];t++)n.$index=t,n.$first=0===t,n.$last=t===p;return;case"set":return m=l[t],void(m&&j(m.$events.$index));case"append":var C=n,T=[];d=[];for(var E in t)t.hasOwnProperty(E)&&"hasOwnProperty"!==E&&T.push(E);if(r.sortedCallback){var A=r.sortedCallback.call(i,T);A&&Array.isArray(A)&&A.length&&(T=A)}for(h=0;E=T[h++];)"hasOwnProperty"!==E&&(C[E]||(C[E]=mt(E,r)),ut(r,s,C[E],d));var O=r.$stamp=r.clone;for(i.insertBefore(O,a),i.insertBefore(s,a),h=0;c=d[h++];)U(c.nodes,c.vmodels),c.nodes=c.vmodels=null}"clear"===e&&(e="del");var M=r.renderedCallback||o,_=arguments;D(i,function(){M.apply(i,_),i.oldValue&&"SELECT"===i.tagName&&avalon(i).val(i.oldValue.split(","))},0/0)}},"with,each".replace(St,function(e){Zt[e]=Zt.repeat});var oa=[],ia=[];Qt.text=function(e,t){if(e=null==e?"":e,3===t.nodeType)try{t.data=e}catch(n){}else"textContent"in t?t.textContent=e:t.innerText=e},avalon.parseDisplay=yt,Zt.visible=function(e,t){var n=avalon(e.element),r=n.css("display");if("none"===r){var a=n[0].style,o=/visibility/i.test(a.cssText),i=n.css("visibility");a.display="",a.visibility="hidden",r=n.css("display"),"none"===r&&(r=yt(n[0].nodeName)),a.visibility=o?i:""}e.display=r,it(e.value,t,e)},Qt.visible=function(e,t,n){t.style.display=e?n.display:"none"},Zt.widget=function(t,n){var r=t.value.match(St),a=t.element,i=r[0],l=r[1];l&&"$"!==l||(l=Xt(i));var s=r[2]||i,c=avalon.ui[i];if("function"==typeof c){n=a.vmodels||n;for(var u,f=0;u=n[f++];)if(u.hasOwnProperty(s)&&"object"==typeof u[s]){var p=u[s];p=p.$model||p;break}if(p){var d=p[i+"Id"];"string"==typeof d&&(l=d)}var v=avalon.getWidgetData(a,i);t.value=[i,l,s].join(","),t[i+"Id"]=l,t.evaluator=o,a.msData["ms-widget-id"]=l;var h=t[i+"Options"]=avalon.mix({},c.defaults,p||{},v);a.removeAttribute("ms-widget");var m=c(a,t,n)||{};m.$id?(avalon.vmodels[l]=m,F(a,m),m.hasOwnProperty("$init")&&m.$init(function(){avalon.scan(a,[m].concat(n)),"function"==typeof h.onInit&&h.onInit.call(a,m,h,n)}),t.rollback=function(){try{m.widgetElement=null,m.$remove()}catch(e){}a.msData={},delete avalon.vmodels[m.$id]},_(t,la),e.chrome&&a.addEventListener("DOMNodeRemovedFromDocument",function(){setTimeout(L)})):avalon.scan(a,n)}else n.length&&(a.vmodels=n)};var la=[],sa=/<script[^>]*>([\S\s]*?)<\/script\s*>/gim,ca=/\s+(on[^=\s]+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,ua=/<\w+\b(?:(["'])[^"]*?(\1)|[^>])*>/gi,fa={a:/\b(href)\=("javascript[^"]*"|'javascript[^']*')/gi,img:/\b(src)\=("javascript[^"]*"|'javascript[^']*')/gi,form:/\b(action)\=("javascript[^"]*"|'javascript[^']*')/gi},pa=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,da=/([^\#-~| |!])/g,va=avalon.filters={uppercase:function(e){return e.toUpperCase()},lowercase:function(e){return e.toLowerCase()},truncate:function(e,t,n){return t=t||30,n=void 0===n?"...":n,e.length>t?e.slice(0,t-n.length)+n:String(e)},$filter:function(e){for(var t=1,n=arguments.length;n>t;t++){var r=arguments[t],a=avalon.filters[r.shift()];if("function"==typeof a){var o=[e].concat(r);e=a.apply(null,o)}}return e},camelize:J,sanitize:function(e){return e.replace(sa,"").replace(ua,function(e){var t=e.toLowerCase().match(/<(\w+)\s/);if(t){var n=fa[t[1]];n&&(e=e.replace(n,function(e,t,n){var r=n.charAt(0);return t+"="+r+"javascript:void(0)"+r}))}return e.replace(ca," ").replace(/\s+/g," ")})},escape:function(e){return String(e).replace(/&/g,"&amp;").replace(pa,function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1);return"&#"+(1024*(t-55296)+(n-56320)+65536)+";"}).replace(da,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")},currency:function(e,t,n){return(t||"¥")+bt(e,isFinite(n)?n:2)},number:function(e,t){return bt(e,isFinite(t)?t:3)}};!new function(){function e(e){return parseInt(e,10)||0}function t(e,t,n){var r="";for(0>e&&(r="-",e=-e),e=""+e;e.length<t;)e="0"+e;return n&&(e=e.substr(e.length-t)),r+e}function n(e,n,r,a){return function(o){var i=o["get"+e]();return(r>0||i>-r)&&(i+=r),0===i&&-12===r&&(i=12),t(i,n,a)}}function r(e,t){return function(n,r){var a=n["get"+e](),o=(t?"SHORT"+e:e).toUpperCase();return r[o][a]}}function a(e){var n=-1*e.getTimezoneOffset(),r=n>=0?"+":"";return r+=t(Math[n>0?"floor":"ceil"](n/60),2)+t(Math.abs(n%60),2)}function o(e,t){return e.getHours()<12?t.AMPMS[0]:t.AMPMS[1]}var i={yyyy:n("FullYear",4),yy:n("FullYear",2,0,!0),y:n("FullYear",1),MMMM:r("Month"),MMM:r("Month",!0),MM:n("Month",2,1),M:n("Month",1,1),dd:n("Date",2),d:n("Date",1),HH:n("Hours",2),H:n("Hours",1),hh:n("Hours",2,-12),h:n("Hours",1,-12),mm:n("Minutes",2),m:n("Minutes",1),ss:n("Seconds",2),s:n("Seconds",1),sss:n("Milliseconds",3),EEEE:r("Day"),EEE:r("Day",!0),a:o,Z:a},l=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,s=/^\/Date\((\d+)\)\/$/;va.date=function(t,n){var r,a,o=va.date.locate,c="",u=[];if(n=n||"mediumDate",n=o[n]||n,"string"==typeof t)if(/^\d+$/.test(t))t=e(t);else if(s.test(t))t=+RegExp.$1;else{var f=t.trim(),p=[0,0,0,0,0,0,0],d=new Date(0);f=f.replace(/^(\d+)\D(\d+)\D(\d+)/,function(t,n,r,a){var o=4===a.length?[a,n,r]:[n,r,a];return p[0]=e(o[0]),p[1]=e(o[1])-1,p[2]=e(o[2]),""});var v=d.setFullYear,h=d.setHours;f=f.replace(/[T\s](\d+):(\d+):?(\d+)?\.?(\d)?/,function(t,n,r,a,o){return p[3]=e(n),p[4]=e(r),p[5]=e(a),o&&(p[6]=Math.round(1e3*parseFloat("0."+o))),""});var m=0,g=0;f=f.replace(/Z|([+-])(\d\d):?(\d\d)/,function(t,n,r,a){return v=d.setUTCFullYear,h=d.setUTCHours,n&&(m=e(n+r),g=e(n+a)),""}),p[3]-=m,p[4]-=g,v.apply(d,p.slice(0,3)),h.apply(d,p.slice(3)),t=d}if("number"==typeof t&&(t=new Date(t)),"date"===avalon.type(t)){for(;n;)a=l.exec(n),a?(u=u.concat(a.slice(1)),n=u.pop()):(u.push(n),n=null);return u.forEach(function(e){r=i[e],c+=r?r(t,o):e.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),c}};var c={AMPMS:{0:"上午",1:"下午"},DAY:{0:"星期日",1:"星期一",2:"星期二",3:"星期三",4:"星期四",5:"星期五",6:"星期六"},MONTH:{0:"1月",1:"2月",2:"3月",3:"4月",4:"5月",5:"6月",6:"7月",7:"8月",8:"9月",9:"10月",10:"11月",11:"12月"},SHORTDAY:{0:"周日",1:"周一",2:"周二",3:"周三",4:"周四",5:"周五",6:"周六"},fullDate:"y年M月d日EEEE",longDate:"y年M月d日",medium:"yyyy-M-d H:mm:ss",mediumDate:"yyyy-M-d",mediumTime:"H:mm:ss","short":"yy-M-d ah:mm",shortDate:"yy-M-d",shortTime:"ah:mm"};c.SHORTMONTH=c.MONTH,va.date.locate=c};var ha=avalon.modules={"domReady!":{exports:avalon,state:3},avalon:{exports:avalon,state:4}};ha.exports=ha.avalon,new function(){function t(e,t){var n="js";e=e.replace(/^(\w+)\!/,function(e,t){return n=t,""}),"ready"===n&&(r("debug: ready!已经被废弃,请使用domReady!"),n="domReady");var a="";e=e.replace(D,function(e){return a=e,""});var o="."+n,i=/js|css/.test(o)?o:"";e=e.replace(/\.[a-z0-9]+$/g,function(e){return e===o?(i=e,""):e});var l=avalon.mix({query:a,ext:i,res:n,name:e,toUrl:h},t);return l.toUrl(e),l}function n(e){var t=e.name,n=e.res,r=ha[t],a=t&&e.urlNoQuery;if(r&&r.state>=3)return t;if(r=ha[a],r&&r.state>=3)return gn(r.deps||[],r.factory,a),a;if(t&&!r){r=ha[a]={id:a,state:1};var o=function(a){P[n]=a,a.load(t,e,function(e){arguments.length&&void 0!==e&&(r.exports=e),r.state=4,s()})};P[n]?o(P[n]):gn([n],o)}return t?a:n+"!"}function i(e,t){for(var n,r=0;n=e[r++];)if(4!==ha[n].state&&(n===t||i(ha[n].deps,t)))return!0}function l(e,t,n){var a=u(e.src);return e.onload=e.onreadystatechange=e.onerror=null,t||n&&ha[a]&&!ha[a].state?(setTimeout(function(){Tt.removeChild(e),e=null}),void r("debug: 加载 "+a+" 失败"+t+" "+!ha[a].state)):!0}function s(){e:for(var e,t=E.length;e=E[--t];){var n=ha[e],r=n.deps;if(r){for(var a,o=0;a=r[o];o++){var i=O[a];if(i&&(a=r[o]=i),4!==Object(ha[a]).state)continue e}4!==n.state&&(E.splice(t,1),v(n.id,n.deps,n.factory),s())}}}function c(e,t,n){function a(){if(!"1"[0]&&!i)return i=setTimeout(a,150);if(c||H.test(o.readyState)){clearTimeout(i);var u=A.pop();u&&u.require(t),n&&n(),l(o,!1,!c)&&(r("debug: 已成功加载 "+e),t&&E.push(t),s())}}var o=Ct.createElement("script");o.className=kt;var i,c="onload"in o,u=c?"onload":"onreadystatechange";o[u]=a,o.onerror=function(){l(o,!0)},Tt.insertBefore(o,Tt.firstChild),o.src=e,r("debug: 正准备加载 "+e)
3
+ }function u(e){return(e||"").replace(D,"")}function f(e){return/^(?:[a-z]+:)?\/\//i.test(String(e))}function p(e,t){return"1"[0]?e[t]:e.getAttribute(t,4)}function d(){var t;try{a.b.c()}catch(n){t=n.stack,!t&&e.opera&&(t=(String(n).match(/of linked script \S+/g)||[]).join(" "))}if(t)return t=t.split(/[@ ]/g).pop(),t="("===t[0]?t.slice(1,-1):t.replace(/\s/,""),u(t.replace(/(:\d+)?:\d+$/i,""));for(var r,o=Tt.getElementsByTagName("script"),i=o.length;r=o[--i];)if(r.className===kt&&"interactive"===r.readyState){var l=p(r,"src");return r.className=u(l)}}function v(t,n,r){var a=Object(ha[t]);a.state=4;for(var o,i=0,l=[];o=n[i++];)if(o=O[o]||o,"exports"===o){var s=a.exports||(a.exports={});l.push(s)}else l.push(ha[o].exports);var c=r.apply(e,l);return void 0!==c&&(a.exports=c),delete a.factory,c}function h(e){0===e.indexOf(this.res+"!")&&(e=e.slice(this.res.length+1));var t=e,n=0,r=this.baseUrl,a=this.parentUrl||r;$(e,g.paths,function(e,r){t=t.replace(r,e),n=1}),n||$(e,g.packages,function(e,n,r){t=t.replace(r.name,r.location)}),this.mapUrl&&$(this.mapUrl,g.map,function(e){$(t,e,function(e,n){t=t.replace(n,e),a=r})});var o=this.ext;o&&n&&t.slice(-o.length)===o&&(t=t.slice(0,-o.length)),f(t)||(a=this.built||/^\w/.test(t)?r:a,t=C(a,t));var i=t+o;return t=i+this.query,$(e,g.urlArgs,function(e){t+=(-1===t.indexOf("?")?"?":"&")+e}),this.url=t,this.urlNoQuery=i}function m(e,t,n){var r=x(e,t,n);return r.sort(w),r}function y(e){return new RegExp("^"+e+"(/|$)")}function b(t){return function(){var n;return t.init&&(n=t.init.apply(e,arguments)),n||t.exports&&T(t.exports)}}function x(e,t,n){var r=[];for(var a in e)if(e.hasOwnProperty(a)){var o={name:a,val:e[a]};r.push(o),o.reg="*"===a&&t?/^/:y(a),n&&"*"!==a&&(o.reg=new RegExp("/"+a.replace(/^\//,"")+"(/|$)"))}return r}function $(e,t,n){t=t||[];for(var r,a=0;r=t[a++];)if(r.reg.test(e))return n(r.val,r.name,r),!1}function w(e,t){var n=e.name,r=t.name;return"*"===r?-1:"*"===n?1:r.length-n.length}function C(e,t){if("/"!==e.charAt(e.length-1)&&(e+="/"),"./"===t.slice(0,2))return e+t.slice(2);if(".."===t.slice(0,2)){for(e+=t;F.test(e);)e=e.replace(F,"");return e}return"/"===t.slice(0,1)?e+t.slice(1):e+t}function T(t){if(!t)return t;var n=e;return t.split(".").forEach(function(e){n=n[e]}),n}var E=[],A=[],k=/\.js$/i,O={},M=[],_=!1;gn=avalon.require=function(e,r,a,i){if(_){Array.isArray(e)||avalon.error("require方法的第一个参数应为数组 "+e);var l=[],c={},u=a||"callback"+setTimeout("1");i=i||{},i.baseUrl=g.baseUrl;var f=!!i.built;if(a&&(i.parentUrl=a.substr(0,a.lastIndexOf("/")),i.mapUrl=a.replace(k,"")),f){var p=t(i.defineName,i);u=p.urlNoQuery}else e.forEach(function(e){var r=t(e,i),a=n(r);a&&(c[a]||(l.push(a),c[a]="司徒正美"))});var d=ha[u];d&&4===d.state||(ha[u]={id:u,deps:f?e.concat():l,factory:r||o,state:3}),d||E.push(u),s()}else if(M.push(avalon.slice(arguments)),arguments.length<=2){_=!0;for(var v,h=M.splice(0,M.length);v=h.shift();)gn.apply(null,v)}},gn.define=function(e,t,n){"string"!=typeof e&&(n=t,t=e,e="anonymous"),Array.isArray(t)||(n=t,t=[]);var r={built:!_,defineName:e},a=[t,n,r];n.require=function(e){if(a.splice(2,0,e),ha[e]){ha[e].state=3;var t=!1;try{t=i(ha[e].deps,e)}catch(r){}t&&avalon.error(e+"模块与之前的模块存在循环依赖,请不要直接用script标签引入"+e+"模块")}delete n.require,gn.apply(null,a)};var o=r.built?"unknown":d();if(o){var l=ha[o];l&&(l.state=2),n.require(o)}else A.push(n)},gn.config=g,gn.define.amd=ha;var S=g["orig.paths"]={},N=g["orig.map"]={},L=g.packages=[],j=g["orig.args"]={};avalon.mix(yn,{paths:function(e){avalon.mix(S,e),g.paths=m(S)},map:function(e){avalon.mix(N,e);var t=m(N,1,1);avalon.each(t,function(e,t){t.val=m(t.val)}),g.map=t},packages:function(e){e=e.concat(L);for(var t,n={},r=[],a=0;t=e[a++];){t="string"==typeof t?{name:t}:t;var o=t.name;if(!n[o]){var i=t.location?t.location:C(o,t.main||"main");i=i.replace(k,""),r.push(t),n[o]=t.location=i,t.reg=y(o)}}g.packages=r.sort()},urlArgs:function(e){"string"==typeof e&&(e={"*":e}),avalon.mix(j,e),g.urlArgs=m(j,1)},baseUrl:function(e){if(!f(e)){var t=Tt.getElementsByTagName("base")[0];t&&Tt.removeChild(t);var n=Ct.createElement("a");n.href=e,e=p(n,"href"),t&&Tt.insertBefore(t,Tt.firstChild)}e.length>3&&(g.baseUrl=e)},shim:function(e){for(var t in e){var n=e[t];Array.isArray(n)&&(n=e[t]={deps:n}),n.exportsFn||!n.exports&&!n.init||(n.exportsFn=b(n))}g.shim=e}});var H=Ct.documentMode>=8?/loaded/:/complete|loaded/,P=gn.plugins={ready:{load:o},js:{load:function(e,t,n){var r=t.url,a=t.urlNoQuery,o=g.shim[e.replace(k,"")];o?gn(o.deps||[],function(){var e=avalon.slice(arguments);c(r,a,function(){n(o.exportsFn?o.exportsFn.apply(0,e):void 0)})}):c(r,a)}},css:{load:function(e,t,n){var a=t.url,o=Ct.createElement("link");o.rel="stylesheet",o.href=a,Tt.insertBefore(o,Tt.firstChild),r("debug: 已成功加载 "+a),n()}},text:{load:function(e,t,n){var a=t.url,o=Qr();o.onreadystatechange=function(){if(4===o.readyState){var e=o.status;e>399&&600>e?avalon.error(a+" 对应资源不存在或没有开启 CORS"):(r("debug: 已成功加载 "+a),n(o.responseText))}},o.open("GET",a,!0),"withCredentials"in o&&(o.withCredentials=!0),o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.send(),r("debug: 正准备加载 "+a)}}};gn.checkDeps=s;var D=/(\?[^#]*)$/,F=/\/\w+\/\.\./,B=Ct.scripts[Ct.scripts.length-1],I=B.getAttribute("data-main");if(I){yn.baseUrl(I);var R=g.baseUrl;g.baseUrl=R.slice(0,R.lastIndexOf("/")+1),c(R.replace(k,"")+".js")}else{var V=u(p(B,"src"));g.baseUrl=V.slice(0,V.lastIndexOf("/")+1)}};var ma=[];if("complete"===Ct.readyState)setTimeout(xt);else if(Rt)Ct.addEventListener("DOMContentLoaded",xt);else{Ct.attachEvent("onreadystatechange",function(){"complete"===Ct.readyState&&xt()});try{var ga=null===e.frameElement}catch(On){}Vt.doScroll&&ga&&e.external&&$t()}avalon.bind(e,"load",xt),avalon.ready=function(e){xt===o?e(avalon):ma.push(e)},avalon.config({loader:!0}),avalon.ready(function(){avalon.scan(Ct.body)}),"function"==typeof define&&define.amd&&define("avalon",[],function(){return avalon});e.avalon;return avalon.noConflict=function(t){return t&&e.avalon===avalon&&(e.avalon=avalon),avalon},void 0===t&&(e.avalon=avalon),avalon});
@@ -5,9 +5,8 @@
5
5
  http://weibo.com/jslouvre/
6
6
 
7
7
  Released under the MIT license
8
- avalon.mobile.js(支持触屏事件) 1.391 build in 2015.1.31
9
- _________
10
- support IE6+ and other browsers
8
+ avalon.mobile.js 1.391 built in 2015.2.12
9
+ support IE10+ and other browsers
11
10
  ==================================================*/
12
11
  (function(global, factory) {
13
12
 
@@ -38,7 +37,7 @@ var expose = Date.now()
38
37
  //http://stackoverflow.com/questions/7290086/javascript-use-strict-and-nicks-find-global-function
39
38
  var DOC = window.document
40
39
  var head = DOC.head //HEAD元素
41
- head.insertAdjacentHTML("afterBegin", '<avalon ms-skip><style id="avalonStyle">.avalonHide{ display: none!important }</style></avalon>')
40
+ head.insertAdjacentHTML("afterBegin", '<avalon ms-skip class="avalonHide"><style id="avalonStyle">.avalonHide{ display: none!important }</style></avalon>')
42
41
  var ifGroup = head.firstChild
43
42
 
44
43
  function log() {
@@ -135,7 +134,7 @@ avalon.type = function(obj) { //取得目标的类型
135
134
  }
136
135
 
137
136
  var isFunction = function(fn) {
138
- return serialize.call(fn) == "[object Function]"
137
+ return serialize.call(fn) === "[object Function]"
139
138
  }
140
139
 
141
140
  avalon.isFunction = isFunction
@@ -245,7 +244,7 @@ avalon.mix({
245
244
  }
246
245
  var index = -1,
247
246
  length = Math.max(0, Math.ceil((end - start) / step)),
248
- result = Array(length)
247
+ result = new Array(length)
249
248
  while (++index < length) {
250
249
  result[index] = start
251
250
  start += step
@@ -285,10 +284,10 @@ avalon.mix({
285
284
  if (node instanceof avalon) {
286
285
  node = node[0]
287
286
  }
288
- var prop = /[_-]/.test(name) ? camelize(name) : name
287
+ var prop = /[_-]/.test(name) ? camelize(name) : name, fn
289
288
  name = avalon.cssName(prop) || prop
290
289
  if (value === void 0 || typeof value === "boolean") { //获取样式
291
- var fn = cssHooks[prop + ":get"] || cssHooks["@:get"]
290
+ fn = cssHooks[prop + ":get"] || cssHooks["@:get"]
292
291
  if (name === "background") {
293
292
  name = "backgroundColor"
294
293
  }
@@ -318,7 +317,7 @@ avalon.mix({
318
317
  }
319
318
  } else {
320
319
  for (i in obj) {
321
- if (obj.hasOwnProperty(i) && fn(i, obj[i] === false)) {
320
+ if (obj.hasOwnProperty(i) && fn(i, obj[i]) === false) {
322
321
  break
323
322
  }
324
323
  }
@@ -619,7 +618,7 @@ var EventBus = {
619
618
  return this
620
619
  },
621
620
  $fire: function(type) {
622
- var special
621
+ var special, i, v, callback
623
622
  if (/^(\w+)!(\S+)$/.test(type)) {
624
623
  special = RegExp.$1
625
624
  type = RegExp.$2
@@ -628,8 +627,8 @@ var EventBus = {
628
627
  var args = aslice.call(arguments, 1)
629
628
  var detail = [type].concat(args)
630
629
  if (special === "all") {
631
- for (var i in avalon.vmodels) {
632
- var v = avalon.vmodels[i]
630
+ for (i in avalon.vmodels) {
631
+ v = avalon.vmodels[i]
633
632
  if (v !== this) {
634
633
  v.$fire.apply(v, detail)
635
634
  }
@@ -638,8 +637,8 @@ var EventBus = {
638
637
  var elements = events.expr ? findNodes(events.expr) : []
639
638
  if (elements.length === 0)
640
639
  return
641
- for (var i in avalon.vmodels) {
642
- var v = avalon.vmodels[i]
640
+ for (i in avalon.vmodels) {
641
+ v = avalon.vmodels[i]
643
642
  if (v !== this) {
644
643
  if (v.$events.expr) {
645
644
  var eventNodes = findNodes(v.$events.expr)
@@ -672,19 +671,19 @@ var EventBus = {
672
671
  if (special === "up") {
673
672
  alls.reverse()
674
673
  }
675
- for (var i = 0, el; el = alls[i++]; ) {
676
- if (el.$fire.apply(el, detail) === false) {
674
+ for (i = 0; callback = alls[i++]; ) {
675
+ if (callback.$fire.apply(callback, detail) === false) {
677
676
  break
678
677
  }
679
678
  }
680
679
  } else {
681
680
  var callbacks = events[type] || []
682
681
  var all = events.$all || []
683
- for (var i = 0, callback; callback = callbacks[i++]; ) {
682
+ for (i = 0; callback = callbacks[i++]; ) {
684
683
  if (isFunction(callback))
685
684
  callback.apply(this, args)
686
685
  }
687
- for (var i = 0, callback; callback = all[i++]; ) {
686
+ for (i = 0; callback = all[i++]; ) {
688
687
  if (isFunction(callback))
689
688
  callback.apply(this, arguments)
690
689
  }
@@ -852,7 +851,7 @@ function modelFactory(source, $special, $model) {
852
851
  } else {
853
852
  if (accessor.type === 0) { //type 0 计算属性 1 监控属性 2 对象属性
854
853
  //计算属性不需要收集视图刷新函数,都是由其他监控属性代劳
855
- var newValue = accessor.get.call($vmodel)
854
+ newValue = accessor.get.call($vmodel)
856
855
  if (oldValue !== newValue) {
857
856
  $model[name] = newValue
858
857
  //这里不用同步视图
@@ -884,12 +883,12 @@ function modelFactory(source, $special, $model) {
884
883
  initCallbacks.push(function() {
885
884
  var data = {
886
885
  evaluator: function() {
887
- data.type = new Date - 0
886
+ data.type = Math.random(),
888
887
  data.element = null
889
888
  $model[name] = accessor.get.call($vmodel)
890
889
  },
891
890
  element: head,
892
- type: new Date - 0,
891
+ type: Math.random(),
893
892
  handler: noop,
894
893
  args: []
895
894
  }
@@ -930,7 +929,7 @@ function modelFactory(source, $special, $model) {
930
929
  $vmodel.$id = generateID()
931
930
  $vmodel.$model = $model
932
931
  $vmodel.$events = $events
933
- for (var i in EventBus) {
932
+ for ( i in EventBus) {
934
933
  var fn = EventBus[i]
935
934
  if (!W3C) { //在IE6-8下,VB对象的方法里的this并不指向自身,需要用bind处理一下
936
935
  fn = fn.bind($vmodel)
@@ -1372,7 +1371,7 @@ function removeSubscribers() {
1372
1371
  if (diff) {
1373
1372
  //avalon.log("有需要移除的元素")
1374
1373
  while (obj = $$subscribers[--i]) {
1375
- var data = obj.data
1374
+ data = obj.data
1376
1375
  if (data.element === void 0)
1377
1376
  continue
1378
1377
  if (needTest[data.type] && isRemove(data.element)) { //如果它没有在DOM树
@@ -1576,50 +1575,6 @@ function bindingSorter(a, b) {
1576
1575
  return a.priority - b.priority
1577
1576
  }
1578
1577
 
1579
- function scanTag(elem, vmodels, node) {
1580
- //扫描顺序 ms-skip(0) --> ms-important(1) --> ms-controller(2) --> ms-if(10) --> ms-repeat(100)
1581
- //--> ms-if-loop(110) --> ms-attr(970) ...--> ms-each(1400)-->ms-with(1500)--〉ms-duplex(2000)垫后
1582
- var a = elem.getAttribute("ms-skip")
1583
- var b = elem.getAttributeNode("ms-important")
1584
- var c = elem.getAttributeNode("ms-controller")
1585
- if (typeof a === "string") {
1586
- return
1587
- } else if (node = b || c) {
1588
- var newVmodel = avalon.vmodels[node.value]
1589
- if (!newVmodel) {
1590
- return
1591
- }
1592
- //ms-important不包含父VM,ms-controller相反
1593
- vmodels = node === b ? [newVmodel] : [newVmodel].concat(vmodels)
1594
- elem.removeAttribute(node.name) //removeAttributeNode不会刷新[ms-controller]样式规则
1595
- elem.classList.remove(node.name)
1596
- createSignalTower(elem, newVmodel)
1597
- }
1598
- scanAttr(elem, vmodels) //扫描特性节点
1599
- }
1600
- function scanNodeList(parent, vmodels) {
1601
- var node = parent.firstChild
1602
- while (node) {
1603
- var nextNode = node.nextSibling
1604
- scanNode(node, node.nodeType, vmodels)
1605
- node = nextNode
1606
- }
1607
- }
1608
-
1609
- function scanNodeArray(nodes, vmodels) {
1610
- for (var i = 0, node; node = nodes[i++]; ) {
1611
- scanNode(node, node.nodeType, vmodels)
1612
- }
1613
- }
1614
- function scanNode(node, nodeType, vmodels) {
1615
- if (nodeType === 1) {
1616
- scanTag(node, vmodels) //扫描元素节点
1617
- } else if (nodeType === 3 && rexpr.test(node.data)){
1618
- scanText(node, vmodels) //扫描文本节点
1619
- } else if (kernel.commentInterpolate && nodeType === 8 && !rexpr.test(node.nodeValue)) {
1620
- scanText(node, vmodels) //扫描注释节点
1621
- }
1622
- }
1623
1578
  function scanAttr(elem, vmodels) {
1624
1579
  //防止setAttribute, removeAttribute时 attributes自动被同步,导致for循环出错
1625
1580
  var attributes = elem.hasAttributes() ? avalon.slice(elem.attributes) : []
@@ -1688,8 +1643,8 @@ function scanAttr(elem, vmodels) {
1688
1643
  }
1689
1644
  bindings.sort(bindingSorter)
1690
1645
  var scanNode = true
1691
- for (var i = 0, binding; binding = bindings[i]; i++) {
1692
- var type = binding.type
1646
+ for (i = 0; binding = bindings[i]; i++) {
1647
+ type = binding.type
1693
1648
  if (rnoscanAttrBinding.test(type)) {
1694
1649
  return executeBindings(bindings.slice(0, i + 1), vmodels)
1695
1650
  } else if (scanNode) {
@@ -1705,14 +1660,61 @@ function scanAttr(elem, vmodels) {
1705
1660
 
1706
1661
  var rnoscanAttrBinding = /^if|widget|repeat$/
1707
1662
  var rnoscanNodeBinding = /^each|with|html|include$/
1663
+ function scanNodeList(parent, vmodels) {
1664
+ var node = parent.firstChild
1665
+ while (node) {
1666
+ var nextNode = node.nextSibling
1667
+ scanNode(node, node.nodeType, vmodels)
1668
+ node = nextNode
1669
+ }
1670
+ }
1671
+
1672
+ function scanNodeArray(nodes, vmodels) {
1673
+ for (var i = 0, node; node = nodes[i++]; ) {
1674
+ scanNode(node, node.nodeType, vmodels)
1675
+ }
1676
+ }
1677
+ function scanNode(node, nodeType, vmodels) {
1678
+ if (nodeType === 1) {
1679
+ scanTag(node, vmodels) //扫描元素节点
1680
+ } else if (nodeType === 3 && rexpr.test(node.data)){
1681
+ scanText(node, vmodels) //扫描文本节点
1682
+ } else if (kernel.commentInterpolate && nodeType === 8 && !rexpr.test(node.nodeValue)) {
1683
+ scanText(node, vmodels) //扫描注释节点
1684
+ }
1685
+ }
1686
+ function scanTag(elem, vmodels, node) {
1687
+ //扫描顺序 ms-skip(0) --> ms-important(1) --> ms-controller(2) --> ms-if(10) --> ms-repeat(100)
1688
+ //--> ms-if-loop(110) --> ms-attr(970) ...--> ms-each(1400)-->ms-with(1500)--〉ms-duplex(2000)垫后
1689
+ var a = elem.getAttribute("ms-skip")
1690
+ var b = elem.getAttributeNode("ms-important")
1691
+ var c = elem.getAttributeNode("ms-controller")
1692
+ if (typeof a === "string") {
1693
+ return
1694
+ } else if (node = b || c) {
1695
+ var newVmodel = avalon.vmodels[node.value]
1696
+ if (!newVmodel) {
1697
+ return
1698
+ }
1699
+ //ms-important不包含父VM,ms-controller相反
1700
+ vmodels = node === b ? [newVmodel] : [newVmodel].concat(vmodels)
1701
+ elem.removeAttribute(node.name) //removeAttributeNode不会刷新[ms-controller]样式规则
1702
+ elem.classList.remove(node.name)
1703
+ createSignalTower(elem, newVmodel)
1704
+ }
1705
+ scanAttr(elem, vmodels) //扫描特性节点
1706
+ }
1708
1707
  var rhasHtml = /\|\s*html\s*/,
1709
1708
  r11a = /\|\|/g,
1710
1709
  rlt = /&lt;/g,
1711
1710
  rgt = /&gt;/g
1712
-
1711
+ rstringLiteral = /(['"])(\\\1|.)+?\1/g
1713
1712
  function getToken(value) {
1714
1713
  if (value.indexOf("|") > 0) {
1715
- var index = value.replace(r11a, "\u1122\u3344").indexOf("|") //干掉所有短路或
1714
+ var scapegoat = value.replace( rstringLiteral, function(_){
1715
+ return Math.pow(10,_.length)
1716
+ })
1717
+ var index = scapegoat.replace(r11a, "\u1122\u3344").indexOf("|") //干掉所有短路或
1716
1718
  if (index > -1) {
1717
1719
  return {
1718
1720
  filters: value.slice(index),
@@ -1776,7 +1778,7 @@ function scanText(textNode, vmodels) {
1776
1778
  tokens = scanExpr(textNode.data)
1777
1779
  }
1778
1780
  if (tokens.length) {
1779
- for (var i = 0, token; token = tokens[i++]; ) {
1781
+ for (var i = 0; token = tokens[i++]; ) {
1780
1782
  var node = DOC.createTextNode(token.value) //将文本转换为文本节点,并替换原来的文本节点
1781
1783
  if (token.expr) {
1782
1784
  token.type = "text"
@@ -2226,14 +2228,14 @@ var keywords =
2226
2228
  // 关键字
2227
2229
  "break,case,catch,continue,debugger,default,delete,do,else,false" +
2228
2230
  ",finally,for,function,if,in,instanceof,new,null,return,switch,this" +
2229
- ",throw,true,try,typeof,var,void,while,with"
2231
+ ",throw,true,try,typeof,var,void,while,with" +
2230
2232
  // 保留字
2231
- + ",abstract,boolean,byte,char,class,const,double,enum,export,extends" +
2233
+ ",abstract,boolean,byte,char,class,const,double,enum,export,extends" +
2232
2234
  ",final,float,goto,implements,import,int,interface,long,native" +
2233
2235
  ",package,private,protected,public,short,static,super,synchronized" +
2234
- ",throws,transient,volatile"
2236
+ ",throws,transient,volatile" +
2235
2237
  // ECMA 5 - use strict
2236
- + ",arguments,let,yield" + ",undefined"
2238
+ ",arguments,let,yield" + ",undefined"
2237
2239
  var rrexpstr = /\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|[\s\t\n]*\.[\s\t\n]*[$\w\.]+/g
2238
2240
  var rsplit = /[^\w$]+/g
2239
2241
  var rkeywords = new RegExp(["\\b" + keywords.replace(/,/g, '\\b|\\b') + "\\b"].join('|'), 'g')
@@ -2373,7 +2375,7 @@ function parseExpr(code, scopes, data) {
2373
2375
  data.evaluator = fn
2374
2376
  return
2375
2377
  }
2376
- var prefix = assigns.join(", ")
2378
+ prefix = assigns.join(", ")
2377
2379
  if (prefix) {
2378
2380
  prefix = "var " + prefix
2379
2381
  }
@@ -2441,12 +2443,6 @@ function parseExprProxy(code, scopes, data, tokens, noregister) {
2441
2443
  }
2442
2444
  }
2443
2445
  avalon.parseExprProxy = parseExprProxy
2444
- /*********************************************************************
2445
- * 各种指令 *
2446
- **********************************************************************/
2447
- //ms-skip绑定已经在scanTag 方法中实现
2448
- //ms-controller绑定已经在scanTag 方法中实现
2449
- //ms-important绑定已经在scanTag 方法中实现
2450
2446
  var bools = "autofocus,autoplay,async,allowTransparency,checked,controls,declare,disabled,defer,defaultChecked,defaultSelected" +
2451
2447
  "contentEditable,isMap,loop,multiple,noHref,noResize,noShade,open,readOnly,selected"
2452
2448
  var boolMap = {}
@@ -2544,7 +2540,7 @@ bindingExecutors.attr = function(val, elem, data) {
2544
2540
  var loaded = data.includeLoaded
2545
2541
  var replace = data.includeReplaced
2546
2542
  var target = replace ? elem.parentNode : elem
2547
- function scanTemplate(text) {
2543
+ var scanTemplate = function(text) {
2548
2544
  if (loaded) {
2549
2545
  text = loaded.apply(target, [text].concat(vmodels))
2550
2546
  }
@@ -2594,7 +2590,7 @@ bindingExecutors.attr = function(val, elem, data) {
2594
2590
  var el = val && val.nodeType === 1 ? val : DOC.getElementById(val)
2595
2591
  if (el) {
2596
2592
  if (el.tagName === "NOSCRIPT" && !(el.innerHTML || el.fixIE78)) { //IE7-8 innerText,innerHTML都无法取得其内容,IE6能取得其innerHTML
2597
- var xhr = getXHR() //IE9-11与chrome的innerHTML会得到转义的内容,它们的innerText可以
2593
+ xhr = getXHR() //IE9-11与chrome的innerHTML会得到转义的内容,它们的innerText可以
2598
2594
  xhr.open("GET", location, false) //谢谢Nodejs 乱炖群 深圳-纯属虚构
2599
2595
  xhr.send(null)
2600
2596
  //http://bbs.csdn.net/topics/390349046?page=1#post-393492653
@@ -2632,8 +2628,6 @@ bindingExecutors.attr = function(val, elem, data) {
2632
2628
  "title,alt,src,value,css,include,href".replace(rword, function(name) {
2633
2629
  bindingHandlers[name] = bindingHandlers.attr
2634
2630
  })
2635
- //ms-include绑定已由ms-attr绑定实现
2636
-
2637
2631
  //根据VM的属性值或表达式的值切换类名,ms-class="xxx yyy zzz:flag"
2638
2632
  //http://www.cnblogs.com/rubylouvre/archive/2012/12/17/2818540.html
2639
2633
  bindingHandlers["class"] = function(data, vmodels) {
@@ -2724,6 +2718,10 @@ bindingExecutors ["class"] = function(val, elem, data) {
2724
2718
  "hover,active".replace(rword, function(method) {
2725
2719
  bindingHandlers[method] = bindingHandlers["class"]
2726
2720
  })
2721
+ //ms-controller绑定已经在scanTag 方法中实现
2722
+ //ms-css绑定已由ms-attr绑定实现
2723
+
2724
+
2727
2725
  // bindingHandlers.data 定义在if.js
2728
2726
  bindingExecutors.data = function(val, elem, data) {
2729
2727
  var key = "data-" + data.param
@@ -2734,357 +2732,107 @@ bindingExecutors.data = function(val, elem, data) {
2734
2732
  }
2735
2733
  }
2736
2734
 
2737
- // bindingHandlers.text 定义在if.js
2738
- bindingExecutors.text = function(val, elem) {
2739
- val = val == null ? "" : val //不在页面上显示undefined null
2740
- if (elem.nodeType === 3) { //绑定在文本节点上
2741
- try { //IE对游离于DOM树外的节点赋值会报错
2742
- elem.data = val
2743
- } catch (e) {
2744
- }
2745
- } else { //绑定在特性节点上
2746
- elem.textContent = val
2747
- }
2748
- }
2735
+ //双工绑定
2736
+ var duplexBinding = bindingHandlers.duplex = function(data, vmodels) {
2737
+ var elem = data.element,
2738
+ hasCast
2739
+ parseExprProxy(data.value, vmodels, data, 0, 1)
2749
2740
 
2750
- // bindingHandlers.html 定义在if.js
2751
- bindingExecutors.html = function(val, elem, data) {
2752
- val = val == null ? "" : val
2753
- var isHtmlFilter = "group" in data
2754
- var parent = isHtmlFilter ? elem.parentNode : elem
2755
- if (!parent)
2756
- return
2757
- if (val.nodeType === 11) { //将val转换为文档碎片
2758
- var fragment = val
2759
- } else if (val.nodeType === 1 || val.item) {
2760
- var nodes = val.nodeType === 1 ? val.childNodes : val.item ? val : []
2761
- fragment = hyperspace.cloneNode(true)
2762
- while (nodes[0]) {
2763
- fragment.appendChild(nodes[0])
2741
+ data.changed = getBindingCallback(elem, "data-duplex-changed", vmodels) || noop
2742
+ if (data.evaluator && data.args) {
2743
+ var params = []
2744
+ var casting = oneObject("string,number,boolean,checked")
2745
+ if (elem.type === "radio" && data.param === "") {
2746
+ data.param = "checked"
2764
2747
  }
2765
- } else {
2766
- fragment = avalon.parseHTML(val)
2767
- }
2768
- //插入占位符, 如果是过滤器,需要有节制地移除指定的数量,如果是html指令,直接清空
2769
- var comment = DOC.createComment("ms-html")
2770
- if (isHtmlFilter) {
2771
- parent.insertBefore(comment, elem)
2772
- var n = data.group, i = 1
2773
- while (i < n) {
2774
- var node = elem.nextSibling
2775
- if (node) {
2776
- parent.removeChild(node)
2777
- i++
2748
+ if (elem.msData) {
2749
+ elem.msData["ms-duplex"] = data.value
2750
+ }
2751
+ data.param.replace(/\w+/g, function(name) {
2752
+ if (/^(checkbox|radio)$/.test(elem.type) && /^(radio|checked)$/.test(name)) {
2753
+ if (name === "radio")
2754
+ log("ms-duplex-radio已经更名为ms-duplex-checked")
2755
+ name = "checked"
2756
+ data.isChecked = true
2757
+ }
2758
+ if (name === "bool") {
2759
+ name = "boolean"
2760
+ log("ms-duplex-bool已经更名为ms-duplex-boolean")
2761
+ } else if (name === "text") {
2762
+ name = "string"
2763
+ log("ms-duplex-text已经更名为ms-duplex-string")
2778
2764
  }
2765
+ if (casting[name]) {
2766
+ hasCast = true
2767
+ }
2768
+ avalon.Array.ensure(params, name)
2769
+ })
2770
+ if (!hasCast) {
2771
+ params.push("string")
2779
2772
  }
2780
- parent.removeChild(elem)
2781
- data.element = comment //防止被CG
2782
- } else {
2783
- avalon.clearHTML(parent).appendChild(comment)
2784
- }
2785
- if (isHtmlFilter) {
2786
- data.group = fragment.childNodes.length || 1
2773
+ data.param = params.join("-")
2774
+ data.bound = function(type, callback) {
2775
+ if (elem.addEventListener) {
2776
+ elem.addEventListener(type, callback, false)
2777
+ } else {
2778
+ elem.attachEvent("on" + type, callback)
2779
+ }
2780
+ var old = data.rollback
2781
+ data.rollback = function() {
2782
+ elem.avalonSetter = null
2783
+ avalon.unbind(elem, type, callback)
2784
+ old && old()
2785
+ }
2786
+ }
2787
+ for (var i in avalon.vmodels) {
2788
+ var v = avalon.vmodels[i]
2789
+ v.$fire("avalon-ms-duplex-init", data)
2790
+ }
2791
+ var cpipe = data.pipe || (data.pipe = pipe)
2792
+ cpipe(null, data, "init")
2793
+ var tagName = elem.tagName
2794
+ duplexBinding[tagName] && duplexBinding[tagName](elem, data.evaluator.apply(null, data.args), data)
2787
2795
  }
2788
- var nodes = avalon.slice(fragment.childNodes)
2789
- if (nodes[0]) {
2790
- if (comment.parentNode)
2791
- comment.parentNode.replaceChild(fragment, comment)
2792
- if (isHtmlFilter) {
2793
- data.element = nodes[0]
2796
+ }
2797
+ //不存在 bindingExecutors.duplex
2798
+ function fixNull(val) {
2799
+ return val == null ? "" : val
2800
+ }
2801
+ avalon.duplexHooks = {
2802
+ checked: {
2803
+ get: function(val, data) {
2804
+ return !data.element.oldValue
2794
2805
  }
2806
+ },
2807
+ string: {
2808
+ get: function(val) { //同步到VM
2809
+ return val
2810
+ },
2811
+ set: fixNull
2812
+ },
2813
+ "boolean": {
2814
+ get: function(val) {
2815
+ return val === "true"
2816
+ },
2817
+ set: fixNull
2818
+ },
2819
+ number: {
2820
+ get: function(val) {
2821
+ return isFinite(val) ? parseFloat(val) || 0 : val
2822
+ },
2823
+ set: fixNull
2795
2824
  }
2796
- scanNodeArray(nodes, data.vmodels)
2797
2825
  }
2798
2826
 
2799
- bindingHandlers["if"] =
2800
- bindingHandlers.data =
2801
- bindingHandlers.text =
2802
- bindingHandlers.html =
2803
- function(data, vmodels) {
2804
- parseExprProxy(data.value, vmodels, data)
2827
+ function pipe(val, data, action, e) {
2828
+ data.param.replace(/\w+/g, function(name) {
2829
+ var hook = avalon.duplexHooks[name]
2830
+ if (hook && typeof hook[action] === "function") {
2831
+ val = hook[action](val, data)
2805
2832
  }
2806
-
2807
- bindingExecutors["if"] = function(val, elem, data) {
2808
- if (val) { //插回DOM树
2809
- if (elem.nodeType === 8) {
2810
- elem.parentNode.replaceChild(data.template, elem)
2811
- elem = data.element = data.template //这时可能为null
2812
- }
2813
- if (elem.getAttribute(data.name)) {
2814
- elem.removeAttribute(data.name)
2815
- scanAttr(elem, data.vmodels)
2816
- }
2817
- data.rollback = null
2818
- } else { //移出DOM树,并用注释节点占据原位置
2819
- if (elem.nodeType === 1) {
2820
- var node = data.element = DOC.createComment("ms-if")
2821
- elem.parentNode.replaceChild(node, elem)
2822
- data.template = elem //元素节点
2823
- ifGroup.appendChild(elem)
2824
- data.rollback = function() {
2825
- if (elem.parentNode === ifGroup) {
2826
- ifGroup.removeChild(elem)
2827
- }
2828
- }
2829
- }
2830
- }
2831
- }
2832
-
2833
-
2834
- function parseDisplay(nodeName, val) {
2835
- //用于取得此类标签的默认display值
2836
- var key = "_" + nodeName
2837
- if (!parseDisplay[key]) {
2838
- var node = DOC.createElement(nodeName)
2839
- root.appendChild(node)
2840
- if (W3C) {
2841
- val = getComputedStyle(node, null).display
2842
- } else {
2843
- val = node.currentStyle.display
2844
- }
2845
- root.removeChild(node)
2846
- parseDisplay[key] = val
2847
- }
2848
- return parseDisplay[key]
2849
- }
2850
-
2851
- avalon.parseDisplay = parseDisplay
2852
-
2853
- bindingHandlers.visible = function(data, vmodels) {
2854
- var elem = avalon(data.element)
2855
- var display = elem.css("display")
2856
- if (display === "none") {
2857
- var style = elem[0].style
2858
- var has = /visibility/i.test(style.cssText)
2859
- var visible = elem.css("visibility")
2860
- style.display = ""
2861
- style.visibility = "hidden"
2862
- display = elem.css("display")
2863
- if (display === "none") {
2864
- display = parseDisplay(elem[0].nodeName)
2865
- }
2866
- style.visibility = has ? visible : ""
2867
- }
2868
- data.display = display
2869
- parseExprProxy(data.value, vmodels, data)
2870
- }
2871
-
2872
- bindingExecutors.visible = function(val, elem, data) {
2873
- elem.style.display = val ? data.display : "none"
2874
- }
2875
-
2876
- var rdash = /\(([^)]*)\)/
2877
- bindingHandlers.on = function(data, vmodels) {
2878
- var value = data.value
2879
- data.type = "on"
2880
- var eventType = data.param.replace(/-\d+$/, "") // ms-on-mousemove-10
2881
- if (typeof bindingHandlers.on[eventType + "Hook"] === "function") {
2882
- bindingHandlers.on[eventType + "Hook"](data)
2883
- }
2884
- if (value.indexOf("(") > 0 && value.indexOf(")") > -1) {
2885
- var matched = (value.match(rdash) || ["", ""])[1].trim()
2886
- if (matched === "" || matched === "$event") { // aaa() aaa($event)当成aaa处理
2887
- value = value.replace(rdash, "")
2888
- }
2889
- }
2890
- parseExprProxy(value, vmodels, data)
2891
- }
2892
-
2893
- bindingExecutors.on = function(callback, elem, data) {
2894
- callback = function(e) {
2895
- var fn = data.evaluator || noop
2896
- return fn.apply(this, data.args.concat(e))
2897
- }
2898
- var eventType = data.param.replace(/-\d+$/, "") // ms-on-mousemove-10
2899
- if (eventType === "scan") {
2900
- callback.call(elem, {
2901
- type: eventType
2902
- })
2903
- } else if (typeof data.specialBind === "function") {
2904
- data.specialBind(elem, callback)
2905
- } else {
2906
- var removeFn = avalon.bind(elem, eventType, callback)
2907
- }
2908
- data.rollback = function() {
2909
- if (typeof data.specialUnbind === "function") {
2910
- data.specialUnbind()
2911
- } else {
2912
- avalon.unbind(elem, eventType, removeFn)
2913
- }
2914
- }
2915
- }
2916
-
2917
-
2918
- bindingHandlers.widget = function(data, vmodels) {
2919
- var args = data.value.match(rword)
2920
- var elem = data.element
2921
- var widget = args[0]
2922
- var id = args[1]
2923
- if (!id || id === "$") {//没有定义或为$时,取组件名+随机数
2924
- id = generateID(widget)
2925
- }
2926
- var optName = args[2] || widget//没有定义,取组件名
2927
- var constructor = avalon.ui[widget]
2928
- if (typeof constructor === "function") { //ms-widget="tabs,tabsAAA,optname"
2929
- vmodels = elem.vmodels || vmodels
2930
- for (var i = 0, v; v = vmodels[i++]; ) {
2931
- if (v.hasOwnProperty(optName) && typeof v[optName] === "object") {
2932
- var vmOptions = v[optName]
2933
- vmOptions = vmOptions.$model || vmOptions
2934
- break
2935
- }
2936
- }
2937
- if (vmOptions) {
2938
- var wid = vmOptions[widget + "Id"]
2939
- if (typeof wid === "string") {
2940
- id = wid
2941
- }
2942
- }
2943
- //抽取data-tooltip-text、data-tooltip-attr属性,组成一个配置对象
2944
- var widgetData = avalon.getWidgetData(elem, widget)
2945
- data.value = [widget, id, optName].join(",")
2946
- data[widget + "Id"] = id
2947
- data.evaluator = noop
2948
- elem.msData["ms-widget-id"] = id
2949
- var options = data[widget + "Options"] = avalon.mix({}, constructor.defaults, vmOptions || {}, widgetData)
2950
- elem.removeAttribute("ms-widget")
2951
- var vmodel = constructor(elem, data, vmodels) || {} //防止组件不返回VM
2952
- if (vmodel.$id) {
2953
- avalon.vmodels[id] = vmodel
2954
- createSignalTower(elem, vmodel)
2955
- if (vmodel.hasOwnProperty("$init")) {
2956
- vmodel.$init(function() {
2957
- avalon.scan(elem, [vmodel].concat(vmodels))
2958
- if (typeof options.onInit === "function") {
2959
- options.onInit.call(elem, vmodel, options, vmodels)
2960
- }
2961
- })
2962
- }
2963
- data.rollback = function() {
2964
- try {
2965
- vmodel.widgetElement = null
2966
- vmodel.$remove()
2967
- } catch (e) {
2968
- }
2969
- elem.msData = {}
2970
- delete avalon.vmodels[vmodel.$id]
2971
- }
2972
- addSubscribers(data, widgetList)
2973
- if (window.chrome) {
2974
- elem.addEventListener("DOMNodeRemovedFromDocument", function() {
2975
- setTimeout(removeSubscribers)
2976
- })
2977
- }
2978
- } else {
2979
- avalon.scan(elem, vmodels)
2980
- }
2981
- } else if (vmodels.length) { //如果该组件还没有加载,那么保存当前的vmodels
2982
- elem.vmodels = vmodels
2983
- }
2984
- }
2985
- var widgetList = []
2986
- //不存在 bindingExecutors.widget
2987
- //双工绑定
2988
- var duplexBinding = bindingHandlers.duplex = function(data, vmodels) {
2989
- var elem = data.element,
2990
- hasCast
2991
- parseExprProxy(data.value, vmodels, data, 0, 1)
2992
-
2993
- data.changed = getBindingCallback(elem, "data-duplex-changed", vmodels) || noop
2994
- if (data.evaluator && data.args) {
2995
- var params = []
2996
- var casting = oneObject("string,number,boolean,checked")
2997
- if (elem.type === "radio" && data.param === "") {
2998
- data.param = "checked"
2999
- }
3000
- if (elem.msData) {
3001
- elem.msData["ms-duplex"] = data.value
3002
- }
3003
- data.param.replace(/\w+/g, function(name) {
3004
- if (/^(checkbox|radio)$/.test(elem.type) && /^(radio|checked)$/.test(name)) {
3005
- if (name === "radio")
3006
- log("ms-duplex-radio已经更名为ms-duplex-checked")
3007
- name = "checked"
3008
- data.isChecked = true
3009
- }
3010
- if (name === "bool") {
3011
- name = "boolean"
3012
- log("ms-duplex-bool已经更名为ms-duplex-boolean")
3013
- } else if (name === "text") {
3014
- name = "string"
3015
- log("ms-duplex-text已经更名为ms-duplex-string")
3016
- }
3017
- if (casting[name]) {
3018
- hasCast = true
3019
- }
3020
- avalon.Array.ensure(params, name)
3021
- })
3022
- if (!hasCast) {
3023
- params.push("string")
3024
- }
3025
- data.param = params.join("-")
3026
- data.bound = function(type, callback) {
3027
- if (elem.addEventListener) {
3028
- elem.addEventListener(type, callback, false)
3029
- } else {
3030
- elem.attachEvent("on" + type, callback)
3031
- }
3032
- var old = data.rollback
3033
- data.rollback = function() {
3034
- elem.avalonSetter = null
3035
- avalon.unbind(elem, type, callback)
3036
- old && old()
3037
- }
3038
- }
3039
- for (var i in avalon.vmodels) {
3040
- var v = avalon.vmodels[i]
3041
- v.$fire("avalon-ms-duplex-init", data)
3042
- }
3043
- var cpipe = data.pipe || (data.pipe = pipe)
3044
- cpipe(null, data, "init")
3045
- var tagName = elem.tagName
3046
- duplexBinding[tagName] && duplexBinding[tagName](elem, data.evaluator.apply(null, data.args), data)
3047
- }
3048
- }
3049
- //不存在 bindingExecutors.duplex
3050
- function fixNull(val) {
3051
- return val == null ? "" : val
3052
- }
3053
- avalon.duplexHooks = {
3054
- checked: {
3055
- get: function(val, data) {
3056
- return !data.element.oldValue
3057
- }
3058
- },
3059
- string: {
3060
- get: function(val) { //同步到VM
3061
- return val
3062
- },
3063
- set: fixNull
3064
- },
3065
- "boolean": {
3066
- get: function(val) {
3067
- return val === "true"
3068
- },
3069
- set: fixNull
3070
- },
3071
- number: {
3072
- get: function(val) {
3073
- return isFinite(val) ? parseFloat(val) || 0 : val
3074
- },
3075
- set: fixNull
3076
- }
3077
- }
3078
-
3079
- function pipe(val, data, action, e) {
3080
- data.param.replace(/\w+/g, function(name) {
3081
- var hook = avalon.duplexHooks[name]
3082
- if (hook && typeof hook[action] === "function") {
3083
- val = hook[action](val, data)
3084
- }
3085
- })
3086
- return val
3087
- }
2833
+ })
2834
+ return val
2835
+ }
3088
2836
 
3089
2837
  var TimerID, ribbon = []
3090
2838
  function W3CFire(el, name, detail) {
@@ -3301,6 +3049,135 @@ duplexBinding.SELECT = function(element, evaluator, data) {
3301
3049
  }
3302
3050
 
3303
3051
 
3052
+ // bindingHandlers.html 定义在if.js
3053
+ bindingExecutors.html = function(val, elem, data) {
3054
+ val = val == null ? "" : val
3055
+ var isHtmlFilter = "group" in data
3056
+ var parent = isHtmlFilter ? elem.parentNode : elem
3057
+ if (!parent)
3058
+ return
3059
+ if (val.nodeType === 11) { //将val转换为文档碎片
3060
+ var fragment = val
3061
+ } else if (val.nodeType === 1 || val.item) {
3062
+ var nodes = val.nodeType === 1 ? val.childNodes : val.item ? val : []
3063
+ fragment = hyperspace.cloneNode(true)
3064
+ while (nodes[0]) {
3065
+ fragment.appendChild(nodes[0])
3066
+ }
3067
+ } else {
3068
+ fragment = avalon.parseHTML(val)
3069
+ }
3070
+ //插入占位符, 如果是过滤器,需要有节制地移除指定的数量,如果是html指令,直接清空
3071
+ var comment = DOC.createComment("ms-html")
3072
+ if (isHtmlFilter) {
3073
+ parent.insertBefore(comment, elem)
3074
+ var n = data.group, i = 1
3075
+ while (i < n) {
3076
+ var node = elem.nextSibling
3077
+ if (node) {
3078
+ parent.removeChild(node)
3079
+ i++
3080
+ }
3081
+ }
3082
+ parent.removeChild(elem)
3083
+ data.element = comment //防止被CG
3084
+ } else {
3085
+ avalon.clearHTML(parent).appendChild(comment)
3086
+ }
3087
+ if (isHtmlFilter) {
3088
+ data.group = fragment.childNodes.length || 1
3089
+ }
3090
+ nodes = avalon.slice(fragment.childNodes)
3091
+ if (nodes[0]) {
3092
+ if (comment.parentNode)
3093
+ comment.parentNode.replaceChild(fragment, comment)
3094
+ if (isHtmlFilter) {
3095
+ data.element = nodes[0]
3096
+ }
3097
+ }
3098
+ scanNodeArray(nodes, data.vmodels)
3099
+ }
3100
+
3101
+ bindingHandlers["if"] =
3102
+ bindingHandlers.data =
3103
+ bindingHandlers.text =
3104
+ bindingHandlers.html =
3105
+ function(data, vmodels) {
3106
+ parseExprProxy(data.value, vmodels, data)
3107
+ }
3108
+
3109
+ bindingExecutors["if"] = function(val, elem, data) {
3110
+ if (val) { //插回DOM树
3111
+ if (elem.nodeType === 8) {
3112
+ elem.parentNode.replaceChild(data.template, elem)
3113
+ elem = data.element = data.template //这时可能为null
3114
+ }
3115
+ if (elem.getAttribute(data.name)) {
3116
+ elem.removeAttribute(data.name)
3117
+ scanAttr(elem, data.vmodels)
3118
+ }
3119
+ data.rollback = null
3120
+ } else { //移出DOM树,并用注释节点占据原位置
3121
+ if (elem.nodeType === 1) {
3122
+ var node = data.element = DOC.createComment("ms-if")
3123
+ elem.parentNode.replaceChild(node, elem)
3124
+ data.template = elem //元素节点
3125
+ ifGroup.appendChild(elem)
3126
+ data.rollback = function() {
3127
+ if (elem.parentNode === ifGroup) {
3128
+ ifGroup.removeChild(elem)
3129
+ }
3130
+ }
3131
+ }
3132
+ }
3133
+ }
3134
+
3135
+
3136
+ //ms-important绑定已经在scanTag 方法中实现
3137
+ //ms-include绑定已由ms-attr绑定实现
3138
+
3139
+ var rdash = /\(([^)]*)\)/
3140
+ bindingHandlers.on = function(data, vmodels) {
3141
+ var value = data.value
3142
+ data.type = "on"
3143
+ var eventType = data.param.replace(/-\d+$/, "") // ms-on-mousemove-10
3144
+ if (typeof bindingHandlers.on[eventType + "Hook"] === "function") {
3145
+ bindingHandlers.on[eventType + "Hook"](data)
3146
+ }
3147
+ if (value.indexOf("(") > 0 && value.indexOf(")") > -1) {
3148
+ var matched = (value.match(rdash) || ["", ""])[1].trim()
3149
+ if (matched === "" || matched === "$event") { // aaa() aaa($event)当成aaa处理
3150
+ value = value.replace(rdash, "")
3151
+ }
3152
+ }
3153
+ parseExprProxy(value, vmodels, data)
3154
+ }
3155
+
3156
+ bindingExecutors.on = function(callback, elem, data) {
3157
+ callback = function(e) {
3158
+ var fn = data.evaluator || noop
3159
+ return fn.apply(this, data.args.concat(e))
3160
+ }
3161
+ var eventType = data.param.replace(/-\d+$/, "") // ms-on-mousemove-10
3162
+ if (eventType === "scan") {
3163
+ callback.call(elem, {
3164
+ type: eventType
3165
+ })
3166
+ } else if (typeof data.specialBind === "function") {
3167
+ data.specialBind(elem, callback)
3168
+ } else {
3169
+ var removeFn = avalon.bind(elem, eventType, callback)
3170
+ }
3171
+ data.rollback = function() {
3172
+ if (typeof data.specialUnbind === "function") {
3173
+ data.specialUnbind()
3174
+ } else {
3175
+ avalon.unbind(elem, eventType, removeFn)
3176
+ }
3177
+ }
3178
+ }
3179
+
3180
+
3304
3181
  bindingHandlers.repeat = function(data, vmodels) {
3305
3182
  var type = data.type
3306
3183
  parseExprProxy(data.value, vmodels, data, 0, 1)
@@ -3373,9 +3250,9 @@ bindingHandlers.repeat = function(data, vmodels) {
3373
3250
  check0 = "$first"
3374
3251
  check1 = "$last"
3375
3252
  }
3376
- for (var i = 0, p; p = vmodels[i++]; ) {
3377
- if (p.hasOwnProperty(check0) && p.hasOwnProperty(check1)) {
3378
- data.$outer = p
3253
+ for (i = 0; v = vmodels[i++]; ) {
3254
+ if (v.hasOwnProperty(check0) && v.hasOwnProperty(check1)) {
3255
+ data.$outer = v
3379
3256
  break
3380
3257
  }
3381
3258
  }
@@ -3405,7 +3282,7 @@ bindingExecutors.repeat = function(method, pos, el) {
3405
3282
  var n = pos + el
3406
3283
  var array = data.$repeat
3407
3284
  var last = array.length - 1
3408
- var fragments = []
3285
+ var fragments = [], fragment
3409
3286
  var start = locateNode(data, pos)
3410
3287
  for (var i = pos; i < n; i++) {
3411
3288
  var proxy = eachProxyAgent(i, data)
@@ -3413,7 +3290,7 @@ bindingExecutors.repeat = function(method, pos, el) {
3413
3290
  shimController(data, transation, proxy, fragments)
3414
3291
  }
3415
3292
  parent.insertBefore(transation, start)
3416
- for (var i = 0, fragment; fragment = fragments[i++]; ) {
3293
+ for (i = 0; fragment = fragments[i++]; ) {
3417
3294
  scanNodeArray(fragment.nodes, fragment.vmodels)
3418
3295
  fragment.nodes = fragment.vmodels = null
3419
3296
  }
@@ -3455,7 +3332,7 @@ bindingExecutors.repeat = function(method, pos, el) {
3455
3332
  parent.insertBefore(transation, end)
3456
3333
  break
3457
3334
  case "index": //将proxies中的第pos个起的所有元素重新索引
3458
- var last = proxies.length - 1
3335
+ last = proxies.length - 1
3459
3336
  for (; el = proxies[pos]; pos++) {
3460
3337
  el.$index = pos
3461
3338
  el.$first = pos === 0
@@ -3463,7 +3340,7 @@ bindingExecutors.repeat = function(method, pos, el) {
3463
3340
  }
3464
3341
  return
3465
3342
  case "set": //将proxies中的第pos个元素的VM设置为el(pos为数字,el任意)
3466
- var proxy = proxies[pos]
3343
+ proxy = proxies[pos]
3467
3344
  if (proxy) {
3468
3345
  notifySubscribers(proxy.$events.$index)
3469
3346
  }
@@ -3471,7 +3348,7 @@ bindingExecutors.repeat = function(method, pos, el) {
3471
3348
  case "append": //将pos的键值对从el中取出(pos为一个普通对象,el为预先生成好的代理VM对象池)
3472
3349
  var pool = el
3473
3350
  var keys = []
3474
- var fragments = []
3351
+ fragments = []
3475
3352
  for (var key in pos) { //得到所有键名
3476
3353
  if (pos.hasOwnProperty(key) && key !== "hasOwnProperty") {
3477
3354
  keys.push(key)
@@ -3483,7 +3360,7 @@ bindingExecutors.repeat = function(method, pos, el) {
3483
3360
  keys = keys2
3484
3361
  }
3485
3362
  }
3486
- for (var i = 0, key; key = keys[i++]; ) {
3363
+ for (i = 0; key = keys[i++]; ) {
3487
3364
  if (key !== "hasOwnProperty") {
3488
3365
  if (!pool[key]) {
3489
3366
  pool[key] = withProxyAgent(key, data)
@@ -3494,7 +3371,7 @@ bindingExecutors.repeat = function(method, pos, el) {
3494
3371
  var comment = data.$stamp = data.clone
3495
3372
  parent.insertBefore(comment, end)
3496
3373
  parent.insertBefore(transation, end)
3497
- for (var i = 0, fragment; fragment = fragments[i++]; ) {
3374
+ for (i = 0; fragment = fragments[i++]; ) {
3498
3375
  scanNodeArray(fragment.nodes, fragment.vmodels)
3499
3376
  fragment.nodes = fragment.vmodels = null
3500
3377
  }
@@ -3661,19 +3538,147 @@ function recycleProxies(proxies, type) {
3661
3538
  proxy.$events[i].length = 0
3662
3539
  }
3663
3540
  }
3664
- proxy.$host = proxy.$outer = {}
3665
- if (proxyPool.unshift(proxy) > kernel.maxRepeatSize) {
3666
- proxyPool.pop()
3541
+ proxy.$host = proxy.$outer = {}
3542
+ if (proxyPool.unshift(proxy) > kernel.maxRepeatSize) {
3543
+ proxyPool.pop()
3544
+ }
3545
+ }
3546
+ })
3547
+ if (type === "each")
3548
+ proxies.length = 0
3549
+ }
3550
+
3551
+
3552
+
3553
+
3554
+ /*********************************************************************
3555
+ * 各种指令 *
3556
+ **********************************************************************/
3557
+ //ms-skip绑定已经在scanTag 方法中实现
3558
+ // bindingHandlers.text 定义在if.js
3559
+ bindingExecutors.text = function(val, elem) {
3560
+ val = val == null ? "" : val //不在页面上显示undefined null
3561
+ if (elem.nodeType === 3) { //绑定在文本节点上
3562
+ try { //IE对游离于DOM树外的节点赋值会报错
3563
+ elem.data = val
3564
+ } catch (e) {
3565
+ }
3566
+ } else { //绑定在特性节点上
3567
+ elem.textContent = val
3568
+ }
3569
+ }
3570
+
3571
+ function parseDisplay(nodeName, val) {
3572
+ //用于取得此类标签的默认display值
3573
+ var key = "_" + nodeName
3574
+ if (!parseDisplay[key]) {
3575
+ var node = DOC.createElement(nodeName)
3576
+ root.appendChild(node)
3577
+ if (W3C) {
3578
+ val = getComputedStyle(node, null).display
3579
+ } else {
3580
+ val = node.currentStyle.display
3581
+ }
3582
+ root.removeChild(node)
3583
+ parseDisplay[key] = val
3584
+ }
3585
+ return parseDisplay[key]
3586
+ }
3587
+
3588
+ avalon.parseDisplay = parseDisplay
3589
+
3590
+ bindingHandlers.visible = function(data, vmodels) {
3591
+ var elem = avalon(data.element)
3592
+ var display = elem.css("display")
3593
+ if (display === "none") {
3594
+ var style = elem[0].style
3595
+ var has = /visibility/i.test(style.cssText)
3596
+ var visible = elem.css("visibility")
3597
+ style.display = ""
3598
+ style.visibility = "hidden"
3599
+ display = elem.css("display")
3600
+ if (display === "none") {
3601
+ display = parseDisplay(elem[0].nodeName)
3602
+ }
3603
+ style.visibility = has ? visible : ""
3604
+ }
3605
+ data.display = display
3606
+ parseExprProxy(data.value, vmodels, data)
3607
+ }
3608
+
3609
+ bindingExecutors.visible = function(val, elem, data) {
3610
+ elem.style.display = val ? data.display : "none"
3611
+ }
3612
+
3613
+ bindingHandlers.widget = function(data, vmodels) {
3614
+ var args = data.value.match(rword)
3615
+ var elem = data.element
3616
+ var widget = args[0]
3617
+ var id = args[1]
3618
+ if (!id || id === "$") {//没有定义或为$时,取组件名+随机数
3619
+ id = generateID(widget)
3620
+ }
3621
+ var optName = args[2] || widget//没有定义,取组件名
3622
+ var constructor = avalon.ui[widget]
3623
+ if (typeof constructor === "function") { //ms-widget="tabs,tabsAAA,optname"
3624
+ vmodels = elem.vmodels || vmodels
3625
+ for (var i = 0, v; v = vmodels[i++]; ) {
3626
+ if (v.hasOwnProperty(optName) && typeof v[optName] === "object") {
3627
+ var vmOptions = v[optName]
3628
+ vmOptions = vmOptions.$model || vmOptions
3629
+ break
3630
+ }
3631
+ }
3632
+ if (vmOptions) {
3633
+ var wid = vmOptions[widget + "Id"]
3634
+ if (typeof wid === "string") {
3635
+ id = wid
3636
+ }
3637
+ }
3638
+ //抽取data-tooltip-text、data-tooltip-attr属性,组成一个配置对象
3639
+ var widgetData = avalon.getWidgetData(elem, widget)
3640
+ data.value = [widget, id, optName].join(",")
3641
+ data[widget + "Id"] = id
3642
+ data.evaluator = noop
3643
+ elem.msData["ms-widget-id"] = id
3644
+ var options = data[widget + "Options"] = avalon.mix({}, constructor.defaults, vmOptions || {}, widgetData)
3645
+ elem.removeAttribute("ms-widget")
3646
+ var vmodel = constructor(elem, data, vmodels) || {} //防止组件不返回VM
3647
+ if (vmodel.$id) {
3648
+ avalon.vmodels[id] = vmodel
3649
+ createSignalTower(elem, vmodel)
3650
+ if (vmodel.hasOwnProperty("$init")) {
3651
+ vmodel.$init(function() {
3652
+ avalon.scan(elem, [vmodel].concat(vmodels))
3653
+ if (typeof options.onInit === "function") {
3654
+ options.onInit.call(elem, vmodel, options, vmodels)
3655
+ }
3656
+ })
3657
+ }
3658
+ data.rollback = function() {
3659
+ try {
3660
+ vmodel.widgetElement = null
3661
+ vmodel.$remove()
3662
+ } catch (e) {
3663
+ }
3664
+ elem.msData = {}
3665
+ delete avalon.vmodels[vmodel.$id]
3666
+ }
3667
+ addSubscribers(data, widgetList)
3668
+ if (window.chrome) {
3669
+ elem.addEventListener("DOMNodeRemovedFromDocument", function() {
3670
+ setTimeout(removeSubscribers)
3671
+ })
3667
3672
  }
3673
+ } else {
3674
+ avalon.scan(elem, vmodels)
3668
3675
  }
3669
- })
3670
- if (type === "each")
3671
- proxies.length = 0
3676
+ } else if (vmodels.length) { //如果该组件还没有加载,那么保存当前的vmodels
3677
+ elem.vmodels = vmodels
3678
+ }
3672
3679
  }
3673
-
3674
-
3675
-
3676
-
3680
+ var widgetList = []
3681
+ //不存在 bindingExecutors.widget
3677
3682
  /*********************************************************************
3678
3683
  * 自带过滤器 *
3679
3684
  **********************************************************************/
@@ -3898,6 +3903,7 @@ new function() {
3898
3903
  Z: timeZoneGetter
3899
3904
  }
3900
3905
  var rdateFormat = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/
3906
+ var raspnetjson = /^\/Date\((\d+)\)\/$/
3901
3907
  filters.date = function(date, format) {
3902
3908
  var locate = filters.date.locate,
3903
3909
  text = "",
@@ -3908,6 +3914,8 @@ new function() {
3908
3914
  if (typeof date === "string") {
3909
3915
  if (/^\d+$/.test(date)) {
3910
3916
  date = toInt(date)
3917
+ } else if (raspnetjson.test(date)) {
3918
+ date = +RegExp.$1
3911
3919
  } else {
3912
3920
  var trimDate = date.trim()
3913
3921
  var dateArray = [0, 0, 0, 0, 0, 0, 0]
@@ -3915,9 +3923,9 @@ new function() {
3915
3923
  //取得年月日
3916
3924
  trimDate = trimDate.replace(/^(\d+)\D(\d+)\D(\d+)/, function(_, a, b, c) {
3917
3925
  var array = c.length === 4 ? [c, a, b] : [a, b, c]
3918
- dateArray[0] = toInt(array[0]) //年
3926
+ dateArray[0] = toInt(array[0]) //年
3919
3927
  dateArray[1] = toInt(array[1]) - 1 //月
3920
- dateArray[2] = toInt(array[2])//日
3928
+ dateArray[2] = toInt(array[2]) //日
3921
3929
  return ""
3922
3930
  })
3923
3931
  var dateSetter = oDate.setFullYear
@@ -3926,10 +3934,9 @@ new function() {
3926
3934
  dateArray[3] = toInt(a) //小时
3927
3935
  dateArray[4] = toInt(b) //分钟
3928
3936
  dateArray[5] = toInt(c) //秒
3929
- if (d) {
3930
- dateArray[6] = Math.round(parseFloat("0." + d) * 1000) //毫秒
3937
+ if (d) { //毫秒
3938
+ dateArray[6] = Math.round(parseFloat("0." + d) * 1000)
3931
3939
  }
3932
- dateArray[6] = d || ""
3933
3940
  return ""
3934
3941
  })
3935
3942
  var tzHour = 0
@@ -4025,45 +4032,164 @@ new function() {
4025
4032
  /*********************************************************************
4026
4033
  * AMD加载器 *
4027
4034
  **********************************************************************/
4028
- //https://www.devbridge.com/articles/understanding-amd-requirejs/
4035
+ //去掉getFullUrl 精简loadJS text!插件 baseUrl插件
4029
4036
  var modules = avalon.modules = {
4030
- "ready!": {
4031
- exports: avalon
4037
+ "domReady!": {
4038
+ exports: avalon,
4039
+ state: 3
4032
4040
  },
4033
4041
  "avalon": {
4034
4042
  exports: avalon,
4035
- state: 2
4043
+ state: 4
4036
4044
  }
4037
4045
  }
4046
+ //Object(modules[id]).state拥有如下值
4047
+ // undefined 没有定义
4048
+ // 1(send) 已经发出请求
4049
+ // 2(loading) 已经被执行但还没有执行完成,在这个阶段define方法会被执行
4050
+ // 3(loaded) 执行完毕,通过onload/onreadystatechange回调判定,在这个阶段checkDeps方法会执行
4051
+ // 4(execute) 其依赖也执行完毕, 值放到exports对象上,在这个阶段fireFactory方法会执行
4038
4052
  modules.exports = modules.avalon
4039
- //http://stackoverflow.com/questions/25175914/bundles-in-requirejs
4040
- //http://maxogden.com/nested-dependencies.html
4053
+
4041
4054
  new function() {
4042
4055
  var loadings = [] //正在加载中的模块列表
4043
- var factorys = [] //储存需要绑定ID与factory对应关系的模块(标准浏览器下,先parse的script节点会先onload)
4044
- //核心API之一 require
4045
- innerRequire = avalon.require = function(array, factory, parentUrl) {
4056
+ var factorys = [] //放置define方法的factory函数
4057
+ var rjsext = /\.js$/i
4058
+ var name2url = {}
4059
+ function makeRequest(name, config) {
4060
+ //1. 去掉资源前缀
4061
+ var res = "js"
4062
+ name = name.replace(/^(\w+)\!/, function(a, b) {
4063
+ res = b
4064
+ return ""
4065
+ })
4066
+ if (res === "ready") {
4067
+ log("debug: ready!已经被废弃,请使用domReady!")
4068
+ res = "domReady"
4069
+ }
4070
+ //2. 去掉querystring, hash
4071
+ var query = ""
4072
+ name = name.replace(rquery, function(a) {
4073
+ query = a
4074
+ return ""
4075
+ })
4076
+ //3. 去掉扩展名
4077
+ var suffix = "." + res
4078
+ var ext = /js|css/.test(suffix) ? suffix : ""
4079
+ name = name.replace(/\.[a-z0-9]+$/g, function(a) {
4080
+ if (a === suffix) {
4081
+ ext = a
4082
+ return ""
4083
+ } else {
4084
+ return a
4085
+ }
4086
+ })
4087
+ var req = avalon.mix({
4088
+ query: query,
4089
+ ext: ext,
4090
+ res: res,
4091
+ name: name,
4092
+ toUrl: toUrl
4093
+ }, config)
4094
+ req.toUrl(name)
4095
+ return req
4096
+ }
4097
+
4098
+ function fireRequest(req) {
4099
+ var name = req.name
4100
+ var res = req.res
4101
+ //1. 如果该模块已经发出请求,直接返回
4102
+ var module = modules[name]
4103
+ var urlNoQuery = name && req.urlNoQuery
4104
+
4105
+ if (module && module.state >= 3) {
4106
+ return name
4107
+ }
4108
+ module = modules[urlNoQuery]
4109
+ if (module && module.state >= 3) {
4110
+ innerRequire(module.deps || [], module.factory, urlNoQuery)
4111
+ return urlNoQuery
4112
+ }
4113
+ if (name && !module) {
4114
+ module = modules[urlNoQuery] = {
4115
+ id: urlNoQuery,
4116
+ state: 1 //send
4117
+ }
4118
+ var wrap = function(obj) {
4119
+ resources[res] = obj
4120
+ obj.load(name, req, function(a) {
4121
+ if (arguments.length && a !== void 0) {
4122
+ module.exports = a
4123
+ }
4124
+ module.state = 4
4125
+ checkDeps()
4126
+ })
4127
+ }
4128
+
4129
+ if (!resources[res]) {
4130
+ innerRequire([res], wrap)
4131
+ } else {
4132
+ wrap(resources[res])
4133
+ }
4134
+ }
4135
+ return name ? urlNoQuery : res + "!"
4136
+ }
4137
+
4138
+
4139
+ //核心API之一 require
4140
+
4141
+ var requireQueue = []
4142
+ var isUserFirstRequire = false
4143
+ innerRequire = avalon.require = function(array, factory, parentUrl, defineConfig) {
4144
+ if (!isUserFirstRequire) {
4145
+ requireQueue.push(avalon.slice(arguments))
4146
+ if (arguments.length <= 2) {
4147
+ isUserFirstRequire = true
4148
+ var queue = requireQueue.splice(0, requireQueue.length), args
4149
+ while (args = queue.shift()) {
4150
+ innerRequire.apply(null, args)
4151
+ }
4152
+ }
4153
+ return
4154
+ }
4155
+
4046
4156
  if (!Array.isArray(array)) {
4047
- avalon.error("require的第一个参数必须是依赖列数,类型为数组 " + array)
4157
+ avalon.error("require方法的第一个参数应为数组 " + array)
4048
4158
  }
4049
- var args = [] // 放置所有依赖项的完整路径
4050
- var deps = {} // args的另一种表现形式,为的是方便去重
4159
+ var deps = [] // 放置所有依赖项的完整路径
4160
+ var uniq = {}
4051
4161
  var id = parentUrl || "callback" + setTimeout("1")
4052
- var mapUrl = parentUrl && parentUrl.replace(/\.js$/i, "")
4053
- parentUrl = getBaseUrl(parentUrl)
4054
-
4055
- array.forEach(function(el) {
4056
- var url = loadResources(el, parentUrl, mapUrl) //加载资源,并返回.能加载资源的完整路径
4057
- if (url) {
4058
- if (!deps[url]) {
4059
- args.push(url)
4060
- deps[url] = "司徒正美" //去重
4162
+ defineConfig = defineConfig || {}
4163
+ defineConfig.baseUrl = kernel.baseUrl
4164
+ var isBuilt = !!defineConfig.built
4165
+ if (parentUrl) {
4166
+ defineConfig.parentUrl = parentUrl.substr(0, parentUrl.lastIndexOf("/"))
4167
+ defineConfig.mapUrl = parentUrl.replace(rjsext, "")
4168
+ }
4169
+ if (isBuilt) {
4170
+ var req = makeRequest(defineConfig.name, defineConfig)
4171
+ id = req.urlNoQuery
4172
+ } else {
4173
+ array.forEach(function(name) {
4174
+ var req = makeRequest(name, defineConfig)
4175
+ var url = fireRequest(req) //加载资源,并返回该资源的完整地址
4176
+ if (url) {
4177
+ if (!uniq[url]) {
4178
+ deps.push(url)
4179
+ uniq[url] = "司徒正美" //去重
4180
+ }
4061
4181
  }
4062
- }
4063
- })
4182
+ })
4183
+ }
4184
+
4064
4185
  var module = modules[id]
4065
- if (!module || module.state !== 2) {
4066
- modules[id] = makeModule(id, 1, factory, deps, args)//更新此模块信息
4186
+ if (!module || module.state !== 4) {
4187
+ modules[id] = {
4188
+ id: id,
4189
+ deps: isBuilt ? array.concat() : deps,
4190
+ factory: factory || noop,
4191
+ state: 3
4192
+ }
4067
4193
  }
4068
4194
  if (!module) {
4069
4195
  //如果此模块是定义在另一个JS文件中, 那必须等该文件加载完毕, 才能放到检测列队中
@@ -4071,52 +4197,63 @@ new function() {
4071
4197
  }
4072
4198
  checkDeps()
4073
4199
  }
4074
- //核心API之二 require
4075
- innerRequire.define = function(urlOrId, deps, factory) { //模块名,依赖列表,模块本身
4076
- var args = aslice.call(arguments)
4077
- if (typeof urlOrId === "string") {
4078
- var id = args.shift()
4200
+
4201
+ //核心API之二 require
4202
+ innerRequire.define = function(name, deps, factory) { //模块名,依赖列表,模块本身
4203
+ if (typeof name !== "string") {
4204
+ factory = deps
4205
+ deps = name
4206
+ name = "anonymous"
4079
4207
  }
4080
- if (typeof args[0] === "function") {
4081
- args.unshift([])
4208
+ if (!Array.isArray(deps)) {
4209
+ factory = deps
4210
+ deps = []
4082
4211
  }
4083
- //上线合并后能直接得到模块ID,否则寻找当前正在解析中的script节点的src作为模块ID
4084
- //现在除了safari5,1-外,我们都能直接通过getCurrentScript一步到位得到当前执行的script节点,
4085
- //safari可通过onload+ factory.require闭包组合解决
4086
- var url = modules[id] && modules[id].state >= 1 ? id : trimQuery(getCurrentScript())
4087
- factory = args[1]
4088
- factory.id = id //用于调试
4089
-
4090
- if (!modules[url] && id) {
4091
- //必须先行定义,并且不存在deps,用于checkCycle方法
4092
- modules[url] = makeModule(url, 1, factory)
4212
+ var config = {
4213
+ built: !isUserFirstRequire, //用r.js打包后,所有define会放到requirejs之前
4214
+ name: name
4093
4215
  }
4094
-
4216
+ var args = [deps, factory, config]
4095
4217
  factory.require = function(url) {
4096
- args.push(url)
4097
- var isCycle = true
4098
- try {
4099
- isCycle = checkCycle(modules[url].deps, url)
4100
- } catch (e) {
4101
- }
4102
- if (isCycle) {
4103
- avalon.error(url + "模块与之前的模块存在循环依赖,请不要直接用script标签引入" + url + "模块")
4218
+ args.splice(2, 0, url)
4219
+ if (modules[url]) {
4220
+ modules[url].state = 3 //loaded
4221
+ var isCycle = false
4222
+ try {
4223
+ isCycle = checkCycle(modules[url].deps, url)
4224
+ } catch (e) {
4225
+ }
4226
+ if (isCycle) {
4227
+ avalon.error(url + "模块与之前的模块存在循环依赖,请不要直接用script标签引入" + url + "模块")
4228
+ }
4104
4229
  }
4105
4230
  delete factory.require //释放内存
4106
4231
  innerRequire.apply(null, args) //0,1,2 --> 1,2,0
4107
4232
  }
4233
+ //根据标准,所有遵循W3C标准的浏览器,script标签会按标签的出现顺序执行。
4234
+ //老的浏览器中,加载也是按顺序的:一个文件下载完成后,才开始下载下一个文件。
4235
+ //较新的浏览器中(IE8+ 、FireFox3.5+ 、Chrome4+ 、Safari4+),为了减小请求时间以优化体验,
4236
+ //下载可以是并行的,但是执行顺序还是按照标签出现的顺序。
4237
+ //但如果script标签是动态插入的, 就未必按照先请求先执行的原则了,目测只有firefox遵守
4238
+ //唯一比较一致的是,IE10+及其他标准浏览器,一旦开始解析脚本, 就会一直堵在那里,直接脚本解析完毕
4239
+ //亦即,先进入loading阶段的script标签(模块)必然会先进入loaded阶段
4240
+ var url = config.built ? "unknown" : getCurrentScript()
4108
4241
  if (url) {
4242
+ var module = modules[url]
4243
+ if (module) {
4244
+ module.state = 2
4245
+ }
4109
4246
  factory.require(url)
4110
- } else { //先进先出
4247
+ } else {//合并前后的safari,合并后的IE6-9走此分支
4111
4248
  factorys.push(factory)
4112
4249
  }
4113
4250
  }
4114
- //核心API之三 require.config(settings)
4251
+ //核心API之三 require.config(settings)
4115
4252
  innerRequire.config = kernel
4116
- //核心API之四 define.amd 标识其符合AMD规范
4253
+ //核心API之四 define.amd 标识其符合AMD规范
4117
4254
  innerRequire.define.amd = modules
4118
4255
 
4119
- //==========================对用户配置项进行再加工==========================
4256
+ //==========================对用户配置项进行再加工==========================
4120
4257
  var allpaths = kernel["orig.paths"] = {}
4121
4258
  var allmaps = kernel["orig.map"] = {}
4122
4259
  var allpackages = kernel["packages"] = []
@@ -4139,11 +4276,11 @@ new function() {
4139
4276
  var uniq = {}
4140
4277
  var ret = []
4141
4278
  for (var i = 0, pkg; pkg = array[i++]; ) {
4142
- var pkg = typeof pkg === "string" ? {name: pkg} : pkg
4279
+ pkg = typeof pkg === "string" ? {name: pkg} : pkg
4143
4280
  var name = pkg.name
4144
4281
  if (!uniq[name]) {
4145
4282
  var url = pkg.location ? pkg.location : joinPath(name, pkg.main || "main")
4146
- url = url.replace(/\.js$/i, "")
4283
+ url = url.replace(rjsext, "")
4147
4284
  ret.push(pkg)
4148
4285
  uniq[name] = pkg.location = url
4149
4286
  pkg.reg = makeMatcher(name)
@@ -4160,18 +4297,19 @@ new function() {
4160
4297
  },
4161
4298
  baseUrl: function(url) {
4162
4299
  if (!isAbsUrl(url)) {
4163
- var baseElement = head.getElementsByTagName("base")[0]
4300
+ var baseElement = head.querySelector("base")
4164
4301
  if (baseElement) {
4165
4302
  head.removeChild(baseElement)
4166
4303
  }
4167
4304
  var node = DOC.createElement("a")
4168
4305
  node.href = url
4169
- url = "1"[0] ? node.href : node.getAttribute("href", 4)
4306
+ url = node.href
4170
4307
  if (baseElement) {
4171
4308
  head.insertBefore(baseElement, head.firstChild)
4172
4309
  }
4173
4310
  }
4174
- kernel.baseUrl = url
4311
+ if (url.length > 3)
4312
+ kernel.baseUrl = url
4175
4313
  },
4176
4314
  shim: function(obj) {
4177
4315
  for (var i in obj) {
@@ -4182,85 +4320,30 @@ new function() {
4182
4320
  }
4183
4321
  }
4184
4322
  if (!value.exportsFn && (value.exports || value.init)) {
4185
- value.exportsFn = makeShimExports(value)
4323
+ value.exportsFn = makeExports(value)
4186
4324
  }
4187
4325
  }
4188
4326
  kernel.shim = obj
4189
- },
4190
- //三大常用资源插件 js!, css!, text!
4191
- js: function(url, shim) {
4192
- var id = trimQuery(url)
4193
- if (!modules[id]) { //如果之前没有加载过
4194
- var module = modules[id] = makeModule(id)
4195
- if (shim) { //shim机制
4196
- innerRequire(shim.deps || [], function() {
4197
- var args = avalon.slice(arguments)
4198
- loadJS(url, id, function() {
4199
- module.state = 2
4200
- if (shim.exportsFn) {
4201
- module.exports = shim.exportsFn.apply(0, args)
4202
- }
4203
- innerRequire.checkDeps()
4204
- })
4205
- })
4206
- } else {
4207
- loadJS(url, id)
4208
- }
4209
- }
4210
- return id
4211
- },
4212
- css: function(url) {
4213
- var id = trimQuery(url)
4214
- if (!DOC.getElementById(id)) {
4215
- var node = DOC.createElement("link")
4216
- node.rel = "stylesheet"
4217
- node.href = url
4218
- node.id = id
4219
- head.insertBefore(node, head.firstChild)
4220
- }
4221
- },
4222
- text: function(url) {
4223
- var id = trimQuery(url)
4224
- modules[id] = {}
4225
- var xhr = getXHR()
4226
- xhr.onreadystatechange = function() {
4227
- if (xhr.readyState === 4) {
4228
- var status = xhr.status;
4229
- if (status > 399 && status < 600) {
4230
- avalon.error(url + " 对应资源不存在或没有开启 CORS")
4231
- } else {
4232
- modules[id].state = 2
4233
- modules[id].exports = xhr.responseText
4234
- innerRequire.checkDeps()
4235
- }
4236
- }
4237
- }
4238
- xhr.open("GET", url, true)
4239
- if ("withCredentials" in xhr) {
4240
- xhr.withCredentials = true
4241
- }
4242
- xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest")
4243
- xhr.send()
4244
- return id
4245
4327
  }
4328
+
4246
4329
  })
4247
4330
 
4248
- plugins.css.ext = ".css"
4249
- plugins.js.ext = ".js"
4250
- //==============================内部方法=================================
4331
+
4332
+ //==============================内部方法=================================
4251
4333
  function checkCycle(deps, nick) {
4252
4334
  //检测是否存在循环依赖
4253
- for (var id in deps) {
4254
- if (deps[id] === "司徒正美" && modules[id].state !== 2 && (id === nick || checkCycle(modules[id].deps, nick))) {
4335
+ for (var i = 0, id; id = deps[i++]; ) {
4336
+ if (modules[id].state !== 4 &&
4337
+ (id === nick || checkCycle(modules[id].deps, nick))) {
4255
4338
  return true
4256
4339
  }
4257
4340
  }
4258
4341
  }
4259
4342
 
4260
- function checkFail(node, onError, fuckIE) {
4343
+ function checkFail(node, onError) {
4261
4344
  var id = trimQuery(node.src) //检测是否死链
4262
- node.onload = node.onreadystatechange = node.onerror = null
4263
- if (onError || (fuckIE && !modules[id].state)) {
4345
+ node.onload = node.onerror = null
4346
+ if (onError) {
4264
4347
  setTimeout(function() {
4265
4348
  head.removeChild(node)
4266
4349
  node = null // 处理旧式IE下的循环引用问题
@@ -4276,19 +4359,103 @@ new function() {
4276
4359
  loop: for (var i = loadings.length, id; id = loadings[--i]; ) {
4277
4360
  var obj = modules[id],
4278
4361
  deps = obj.deps
4279
- for (var key in deps) {
4280
- if (ohasOwn.call(deps, key) && modules[key].state !== 2) {
4362
+ if (!deps)
4363
+ continue
4364
+ for (var j = 0, key; key = deps[j]; j++) {
4365
+ var k = name2url[key]
4366
+ if (k) {
4367
+ key = deps[j] = k
4368
+ }
4369
+ if (Object(modules[key]).state !== 4) {
4281
4370
  continue loop
4282
4371
  }
4283
4372
  }
4284
4373
  //如果deps是空对象或者其依赖的模块的状态都是2
4285
- if (obj.state !== 2) {
4374
+ if (obj.state !== 4) {
4286
4375
  loadings.splice(i, 1) //必须先移除再安装,防止在IE下DOM树建完后手动刷新页面,会多次执行它
4287
- fireFactory(obj.id, obj.args, obj.factory)
4376
+ fireFactory(obj.id, obj.deps, obj.factory)
4288
4377
  checkDeps() //如果成功,则再执行一次,以防有些模块就差本模块没有安装好
4289
4378
  }
4290
4379
  }
4291
4380
  }
4381
+ function loadJS(url, id, callback) {
4382
+ //通过script节点加载目标模块
4383
+ var node = DOC.createElement("script")
4384
+ node.className = subscribers //让getCurrentScript只处理类名为subscribers的script节点
4385
+ node.onload = function() {
4386
+ var factory = factorys.pop()
4387
+ factory && factory.require(id)
4388
+ if (callback) {
4389
+ callback()
4390
+ }
4391
+ log("debug: 已成功加载 " + url)
4392
+ id && loadings.push(id)
4393
+ checkDeps()
4394
+ }
4395
+ node.onerror = function() {
4396
+ checkFail(node, true)
4397
+ }
4398
+
4399
+ head.appendChild(node) //chrome下第二个参数不能为null
4400
+ node.src = url //插入到head的第一个节点前,防止IE6下head标签没闭合前使用appendChild抛错
4401
+ log("debug: 正准备加载 " + url) //更重要的是IE6下可以收窄getCurrentScript的寻找范围
4402
+ }
4403
+
4404
+ var resources = innerRequire.plugins = {
4405
+ //三大常用资源插件 js!, css!, text!, ready!
4406
+ ready: {
4407
+ load: noop
4408
+ },
4409
+ js: {
4410
+ load: function(name, req, onLoad) {
4411
+ var url = req.url
4412
+ var id = req.urlNoQuery
4413
+ var shim = kernel.shim[name.replace(rjsext, "")]
4414
+ if (shim) { //shim机制
4415
+ innerRequire(shim.deps || [], function() {
4416
+ var args = avalon.slice(arguments)
4417
+ loadJS(url, id, function() {
4418
+ onLoad(shim.exportsFn ? shim.exportsFn.apply(0, args) : void 0)
4419
+ })
4420
+ })
4421
+ } else {
4422
+ loadJS(url, id)
4423
+ }
4424
+ }
4425
+ },
4426
+ css: {
4427
+ load: function(name, req, onLoad) {
4428
+ var url = req.url
4429
+ var node = DOC.createElement("link")
4430
+ node.rel = "stylesheet"
4431
+ node.href = url
4432
+ head.appendChild(node)
4433
+ log("debug: 已成功加载 " + url)
4434
+ onLoad()
4435
+ }
4436
+ },
4437
+ text: {
4438
+ load: function(name, req, onLoad) {
4439
+ var url = req.url
4440
+ var xhr = getXHR()
4441
+ xhr.onload = function() {
4442
+ var status = xhr.status;
4443
+ if (status > 399 && status < 600) {
4444
+ avalon.error(url + " 对应资源不存在或没有开启 CORS")
4445
+ } else {
4446
+ onLoad(xhr.responseText)
4447
+ }
4448
+ }
4449
+ xhr.open("GET", url, true)
4450
+ if ("withCredentials" in xhr) {//这是处理跨域
4451
+ xhr.withCredentials = true
4452
+ }
4453
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest")//告诉后端这是AJAX请求
4454
+ xhr.send()
4455
+ log("debug: 正准备加载 " + url)
4456
+ }
4457
+ }
4458
+ }
4292
4459
  innerRequire.checkDeps = checkDeps
4293
4460
 
4294
4461
  var rquery = /(\?[^#]*)$/
@@ -4301,24 +4468,13 @@ new function() {
4301
4468
  return /^(?:[a-z]+:)?\/\//i.test(String(path))
4302
4469
  }
4303
4470
 
4304
- function getBaseUrl(parentUrl) {
4305
- return parentUrl ?
4306
- parentUrl.substr(0, parentUrl.lastIndexOf("/")) :
4307
- kernel.baseUrl ? kernel.baseUrl :
4308
- kernel.loaderUrl
4309
- }
4310
-
4311
- function getCurrentScript(base) {
4471
+ function getCurrentScript() {
4312
4472
  // inspireb by https://github.com/samyk/jiagra/blob/master/jiagra.js
4313
4473
  var stack
4314
4474
  try {
4315
4475
  a.b.c() //强制报错,以便捕获e.stack
4316
- } catch (e) { //safari的错误对象只有line,sourceId,sourceURL
4476
+ } catch (e) { //safari5的sourceURL,firefox的fileName,它们的效果与e.stack不一样
4317
4477
  stack = e.stack
4318
- if (!stack && window.opera) {
4319
- //opera 9没有e.stack,但有e.Backtrace,但不能直接取得,需要对e对象转字符串进行抽取
4320
- stack = (String(e).match(/of linked script \S+/g) || []).join(" ")
4321
- }
4322
4478
  }
4323
4479
  if (stack) {
4324
4480
  /**e.stack最后一行在所有支持的浏览器大致如下:
@@ -4334,116 +4490,83 @@ new function() {
4334
4490
  */
4335
4491
  stack = stack.split(/[@ ]/g).pop() //取得最后一行,最后一个空格或@之后的部分
4336
4492
  stack = stack[0] === "(" ? stack.slice(1, -1) : stack.replace(/\s/, "") //去掉换行符
4337
- return stack.replace(/(:\d+)?:\d+$/i, "") //去掉行号与或许存在的出错字符起始位置
4493
+ return trimQuery(stack.replace(/(:\d+)?:\d+$/i, "")) //去掉行号与或许存在的出错字符起始位置
4338
4494
  }
4339
- var nodes = (base ? DOC : head).getElementsByTagName("script") //只在head标签中寻找
4495
+ var nodes = head.getElementsByTagName("script") //只在head标签中寻找
4340
4496
  for (var i = nodes.length, node; node = nodes[--i]; ) {
4341
- if ((base || node.className === subscribers) && node.readyState === "interactive") {
4342
- var url = "1"[0] ? node.src : node.getAttribute("src", 4)
4343
- return node.className = url
4497
+ if (node.className === subscribers && node.readyState === "interactive") {
4498
+ var url = node.src
4499
+ return node.className = trimQuery(url)
4344
4500
  }
4345
4501
  }
4346
4502
  }
4347
4503
 
4348
- function loadResources(url, parentUrl, mapUrl) {
4349
- //1. 特别处理ready标识符及已经加载好的模块
4350
- if (url === "ready!" || (modules[url] && modules[url].state === 2)) {
4351
- return url
4504
+
4505
+ function fireFactory(id, deps, factory) {
4506
+ var module = Object(modules[id])
4507
+ module.state = 4
4508
+ for (var i = 0, array = [], d; d = deps[i++]; ) {
4509
+ d = name2url[d] || d
4510
+ if (d === "exports") {
4511
+ var obj = module.exports || (module.exports = {})
4512
+ array.push(obj)
4513
+ } else {
4514
+ array.push(modules[d].exports)
4515
+ }
4352
4516
  }
4353
- //2. 获取模块ID(去掉资源前缀,扩展名 hash, query)
4354
- var res = "js"
4355
- url = url.replace(/^(\w+)\!/, function(a, b) {
4356
- res = b
4357
- return ""
4358
- })
4359
- var plugin = plugins[res] || noop
4360
- var query = ""
4361
- var id = url.replace(rquery, function(a) {
4362
- query = a
4363
- return ""
4364
- })
4365
- var ext = ""
4366
- if (res === "js") {
4367
- url = id = id.replace(/\.js$/i, "")
4368
- ext = ".js"
4517
+ var ret = factory.apply(window, array)
4518
+ if (ret !== void 0) {
4519
+ module.exports = ret
4520
+ }
4521
+ delete module.factory
4522
+ return ret
4523
+ }
4524
+ function toUrl(id) {
4525
+ if (id.indexOf(this.res + "!") === 0) {
4526
+ id = id.slice(this.res.length + 1) //处理define("css!style",[], function(){})的情况
4369
4527
  }
4370
- //3. 是否命中paths配置项
4528
+ var url = id
4529
+ //1. 是否命中paths配置项
4371
4530
  var usePath = 0
4531
+ var baseUrl = this.baseUrl
4532
+ var rootUrl = this.parentUrl || baseUrl
4372
4533
  eachIndexArray(id, kernel.paths, function(value, key) {
4373
4534
  url = url.replace(key, value)
4374
4535
  usePath = 1
4375
4536
  })
4376
- //4. 是否命中packages配置项
4537
+ //2. 是否命中packages配置项
4377
4538
  if (!usePath) {
4378
4539
  eachIndexArray(id, kernel.packages, function(value, key, item) {
4379
4540
  url = url.replace(item.name, item.location)
4380
4541
  })
4381
4542
  }
4382
- //5. 是否命中map配置项
4383
- if (mapUrl) {
4384
- eachIndexArray(mapUrl, kernel.map, function(array) {
4543
+ //3. 是否命中map配置项
4544
+ if (this.mapUrl) {
4545
+ eachIndexArray(this.mapUrl, kernel.map, function(array) {
4385
4546
  eachIndexArray(url, array, function(mdValue, mdKey) {
4386
4547
  url = url.replace(mdKey, mdValue)
4548
+ rootUrl = baseUrl
4387
4549
  })
4388
4550
  })
4389
4551
  }
4390
- //6. 转换为绝对路径
4552
+ var ext = this.ext
4553
+ if (ext && usePath && url.slice(-ext.length) === ext) {
4554
+ url = url.slice(0, -ext.length)
4555
+ }
4556
+ //4. 转换为绝对路径
4391
4557
  if (!isAbsUrl(url)) {
4392
- url = joinPath(/\w/.test(url.charAt(0)) ? getBaseUrl() : parentUrl, url)
4558
+ rootUrl = this.built || /^\w/.test(url) ? baseUrl : rootUrl
4559
+ url = joinPath(rootUrl, url)
4393
4560
  }
4394
- //7. 还原扩展名,query
4395
- url += ext + query
4396
- //8. 处理urlArgs
4561
+ //5. 还原扩展名,query
4562
+ var urlNoQuery = url + ext
4563
+ url = urlNoQuery + this.query
4564
+ //6. 处理urlArgs
4397
4565
  eachIndexArray(id, kernel.urlArgs, function(value) {
4398
4566
  url += (url.indexOf("?") === -1 ? "?" : "&") + value;
4399
4567
  })
4400
- return plugin(url, kernel.shim[id])
4401
- }
4402
-
4403
- function loadJS(url, id, callback) {
4404
- //通过script节点加载目标模块
4405
- var node = DOC.createElement("script")
4406
- node.className = subscribers //让getCurrentScript只处理类名为subscribers的script节点
4407
- node[W3C ? "onload" : "onreadystatechange"] = function() {
4408
- if (W3C || /loaded|complete/i.test(node.readyState)) {
4409
- //mass Framework会在_checkFail把它上面的回调清掉,尽可能释放回存,尽管DOM0事件写法在IE6下GC无望
4410
- var factory = factorys.pop()
4411
-
4412
- factory && factory.require(id)
4413
- if (callback) {
4414
- callback()
4415
- }
4416
- if (checkFail(node, false, !W3C)) {
4417
- log("debug: 已成功加载 " + url)
4418
- loadings.push(id)
4419
- checkDeps()
4420
- }
4421
- }
4422
- }
4423
- node.onerror = function() {
4424
- checkFail(node, true)
4425
- }
4426
- node.src = url //插入到head的第一个节点前,防止IE6下head标签没闭合前使用appendChild抛错
4427
- head.insertBefore(node, head.firstChild) //chrome下第二个参数不能为null
4428
- log("debug: 正准备加载 " + url) //更重要的是IE6下可以收窄getCurrentScript的寻找范围
4429
- }
4430
-
4431
- function fireFactory(id, deps, factory) {
4432
- var module = Object(modules[id])
4433
- module.state = 2
4434
- for (var i = 0, array = [], d; d = deps[i++]; ) {
4435
- if (d === "exports") {
4436
- var obj = module.exports || (module.exports = {})
4437
- array.push(obj)
4438
- } else {
4439
- array.push(modules[d].exports)
4440
- }
4441
- }
4442
- var ret = factory.apply(window, array)
4443
- if (ret !== void 0) {
4444
- modules[id].exports = ret
4445
- }
4446
- return ret
4568
+ this.url = url
4569
+ return this.urlNoQuery = urlNoQuery
4447
4570
  }
4448
4571
 
4449
4572
  function makeIndexArray(hash, useStar, part) {
@@ -4457,7 +4580,7 @@ new function() {
4457
4580
  return new RegExp('^' + prefix + '(/|$)')
4458
4581
  }
4459
4582
 
4460
- function makeShimExports(value) {
4583
+ function makeExports(value) {
4461
4584
  return function() {
4462
4585
  var ret
4463
4586
  if (value.init) {
@@ -4467,15 +4590,6 @@ new function() {
4467
4590
  }
4468
4591
  }
4469
4592
 
4470
- function makeModule(id, state, factory, deps, args) {
4471
- return {
4472
- id: id,
4473
- state: state || 1,
4474
- factory: factory || noop,
4475
- deps: deps || {},
4476
- args: args || []
4477
- }
4478
- }
4479
4593
 
4480
4594
  function hash2array(hash, useStar, part) {
4481
4595
  var array = [];
@@ -4486,9 +4600,7 @@ new function() {
4486
4600
  val: hash[key]
4487
4601
  }
4488
4602
  array.push(item)
4489
- item.reg = key === "*" && useStar
4490
- ? /^/
4491
- : makeMatcher(key)
4603
+ item.reg = key === "*" && useStar ? /^/ : makeMatcher(key)
4492
4604
  if (part && key !== "*") {
4493
4605
  item.reg = new RegExp('\/' + key.replace(/^\//, "") + '(/|$)')
4494
4606
  }
@@ -4506,7 +4618,7 @@ new function() {
4506
4618
  }
4507
4619
  }
4508
4620
  }
4509
- // 根据元素的name项进行数组字符数逆序的排序函数
4621
+ // 根据元素的name项进行数组字符数逆序的排序函数
4510
4622
  function descSorterByName(a, b) {
4511
4623
  var aaa = a.name
4512
4624
  var bbb = b.name
@@ -4551,14 +4663,17 @@ new function() {
4551
4663
  return g
4552
4664
  }
4553
4665
 
4554
-
4555
- var cur = getCurrentScript(true) //求得当前avalon.js 所在的JS文件的路径
4556
- if (!cur) { //处理window safari的Error没有stack的问题
4557
- cur = DOC.scripts[DOC.scripts.length - 1].src
4666
+ var mainNode = DOC.scripts[DOC.scripts.length - 1]
4667
+ var dataMain = mainNode.getAttribute("data-main")
4668
+ if (dataMain) {
4669
+ plugins.baseUrl(dataMain)
4670
+ var href = kernel.baseUrl
4671
+ kernel.baseUrl = href.slice(0, href.lastIndexOf("/") + 1)
4672
+ loadJS(href.replace(rjsext, "") + ".js")
4673
+ } else {
4674
+ var loaderUrl = trimQuery(mainNode.src)
4675
+ kernel.baseUrl = loaderUrl.slice(0, loaderUrl.lastIndexOf("/") + 1)
4558
4676
  }
4559
- var url = trimQuery(cur)
4560
- kernel.loaderUrl = url.slice(0, url.lastIndexOf("/") + 1)
4561
-
4562
4677
  }
4563
4678
 
4564
4679
  /*********************************************************************
@@ -4567,13 +4682,12 @@ new function() {
4567
4682
  var readyList = []
4568
4683
  function fireReady() {
4569
4684
  if (innerRequire) {
4570
- modules["ready!"].state = 2
4685
+ modules["domReady!"].state = 4
4571
4686
  innerRequire.checkDeps()//隋性函数,防止IE9二次调用_checkDeps
4572
- } else {
4573
- readyList.forEach(function(a) {
4574
- a(avalon)
4575
- })
4576
4687
  }
4688
+ readyList.forEach(function(a) {
4689
+ a(avalon)
4690
+ })
4577
4691
  fireReady = noop //隋性函数,防止IE9二次调用_checkDeps
4578
4692
  }
4579
4693
 
@@ -4584,9 +4698,7 @@ if (DOC.readyState === "complete") {
4584
4698
  window.addEventListener("load", fireReady)
4585
4699
  }
4586
4700
  avalon.ready = function(fn) {
4587
- if (innerRequire) {
4588
- innerRequire(["ready!"], fn)
4589
- } else if (fireReady === noop) {
4701
+ if (fireReady === noop) {
4590
4702
  fn(avalon)
4591
4703
  } else {
4592
4704
  readyList.push(fn)
@@ -4602,7 +4714,7 @@ new function() {
4602
4714
  var ua = navigator.userAgent
4603
4715
  var isAndroid = ua.indexOf("Android") > 0
4604
4716
  var isIOS = /iP(ad|hone|od)/.test(ua)
4605
- var self = bindingHandlers.on
4717
+ var me = bindingHandlers.on
4606
4718
  var touchProxy = {}
4607
4719
 
4608
4720
  var IE11touch = navigator.pointerEnabled
@@ -4616,7 +4728,7 @@ new function() {
4616
4728
  supported = true
4617
4729
  }
4618
4730
  var e = document.createEvent("TouchEvent")
4619
- e.initTouchEvent("touchstart", true, true)
4731
+ e.initUIEvent("touchstart", true, true)
4620
4732
  div.dispatchEvent(e)
4621
4733
  } catch (err) {
4622
4734
  }
@@ -4633,7 +4745,50 @@ new function() {
4633
4745
  } else if (IE9_10touch) {
4634
4746
  touchNames = ["MSPointerDown", "MSPointerMove", "MSPointerUp", "MSPointerCancel"]
4635
4747
  }
4636
-
4748
+ var clickbuster = {
4749
+ underFrame: null,
4750
+ coordinates: [],
4751
+ addUnderFrame: function(event) {
4752
+ var underFrame = null
4753
+ if(!clickbuster.underFrame) {
4754
+ underFrame = document.createElement('div');
4755
+ underFrame.style.cssText = [
4756
+ "opacity: 0",
4757
+ "display: none;",
4758
+ "border-radius: 60px;",
4759
+ "position: absolute;",
4760
+ "z-index: 99999;",
4761
+ "width: 60px;",
4762
+ "height: 60px"
4763
+ ].join("");
4764
+ document.body.appendChild(underFrame)
4765
+ }
4766
+ clickbuster.underFrame = underFrame
4767
+ underFrame.style.top = (event.changedTouches[0].clientY - 30) + "px"
4768
+ underFrame.style.left = (event.changedTouches[0].clientX - 30) + "px"
4769
+ underFrame.style.display = "block"
4770
+ setTimeout(function(){
4771
+ underFrame.style.display = "none"
4772
+ }, 360)
4773
+ },
4774
+ preventGhostClick: function(x, y) {
4775
+ clickbuster.coordinates.push(x, y);
4776
+ window.setTimeout(clickbuster.pop, 2500)
4777
+ },
4778
+ pop: function() {
4779
+ clickbuster.coordinates.splice(0, 2)
4780
+ },
4781
+ onClick: function(event) {
4782
+ for (var i = 0; i < clickbuster.coordinates.length; i += 2) {
4783
+ var x = clickbuster.coordinates[i]
4784
+ var y = clickbuster.coordinates[i + 1]
4785
+ if (Math.abs(event.clientX - x) < 25 && Math.abs(event.clientY - y) < 25) {
4786
+ event.stopPropagation();
4787
+ event.preventDefault();
4788
+ }
4789
+ }
4790
+ }
4791
+ }
4637
4792
 
4638
4793
  if (touchSupported) {
4639
4794
  //我们经由ms-click, ms-on-tap绑定事件, 其实没有直接绑在元素,全部放到一个数组中
@@ -4647,7 +4802,7 @@ new function() {
4647
4802
  var fns = el[listName] || (el[listName] = [])
4648
4803
  if (!el["msdispatch"]) {
4649
4804
  el["msdispatch"] = function(event) {
4650
- if (event.fireByAvalon) {
4805
+ if (event.fireByAvalon) {
4651
4806
  for (var i = 0, fn; fn = fns[i++]; ) {
4652
4807
  fn.call(el, event)
4653
4808
  }
@@ -4667,7 +4822,6 @@ new function() {
4667
4822
  })
4668
4823
  }
4669
4824
 
4670
- var touchProxy = {}
4671
4825
  //判定滑动方向
4672
4826
  function swipeDirection(x1, x2, y1, y2) {
4673
4827
  return Math.abs(x1 - x2) >=
@@ -4682,22 +4836,16 @@ new function() {
4682
4836
  }
4683
4837
  }
4684
4838
 
4685
- function touchend(event) {
4839
+ function touchend(event) {
4686
4840
  var element = touchProxy.element
4687
- if (!element)
4841
+ if (!element)
4688
4842
  return
4689
4843
  var e = getCoordinates(event)
4690
4844
  var diff = Date.now() - touchProxy.startTime //经过时间
4691
4845
  var totalX = Math.abs(touchProxy.x - e.x)
4692
4846
  var totalY = Math.abs(touchProxy.y - e.y)
4693
-
4694
- var canDoubleClick = false
4695
- if (touchProxy.doubleIndex === 2) {//如果已经点了两次,就可以触发dblclick 回调
4696
- touchProxy.doubleIndex = 0
4697
- canDoubleClick = true
4698
- if (avalon.config.stopZoom) {
4699
- event.preventDefault()
4700
- }
4847
+ if (touchProxy.doubleIndex === 2 && avalon.config.stopZoom) {//如果已经点了两次,就可以触发dblclick 回调
4848
+ event.preventDefault()
4701
4849
  }
4702
4850
  if (totalX > 30 || totalY > 30) {
4703
4851
  //如果用户滑动的距离有点大,就认为是swipe事件
@@ -4732,22 +4880,31 @@ new function() {
4732
4880
  avalon.fastclick.fireEvent(forElement, "click", event)
4733
4881
  W3CFire(element, "tap")//触发tap事件
4734
4882
  }
4735
- if (canDoubleClick) {
4736
- if (diff < 250) {
4883
+ if (diff < 250) {
4884
+ if (touchProxy.doubleIndex == 2) {
4737
4885
  avalon.fastclick.fireEvent(element, "dblclick", event)//触发dblclick事件
4738
4886
  W3CFire(element, "doubletap")//触发doubletap事件
4887
+ touchProxy.doubleIndex = 0
4888
+ } else {
4889
+ setTimeout(function() {
4890
+ touchProxy.doubleIndex = 0
4891
+ }, 250)
4739
4892
  }
4740
- touchProxy.doubleIndex = 0
4741
4893
  }
4894
+
4742
4895
  if (diff > fastclick.clickDuration) {
4743
4896
  W3CFire(element, "hold")
4744
4897
  W3CFire(element, "longtap")
4898
+ touchProxy.doubleIndex = 0
4745
4899
  }
4746
4900
  }
4747
4901
  }
4748
4902
  avalon(element).removeClass(fastclick.activeClass)
4749
4903
  touchProxy.element = null
4750
4904
  }
4905
+ // 避免被点击的元素下有input、textarea时会触发其focus从而调出键盘
4906
+ // http://hzxiaosheng.github.io/work/2014/09/13/click-event-300ms-delay-and-ghost-click-in-mobile-browser/
4907
+ document.addEventListener('click', clickbuster.onClick, true)
4751
4908
  document.addEventListener(touchNames[1], function(event) {
4752
4909
  if (!touchProxy.element)
4753
4910
  return
@@ -4758,11 +4915,12 @@ new function() {
4758
4915
  touchProxy.element = null
4759
4916
  }
4760
4917
  })
4918
+
4761
4919
  document.addEventListener(touchNames[2], touchend)
4762
4920
  if (touchNames[3]) {
4763
4921
  document.addEventListener(touchNames[3], touchend)
4764
4922
  }
4765
- self["clickHook"] = function(data) {
4923
+ me["clickHook"] = function(data) {
4766
4924
  function touchstart(event) {
4767
4925
  var element = data.element
4768
4926
  avalon.mix(touchProxy, getCoordinates(event))
@@ -4770,22 +4928,18 @@ new function() {
4770
4928
  touchProxy.cy = touchProxy.y
4771
4929
  touchProxy.mx = 0 //计算总结移动了多少距离,指在移动距离重分
4772
4930
  touchProxy.my = 0
4773
- touchProxy.startTime = Date.now()
4931
+ // touchProxy.startTime = Date.now()
4774
4932
  touchProxy.event = data.param
4775
4933
  touchProxy.tapping = /click|tap|hold$/.test(touchProxy.event)
4776
4934
 
4777
- touchProxy.element = element
4778
4935
  //--------------处理双击事件--------------
4779
- if (touchProxy.element !== element) {
4936
+ if (!touchProxy.doubleIndex) {
4780
4937
  touchProxy.doubleIndex = 1
4781
- touchProxy.doubleStartTime = Date.now()
4938
+ touchProxy.startTime = Date.now()
4782
4939
  } else {
4783
- if (!touchProxy.doubleIndex) {
4784
- touchProxy.doubleIndex = 1
4785
- } else {
4786
- touchProxy.doubleIndex = 2
4787
- }
4940
+ touchProxy.doubleIndex = 2
4788
4941
  }
4942
+ touchProxy.element = element
4789
4943
  if (touchProxy.tapping && avalon.fastclick.canClick(element)) {
4790
4944
  avalon(element).addClass(fastclick.activeClass)
4791
4945
  }
@@ -4871,9 +5025,28 @@ new function() {
4871
5025
 
4872
5026
 
4873
5027
  ["swipe", "swipeleft", "swiperight", "swipeup", "swipedown", "doubletap", "tap", "dblclick", "longtap", "hold"].forEach(function(method) {
4874
- self[method + "Hook"] = self["clickHook"]
5028
+ me[method + "Hook"] = me["clickHook"]
4875
5029
  })
4876
-
5030
+ if (touchSupported) {
5031
+ me[touchNames[2] + "Hook"] = function(data) {
5032
+ data.specialBind = function(element, callback) {
5033
+ var _callback = callback
5034
+ if (element.hasAttribute('avoidFocus')) {
5035
+ _callback = function(event) {
5036
+ var e = getCoordinates(event)
5037
+ clickbuster.preventGhostClick(e.x, e.y)
5038
+ clickbuster.addUnderFrame(event)
5039
+ callback.apply(this, [].slice.call(arguments))
5040
+ }
5041
+ }
5042
+ data.msCallback = _callback
5043
+ avalon.bind(element, data.param, _callback)
5044
+ }
5045
+ data.specialUnbind = function() {
5046
+ avalon.unbind(data.element, data.param, data.msCallback)
5047
+ }
5048
+ }
5049
+ }
4877
5050
  //各种摸屏事件的示意图 http://quojs.tapquo.com/ http://touch.code.baidu.com/
4878
5051
  }
4879
5052
 
@@ -4903,11 +5076,11 @@ new function() {
4903
5076
  }
4904
5077
  return avalon
4905
5078
  }
4906
- // Expose avalon and $ identifiers, even in AMD
5079
+ // Expose avalon identifiers, even in AMD
4907
5080
  // and CommonJS for browser emulators
4908
5081
  if (noGlobal === void 0) {
4909
5082
  window.avalon = avalon
4910
5083
  }
4911
5084
  return avalon
4912
5085
 
4913
- }));
5086
+ }));