diff --git a/dist/css/layui.mobile.css b/dist/css/layui.mobile.css deleted file mode 100644 index 780c9459..00000000 --- a/dist/css/layui.mobile.css +++ /dev/null @@ -1,2 +0,0 @@ -/** layui-v2.5.7 MIT License */ - blockquote,body,button,dd,div,dl,dt,form,h1,h2,h3,h4,h5,h6,input,legend,li,ol,p,td,textarea,th,ul{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}html{font:12px 'Helvetica Neue','PingFang SC',STHeitiSC-Light,Helvetica,Arial,sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}a,button,input{-webkit-tap-highlight-color:rgba(255,0,0,0)}a{text-decoration:none;background:0 0}a:active,a:hover{outline:0}table{border-collapse:collapse;border-spacing:0}li{list-style:none}b,strong{font-weight:700}h1,h2,h3,h4,h5,h6{font-weight:500}address,cite,dfn,em,var{font-style:normal}dfn{font-style:italic}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}img{border:0;vertical-align:bottom}.layui-inline,input,label{vertical-align:middle}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;outline:0}button,select{text-transform:none}select{-webkit-appearance:none;border:none}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}@font-face{font-family:layui-icon;src:url(../font/iconfont.eot?v=1.0.7);src:url(../font/iconfont.eot?v=1.0.7#iefix) format('embedded-opentype'),url(../font/iconfont.woff?v=1.0.7) format('woff'),url(../font/iconfont.ttf?v=1.0.7) format('truetype'),url(../font/iconfont.svg?v=1.0.7#iconfont) format('svg')}.layui-icon{font-family:layui-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-box,.layui-box *{-webkit-box-sizing:content-box!important;-moz-box-sizing:content-box!important;box-sizing:content-box!important}.layui-border-box,.layui-border-box *{-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important;box-sizing:border-box!important}.layui-inline{position:relative;display:inline-block;*display:inline;*zoom:1}.layui-edge,.layui-upload-iframe{position:absolute;width:0;height:0}.layui-edge{border-style:dashed;border-color:transparent;overflow:hidden}.layui-elip{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-unselect{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-disabled,.layui-disabled:active{background-color:#d2d2d2!important;color:#fff!important;cursor:not-allowed!important}.layui-circle{border-radius:100%}.layui-show{display:block!important}.layui-hide{display:none!important}.layui-upload-iframe{border:0;visibility:hidden}.layui-upload-enter{border:1px solid #009E94;background-color:#009E94;color:#fff;-webkit-transform:scale(1.1);transform:scale(1.1)}@-webkit-keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.layui-m-anim-scale{animation-name:layui-m-anim-scale;-webkit-animation-name:layui-m-anim-scale}@-webkit-keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.layui-m-anim-up{-webkit-animation-name:layui-m-anim-up;animation-name:layui-m-anim-up}@-webkit-keyframes layui-m-anim-left{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes layui-m-anim-left{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}.layui-m-anim-left{-webkit-animation-name:layui-m-anim-left;animation-name:layui-m-anim-left}@-webkit-keyframes layui-m-anim-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes layui-m-anim-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}.layui-m-anim-right{-webkit-animation-name:layui-m-anim-right;animation-name:layui-m-anim-right}@-webkit-keyframes layui-m-anim-lout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}@keyframes layui-m-anim-lout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}.layui-m-anim-lout{-webkit-animation-name:layui-m-anim-lout;animation-name:layui-m-anim-lout}@-webkit-keyframes layui-m-anim-rout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(100%);transform:translateX(100%)}}@keyframes layui-m-anim-rout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(100%);transform:translateX(100%)}}.layui-m-anim-rout{-webkit-animation-name:layui-m-anim-rout;animation-name:layui-m-anim-rout}.layui-m-layer{position:relative;z-index:19891014}.layui-m-layer *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.layui-m-layermain,.layui-m-layershade{position:fixed;left:0;top:0;width:100%;height:100%}.layui-m-layershade{background-color:rgba(0,0,0,.7);pointer-events:auto}.layui-m-layermain{display:table;font-family:Helvetica,arial,sans-serif;pointer-events:none}.layui-m-layermain .layui-m-layersection{display:table-cell;vertical-align:middle;text-align:center}.layui-m-layerchild{position:relative;display:inline-block;text-align:left;background-color:#fff;font-size:14px;border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,.1);pointer-events:auto;-webkit-overflow-scrolling:touch;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}.layui-m-layer0 .layui-m-layerchild{width:90%;max-width:640px}.layui-m-layer1 .layui-m-layerchild{border:none;border-radius:0}.layui-m-layer2 .layui-m-layerchild{width:auto;max-width:260px;min-width:40px;border:none;background:0 0;box-shadow:none;color:#fff}.layui-m-layerchild h3{padding:0 10px;height:60px;line-height:60px;font-size:16px;font-weight:400;border-radius:5px 5px 0 0;text-align:center}.layui-m-layerbtn span,.layui-m-layerchild h3{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-m-layercont{padding:50px 30px;line-height:22px;text-align:center}.layui-m-layer1 .layui-m-layercont{padding:0;text-align:left}.layui-m-layer2 .layui-m-layercont{text-align:center;padding:0;line-height:0}.layui-m-layer2 .layui-m-layercont i{width:25px;height:25px;margin-left:8px;display:inline-block;background-color:#fff;border-radius:100%;-webkit-animation:layui-m-anim-loading 1.4s infinite ease-in-out;animation:layui-m-anim-loading 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-m-layerbtn,.layui-m-layerbtn span{position:relative;text-align:center;border-radius:0 0 5px 5px}.layui-m-layer2 .layui-m-layercont p{margin-top:20px}@-webkit-keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0;-webkit-animation-delay:-.32s;animation-delay:-.32s}.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay:-.16s;animation-delay:-.16s}.layui-m-layer2 .layui-m-layercont>div{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px} \ No newline at end of file diff --git a/dist/lay/modules/mobile.js b/dist/lay/modules/mobile.js index 2559d17f..c9aa8445 100644 --- a/dist/lay/modules/mobile.js +++ b/dist/lay/modules/mobile.js @@ -1,2 +1,2 @@ /** layui-v2.5.7 MIT License */ - ;layui.define(function(i){i("layui.mobile",layui.v)});layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});layui.define(function(e){"use strict";var t=(window,document),i="querySelectorAll",n="getElementsByClassName",a=function(e){return t[i](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var i in e)t[i]=e[i];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var o=0,r=["layui-m-layer"],d=function(e){var t=this;t.config=l.extend(e),t.view()};d.prototype.view=function(){var e=this,i=e.config,s=t.createElement("div");e.id=s.id=r[0]+o,s.setAttribute("class",r[0]+" "+r[0]+(i.type||0)),s.setAttribute("index",o);var l=function(){var e="object"==typeof i.title;return i.title?'

'+(e?i.title[0]:i.title)+"

":""}(),d=function(){"string"==typeof i.btn&&(i.btn=[i.btn]);var e,t=(i.btn||[]).length;return 0!==t&&i.btn?(e=''+i.btn[0]+"",2===t&&(e=''+i.btn[1]+""+e),'
'+e+"
"):""}();if(i.fixed||(i.top=i.hasOwnProperty("top")?i.top:100,i.style=i.style||"",i.style+=" top:"+(t.body.scrollTop+i.top)+"px"),2===i.type&&(i.content='

'+(i.content||"")+"

"),i.skin&&(i.anim="up"),"msg"===i.skin&&(i.shade=!1),s.innerHTML=(i.shade?"
':"")+'
"+l+'
'+i.content+"
"+d+"
",!i.type||2===i.type){var y=t[n](r[0]+i.type),u=y.length;u>=1&&c.close(y[0].getAttribute("index"))}document.body.appendChild(s);var m=e.elem=a("#"+e.id)[0];i.success&&i.success(m),e.index=o++,e.action(i,m)},d.prototype.action=function(e,t){var i=this;e.time&&(l.timer[i.index]=setTimeout(function(){c.close(i.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),c.close(i.index)):e.yes?e.yes(i.index):c.close(i.index)};if(e.btn)for(var s=t[n]("layui-m-layerbtn")[0].children,o=s.length,r=0;r0&&e-1 in t)}function s(t){return A.call(t,function(t){return null!=t})}function u(t){return t.length>0?T.fn.concat.apply([],t):t}function c(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function l(t){return t in F?F[t]:F[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function f(t,e){return"number"!=typeof e||k[c(t)]?e:e+"px"}function h(t){var e,n;return $[t]||(e=L.createElement(t),L.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),$[t]=n),$[t]}function p(t){return"children"in t?D.call(t.children):T.map(t.childNodes,function(t){if(1==t.nodeType)return t})}function d(t,e){var n,r=t?t.length:0;for(n=0;n]*>/,R=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Z=/^(?:body|html)$/i,q=/([A-Z])/g,H=["val","css","html","text","data","width","height","offset"],I=["after","prepend","before","append"],V=L.createElement("table"),_=L.createElement("tr"),B={tr:L.createElement("tbody"),tbody:V,thead:V,tfoot:V,td:_,th:_,"*":L.createElement("div")},U=/complete|loaded|interactive/,X=/^[\w-]*$/,J={},W=J.toString,Y={},G=L.createElement("div"),K={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},Q=Array.isArray||function(t){return t instanceof Array};return Y.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=G).appendChild(t),r=~Y.qsa(i,e).indexOf(t),o&&G.removeChild(t),r},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},N=function(t){return A.call(t,function(e,n){return t.indexOf(e)==n})},Y.fragment=function(t,e,n){var r,i,a;return R.test(t)&&(r=T(L.createElement(RegExp.$1))),r||(t.replace&&(t=t.replace(z,"<$1>")),e===E&&(e=M.test(t)&&RegExp.$1),e in B||(e="*"),a=B[e],a.innerHTML=""+t,r=T.each(D.call(a.childNodes),function(){a.removeChild(this)})),o(n)&&(i=T(r),T.each(n,function(t,e){H.indexOf(t)>-1?i[t](e):i.attr(t,e)})),r},Y.Z=function(t,e){return new d(t,e)},Y.isZ=function(t){return t instanceof Y.Z},Y.init=function(t,n){var r;if(!t)return Y.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&M.test(t))r=Y.fragment(t,RegExp.$1,n),t=null;else{if(n!==E)return T(n).find(t);r=Y.qsa(L,t)}else{if(e(t))return T(L).ready(t);if(Y.isZ(t))return t;if(Q(t))r=s(t);else if(i(t))r=[t],t=null;else if(M.test(t))r=Y.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==E)return T(n).find(t);r=Y.qsa(L,t)}}return Y.Z(r,t)},T=function(t,e){return Y.init(t,e)},T.extend=function(t){var e,n=D.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){m(t,n,e)}),t},Y.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,a=X.test(o);return t.getElementById&&a&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:D.call(a&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},T.contains=L.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},T.type=t,T.isFunction=e,T.isWindow=n,T.isArray=Q,T.isPlainObject=o,T.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},T.isNumeric=function(t){var e=Number(t),n=typeof t;return null!=t&&"boolean"!=n&&("string"!=n||t.length)&&!isNaN(e)&&isFinite(e)||!1},T.inArray=function(t,e,n){return O.indexOf.call(e,t,n)},T.camelCase=C,T.trim=function(t){return null==t?"":String.prototype.trim.call(t)},T.uuid=0,T.support={},T.expr={},T.noop=function(){},T.map=function(t,e){var n,r,i,o=[];if(a(t))for(r=0;r=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return O.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return e(t)?this.not(this.not(t)):T(A.call(this,function(e){return Y.matches(e,t)}))},add:function(t,e){return T(N(this.concat(T(t,e))))},is:function(t){return this.length>0&&Y.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==E)this.each(function(e){t.call(this,e)||n.push(this)});else{var r="string"==typeof t?this.filter(t):a(t)&&e(t.item)?D.call(t):T(t);this.forEach(function(t){r.indexOf(t)<0&&n.push(t)})}return T(n)},has:function(t){return this.filter(function(){return i(t)?T.contains(this,t):T(this).find(t).size()})},eq:function(t){return t===-1?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!i(t)?t:T(t)},last:function(){var t=this[this.length-1];return t&&!i(t)?t:T(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?T(t).filter(function(){var t=this;return O.some.call(n,function(e){return T.contains(e,t)})}):1==this.length?T(Y.qsa(this[0],t)):this.map(function(){return Y.qsa(this,t)}):T()},closest:function(t,e){var n=[],i="object"==typeof t&&T(t);return this.each(function(o,a){for(;a&&!(i?i.indexOf(a)>=0:Y.matches(a,t));)a=a!==e&&!r(a)&&a.parentNode;a&&n.indexOf(a)<0&&n.push(a)}),T(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=T.map(n,function(t){if((t=t.parentNode)&&!r(t)&&e.indexOf(t)<0)return e.push(t),t});return v(e,t)},parent:function(t){return v(N(this.pluck("parentNode")),t)},children:function(t){return v(this.map(function(){return p(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||D.call(this.childNodes)})},siblings:function(t){return v(this.map(function(t,e){return A.call(p(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return T.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=h(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=e(t);if(this[0]&&!n)var r=T(t).get(0),i=r.parentNode||this.length>1;return this.each(function(e){T(this).wrapAll(n?t.call(this,e):i?r.cloneNode(!0):r)})},wrapAll:function(t){if(this[0]){T(this[0]).before(t=T(t));for(var e;(e=t.children()).length;)t=e.first();T(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each(function(e){var r=T(this),i=r.contents(),o=n?t.call(this,e):t;i.length?i.wrapAll(o):r.append(o)})},unwrap:function(){return this.parent().each(function(){T(this).replaceWith(T(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var e=T(this);(t===E?"none"==e.css("display"):t)?e.show():e.hide()})},prev:function(t){return T(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return T(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;T(this).empty().append(g(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=g(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(t,e){var n;return"string"!=typeof t||1 in arguments?this.each(function(n){if(1===this.nodeType)if(i(t))for(j in t)y(this,j,t[j]);else y(this,t,g(this,e,n,this.getAttribute(t)))}):0 in this&&1==this[0].nodeType&&null!=(n=this[0].getAttribute(t))?n:E},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){y(this,t)},this)})},prop:function(t,e){return t=K[t]||t,1 in arguments?this.each(function(n){this[t]=g(this,e,n,this[t])}):this[0]&&this[0][t]},removeProp:function(t){return t=K[t]||t,this.each(function(){delete this[t]})},data:function(t,e){var n="data-"+t.replace(q,"-$1").toLowerCase(),r=1 in arguments?this.attr(n,e):this.attr(n);return null!==r?b(r):E},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each(function(e){this.value=g(this,t,e,this.value)})):this[0]&&(this[0].multiple?T(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var n=T(this),r=g(this,t,e,n.offset()),i=n.offsetParent().offset(),o={top:r.top-i.top,left:r.left-i.left};"static"==n.css("position")&&(o.position="relative"),n.css(o)});if(!this.length)return null;if(L.documentElement!==this[0]&&!T.contains(L.documentElement,this[0]))return{top:0,left:0};var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(e,n){if(arguments.length<2){var r=this[0];if("string"==typeof e){if(!r)return;return r.style[C(e)]||getComputedStyle(r,"").getPropertyValue(e)}if(Q(e)){if(!r)return;var i={},o=getComputedStyle(r,"");return T.each(e,function(t,e){i[e]=r.style[C(e)]||o.getPropertyValue(e)}),i}}var a="";if("string"==t(e))n||0===n?a=c(e)+":"+f(e,n):this.each(function(){this.style.removeProperty(c(e))});else for(j in e)e[j]||0===e[j]?a+=c(j)+":"+f(j,e[j])+";":this.each(function(){this.style.removeProperty(c(j))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(T(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return!!t&&O.some.call(this,function(t){return this.test(x(t))},l(t))},addClass:function(t){return t?this.each(function(e){if("className"in this){S=[];var n=x(this),r=g(this,t,e,n);r.split(/\s+/g).forEach(function(t){T(this).hasClass(t)||S.push(t)},this),S.length&&x(this,n+(n?" ":"")+S.join(" "))}}):this},removeClass:function(t){return this.each(function(e){if("className"in this){if(t===E)return x(this,"");S=x(this),g(this,t,e,S).split(/\s+/g).forEach(function(t){S=S.replace(l(t)," ")}),x(this,S.trim())}})},toggleClass:function(t,e){return t?this.each(function(n){var r=T(this),i=g(this,t,n,x(this));i.split(/\s+/g).forEach(function(t){(e===E?!r.hasClass(t):e)?r.addClass(t):r.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===E?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===E?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),r=Z.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(T(t).css("margin-top"))||0,n.left-=parseFloat(T(t).css("margin-left"))||0,r.top+=parseFloat(T(e[0]).css("border-top-width"))||0,r.left+=parseFloat(T(e[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||L.body;t&&!Z.test(t.nodeName)&&"static"==T(t).css("position");)t=t.offsetParent;return t})}},T.fn.detach=T.fn.remove,["width","height"].forEach(function(t){var e=t.replace(/./,function(t){return t[0].toUpperCase()});T.fn[t]=function(i){var o,a=this[0];return i===E?n(a)?a["inner"+e]:r(a)?a.documentElement["scroll"+e]:(o=this.offset())&&o[t]:this.each(function(e){a=T(this),a.css(t,g(this,i,e,a[t]()))})}}),I.forEach(function(e,n){var r=n%2;T.fn[e]=function(){var e,i,o=T.map(arguments,function(n){var r=[];return e=t(n),"array"==e?(n.forEach(function(t){return t.nodeType!==E?r.push(t):T.zepto.isZ(t)?r=r.concat(t.get()):void(r=r.concat(Y.fragment(t)))}),r):"object"==e||null==n?n:Y.fragment(n)}),a=this.length>1;return o.length<1?this:this.each(function(t,e){i=r?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null;var s=T.contains(L.documentElement,i);o.forEach(function(t){if(a)t=t.cloneNode(!0);else if(!i)return T(t).remove();i.insertBefore(t,e),s&&w(t,function(t){if(!(null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src)){var e=t.ownerDocument?t.ownerDocument.defaultView:window;e.eval.call(e,t.innerHTML)}})})})},T.fn[r?e+"To":"insert"+(n?"Before":"After")]=function(t){return T(t)[e](this),this}}),Y.Z.prototype=d.prototype=T.fn,Y.uniq=N,Y.deserializeValue=b,T.zepto=Y,T}();!function(t){function e(t){return t._zid||(t._zid=h++)}function n(t,n,o,a){if(n=r(n),n.ns)var s=i(n.ns);return(v[e(t)]||[]).filter(function(t){return t&&(!n.e||t.e==n.e)&&(!n.ns||s.test(t.ns))&&(!o||e(t.fn)===e(o))&&(!a||t.sel==a)})}function r(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function i(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function o(t,e){return t.del&&!y&&t.e in x||!!e}function a(t){return b[t]||y&&x[t]||t}function s(n,i,s,u,l,h,p){var d=e(n),m=v[d]||(v[d]=[]);i.split(/\s/).forEach(function(e){if("ready"==e)return t(document).ready(s);var i=r(e);i.fn=s,i.sel=l,i.e in b&&(s=function(e){var n=e.relatedTarget;if(!n||n!==this&&!t.contains(this,n))return i.fn.apply(this,arguments)}),i.del=h;var d=h||s;i.proxy=function(t){if(t=c(t),!t.isImmediatePropagationStopped()){t.data=u;var e=d.apply(n,t._args==f?[t]:[t].concat(t._args));return e===!1&&(t.preventDefault(),t.stopPropagation()),e}},i.i=m.length,m.push(i),"addEventListener"in n&&n.addEventListener(a(i.e),i.proxy,o(i,p))})}function u(t,r,i,s,u){var c=e(t);(r||"").split(/\s/).forEach(function(e){n(t,e,i,s).forEach(function(e){delete v[c][e.i],"removeEventListener"in t&&t.removeEventListener(a(e.e),e.proxy,o(e,u))})})}function c(e,n){return!n&&e.isDefaultPrevented||(n||(n=e),t.each(T,function(t,r){var i=n[t];e[t]=function(){return this[r]=w,i&&i.apply(n,arguments)},e[r]=E}),e.timeStamp||(e.timeStamp=Date.now()),(n.defaultPrevented!==f?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=w)),e}function l(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===f||(n[e]=t[e]);return c(n,t)}var f,h=1,p=Array.prototype.slice,d=t.isFunction,m=function(t){return"string"==typeof t},v={},g={},y="onfocusin"in window,x={focus:"focusin",blur:"focusout"},b={mouseenter:"mouseover",mouseleave:"mouseout"};g.click=g.mousedown=g.mouseup=g.mousemove="MouseEvents",t.event={add:s,remove:u},t.proxy=function(n,r){var i=2 in arguments&&p.call(arguments,2);if(d(n)){var o=function(){return n.apply(r,i?i.concat(p.call(arguments)):arguments)};return o._zid=e(n),o}if(m(r))return i?(i.unshift(n[r],n),t.proxy.apply(null,i)):t.proxy(n[r],n);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var w=function(){return!0},E=function(){return!1},j=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,T={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,n,r,i,o){var a,c,h=this;return e&&!m(e)?(t.each(e,function(t,e){h.on(t,n,r,e,o)}),h):(m(n)||d(i)||i===!1||(i=r,r=n,n=f),i!==f&&r!==!1||(i=r,r=f),i===!1&&(i=E),h.each(function(f,h){o&&(a=function(t){return u(h,t.type,i),i.apply(this,arguments)}),n&&(c=function(e){var r,o=t(e.target).closest(n,h).get(0);if(o&&o!==h)return r=t.extend(l(e),{currentTarget:o,liveFired:h}),(a||i).apply(o,[r].concat(p.call(arguments,1)))}),s(h,e,i,r,n,c||a)}))},t.fn.off=function(e,n,r){var i=this;return e&&!m(e)?(t.each(e,function(t,e){i.off(t,n,e)}),i):(m(n)||d(r)||r===!1||(r=n,n=f),r===!1&&(r=E),i.each(function(){u(this,e,r,n)}))},t.fn.trigger=function(e,n){return e=m(e)||t.isPlainObject(e)?t.Event(e):c(e),e._args=n,this.each(function(){e.type in x&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,r){var i,o;return this.each(function(a,s){i=l(m(e)?t.Event(e):e),i._args=r,i.target=s,t.each(n(s,e.type||e),function(t,e){if(o=e.proxy(i),i.isImmediatePropagationStopped())return!1})}),o},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){m(t)||(e=t,t=e.type);var n=document.createEvent(g[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),c(n)}}(e),function(t){function e(e,n,r){var i=t.Event(n);return t(e).trigger(i,r),!i.isDefaultPrevented()}function n(t,n,r,i){if(t.global)return e(n||x,r,i)}function r(e){e.global&&0===t.active++&&n(e,null,"ajaxStart")}function i(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}function o(t,e){var r=e.context;return e.beforeSend.call(r,t,e)!==!1&&n(e,r,"ajaxBeforeSend",[t,e])!==!1&&void n(e,r,"ajaxSend",[t,e])}function a(t,e,r,i){var o=r.context,a="success";r.success.call(o,t,a,e),i&&i.resolveWith(o,[t,a,e]),n(r,o,"ajaxSuccess",[e,r,t]),u(a,e,r)}function s(t,e,r,i,o){var a=i.context;i.error.call(a,r,e,t),o&&o.rejectWith(a,[r,e,t]),n(i,a,"ajaxError",[r,i,t||e]),u(e,r,i)}function u(t,e,r){var o=r.context;r.complete.call(o,e,t),n(r,o,"ajaxComplete",[e,r]),i(r)}function c(t,e,n){if(n.dataFilter==l)return t;var r=n.context;return n.dataFilter.call(r,t,e)}function l(){}function f(t){return t&&(t=t.split(";",2)[0]),t&&(t==T?"html":t==j?"json":w.test(t)?"script":E.test(t)&&"xml")||"text"}function h(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function p(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()&&"jsonp"!=e.dataType||(e.url=h(e.url,e.data),e.data=void 0)}function d(e,n,r,i){return t.isFunction(n)&&(i=r,r=n,n=void 0),t.isFunction(r)||(i=r,r=void 0),{url:e,data:n,success:r,dataType:i}}function m(e,n,r,i){var o,a=t.isArray(n),s=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),i&&(n=r?i:i+"["+(s||"object"==o||"array"==o?n:"")+"]"),!i&&a?e.add(u.name,u.value):"array"==o||!r&&"object"==o?m(e,u,r,n):e.add(n,u)})}var v,g,y=+new Date,x=window.document,b=/)<[^<]*)*<\/script>/gi,w=/^(?:text|application)\/javascript/i,E=/^(?:text|application)\/xml/i,j="application/json",T="text/html",S=/^\s*$/,C=x.createElement("a");C.href=window.location.href,t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var r,i,u=e.jsonpCallback,c=(t.isFunction(u)?u():u)||"Zepto"+y++,l=x.createElement("script"),f=window[c],h=function(e){t(l).triggerHandler("error",e||"abort")},p={abort:h};return n&&n.promise(p),t(l).on("load error",function(o,u){clearTimeout(i),t(l).off().remove(),"error"!=o.type&&r?a(r[0],p,e,n):s(null,u||"error",p,e,n),window[c]=f,r&&t.isFunction(f)&&f(r[0]),f=r=void 0}),o(p,e)===!1?(h("abort"),p):(window[c]=function(){r=arguments},l.src=e.url.replace(/\?(.+)=\?/,"?$1="+c),x.head.appendChild(l),e.timeout>0&&(i=setTimeout(function(){h("timeout")},e.timeout)),p)},t.ajaxSettings={type:"GET",beforeSend:l,success:l,error:l,complete:l,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:j,xml:"application/xml, text/xml",html:T,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:l},t.ajax=function(e){var n,i,u=t.extend({},e||{}),d=t.Deferred&&t.Deferred();for(v in t.ajaxSettings)void 0===u[v]&&(u[v]=t.ajaxSettings[v]);r(u),u.crossDomain||(n=x.createElement("a"),n.href=u.url,n.href=n.href,u.crossDomain=C.protocol+"//"+C.host!=n.protocol+"//"+n.host),u.url||(u.url=window.location.toString()),(i=u.url.indexOf("#"))>-1&&(u.url=u.url.slice(0,i)),p(u);var m=u.dataType,y=/\?.+=\?/.test(u.url);if(y&&(m="jsonp"),u.cache!==!1&&(e&&e.cache===!0||"script"!=m&&"jsonp"!=m)||(u.url=h(u.url,"_="+Date.now())),"jsonp"==m)return y||(u.url=h(u.url,u.jsonp?u.jsonp+"=?":u.jsonp===!1?"":"callback=?")),t.ajaxJSONP(u,d);var b,w=u.accepts[m],E={},j=function(t,e){E[t.toLowerCase()]=[t,e]},T=/^([\w-]+:)\/\//.test(u.url)?RegExp.$1:window.location.protocol,N=u.xhr(),O=N.setRequestHeader;if(d&&d.promise(N),u.crossDomain||j("X-Requested-With","XMLHttpRequest"),j("Accept",w||"*/*"),(w=u.mimeType||w)&&(w.indexOf(",")>-1&&(w=w.split(",",2)[0]),N.overrideMimeType&&N.overrideMimeType(w)),(u.contentType||u.contentType!==!1&&u.data&&"GET"!=u.type.toUpperCase())&&j("Content-Type",u.contentType||"application/x-www-form-urlencoded"),u.headers)for(g in u.headers)j(g,u.headers[g]);if(N.setRequestHeader=j,N.onreadystatechange=function(){if(4==N.readyState){N.onreadystatechange=l,clearTimeout(b);var e,n=!1;if(N.status>=200&&N.status<300||304==N.status||0==N.status&&"file:"==T){if(m=m||f(u.mimeType||N.getResponseHeader("content-type")),"arraybuffer"==N.responseType||"blob"==N.responseType)e=N.response;else{e=N.responseText;try{e=c(e,m,u),"script"==m?(0,eval)(e):"xml"==m?e=N.responseXML:"json"==m&&(e=S.test(e)?null:t.parseJSON(e))}catch(r){n=r}if(n)return s(n,"parsererror",N,u,d)}a(e,N,u,d)}else s(N.statusText||null,N.status?"error":"abort",N,u,d)}},o(N,u)===!1)return N.abort(),s(null,"abort",N,u,d),N;var P=!("async"in u)||u.async;if(N.open(u.type,u.url,P,u.username,u.password),u.xhrFields)for(g in u.xhrFields)N[g]=u.xhrFields[g];for(g in E)O.apply(N,E[g]);return u.timeout>0&&(b=setTimeout(function(){N.onreadystatechange=l,N.abort(),s(null,"timeout",N,u,d)},u.timeout)),N.send(u.data?u.data:null),N},t.get=function(){return t.ajax(d.apply(null,arguments))},t.post=function(){var e=d.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=d.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,r){if(!this.length)return this;var i,o=this,a=e.split(/\s/),s=d(e,n,r),u=s.success;return a.length>1&&(s.url=a[0],i=a[1]),s.success=function(e){o.html(i?t("
").html(e.replace(b,"")).find(i):e),u&&u.apply(o,arguments)},t.ajax(s),this};var N=encodeURIComponent;t.param=function(e,n){var r=[];return r.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(N(e)+"="+N(n))},m(r,e,n),r.join("&").replace(/%20/g,"+")}}(e),function(t){t.fn.serializeArray=function(){var e,n,r=[],i=function(t){return t.forEach?t.forEach(i):void r.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(r,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&i(t(o).val())}),r},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(e),function(){try{getComputedStyle(void 0)}catch(t){var e=getComputedStyle;window.getComputedStyle=function(t,n){try{return e(t,n)}catch(r){return null}}}}(),t("zepto",e)});layui.define(["laytpl","upload","layer-mobile","zepto"],function(i){var e="2.5.0",a=layui.zepto,t=layui.laytpl,n=layui["layer-mobile"],l=layui.device(),s="layui-show",o="layim-this",c=20,d={},r=function(){this.v=e,u(a("body"),"*[layim-event]",function(i){var e=a(this),t=e.attr("layim-event");R[t]?R[t].call(this,e,i):""})},u=function(i,e,t){var n,l="function"==typeof e,s=function(i){var e=a(this);e.data("lock")||(n||t.call(this,i),n=!1,e.data("lock","true"),setTimeout(function(){e.removeAttr("data-lock")},e.data("locktime")||0))};return l&&(t=e),i="string"==typeof i?a(i):i,m?void(l?i.on("touchmove",function(){n=!0}).on("touchend",s):i.on("touchmove",e,function(){n=!0}).on("touchend",e,s)):void(l?i.on("click",s):i.on("click",e,s))},m=/Android|iPhone|SymbianOS|Windows Phone|iPad|iPod/.test(navigator.userAgent);n.popBottom=function(i){n.close(n.popBottom.index),n.popBottom.index=n.open(a.extend({type:1,content:i.content||"",shade:!1,className:"layim-layer"},i))},r.prototype.config=function(i){i=i||{},i=a.extend({title:"我的IM",isgroup:0,isNewFriend:!0,voice:"default.mp3",chatTitleColor:"#36373C"},i),C(i)},r.prototype.on=function(i,e){return"function"==typeof e&&(d[i]?d[i].push(e):d[i]=[e]),this},r.prototype.chat=function(i){if(window.JSON&&window.JSON.parse)return N(i,-1),this},r.prototype.panel=function(i){return S(i)},r.prototype.cache=function(){return w},r.prototype.getMessage=function(i){return _(i),this},r.prototype.addList=function(i){return $(i),this},r.prototype.removeList=function(i){return O(i),this},r.prototype.setFriendStatus=function(i,e){var t=a(".layim-friend"+i);t["online"===e?"removeClass":"addClass"]("layim-list-gray")},r.prototype.setChatStatus=function(i){var e=T(),a=e.elem.find(".layim-chat-status");return a.html(i),this},r.prototype.showNew=function(i,e){H(i,e)},r.prototype.content=function(i){return layui.data.content(i)};var y=function(i){var e={friend:"该分组下暂无好友",group:"暂无群组",history:"暂无任何消息"};return i=i||{},"history"===i.type&&(i.item=i.item||"d.sortHistory"),["{{# var length = 0; layui.each("+i.item+", function(i, data){ length++; }}",'
  • {{ data.username||data.groupname||data.name||"佚名" }}

    {{ data.remark||data.sign||"" }}

    new
  • ',"{{# }); if(length === 0){ }}",'
  • '+(e[i.type]||"暂无数据")+"
  • ","{{# } }}"].join("")},p=function(i,e,a){return['
    ','
    ',"

    ",a?'':"",'{{ d.title || d.base.title }}',"{{# if(d.data){ }}",'{{# if(d.data.type === "group"){ }}','',"{{# } }}","{{# } }}","

    ","
    ",'
    ',i,"
    ","
    "].join("")},f=['
    ','
    ','
      ','
        ',y({type:"history"}),"
      ","
    ","
    ",'
    ','
      ',"{{# if(d.base.isNewFriend){ }}",'
    • 新的朋友
    • ',"{{# } if(d.base.isgroup){ }}",'
    • 群聊
    • ',"{{# } }}","
    ",'
      ','{{# layui.each(d.friend, function(index, item){ var spread = d.local["spread"+index]; }}',"
    • ",'
      {{# if(spread === "true"){ }}{{# } else { }}{{# } }}{{ item.groupname||"未命名分组"+index }}( {{ (item.list||[]).length }})
      ','
        ',y({type:"friend",item:"item.list",index:"index"}),"
      ","
    • ","{{# }); if(d.friend.length === 0){ }}",'
      • 暂无联系人
      ',"{{# } }}","
    ","
    ",'
    ','
      ',"{{# layui.each(d.base.moreList, function(index, item){ }}",'
    • ','{{item.iconUnicode||""}}{{item.title}}',"
    • ","{{# }); if(!d.base.copyright){ }}",'
    • 关于
    • ',"{{# } }}","
    ","
    ","
    ",'
      ','
    • 消息
    • ','
    • 联系人
    • ','
    • 更多
    • ',"
    "].join(""),h=['
    ','
    ',"
      ","
      ",'","
      "].join(""),v=function(i){return i<10?"0"+(0|i):i};layui.data.date=function(i){var e=new Date(i||new Date);return v(e.getMonth()+1)+"-"+v(e.getDate())+" "+v(e.getHours())+":"+v(e.getMinutes())},layui.data.content=function(i){var e=function(i){return new RegExp("\\n*\\["+(i||"")+"(pre|div|p|table|thead|th|tbody|tr|td|ul|li|ol|li|dl|dt|dd|h2|h3|h4|h5)([\\s\\S]*?)\\]\\n*","g")};return i=(i||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(/@(\S+)(\s+?|$)/g,'@$1$2').replace(/face\[([^\s\[\]]+?)\]/g,function(i){var e=i.replace(/^face/g,"");return''+e+''}).replace(/img\[([^\s]+?)\]/g,function(i){return''}).replace(/file\([\s\S]+?\)\[[\s\S]*?\]/g,function(i){var e=(i.match(/file\(([\s\S]+?)\)\[/)||[])[1],a=(i.match(/\)\[([\s\S]*?)\]/)||[])[1];return e?''+(a||e)+"":i}).replace(/audio\[([^\s]+?)\]/g,function(i){return'

      音频消息

      '}).replace(/video\[([^\s]+?)\]/g,function(i){return'
      '}).replace(/a\([\s\S]+?\)\[[\s\S]*?\]/g,function(i){var e=(i.match(/a\(([\s\S]+?)\)\[/)||[])[1],a=(i.match(/\)\[([\s\S]*?)\]/)||[])[1];return e?''+(a||e)+"":i}).replace(e(),"<$1 $2>").replace(e("/"),"").replace(/\n/g,"
      ")};var g,b,x=['
    • ','
      {{ d.uid || d.id }}','{{ d.username||"佚名" }}',"
      ",'
      {{ layui.data.content(d.content||" ") }}
      ',"
    • "].join(""),w={message:{},chat:[]},C=function(i){var e=i.init||{};return mine=e.mine||{},local=layui.data("layim-mobile")[mine.id]||{},obj={base:i,local:local,mine:mine,history:local.history||[]},create=function(e){var n=e.mine||{},l=layui.data("layim-mobile")[n.id]||{},s={base:i,local:l,mine:n,friend:e.friend||[],group:e.group||[],history:l.history||[]};s.sortHistory=A(s.history,"historyTime"),w=a.extend(w,s),k(t(p(f)).render(s)),layui.each(d.ready,function(i,e){e&&e(s)})},w=a.extend(w,obj),i.brief?layui.each(d.ready,function(i,e){e&&e(obj)}):void create(e)},k=function(i){return n.open({type:1,shade:!1,shadeClose:!1,anim:-1,content:i,success:function(i){g=a(i),L(g.find(".layui-layim")),w.base.tabIndex&&R.tab(a(".layui-layim-tab>li").eq(w.base.tabIndex))}})},S=function(i,e){i=i||{};var l=a.extend({},w,{title:i.title||"",data:i.data});return n.open({type:1,shade:!1,shadeClose:!1,anim:-1,content:t(p(i.tpl,e!==-1,!0)).render(l),success:function(e){var t=a(e);t.prev().find(".layim-panel").addClass("layui-m-anim-lout"),i.success&&i.success(e),i.isChat||L(t.find(".layim-content"))},end:i.end})},N=function(i,e,t){return i=i||{},i.id?(n.close(N.index),N.index=S({tpl:h,data:i,title:i.name,isChat:!0,success:function(e){b=a(e),J(),M(),delete w.message[i.type+i.id],H("Msg");var t=T(),n=t.elem.find(".layim-chat-main");layui.each(d.chatChange,function(i,e){e&&e(t)}),L(n),t.textarea.on("focus",function(){setTimeout(function(){n.scrollTop(n[0].scrollHeight+1e3)},500)})},end:function(){b=null,q.time=0}},e)):n.msg("非法用户")},L=function(i){l.ios&&i.on("touchmove",function(e){var a=i.scrollTop();a<=0&&(i.scrollTop(1),e.preventDefault(e)),this.scrollHeight-a-i.height()<=0&&(i.scrollTop(i.scrollTop()-1),e.preventDefault(e))})},T=function(){if(!b)return{};var i=b.find(".layim-chat"),e=JSON.parse(decodeURIComponent(i.find(".layim-chat-tool").data("json")));return{elem:i,data:e,textarea:i.find("input")}},A=function(i,e,a){var t=[],n=function(i,a){var t=i[e],n=a[e];return nt?1:0};return layui.each(i,function(i,e){t.push(e)}),t.sort(n),a&&t.reverse(),t},j=function(i){var e=layui.data("layim-mobile")[w.mine.id]||{},a={},n=e.history||{};n[i.type+i.id];if(g){var l=g.find(".layim-list-history");i.historyTime=(new Date).getTime(),i.sign=i.content,n[i.type+i.id]=i,e.history=n,layui.data("layim-mobile",{key:w.mine.id,value:e});var o=l.find(".layim-"+i.type+i.id),c=(w.message[i.type+i.id]||[]).length,d=function(){o=l.find(".layim-"+i.type+i.id),o.find("p").html(i.content),c>0&&o.find(".layim-msg-status").html(c).addClass(s)};if(o.length>0)d(),l.prepend(o.clone()),o.remove();else{a[i.type+i.id]=i;var r=t(y({type:"history",item:"d.data"})).render({data:a});l.prepend(r),d(),l.find(".layim-null").remove()}H("Msg")}},H=function(i,e){if(!e){var e;layui.each(w.message,function(){return e=!0,!1})}a("#LAY_layimNew"+i)[e?"addClass":"removeClass"](s)},q=function(){var i={username:w.mine?w.mine.username:"访客",avatar:w.mine?w.mine.avatar:layui.cache.dir+"css/pc/layim/skin/logo.jpg",id:w.mine?w.mine.id:null,mine:!0},e=T(),a=e.elem.find(".layim-chat-main ul"),l=e.data,s=w.base.maxLength||3e3,o=(new Date).getTime(),c=e.textarea;if(i.content=c.val(),""!==i.content){if(i.content.length>s)return n.msg("内容最长不能超过"+s+"个字符");o-(q.time||0)>6e4&&(a.append('
    • '+layui.data.date()+"
    • "),q.time=o),a.append(t(x).render(i));var r={mine:i,to:l},u={username:r.mine.username,avatar:r.mine.avatar,id:l.id,type:l.type,content:r.mine.content,timestamp:o,mine:!0};F(u),layui.each(d.sendMessage,function(i,e){e&&e(r)}),l.content=i.content,j(l),Y(),c.val(""),c.next().addClass("layui-disabled")}},I=function(){var i=document.createElement("audio");i.src=layui.cache.dir+"css/modules/layim/voice/"+w.base.voice,i.play()},D={},_=function(i){i=i||{};var e={},n=T(),l=n.data||{},s=l.id==i.id&&l.type==i.type;i.timestamp=i.timestamp||(new Date).getTime(),i.system||F(i),console.log(i),D=JSON.parse(JSON.stringify(i)),w.base.voice&&I(),(!b&&i.content||!s)&&(w.message[i.type+i.id]?w.message[i.type+i.id].push(i):w.message[i.type+i.id]=[i]);var e={};if("friend"===i.type){var o;layui.each(w.friend,function(e,a){if(layui.each(a.list,function(e,a){if(a.id==i.id)return i.type="friend",i.name=a.username,o=!0}),o)return!0}),o||(i.temporary=!0)}else"group"===i.type?layui.each(w.group,function(a,t){if(t.id==i.id)return i.type="group",i.name=i.groupname=t.groupname,e.avatar=t.avatar,!0}):i.name=i.name||i.username||i.groupname;var c=a.extend({},i,{avatar:e.avatar||i.avatar});if("group"===i.type&&delete c.username,j(c),b&&s){var d=b.find(".layim-chat"),r=d.find(".layim-chat-main ul");i.system?r.append('
    • '+i.content+"
    • "):""!==i.content.replace(/\s/g,"")&&(i.timestamp-(q.time||0)>6e4&&(r.append('
    • '+layui.data.date(i.timestamp)+"
    • "),q.time=i.timestamp),r.append(t(x).render(i))),Y()}},F=function(i){var e=layui.data("layim-mobile")[w.mine.id]||{},a=e.chatlog||{};a[i.type+i.id]?(a[i.type+i.id].push(i),a[i.type+i.id].length>c&&a[i.type+i.id].shift()):a[i.type+i.id]=[i],e.chatlog=a,layui.data("layim-mobile",{key:w.mine.id,value:e})},M=function(){var i=layui.data("layim-mobile")[w.mine.id]||{},e=T(),a=i.chatlog||{},n=e.elem.find(".layim-chat-main ul");layui.each(a[e.data.type+e.data.id],function(i,e){(new Date).getTime()>e.timestamp&&e.timestamp-(q.time||0)>6e4&&(n.append('
    • '+layui.data.date(e.timestamp)+"
    • "),q.time=e.timestamp),n.append(t(x).render(e))}),Y()},$=function(i){var e,a={},l=g.find(".layim-list-"+i.type);if(w[i.type])if("friend"===i.type)layui.each(w.friend,function(t,l){if(i.groupid==l.id)return layui.each(w.friend[t].list,function(a,t){if(t.id==i.id)return e=!0}),e?n.msg("好友 ["+(i.username||"")+"] 已经存在列表中",{anim:6}):(w.friend[t].list=w.friend[t].list||[],a[w.friend[t].list.length]=i,i.groupIndex=t,w.friend[t].list.push(i),!0)});else if("group"===i.type){if(layui.each(w.group,function(a,t){if(t.id==i.id)return e=!0}),e)return n.msg("您已是 ["+(i.groupname||"")+"] 的群成员",{anim:6});a[w.group.length]=i,w.group.push(i)}if(!e){var s=t(y({type:i.type,item:"d.data",index:"friend"===i.type?"data.groupIndex":null})).render({data:a});if("friend"===i.type){var o=l.children("li").eq(i.groupIndex);o.find(".layui-layim-list").append(s),o.find(".layim-count").html(w.friend[i.groupIndex].list.length),o.find(".layim-null")[0]&&o.find(".layim-null").remove()}else"group"===i.type&&(l.append(s),l.find(".layim-null")[0]&&l.find(".layim-null").remove())}},O=function(i){var e=g.find(".layim-list-"+i.type);w[i.type]&&("friend"===i.type?layui.each(w.friend,function(a,t){layui.each(t.list,function(t,n){if(i.id==n.id){var l=e.children("li").eq(a);l.find(".layui-layim-list").children("li");return l.find(".layui-layim-list").children("li").eq(t).remove(),w.friend[a].list.splice(t,1),l.find(".layim-count").html(w.friend[a].list.length),0===w.friend[a].list.length&&l.find(".layui-layim-list").html('
    • 该分组下已无好友了
    • '),!0}})}):"group"===i.type&&layui.each(w.group,function(a,t){if(i.id==t.id)return e.children("li").eq(a).remove(),w.group.splice(a,1),0===w.group.length&&e.html('
    • 暂无群组
    • '),!0}))},Y=function(){var i=T(),e=i.elem.find(".layim-chat-main"),a=e.find("ul"),t=a.children(".layim-chat-li");if(t.length>=c){var n=t.eq(0);n.prev().remove(),a.prev().hasClass("layim-chat-system")||a.before('
      查看更多记录
      '),n.remove()}e.scrollTop(e[0].scrollHeight+1e3)},J=function(){var i=T(),e=i.textarea,a=e.next();e.off("keyup").on("keyup",function(i){var t=i.keyCode;13===t&&(i.preventDefault(),q()),a[""===e.val()?"addClass":"removeClass"]("layui-disabled")})},B=function(){var i=["[微笑]","[嘻嘻]","[哈哈]","[可爱]","[可怜]","[挖鼻]","[吃惊]","[害羞]","[挤眼]","[闭嘴]","[鄙视]","[爱你]","[泪]","[偷笑]","[亲亲]","[生病]","[太开心]","[白眼]","[右哼哼]","[左哼哼]","[嘘]","[衰]","[委屈]","[吐]","[哈欠]","[抱抱]","[怒]","[疑问]","[馋嘴]","[拜拜]","[思考]","[汗]","[困]","[睡]","[钱]","[失望]","[酷]","[色]","[哼]","[鼓掌]","[晕]","[悲伤]","[抓狂]","[黑线]","[阴险]","[怒骂]","[互粉]","[心]","[伤心]","[猪头]","[熊猫]","[兔子]","[ok]","[耶]","[good]","[NO]","[赞]","[来]","[弱]","[草泥马]","[神马]","[囧]","[浮云]","[给力]","[围观]","[威武]","[奥特曼]","[礼物]","[钟]","[话筒]","[蜡烛]","[蛋糕]"],e={};return layui.each(i,function(i,a){e[a]=layui.cache.dir+"images/face/"+i+".gif"}),e}(),E=layui.stope,P=function(i,e,a){var t,n=i.value;a||i.focus(),document.selection?(t=document.selection.createRange(),document.selection.empty(),t.text=e):(t=[n.substring(0,i.selectionStart),e,n.substr(i.selectionEnd)],a||i.focus(),i.value=t.join(""))},R={chat:function(i){var e=layui.data("layim-mobile")[w.mine.id]||{},t=i.data("type"),n=i.data("index"),l=i.attr("data-list")||i.index(),o={};"friend"===t?o=w[t][n].list[l]:"group"===t?o=w[t][l]:"history"===t&&(o=(e.history||{})[n]||{}),o.name=o.name||o.username||o.groupname,"history"!==t&&(o.type=t),N(o,!0),a(".layim-"+o.type+o.id).find(".layim-msg-status").removeClass(s)},spread:function(i){var e=i.attr("lay-type"),a="true"===e?"false":"true",t=layui.data("layim-mobile")[w.mine.id]||{};i.next()["true"===e?"removeClass":"addClass"](s),t["spread"+i.parent().index()]=a,layui.data("layim-mobile",{key:w.mine.id,value:t}),i.attr("lay-type",a),i.find(".layui-icon").html("true"===a?"":"")},tab:function(i){var e=i.index(),a=".layim-tab-content";i.addClass(o).siblings().removeClass(o),g.find(a).eq(e).addClass(s).siblings(a).removeClass(s)},back:function(i){var e=i.parents(".layui-m-layer").eq(0),a=e.attr("index"),t=".layim-panel";setTimeout(function(){n.close(a)},300),i.parents(t).eq(0).removeClass("layui-m-anim-left").addClass("layui-m-anim-rout"),e.prev().find(t).eq(0).removeClass("layui-m-anim-lout").addClass("layui-m-anim-right"),layui.each(d.back,function(i,e){setTimeout(function(){e&&e()},200)})},send:function(){q()},face:function(i,e){var t="",l=T(),s=l.textarea;layui.each(B,function(i,e){t+='
    • '}),t='
        '+t+"
      ",n.popBottom({content:t,success:function(i){var e=a(i).find(".layui-layim-face").children("li");u(e,function(){return P(s[0],"face"+this.title+" ",!0),s.next()[""===s.val()?"addClass":"removeClass"]("layui-disabled"),!1})}});var o=a(document);m?u(o,function(){R.faceHide()}):o.off("click",R.faceHide).on("click",R.faceHide),E(e)},faceHide:function(){n.close(n.popBottom.index),a(document).off("touchend",R.faceHide).off("click",R.faceHide)},image:function(i){var e=i.data("type")||"images",a={images:"uploadImage",file:"uploadFile"},t=T(),l=w.base[a[e]]||{};layui.upload.render({url:l.url||"",method:l.type,elem:i.find("input")[0],accept:e,done:function(i){0==i.code?(i.data=i.data||{},"images"===e?P(t.textarea[0],"img["+(i.data.src||"")+"]"):"file"===e&&P(t.textarea[0],"file("+(i.data.src||"")+")["+(i.data.name||"下载文件")+"]"),q()):n.msg(i.msg||"上传失败")}})},extend:function(i){var e=i.attr("lay-filter"),a=T();layui.each(d["tool("+e+")"],function(e,t){t&&t.call(i,function(i){P(a.textarea[0],i)},q,a)})},newFriend:function(){layui.each(d.newFriend,function(i,e){e&&e()})},group:function(){S({title:"群聊",tpl:['
      ',y({type:"group",item:"d.group"}),"
      "].join(""),data:{}})},detail:function(){var i=T();layui.each(d.detail,function(e,a){a&&a(i.data)})},playAudio:function(i){var e=i.data("audio"),a=e||document.createElement("audio"),t=function(){a.pause(),i.removeAttr("status"),i.find("i").html("")};return i.data("error")?n.msg("播放音频源异常"):a.play?void(i.attr("status")?t():(e||(a.src=i.data("src")),a.play(),i.attr("status","pause"),i.data("audio",a),i.find("i").html(""),a.onended=function(){t()},a.onerror=function(){n.msg("播放音频源异常"),i.data("error",!0),t()})):n.msg("您的浏览器不支持audio")},playVideo:function(i){var e=i.data("src"),a=document.createElement("video");return a.play?(n.close(R.playVideo.index),void(R.playVideo.index=n.open({type:1,anim:!1,style:"width: 100%; height: 50%;",content:'
      '}))):n.msg("您的浏览器不支持video")},chatLog:function(i){var e=T();layui.each(d.chatlog,function(i,a){a&&a(e.data,e.elem.find(".layim-chat-main>ul"))})},moreList:function(i){var e=i.attr("lay-filter");layui.each(d.moreList,function(i,a){a&&a({alias:e})})},about:function(){n.open({content:'

      版本:layim mobile v'+e+"

      ",className:"layim-about",shadeClose:!1,btn:"我知道了"})}};i("layim-mobile",new r)}).addcss("modules/layim/mobile/layim.css?v=2.50","skinlayim-mobilecss");layui["layui.mobile"]||layui.config({base:layui.cache.dir+"lay/modules/mobile/"}).extend({"layer-mobile":"layer-mobile",zepto:"zepto","upload-mobile":"upload-mobile","layim-mobile":"layim-mobile"}),layui.define(["layer-mobile","zepto","layim-mobile"],function(l){l("mobile",{layer:layui["layer-mobile"],layim:layui["layim-mobile"]})}); \ No newline at end of file + ;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)}); \ No newline at end of file diff --git a/package.json b/package.json index eded13a2..adaf883a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "realname": "layui", "version": "2.5.7", "independents": { - "layim": "3.9.5" + "layim": "3.9.6" }, "description": "Classic modular front-end component library", "main": "dist/layui.js", diff --git a/src/css/layui.mobile.css b/src/css/layui.mobile.css deleted file mode 100644 index a58b2941..00000000 --- a/src/css/layui.mobile.css +++ /dev/null @@ -1,191 +0,0 @@ -/** - - @Name: layui mobile - @Author: 贤心 - @Site: http://www.layui.com/mobile/ - - */ - -/* reset */ -body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,input,button,textarea,p,blockquote,th,td,form,legend{margin:0; padding:0; -webkit-tap-highlight-color:rgba(0,0,0,0)} -html{font:12px 'Helvetica Neue','PingFang SC',STHeitiSC-Light,Helvetica,Arial,sans-serif; -ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;} -a,button,input{-webkit-tap-highlight-color:rgba(255,0,0,0);} -a{text-decoration: none; background:transparent} -a:active,a:hover{outline:0} -table{border-collapse:collapse;border-spacing:0} -li{list-style:none;} -b,strong{font-weight:700;} -h1, h2, h3, h4, h5, h6{font-weight:500;} -address,cite,dfn,em,var{font-style:normal;} -dfn{font-style:italic} -sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline} -img{border:0; vertical-align: bottom} -button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0; outline: 0;} -button,select{text-transform:none} -select{-webkit-appearance: none; border:none;} -input{line-height:normal; } -input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0} -input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto} -input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box} -input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none} -label,input{vertical-align: middle;} - - -/** 图标字体 **/ -@font-face {font-family: 'layui-icon'; - src: url('../font/iconfont.eot?v=1.0.7'); - src: url('../font/iconfont.eot?v=1.0.7#iefix') format('embedded-opentype'), - url('../font/iconfont.woff?v=1.0.7') format('woff'), - url('../font/iconfont.ttf?v=1.0.7') format('truetype'), - url('../font/iconfont.svg?v=1.0.7#iconfont') format('svg'); -} - -.layui-icon{ - font-family:"layui-icon" !important; - font-size: 16px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - - -/** 基础通用 **/ -/* 消除第三方ui可能造成的冲突 */.layui-box, .layui-box *{-webkit-box-sizing: content-box !important; -moz-box-sizing: content-box !important; box-sizing: content-box !important;} -.layui-border-box, .layui-border-box *{-webkit-box-sizing: border-box !important; -moz-box-sizing: border-box !important; box-sizing: border-box !important;} -.layui-inline{position: relative; display: inline-block; *display:inline; *zoom:1; vertical-align: middle;} -/* 三角形 */.layui-edge{position: absolute; width: 0; height: 0; border-style: dashed; border-color: transparent; overflow: hidden;} -/* 单行溢出省略 */.layui-elip{text-overflow: ellipsis; overflow: hidden; white-space: nowrap;} -/* 屏蔽选中 */.layui-unselect{-moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;} -.layui-disabled,.layui-disabled:active{background-color: #d2d2d2 !important; color: #fff !important; cursor: not-allowed !important;} -/* 纯圆角 */.layui-circle{border-radius: 100%;} -.layui-show{display: block !important;} -.layui-hide{display: none !important;} - - -.layui-upload-iframe{position: absolute; width: 0px; height: 0px; border: 0px; visibility: hidden;} -.layui-upload-enter{border: 1px solid #009E94; background-color: #009E94; color: #fff; -webkit-transform: scale(1.1); transform: scale(1.1);} - - -/* 弹出动画 */ -@-webkit-keyframes layui-m-anim-scale { /* 默认 */ - 0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)} - 100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)} -} -@keyframes layui-m-anim-scale { /* 由小到大 */ - 0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)} - 100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)} -} -.layui-m-anim-scale{animation-name: layui-m-anim-scale; -webkit-animation-name: layui-m-anim-scale;} - -@-webkit-keyframes layui-m-anim-up{ /* 从下往上 */ - 0%{opacity: 0; -webkit-transform: translateY(800px); transform: translateY(800px)} - 100%{opacity: 1; -webkit-transform: translateY(0); transform: translateY(0)} -} -@keyframes layui-m-anim-up{ - 0%{opacity: 0; -webkit-transform: translateY(800px); transform: translateY(800px)} - 100%{opacity: 1; -webkit-transform: translateY(0); transform: translateY(0)} -} -.layui-m-anim-up{-webkit-animation-name: layui-m-anim-up; animation-name: layui-m-anim-up} - -@-webkit-keyframes layui-m-anim-left{ /* 从右往左 */ - 0%{-webkit-transform: translateX(100%); transform: translateX(100%)} - 100%{-webkit-transform: translateX(0); transform: translateX(0)} -} -@keyframes layui-m-anim-left{ - 0%{-webkit-transform: translateX(100%); transform: translateX(100%)} - 100%{-webkit-transform: translateX(0); transform: translateX(0)} -} -.layui-m-anim-left{-webkit-animation-name: layui-m-anim-left; animation-name: layui-m-anim-left} - -@-webkit-keyframes layui-m-anim-right{ /* 从左往右 */ - 0%{-webkit-transform: translateX(-100%); transform: translateX(-100%)} - 100%{-webkit-transform: translateX(0); transform: translateX(0)} -} -@keyframes layui-m-anim-right{ - 0%{-webkit-transform: translateX(-100%); transform: translateX(-100%)} - 100%{-webkit-transform: translateX(0); transform: translateX(0)} -} -.layui-m-anim-right{-webkit-animation-name: layui-m-anim-right; animation-name: layui-m-anim-right} - -@-webkit-keyframes layui-m-anim-lout{ /* 往左收缩 */ - 0%{-webkit-transform: translateX(0); transform: translateX(0)} - 100%{-webkit-transform: translateX(-100%); transform: translateX(-100%)} -} -@keyframes layui-m-anim-lout{ - 0%{-webkit-transform: translateX(0); transform: translateX(0)} - 100%{-webkit-transform: translateX(-100%); transform: translateX(-100%)} -} -.layui-m-anim-lout{-webkit-animation-name: layui-m-anim-lout; animation-name: layui-m-anim-lout} - -@-webkit-keyframes layui-m-anim-rout{ /* 往右收缩 */ - 0%{-webkit-transform: translateX(0); transform: translateX(0)} - 100%{-webkit-transform: translateX(100%); transform: translateX(100%)} -} -@keyframes layui-m-anim-rout{ - 0%{-webkit-transform: translateX(0); transform: translateX(0)} - 100%{-webkit-transform: translateX(100%); transform: translateX(100%)} -} -.layui-m-anim-rout{-webkit-animation-name: layui-m-anim-rout; animation-name: layui-m-anim-rout} - - -/** layer mobile */ -.layui-m-layer{position:relative; z-index: 19891014;} -.layui-m-layer *{-webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box;} -.layui-m-layershade, -.layui-m-layermain{position:fixed; left:0; top:0; width:100%; height:100%;} -.layui-m-layershade{background-color:rgba(0,0,0, .7); pointer-events:auto;} -.layui-m-layermain{display:table; font-family: Helvetica, arial, sans-serif; pointer-events: none;} -.layui-m-layermain .layui-m-layersection{display:table-cell; vertical-align:middle; text-align:center;} -.layui-m-layerchild{position:relative; display:inline-block; text-align:left; background-color:#fff; font-size:14px; border-radius: 5px; box-shadow: 0 0 8px rgba(0, 0, 0, 0.1); pointer-events:auto; -webkit-overflow-scrolling: touch;} -.layui-m-layerchild{-webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration: .2s; animation-duration: .2s;} - -.layui-m-layer0 .layui-m-layerchild{width: 90%; max-width: 640px;} -.layui-m-layer1 .layui-m-layerchild{border:none; border-radius:0;} -.layui-m-layer2 .layui-m-layerchild{width:auto; max-width:260px; min-width:40px; border:none; background: none; box-shadow: none; color:#fff;} -.layui-m-layerchild h3{padding: 0 10px; height: 60px; line-height: 60px; font-size:16px; font-weight: 400; border-radius: 5px 5px 0 0; text-align: center;} -.layui-m-layerchild h3, -.layui-m-layerbtn span{ text-overflow:ellipsis; overflow:hidden; white-space:nowrap;} -.layui-m-layercont{padding: 50px 30px; line-height: 22px; text-align:center;} -.layui-m-layer1 .layui-m-layercont{padding:0; text-align:left;} -.layui-m-layer2 .layui-m-layercont{text-align:center; padding: 0; line-height: 0;} -.layui-m-layer2 .layui-m-layercont i{width:25px; height:25px; margin-left:8px; display:inline-block; background-color:#fff; border-radius:100%;} -.layui-m-layer2 .layui-m-layercont p{margin-top: 20px;} - -/* loading */ -@-webkit-keyframes layui-m-anim-loading{ - 0%,80%,100%{transform:scale(0); -webkit-transform:scale(0)} - 40%{transform:scale(1); -webkit-transform:scale(1)} -} -@keyframes layui-m-anim-loading{ - 0%,80%,100%{transform:scale(0); -webkit-transform:scale(0)} - 40%{transform:scale(1); -webkit-transform:scale(1)} -} -.layui-m-layer2 .layui-m-layercont i{-webkit-animation: layui-m-anim-loading 1.4s infinite ease-in-out; animation: layui-m-anim-loading 1.4s infinite ease-in-out; -webkit-animation-fill-mode: both; animation-fill-mode: both;} - -.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0; -webkit-animation-delay: -.32s; animation-delay: -.32s;} -.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay: -.16s; animation-delay: -.16s;} -.layui-m-layer2 .layui-m-layercont>div{line-height:22px; padding-top:7px; margin-bottom:20px; font-size: 14px;} -.layui-m-layerbtn{display: box; display: -moz-box; display: -webkit-box; width: 100%; position:relative; height: 50px; line-height: 50px; font-size: 0; text-align:center; border-top:1px solid #D0D0D0; background-color: #F2F2F2; border-radius: 0 0 5px 5px;} -.layui-m-layerbtn span{position:relative; display: block; -moz-box-flex: 1; box-flex: 1; -webkit-box-flex: 1; text-align:center; font-size:14px; border-radius: 0 0 5px 5px; cursor:pointer;} -.layui-m-layerbtn span[yes]{color: #40AFFE;} -.layui-m-layerbtn span[no]{border-right: 1px solid #D0D0D0; border-radius: 0 0 0 5px;} -.layui-m-layerbtn span:active{background-color: #F6F6F6;} -.layui-m-layerend{position:absolute; right:7px; top:10px; width:30px; height:30px; border: 0; font-weight:400; background: transparent; cursor: pointer; -webkit-appearance: none; font-size:30px;} -.layui-m-layerend::before, .layui-m-layerend::after{position:absolute; left:5px; top:15px; content:''; width:18px; height:1px; background-color:#999; transform:rotate(45deg); -webkit-transform:rotate(45deg); border-radius: 3px;} -.layui-m-layerend::after{transform:rotate(-45deg); -webkit-transform:rotate(-45deg);} - -/* 底部对话框风格 */ -body .layui-m-layer .layui-m-layer-footer{position: fixed; width: 95%; max-width: 100%; margin: 0 auto; left:0; right: 0; bottom: 10px; background: none;} -.layui-m-layer-footer .layui-m-layercont{padding: 20px; border-radius: 5px 5px 0 0; background-color: rgba(255,255,255,.8);} -.layui-m-layer-footer .layui-m-layerbtn{display: block; height: auto; background: none; border-top: none;} -.layui-m-layer-footer .layui-m-layerbtn span{background-color: rgba(255,255,255,.8);} -.layui-m-layer-footer .layui-m-layerbtn span[no]{color: #FD482C; border-top: 1px solid #c2c2c2; border-radius: 0 0 5px 5px;} -.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top: 10px; border-radius: 5px;} - -/* 通用提示 */ -body .layui-m-layer .layui-m-layer-msg{width: auto; max-width: 90%; margin: 0 auto; bottom: -150px; background-color: rgba(0,0,0,.7); color: #fff;} -.layui-m-layer-msg .layui-m-layercont{padding: 10px 20px;} - - - - diff --git a/src/lay/all-mobile.js b/src/lay/all-mobile.js deleted file mode 100644 index 3ebb7d2c..00000000 --- a/src/lay/all-mobile.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - - @Name:用于打包移动完整版 - @Author:贤心 - @License:LGPL - - */ - -layui.define(function(exports){ - exports('layui.mobile', layui.v); -}); diff --git a/src/lay/modules/layer.js b/src/lay/modules/layer.js index 8912fcce..5e18e0d9 100644 --- a/src/lay/modules/layer.js +++ b/src/lay/modules/layer.js @@ -1,6 +1,6 @@ /** - @Name:layer v3.1.2 Web弹层组件 + @Name:layer v3.2.0 Web弹层组件 @Author:贤心 @Site:http://layer.layui.com @License:MIT @@ -72,7 +72,7 @@ var isLayui = window.layui && layui.define, $, win, ready = { //默认内置方法。 var layer = { - v: '3.1.1', + v: '3.2.0', ie: function(){ //ie版本 var agent = navigator.userAgent.toLowerCase(); return (!!window.ActiveXObject || "ActiveXObject" in window) ? ( diff --git a/src/lay/modules/mobile.js b/src/lay/modules/mobile.js deleted file mode 100644 index e6f00164..00000000 --- a/src/lay/modules/mobile.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - - @Name:layui 移动模块入口 | 构建后则为移动模块集合 - @Author:贤心 - @License:MIT - - */ - - -if(!layui['layui.mobile']){ - layui.config({ - base: layui.cache.dir + 'lay/modules/mobile/' - }).extend({ - 'layer-mobile': 'layer-mobile' - ,'zepto': 'zepto' - ,'upload-mobile': 'upload-mobile' - ,'layim-mobile': 'layim-mobile' - }); -} - -layui.define([ - 'layer-mobile' - ,'zepto' - ,'layim-mobile' -], function(exports){ - exports('mobile', { - layer: layui['layer-mobile'] //弹层 - ,layim: layui['layim-mobile'] //WebIM - }); -}); \ No newline at end of file diff --git a/src/lay/modules/mobile/layer-mobile.js b/src/lay/modules/mobile/layer-mobile.js deleted file mode 100644 index 6258f329..00000000 --- a/src/lay/modules/mobile/layer-mobile.js +++ /dev/null @@ -1,189 +0,0 @@ -/*! - - @Name:layer mobile v2.0.0 (Web 弹层组件移动版) - @Author:贤心 - @Site:http://layer.layui.com/mobie/ - @License:MIT - - */ - -layui.define(function(exports){ - - "use strict"; - - var win = window, doc = document, query = 'querySelectorAll', claname = 'getElementsByClassName', S = function(s){ - return doc[query](s); - }; - - //默认配置 - var config = { - type: 0 - ,shade: true - ,shadeClose: true - ,fixed: true - ,anim: 'scale' //默认动画类型 - }; - - var ready = { - extend: function(obj){ - var newobj = JSON.parse(JSON.stringify(config)); - for(var i in obj){ - newobj[i] = obj[i]; - } - return newobj; - }, - timer: {}, end: {} - }; - - //点触事件 - ready.touch = function(elem, fn){ - elem.addEventListener('click', function(e){ - fn.call(this, e); - }, false); - }; - - var index = 0, classs = ['layui-m-layer'], Layer = function(options){ - var that = this; - that.config = ready.extend(options); - that.view(); - }; - - Layer.prototype.view = function(){ - var that = this, config = that.config, layerbox = doc.createElement('div'); - - that.id = layerbox.id = classs[0] + index; - layerbox.setAttribute('class', classs[0] + ' ' + classs[0]+(config.type || 0)); - layerbox.setAttribute('index', index); - - //标题区域 - var title = (function(){ - var titype = typeof config.title === 'object'; - return config.title - ? '

      '+ (titype ? config.title[0] : config.title) +'

      ' - : ''; - }()); - - //按钮区域 - var button = (function(){ - typeof config.btn === 'string' && (config.btn = [config.btn]); - var btns = (config.btn || []).length, btndom; - if(btns === 0 || !config.btn){ - return ''; - } - btndom = ''+ config.btn[0] +'' - if(btns === 2){ - btndom = ''+ config.btn[1] +'' + btndom; - } - return '
      '+ btndom + '
      '; - }()); - - if(!config.fixed){ - config.top = config.hasOwnProperty('top') ? config.top : 100; - config.style = config.style || ''; - config.style += ' top:'+ ( doc.body.scrollTop + config.top) + 'px'; - } - - if(config.type === 2){ - config.content = '

      '+ (config.content||'') +'

      '; - } - - if(config.skin) config.anim = 'up'; - if(config.skin === 'msg') config.shade = false; - - layerbox.innerHTML = (config.shade ? '
      ' : '') - +'
      ' - +'
      ' - +'
      ' - + title - +'
      '+ config.content +'
      ' - + button - +'
      ' - +'
      ' - +'
      '; - - if(!config.type || config.type === 2){ - var dialogs = doc[claname](classs[0] + config.type), dialen = dialogs.length; - if(dialen >= 1){ - layer.close(dialogs[0].getAttribute('index')) - } - } - - document.body.appendChild(layerbox); - var elem = that.elem = S('#'+that.id)[0]; - config.success && config.success(elem); - - that.index = index++; - that.action(config, elem); - }; - - Layer.prototype.action = function(config, elem){ - var that = this; - - //自动关闭 - if(config.time){ - ready.timer[that.index] = setTimeout(function(){ - layer.close(that.index); - }, config.time*1000); - } - - //确认取消 - var btn = function(){ - var type = this.getAttribute('type'); - if(type == 0){ - config.no && config.no(); - layer.close(that.index); - } else { - config.yes ? config.yes(that.index) : layer.close(that.index); - } - }; - if(config.btn){ - var btns = elem[claname]('layui-m-layerbtn')[0].children, btnlen = btns.length; - for(var ii = 0; ii < btnlen; ii++){ - ready.touch(btns[ii], btn); - } - } - - //点遮罩关闭 - if(config.shade && config.shadeClose){ - var shade = elem[claname]('layui-m-layershade')[0]; - ready.touch(shade, function(){ - layer.close(that.index, config.end); - }); - } - - config.end && (ready.end[that.index] = config.end); - }; - - var layer = { - v: '2.0 m', - index: index, - - //核心方法 - open: function(options){ - var o = new Layer(options || {}); - return o.index; - }, - - close: function(index){ - var ibox = S('#'+classs[0]+index)[0]; - if(!ibox) return; - ibox.innerHTML = ''; - doc.body.removeChild(ibox); - clearTimeout(ready.timer[index]); - delete ready.timer[index]; - typeof ready.end[index] === 'function' && ready.end[index](); - delete ready.end[index]; - }, - - //关闭所有layer层 - closeAll: function(){ - var boxs = doc[claname](classs[0]); - for(var i = 0, len = boxs.length; i < len; i++){ - layer.close((boxs[0].getAttribute('index')|0)); - } - } - }; - - exports('layer-mobile', layer); - -}); \ No newline at end of file diff --git a/src/lay/modules/mobile/layim-mobile-open.js b/src/lay/modules/mobile/layim-mobile-open.js deleted file mode 100644 index bd623c54..00000000 --- a/src/lay/modules/mobile/layim-mobile-open.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - - @Name:layim mobile 开源包 - @Author:贤心 - @License:MIT - - */ - -layui.define(function(exports){ - exports('layim-mobile', layui.v); -}); \ No newline at end of file diff --git a/src/lay/modules/mobile/zepto.js b/src/lay/modules/mobile/zepto.js deleted file mode 100644 index 404ec0b8..00000000 --- a/src/lay/modules/mobile/zepto.js +++ /dev/null @@ -1,1646 +0,0 @@ -/* Zepto v1.2.0 - zepto event ajax form ie - zeptojs.com/license */ - -layui.define(function(exports){ - - var Zepto = (function() { - var undefined, key, $, classList, emptyArray = [], concat = emptyArray.concat, filter = emptyArray.filter, slice = emptyArray.slice, - document = window.document, - elementDisplay = {}, classCache = {}, - cssNumber = { 'column-count': 1, 'columns': 1, 'font-weight': 1, 'line-height': 1,'opacity': 1, 'z-index': 1, 'zoom': 1 }, - fragmentRE = /^\s*<(\w+|!)[^>]*>/, - singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rootNodeRE = /^(?:body|html)$/i, - capitalRE = /([A-Z])/g, - - // special attributes that should be get/set via method calls - methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'], - - adjacencyOperators = [ 'after', 'prepend', 'before', 'append' ], - table = document.createElement('table'), - tableRow = document.createElement('tr'), - containers = { - 'tr': document.createElement('tbody'), - 'tbody': table, 'thead': table, 'tfoot': table, - 'td': tableRow, 'th': tableRow, - '*': document.createElement('div') - }, - readyRE = /complete|loaded|interactive/, - simpleSelectorRE = /^[\w-]*$/, - class2type = {}, - toString = class2type.toString, - zepto = {}, - camelize, uniq, - tempParent = document.createElement('div'), - propMap = { - 'tabindex': 'tabIndex', - 'readonly': 'readOnly', - 'for': 'htmlFor', - 'class': 'className', - 'maxlength': 'maxLength', - 'cellspacing': 'cellSpacing', - 'cellpadding': 'cellPadding', - 'rowspan': 'rowSpan', - 'colspan': 'colSpan', - 'usemap': 'useMap', - 'frameborder': 'frameBorder', - 'contenteditable': 'contentEditable' - }, - isArray = Array.isArray || - function(object){ return object instanceof Array } - - zepto.matches = function(element, selector) { - if (!selector || !element || element.nodeType !== 1) return false - var matchesSelector = element.matches || element.webkitMatchesSelector || - element.mozMatchesSelector || element.oMatchesSelector || - element.matchesSelector - if (matchesSelector) return matchesSelector.call(element, selector) - // fall back to performing a selector: - var match, parent = element.parentNode, temp = !parent - if (temp) (parent = tempParent).appendChild(element) - match = ~zepto.qsa(parent, selector).indexOf(element) - temp && tempParent.removeChild(element) - return match - } - - function type(obj) { - return obj == null ? String(obj) : - class2type[toString.call(obj)] || "object" - } - - function isFunction(value) { return type(value) == "function" } - function isWindow(obj) { return obj != null && obj == obj.window } - function isDocument(obj) { return obj != null && obj.nodeType == obj.DOCUMENT_NODE } - function isObject(obj) { return type(obj) == "object" } - function isPlainObject(obj) { - return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype - } - - function likeArray(obj) { - var length = !!obj && 'length' in obj && obj.length, - type = $.type(obj) - - return 'function' != type && !isWindow(obj) && ( - 'array' == type || length === 0 || - (typeof length == 'number' && length > 0 && (length - 1) in obj) - ) - } - - function compact(array) { return filter.call(array, function(item){ return item != null }) } - function flatten(array) { return array.length > 0 ? $.fn.concat.apply([], array) : array } - camelize = function(str){ return str.replace(/-+(.)?/g, function(match, chr){ return chr ? chr.toUpperCase() : '' }) } - function dasherize(str) { - return str.replace(/::/g, '/') - .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') - .replace(/([a-z\d])([A-Z])/g, '$1_$2') - .replace(/_/g, '-') - .toLowerCase() - } - uniq = function(array){ return filter.call(array, function(item, idx){ return array.indexOf(item) == idx }) } - - function classRE(name) { - return name in classCache ? - classCache[name] : (classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)')) - } - - function maybeAddPx(name, value) { - return (typeof value == "number" && !cssNumber[dasherize(name)]) ? value + "px" : value - } - - function defaultDisplay(nodeName) { - var element, display - if (!elementDisplay[nodeName]) { - element = document.createElement(nodeName) - document.body.appendChild(element) - display = getComputedStyle(element, '').getPropertyValue("display") - element.parentNode.removeChild(element) - display == "none" && (display = "block") - elementDisplay[nodeName] = display - } - return elementDisplay[nodeName] - } - - function children(element) { - return 'children' in element ? - slice.call(element.children) : - $.map(element.childNodes, function(node){ if (node.nodeType == 1) return node }) - } - - function Z(dom, selector) { - var i, len = dom ? dom.length : 0 - for (i = 0; i < len; i++) this[i] = dom[i] - this.length = len - this.selector = selector || '' - } - - // `$.zepto.fragment` takes a html string and an optional tag name - // to generate DOM nodes from the given html string. - // The generated DOM nodes are returned as an array. - // This function can be overridden in plugins for example to make - // it compatible with browsers that don't support the DOM fully. - zepto.fragment = function(html, name, properties) { - var dom, nodes, container - - // A special case optimization for a single tag - if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1)) - - if (!dom) { - if (html.replace) html = html.replace(tagExpanderRE, "<$1>") - if (name === undefined) name = fragmentRE.test(html) && RegExp.$1 - if (!(name in containers)) name = '*' - - container = containers[name] - container.innerHTML = '' + html - dom = $.each(slice.call(container.childNodes), function(){ - container.removeChild(this) - }) - } - - if (isPlainObject(properties)) { - nodes = $(dom) - $.each(properties, function(key, value) { - if (methodAttributes.indexOf(key) > -1) nodes[key](value) - else nodes.attr(key, value) - }) - } - - return dom - } - - // `$.zepto.Z` swaps out the prototype of the given `dom` array - // of nodes with `$.fn` and thus supplying all the Zepto functions - // to the array. This method can be overridden in plugins. - zepto.Z = function(dom, selector) { - return new Z(dom, selector) - } - - // `$.zepto.isZ` should return `true` if the given object is a Zepto - // collection. This method can be overridden in plugins. - zepto.isZ = function(object) { - return object instanceof zepto.Z - } - - // `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and - // takes a CSS selector and an optional context (and handles various - // special cases). - // This method can be overridden in plugins. - zepto.init = function(selector, context) { - var dom - // If nothing given, return an empty Zepto collection - if (!selector) return zepto.Z() - // Optimize for string selectors - else if (typeof selector == 'string') { - selector = selector.trim() - // If it's a html fragment, create nodes from it - // Note: In both Chrome 21 and Firefox 15, DOM error 12 - // is thrown if the fragment doesn't begin with < - if (selector[0] == '<' && fragmentRE.test(selector)) - dom = zepto.fragment(selector, RegExp.$1, context), selector = null - // If there's a context, create a collection on that context first, and select - // nodes from there - else if (context !== undefined) return $(context).find(selector) - // If it's a CSS selector, use it to select nodes. - else dom = zepto.qsa(document, selector) - } - // If a function is given, call it when the DOM is ready - else if (isFunction(selector)) return $(document).ready(selector) - // If a Zepto collection is given, just return it - else if (zepto.isZ(selector)) return selector - else { - // normalize array if an array of nodes is given - if (isArray(selector)) dom = compact(selector) - // Wrap DOM nodes. - else if (isObject(selector)) - dom = [selector], selector = null - // If it's a html fragment, create nodes from it - else if (fragmentRE.test(selector)) - dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null - // If there's a context, create a collection on that context first, and select - // nodes from there - else if (context !== undefined) return $(context).find(selector) - // And last but no least, if it's a CSS selector, use it to select nodes. - else dom = zepto.qsa(document, selector) - } - // create a new Zepto collection from the nodes found - return zepto.Z(dom, selector) - } - - // `$` will be the base `Zepto` object. When calling this - // function just call `$.zepto.init, which makes the implementation - // details of selecting nodes and creating Zepto collections - // patchable in plugins. - $ = function(selector, context){ - return zepto.init(selector, context) - } - - function extend(target, source, deep) { - for (key in source) - if (deep && (isPlainObject(source[key]) || isArray(source[key]))) { - if (isPlainObject(source[key]) && !isPlainObject(target[key])) - target[key] = {} - if (isArray(source[key]) && !isArray(target[key])) - target[key] = [] - extend(target[key], source[key], deep) - } - else if (source[key] !== undefined) target[key] = source[key] - } - - // Copy all but undefined properties from one or more - // objects to the `target` object. - $.extend = function(target){ - var deep, args = slice.call(arguments, 1) - if (typeof target == 'boolean') { - deep = target - target = args.shift() - } - args.forEach(function(arg){ extend(target, arg, deep) }) - return target - } - - // `$.zepto.qsa` is Zepto's CSS selector implementation which - // uses `document.querySelectorAll` and optimizes for some special cases, like `#id`. - // This method can be overridden in plugins. - zepto.qsa = function(element, selector){ - var found, - maybeID = selector[0] == '#', - maybeClass = !maybeID && selector[0] == '.', - nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, // Ensure that a 1 char tag name still gets checked - isSimple = simpleSelectorRE.test(nameOnly) - return (element.getElementById && isSimple && maybeID) ? // Safari DocumentFragment doesn't have getElementById - ( (found = element.getElementById(nameOnly)) ? [found] : [] ) : - (element.nodeType !== 1 && element.nodeType !== 9 && element.nodeType !== 11) ? [] : - slice.call( - isSimple && !maybeID && element.getElementsByClassName ? // DocumentFragment doesn't have getElementsByClassName/TagName - maybeClass ? element.getElementsByClassName(nameOnly) : // If it's simple, it could be a class - element.getElementsByTagName(selector) : // Or a tag - element.querySelectorAll(selector) // Or it's not simple, and we need to query all - ) - } - - function filtered(nodes, selector) { - return selector == null ? $(nodes) : $(nodes).filter(selector) - } - - $.contains = document.documentElement.contains ? - function(parent, node) { - return parent !== node && parent.contains(node) - } : - function(parent, node) { - while (node && (node = node.parentNode)) - if (node === parent) return true - return false - } - - function funcArg(context, arg, idx, payload) { - return isFunction(arg) ? arg.call(context, idx, payload) : arg - } - - function setAttribute(node, name, value) { - value == null ? node.removeAttribute(name) : node.setAttribute(name, value) - } - - // access className property while respecting SVGAnimatedString - function className(node, value){ - var klass = node.className || '', - svg = klass && klass.baseVal !== undefined - - if (value === undefined) return svg ? klass.baseVal : klass - svg ? (klass.baseVal = value) : (node.className = value) - } - - // "true" => true - // "false" => false - // "null" => null - // "42" => 42 - // "42.5" => 42.5 - // "08" => "08" - // JSON => parse if valid - // String => self - function deserializeValue(value) { - try { - return value ? - value == "true" || - ( value == "false" ? false : - value == "null" ? null : - +value + "" == value ? +value : - /^[\[\{]/.test(value) ? $.parseJSON(value) : - value ) - : value - } catch(e) { - return value - } - } - - $.type = type - $.isFunction = isFunction - $.isWindow = isWindow - $.isArray = isArray - $.isPlainObject = isPlainObject - - $.isEmptyObject = function(obj) { - var name - for (name in obj) return false - return true - } - - $.isNumeric = function(val) { - var num = Number(val), type = typeof val - return val != null && type != 'boolean' && - (type != 'string' || val.length) && - !isNaN(num) && isFinite(num) || false - } - - $.inArray = function(elem, array, i){ - return emptyArray.indexOf.call(array, elem, i) - } - - $.camelCase = camelize - $.trim = function(str) { - return str == null ? "" : String.prototype.trim.call(str) - } - - // plugin compatibility - $.uuid = 0 - $.support = { } - $.expr = { } - $.noop = function() {} - - $.map = function(elements, callback){ - var value, values = [], i, key - if (likeArray(elements)) - for (i = 0; i < elements.length; i++) { - value = callback(elements[i], i) - if (value != null) values.push(value) - } - else - for (key in elements) { - value = callback(elements[key], key) - if (value != null) values.push(value) - } - return flatten(values) - } - - $.each = function(elements, callback){ - var i, key - if (likeArray(elements)) { - for (i = 0; i < elements.length; i++) - if (callback.call(elements[i], i, elements[i]) === false) return elements - } else { - for (key in elements) - if (callback.call(elements[key], key, elements[key]) === false) return elements - } - - return elements - } - - $.grep = function(elements, callback){ - return filter.call(elements, callback) - } - - if (window.JSON) $.parseJSON = JSON.parse - - // Populate the class2type map - $.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase() - }) - - // Define methods that will be available on all - // Zepto collections - $.fn = { - constructor: zepto.Z, - length: 0, - - // Because a collection acts like an array - // copy over these useful array functions. - forEach: emptyArray.forEach, - reduce: emptyArray.reduce, - push: emptyArray.push, - sort: emptyArray.sort, - splice: emptyArray.splice, - indexOf: emptyArray.indexOf, - concat: function(){ - var i, value, args = [] - for (i = 0; i < arguments.length; i++) { - value = arguments[i] - args[i] = zepto.isZ(value) ? value.toArray() : value - } - return concat.apply(zepto.isZ(this) ? this.toArray() : this, args) - }, - - // `map` and `slice` in the jQuery API work differently - // from their array counterparts - map: function(fn){ - return $($.map(this, function(el, i){ return fn.call(el, i, el) })) - }, - slice: function(){ - return $(slice.apply(this, arguments)) - }, - - ready: function(callback){ - // need to check if document.body exists for IE as that browser reports - // document ready when it hasn't yet created the body element - if (readyRE.test(document.readyState) && document.body) callback($) - else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false) - return this - }, - get: function(idx){ - return idx === undefined ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length] - }, - toArray: function(){ return this.get() }, - size: function(){ - return this.length - }, - remove: function(){ - return this.each(function(){ - if (this.parentNode != null) - this.parentNode.removeChild(this) - }) - }, - each: function(callback){ - emptyArray.every.call(this, function(el, idx){ - return callback.call(el, idx, el) !== false - }) - return this - }, - filter: function(selector){ - if (isFunction(selector)) return this.not(this.not(selector)) - return $(filter.call(this, function(element){ - return zepto.matches(element, selector) - })) - }, - add: function(selector,context){ - return $(uniq(this.concat($(selector,context)))) - }, - is: function(selector){ - return this.length > 0 && zepto.matches(this[0], selector) - }, - not: function(selector){ - var nodes=[] - if (isFunction(selector) && selector.call !== undefined) - this.each(function(idx){ - if (!selector.call(this,idx)) nodes.push(this) - }) - else { - var excludes = typeof selector == 'string' ? this.filter(selector) : - (likeArray(selector) && isFunction(selector.item)) ? slice.call(selector) : $(selector) - this.forEach(function(el){ - if (excludes.indexOf(el) < 0) nodes.push(el) - }) - } - return $(nodes) - }, - has: function(selector){ - return this.filter(function(){ - return isObject(selector) ? - $.contains(this, selector) : - $(this).find(selector).size() - }) - }, - eq: function(idx){ - return idx === -1 ? this.slice(idx) : this.slice(idx, + idx + 1) - }, - first: function(){ - var el = this[0] - return el && !isObject(el) ? el : $(el) - }, - last: function(){ - var el = this[this.length - 1] - return el && !isObject(el) ? el : $(el) - }, - find: function(selector){ - var result, $this = this - if (!selector) result = $() - else if (typeof selector == 'object') - result = $(selector).filter(function(){ - var node = this - return emptyArray.some.call($this, function(parent){ - return $.contains(parent, node) - }) - }) - else if (this.length == 1) result = $(zepto.qsa(this[0], selector)) - else result = this.map(function(){ return zepto.qsa(this, selector) }) - return result - }, - closest: function(selector, context){ - var nodes = [], collection = typeof selector == 'object' && $(selector) - this.each(function(_, node){ - while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector))) - node = node !== context && !isDocument(node) && node.parentNode - if (node && nodes.indexOf(node) < 0) nodes.push(node) - }) - return $(nodes) - }, - parents: function(selector){ - var ancestors = [], nodes = this - while (nodes.length > 0) - nodes = $.map(nodes, function(node){ - if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) { - ancestors.push(node) - return node - } - }) - return filtered(ancestors, selector) - }, - parent: function(selector){ - return filtered(uniq(this.pluck('parentNode')), selector) - }, - children: function(selector){ - return filtered(this.map(function(){ return children(this) }), selector) - }, - contents: function() { - return this.map(function() { return this.contentDocument || slice.call(this.childNodes) }) - }, - siblings: function(selector){ - return filtered(this.map(function(i, el){ - return filter.call(children(el.parentNode), function(child){ return child!==el }) - }), selector) - }, - empty: function(){ - return this.each(function(){ this.innerHTML = '' }) - }, - // `pluck` is borrowed from Prototype.js - pluck: function(property){ - return $.map(this, function(el){ return el[property] }) - }, - show: function(){ - return this.each(function(){ - this.style.display == "none" && (this.style.display = '') - if (getComputedStyle(this, '').getPropertyValue("display") == "none") - this.style.display = defaultDisplay(this.nodeName) - }) - }, - replaceWith: function(newContent){ - return this.before(newContent).remove() - }, - wrap: function(structure){ - var func = isFunction(structure) - if (this[0] && !func) - var dom = $(structure).get(0), - clone = dom.parentNode || this.length > 1 - - return this.each(function(index){ - $(this).wrapAll( - func ? structure.call(this, index) : - clone ? dom.cloneNode(true) : dom - ) - }) - }, - wrapAll: function(structure){ - if (this[0]) { - $(this[0]).before(structure = $(structure)) - var children - // drill down to the inmost element - while ((children = structure.children()).length) structure = children.first() - $(structure).append(this) - } - return this - }, - wrapInner: function(structure){ - var func = isFunction(structure) - return this.each(function(index){ - var self = $(this), contents = self.contents(), - dom = func ? structure.call(this, index) : structure - contents.length ? contents.wrapAll(dom) : self.append(dom) - }) - }, - unwrap: function(){ - this.parent().each(function(){ - $(this).replaceWith($(this).children()) - }) - return this - }, - clone: function(){ - return this.map(function(){ return this.cloneNode(true) }) - }, - hide: function(){ - return this.css("display", "none") - }, - toggle: function(setting){ - return this.each(function(){ - var el = $(this) - ;(setting === undefined ? el.css("display") == "none" : setting) ? el.show() : el.hide() - }) - }, - prev: function(selector){ return $(this.pluck('previousElementSibling')).filter(selector || '*') }, - next: function(selector){ return $(this.pluck('nextElementSibling')).filter(selector || '*') }, - html: function(html){ - return 0 in arguments ? - this.each(function(idx){ - var originHtml = this.innerHTML - $(this).empty().append( funcArg(this, html, idx, originHtml) ) - }) : - (0 in this ? this[0].innerHTML : null) - }, - text: function(text){ - return 0 in arguments ? - this.each(function(idx){ - var newText = funcArg(this, text, idx, this.textContent) - this.textContent = newText == null ? '' : ''+newText - }) : - (0 in this ? this.pluck('textContent').join("") : null) - }, - attr: function(name, value){ - var result - return (typeof name == 'string' && !(1 in arguments)) ? - (0 in this && this[0].nodeType == 1 && (result = this[0].getAttribute(name)) != null ? result : undefined) : - this.each(function(idx){ - if (this.nodeType !== 1) return - if (isObject(name)) for (key in name) setAttribute(this, key, name[key]) - else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name))) - }) - }, - removeAttr: function(name){ - return this.each(function(){ this.nodeType === 1 && name.split(' ').forEach(function(attribute){ - setAttribute(this, attribute) - }, this)}) - }, - prop: function(name, value){ - name = propMap[name] || name - return (1 in arguments) ? - this.each(function(idx){ - this[name] = funcArg(this, value, idx, this[name]) - }) : - (this[0] && this[0][name]) - }, - removeProp: function(name){ - name = propMap[name] || name - return this.each(function(){ delete this[name] }) - }, - data: function(name, value){ - var attrName = 'data-' + name.replace(capitalRE, '-$1').toLowerCase() - - var data = (1 in arguments) ? - this.attr(attrName, value) : - this.attr(attrName) - - return data !== null ? deserializeValue(data) : undefined - }, - val: function(value){ - if (0 in arguments) { - if (value == null) value = "" - return this.each(function(idx){ - this.value = funcArg(this, value, idx, this.value) - }) - } else { - return this[0] && (this[0].multiple ? - $(this[0]).find('option').filter(function(){ return this.selected }).pluck('value') : - this[0].value) - } - }, - offset: function(coordinates){ - if (coordinates) return this.each(function(index){ - var $this = $(this), - coords = funcArg(this, coordinates, index, $this.offset()), - parentOffset = $this.offsetParent().offset(), - props = { - top: coords.top - parentOffset.top, - left: coords.left - parentOffset.left - } - - if ($this.css('position') == 'static') props['position'] = 'relative' - $this.css(props) - }) - if (!this.length) return null - if (document.documentElement !== this[0] && !$.contains(document.documentElement, this[0])) - return {top: 0, left: 0} - var obj = this[0].getBoundingClientRect() - return { - left: obj.left + window.pageXOffset, - top: obj.top + window.pageYOffset, - width: Math.round(obj.width), - height: Math.round(obj.height) - } - }, - css: function(property, value){ - if (arguments.length < 2) { - var element = this[0] - if (typeof property == 'string') { - if (!element) return - return element.style[camelize(property)] || getComputedStyle(element, '').getPropertyValue(property) - } else if (isArray(property)) { - if (!element) return - var props = {} - var computedStyle = getComputedStyle(element, '') - $.each(property, function(_, prop){ - props[prop] = (element.style[camelize(prop)] || computedStyle.getPropertyValue(prop)) - }) - return props - } - } - - var css = '' - if (type(property) == 'string') { - if (!value && value !== 0) - this.each(function(){ this.style.removeProperty(dasherize(property)) }) - else - css = dasherize(property) + ":" + maybeAddPx(property, value) - } else { - for (key in property) - if (!property[key] && property[key] !== 0) - this.each(function(){ this.style.removeProperty(dasherize(key)) }) - else - css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';' - } - - return this.each(function(){ this.style.cssText += ';' + css }) - }, - index: function(element){ - return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0]) - }, - hasClass: function(name){ - if (!name) return false - return emptyArray.some.call(this, function(el){ - return this.test(className(el)) - }, classRE(name)) - }, - addClass: function(name){ - if (!name) return this - return this.each(function(idx){ - if (!('className' in this)) return - classList = [] - var cls = className(this), newName = funcArg(this, name, idx, cls) - newName.split(/\s+/g).forEach(function(klass){ - if (!$(this).hasClass(klass)) classList.push(klass) - }, this) - classList.length && className(this, cls + (cls ? " " : "") + classList.join(" ")) - }) - }, - removeClass: function(name){ - return this.each(function(idx){ - if (!('className' in this)) return - if (name === undefined) return className(this, '') - classList = className(this) - funcArg(this, name, idx, classList).split(/\s+/g).forEach(function(klass){ - classList = classList.replace(classRE(klass), " ") - }) - className(this, classList.trim()) - }) - }, - toggleClass: function(name, when){ - if (!name) return this - return this.each(function(idx){ - var $this = $(this), names = funcArg(this, name, idx, className(this)) - names.split(/\s+/g).forEach(function(klass){ - (when === undefined ? !$this.hasClass(klass) : when) ? - $this.addClass(klass) : $this.removeClass(klass) - }) - }) - }, - scrollTop: function(value){ - if (!this.length) return - var hasScrollTop = 'scrollTop' in this[0] - if (value === undefined) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset - return this.each(hasScrollTop ? - function(){ this.scrollTop = value } : - function(){ this.scrollTo(this.scrollX, value) }) - }, - scrollLeft: function(value){ - if (!this.length) return - var hasScrollLeft = 'scrollLeft' in this[0] - if (value === undefined) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset - return this.each(hasScrollLeft ? - function(){ this.scrollLeft = value } : - function(){ this.scrollTo(value, this.scrollY) }) - }, - position: function() { - if (!this.length) return - - var elem = this[0], - // Get *real* offsetParent - offsetParent = this.offsetParent(), - // Get correct offsets - offset = this.offset(), - parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset() - - // Subtract element margins - // note: when an element has margin: auto the offsetLeft and marginLeft - // are the same in Safari causing offset.left to incorrectly be 0 - offset.top -= parseFloat( $(elem).css('margin-top') ) || 0 - offset.left -= parseFloat( $(elem).css('margin-left') ) || 0 - - // Add offsetParent borders - parentOffset.top += parseFloat( $(offsetParent[0]).css('border-top-width') ) || 0 - parentOffset.left += parseFloat( $(offsetParent[0]).css('border-left-width') ) || 0 - - // Subtract the two offsets - return { - top: offset.top - parentOffset.top, - left: offset.left - parentOffset.left - } - }, - offsetParent: function() { - return this.map(function(){ - var parent = this.offsetParent || document.body - while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css("position") == "static") - parent = parent.offsetParent - return parent - }) - } - } - - // for now - $.fn.detach = $.fn.remove - - // Generate the `width` and `height` functions - ;['width', 'height'].forEach(function(dimension){ - var dimensionProperty = - dimension.replace(/./, function(m){ return m[0].toUpperCase() }) - - $.fn[dimension] = function(value){ - var offset, el = this[0] - if (value === undefined) return isWindow(el) ? el['inner' + dimensionProperty] : - isDocument(el) ? el.documentElement['scroll' + dimensionProperty] : - (offset = this.offset()) && offset[dimension] - else return this.each(function(idx){ - el = $(this) - el.css(dimension, funcArg(this, value, idx, el[dimension]())) - }) - } - }) - - function traverseNode(node, fun) { - fun(node) - for (var i = 0, len = node.childNodes.length; i < len; i++) - traverseNode(node.childNodes[i], fun) - } - - // Generate the `after`, `prepend`, `before`, `append`, - // `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods. - adjacencyOperators.forEach(function(operator, operatorIndex) { - var inside = operatorIndex % 2 //=> prepend, append - - $.fn[operator] = function(){ - // arguments can be nodes, arrays of nodes, Zepto objects and HTML strings - var argType, nodes = $.map(arguments, function(arg) { - var arr = [] - argType = type(arg) - if (argType == "array") { - arg.forEach(function(el) { - if (el.nodeType !== undefined) return arr.push(el) - else if ($.zepto.isZ(el)) return arr = arr.concat(el.get()) - arr = arr.concat(zepto.fragment(el)) - }) - return arr - } - return argType == "object" || arg == null ? - arg : zepto.fragment(arg) - }), - parent, copyByClone = this.length > 1 - if (nodes.length < 1) return this - - return this.each(function(_, target){ - parent = inside ? target : target.parentNode - - // convert all methods to a "before" operation - target = operatorIndex == 0 ? target.nextSibling : - operatorIndex == 1 ? target.firstChild : - operatorIndex == 2 ? target : - null - - var parentInDocument = $.contains(document.documentElement, parent) - - nodes.forEach(function(node){ - if (copyByClone) node = node.cloneNode(true) - else if (!parent) return $(node).remove() - - parent.insertBefore(node, target) - if (parentInDocument) traverseNode(node, function(el){ - if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' && - (!el.type || el.type === 'text/javascript') && !el.src){ - var target = el.ownerDocument ? el.ownerDocument.defaultView : window - target['eval'].call(target, el.innerHTML) - } - }) - }) - }) - } - - // after => insertAfter - // prepend => prependTo - // before => insertBefore - // append => appendTo - $.fn[inside ? operator+'To' : 'insert'+(operatorIndex ? 'Before' : 'After')] = function(html){ - $(html)[operator](this) - return this - } - }) - - zepto.Z.prototype = Z.prototype = $.fn - - // Export internal API functions in the `$.zepto` namespace - zepto.uniq = uniq - zepto.deserializeValue = deserializeValue - $.zepto = zepto - - return $ -})() - -;(function($){ - var _zid = 1, undefined, - slice = Array.prototype.slice, - isFunction = $.isFunction, - isString = function(obj){ return typeof obj == 'string' }, - handlers = {}, - specialEvents={}, - focusinSupported = 'onfocusin' in window, - focus = { focus: 'focusin', blur: 'focusout' }, - hover = { mouseenter: 'mouseover', mouseleave: 'mouseout' } - - specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents' - - function zid(element) { - return element._zid || (element._zid = _zid++) - } - function findHandlers(element, event, fn, selector) { - event = parse(event) - if (event.ns) var matcher = matcherFor(event.ns) - return (handlers[zid(element)] || []).filter(function(handler) { - return handler - && (!event.e || handler.e == event.e) - && (!event.ns || matcher.test(handler.ns)) - && (!fn || zid(handler.fn) === zid(fn)) - && (!selector || handler.sel == selector) - }) - } - function parse(event) { - var parts = ('' + event).split('.') - return {e: parts[0], ns: parts.slice(1).sort().join(' ')} - } - function matcherFor(ns) { - return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)') - } - - function eventCapture(handler, captureSetting) { - return handler.del && - (!focusinSupported && (handler.e in focus)) || - !!captureSetting - } - - function realEvent(type) { - return hover[type] || (focusinSupported && focus[type]) || type - } - - function add(element, events, fn, data, selector, delegator, capture){ - var id = zid(element), set = (handlers[id] || (handlers[id] = [])) - events.split(/\s/).forEach(function(event){ - if (event == 'ready') return $(document).ready(fn) - var handler = parse(event) - handler.fn = fn - handler.sel = selector - // emulate mouseenter, mouseleave - if (handler.e in hover) fn = function(e){ - var related = e.relatedTarget - if (!related || (related !== this && !$.contains(this, related))) - return handler.fn.apply(this, arguments) - } - handler.del = delegator - var callback = delegator || fn - handler.proxy = function(e){ - e = compatible(e) - if (e.isImmediatePropagationStopped()) return - e.data = data - var result = callback.apply(element, e._args == undefined ? [e] : [e].concat(e._args)) - if (result === false) e.preventDefault(), e.stopPropagation() - return result - } - handler.i = set.length - set.push(handler) - if ('addEventListener' in element) - element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture)) - }) - } - function remove(element, events, fn, selector, capture){ - var id = zid(element) - ;(events || '').split(/\s/).forEach(function(event){ - findHandlers(element, event, fn, selector).forEach(function(handler){ - delete handlers[id][handler.i] - if ('removeEventListener' in element) - element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture)) - }) - }) - } - - $.event = { add: add, remove: remove } - - $.proxy = function(fn, context) { - var args = (2 in arguments) && slice.call(arguments, 2) - if (isFunction(fn)) { - var proxyFn = function(){ return fn.apply(context, args ? args.concat(slice.call(arguments)) : arguments) } - proxyFn._zid = zid(fn) - return proxyFn - } else if (isString(context)) { - if (args) { - args.unshift(fn[context], fn) - return $.proxy.apply(null, args) - } else { - return $.proxy(fn[context], fn) - } - } else { - throw new TypeError("expected function") - } - } - - $.fn.bind = function(event, data, callback){ - return this.on(event, data, callback) - } - $.fn.unbind = function(event, callback){ - return this.off(event, callback) - } - $.fn.one = function(event, selector, data, callback){ - return this.on(event, selector, data, callback, 1) - } - - var returnTrue = function(){return true}, - returnFalse = function(){return false}, - ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/, - eventMethods = { - preventDefault: 'isDefaultPrevented', - stopImmediatePropagation: 'isImmediatePropagationStopped', - stopPropagation: 'isPropagationStopped' - } - - function compatible(event, source) { - if (source || !event.isDefaultPrevented) { - source || (source = event) - - $.each(eventMethods, function(name, predicate) { - var sourceMethod = source[name] - event[name] = function(){ - this[predicate] = returnTrue - return sourceMethod && sourceMethod.apply(source, arguments) - } - event[predicate] = returnFalse - }) - - event.timeStamp || (event.timeStamp = Date.now()) - - if (source.defaultPrevented !== undefined ? source.defaultPrevented : - 'returnValue' in source ? source.returnValue === false : - source.getPreventDefault && source.getPreventDefault()) - event.isDefaultPrevented = returnTrue - } - return event - } - - function createProxy(event) { - var key, proxy = { originalEvent: event } - for (key in event) - if (!ignoreProperties.test(key) && event[key] !== undefined) proxy[key] = event[key] - - return compatible(proxy, event) - } - - $.fn.delegate = function(selector, event, callback){ - return this.on(event, selector, callback) - } - $.fn.undelegate = function(selector, event, callback){ - return this.off(event, selector, callback) - } - - $.fn.live = function(event, callback){ - $(document.body).delegate(this.selector, event, callback) - return this - } - $.fn.die = function(event, callback){ - $(document.body).undelegate(this.selector, event, callback) - return this - } - - $.fn.on = function(event, selector, data, callback, one){ - var autoRemove, delegator, $this = this - if (event && !isString(event)) { - $.each(event, function(type, fn){ - $this.on(type, selector, data, fn, one) - }) - return $this - } - - if (!isString(selector) && !isFunction(callback) && callback !== false) - callback = data, data = selector, selector = undefined - if (callback === undefined || data === false) - callback = data, data = undefined - - if (callback === false) callback = returnFalse - - return $this.each(function(_, element){ - if (one) autoRemove = function(e){ - remove(element, e.type, callback) - return callback.apply(this, arguments) - } - - if (selector) delegator = function(e){ - var evt, match = $(e.target).closest(selector, element).get(0) - if (match && match !== element) { - evt = $.extend(createProxy(e), {currentTarget: match, liveFired: element}) - return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1))) - } - } - - add(element, event, callback, data, selector, delegator || autoRemove) - }) - } - $.fn.off = function(event, selector, callback){ - var $this = this - if (event && !isString(event)) { - $.each(event, function(type, fn){ - $this.off(type, selector, fn) - }) - return $this - } - - if (!isString(selector) && !isFunction(callback) && callback !== false) - callback = selector, selector = undefined - - if (callback === false) callback = returnFalse - - return $this.each(function(){ - remove(this, event, callback, selector) - }) - } - - $.fn.trigger = function(event, args){ - event = (isString(event) || $.isPlainObject(event)) ? $.Event(event) : compatible(event) - event._args = args - return this.each(function(){ - // handle focus(), blur() by calling them directly - if (event.type in focus && typeof this[event.type] == "function") this[event.type]() - // items in the collection might not be DOM elements - else if ('dispatchEvent' in this) this.dispatchEvent(event) - else $(this).triggerHandler(event, args) - }) - } - - // triggers event handlers on current element just as if an event occurred, - // doesn't trigger an actual event, doesn't bubble - $.fn.triggerHandler = function(event, args){ - var e, result - this.each(function(i, element){ - e = createProxy(isString(event) ? $.Event(event) : event) - e._args = args - e.target = element - $.each(findHandlers(element, event.type || event), function(i, handler){ - result = handler.proxy(e) - if (e.isImmediatePropagationStopped()) return false - }) - }) - return result - } - - // shortcut methods for `.bind(event, fn)` for each event type - ;('focusin focusout focus blur load resize scroll unload click dblclick '+ - 'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave '+ - 'change select keydown keypress keyup error').split(' ').forEach(function(event) { - $.fn[event] = function(callback) { - return (0 in arguments) ? - this.bind(event, callback) : - this.trigger(event) - } - }) - - $.Event = function(type, props) { - if (!isString(type)) props = type, type = props.type - var event = document.createEvent(specialEvents[type] || 'Events'), bubbles = true - if (props) for (var name in props) (name == 'bubbles') ? (bubbles = !!props[name]) : (event[name] = props[name]) - event.initEvent(type, bubbles, true) - return compatible(event) - } - -})(Zepto) - -;(function($){ - var jsonpID = +new Date(), - document = window.document, - key, - name, - rscript = /)<[^<]*)*<\/script>/gi, - scriptTypeRE = /^(?:text|application)\/javascript/i, - xmlTypeRE = /^(?:text|application)\/xml/i, - jsonType = 'application/json', - htmlType = 'text/html', - blankRE = /^\s*$/, - originAnchor = document.createElement('a') - - originAnchor.href = window.location.href - - // trigger a custom event and return false if it was cancelled - function triggerAndReturn(context, eventName, data) { - var event = $.Event(eventName) - $(context).trigger(event, data) - return !event.isDefaultPrevented() - } - - // trigger an Ajax "global" event - function triggerGlobal(settings, context, eventName, data) { - if (settings.global) return triggerAndReturn(context || document, eventName, data) - } - - // Number of active Ajax requests - $.active = 0 - - function ajaxStart(settings) { - if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart') - } - function ajaxStop(settings) { - if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop') - } - - // triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable - function ajaxBeforeSend(xhr, settings) { - var context = settings.context - if (settings.beforeSend.call(context, xhr, settings) === false || - triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false) - return false - - triggerGlobal(settings, context, 'ajaxSend', [xhr, settings]) - } - function ajaxSuccess(data, xhr, settings, deferred) { - var context = settings.context, status = 'success' - settings.success.call(context, data, status, xhr) - if (deferred) deferred.resolveWith(context, [data, status, xhr]) - triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data]) - ajaxComplete(status, xhr, settings) - } - // type: "timeout", "error", "abort", "parsererror" - function ajaxError(error, type, xhr, settings, deferred) { - var context = settings.context - settings.error.call(context, xhr, type, error) - if (deferred) deferred.rejectWith(context, [xhr, type, error]) - triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type]) - ajaxComplete(type, xhr, settings) - } - // status: "success", "notmodified", "error", "timeout", "abort", "parsererror" - function ajaxComplete(status, xhr, settings) { - var context = settings.context - settings.complete.call(context, xhr, status) - triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings]) - ajaxStop(settings) - } - - function ajaxDataFilter(data, type, settings) { - if (settings.dataFilter == empty) return data - var context = settings.context - return settings.dataFilter.call(context, data, type) - } - - // Empty function, used as default callback - function empty() {} - - $.ajaxJSONP = function(options, deferred){ - if (!('type' in options)) return $.ajax(options) - - var _callbackName = options.jsonpCallback, - callbackName = ($.isFunction(_callbackName) ? - _callbackName() : _callbackName) || ('Zepto' + (jsonpID++)), - script = document.createElement('script'), - originalCallback = window[callbackName], - responseData, - abort = function(errorType) { - $(script).triggerHandler('error', errorType || 'abort') - }, - xhr = { abort: abort }, abortTimeout - - if (deferred) deferred.promise(xhr) - - $(script).on('load error', function(e, errorType){ - clearTimeout(abortTimeout) - $(script).off().remove() - - if (e.type == 'error' || !responseData) { - ajaxError(null, errorType || 'error', xhr, options, deferred) - } else { - ajaxSuccess(responseData[0], xhr, options, deferred) - } - - window[callbackName] = originalCallback - if (responseData && $.isFunction(originalCallback)) - originalCallback(responseData[0]) - - originalCallback = responseData = undefined - }) - - if (ajaxBeforeSend(xhr, options) === false) { - abort('abort') - return xhr - } - - window[callbackName] = function(){ - responseData = arguments - } - - script.src = options.url.replace(/\?(.+)=\?/, '?$1=' + callbackName) - document.head.appendChild(script) - - if (options.timeout > 0) abortTimeout = setTimeout(function(){ - abort('timeout') - }, options.timeout) - - return xhr - } - - $.ajaxSettings = { - // Default type of request - type: 'GET', - // Callback that is executed before request - beforeSend: empty, - // Callback that is executed if the request succeeds - success: empty, - // Callback that is executed the the server drops error - error: empty, - // Callback that is executed on request complete (both: error and success) - complete: empty, - // The context for the callbacks - context: null, - // Whether to trigger "global" Ajax events - global: true, - // Transport - xhr: function () { - return new window.XMLHttpRequest() - }, - // MIME types mapping - // IIS returns Javascript as "application/x-javascript" - accepts: { - script: 'text/javascript, application/javascript, application/x-javascript', - json: jsonType, - xml: 'application/xml, text/xml', - html: htmlType, - text: 'text/plain' - }, - // Whether the request is to another domain - crossDomain: false, - // Default timeout - timeout: 0, - // Whether data should be serialized to string - processData: true, - // Whether the browser should be allowed to cache GET responses - cache: true, - //Used to handle the raw response data of XMLHttpRequest. - //This is a pre-filtering function to sanitize the response. - //The sanitized response should be returned - dataFilter: empty - } - - function mimeToDataType(mime) { - if (mime) mime = mime.split(';', 2)[0] - return mime && ( mime == htmlType ? 'html' : - mime == jsonType ? 'json' : - scriptTypeRE.test(mime) ? 'script' : - xmlTypeRE.test(mime) && 'xml' ) || 'text' - } - - function appendQuery(url, query) { - if (query == '') return url - return (url + '&' + query).replace(/[&?]{1,2}/, '?') - } - - // serialize payload and append it to the URL for GET requests - function serializeData(options) { - if (options.processData && options.data && $.type(options.data) != "string") - options.data = $.param(options.data, options.traditional) - if (options.data && (!options.type || options.type.toUpperCase() == 'GET' || 'jsonp' == options.dataType)) - options.url = appendQuery(options.url, options.data), options.data = undefined - } - - $.ajax = function(options){ - var settings = $.extend({}, options || {}), - deferred = $.Deferred && $.Deferred(), - urlAnchor, hashIndex - for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key] - - ajaxStart(settings) - - if (!settings.crossDomain) { - urlAnchor = document.createElement('a') - urlAnchor.href = settings.url - // cleans up URL for .href (IE only), see https://github.com/madrobby/zepto/pull/1049 - urlAnchor.href = urlAnchor.href - settings.crossDomain = (originAnchor.protocol + '//' + originAnchor.host) !== (urlAnchor.protocol + '//' + urlAnchor.host) - } - - if (!settings.url) settings.url = window.location.toString() - if ((hashIndex = settings.url.indexOf('#')) > -1) settings.url = settings.url.slice(0, hashIndex) - serializeData(settings) - - var dataType = settings.dataType, hasPlaceholder = /\?.+=\?/.test(settings.url) - if (hasPlaceholder) dataType = 'jsonp' - - if (settings.cache === false || ( - (!options || options.cache !== true) && - ('script' == dataType || 'jsonp' == dataType) - )) - settings.url = appendQuery(settings.url, '_=' + Date.now()) - - if ('jsonp' == dataType) { - if (!hasPlaceholder) - settings.url = appendQuery(settings.url, - settings.jsonp ? (settings.jsonp + '=?') : settings.jsonp === false ? '' : 'callback=?') - return $.ajaxJSONP(settings, deferred) - } - - var mime = settings.accepts[dataType], - headers = { }, - setHeader = function(name, value) { headers[name.toLowerCase()] = [name, value] }, - protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol, - xhr = settings.xhr(), - nativeSetHeader = xhr.setRequestHeader, - abortTimeout - - if (deferred) deferred.promise(xhr) - - if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest') - setHeader('Accept', mime || '*/*') - if (mime = settings.mimeType || mime) { - if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0] - xhr.overrideMimeType && xhr.overrideMimeType(mime) - } - if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET')) - setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded') - - if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name]) - xhr.setRequestHeader = setHeader - - xhr.onreadystatechange = function(){ - if (xhr.readyState == 4) { - xhr.onreadystatechange = empty - clearTimeout(abortTimeout) - var result, error = false - if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) { - dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type')) - - if (xhr.responseType == 'arraybuffer' || xhr.responseType == 'blob') - result = xhr.response - else { - result = xhr.responseText - - try { - // http://perfectionkills.com/global-eval-what-are-the-options/ - // sanitize response accordingly if data filter callback provided - result = ajaxDataFilter(result, dataType, settings) - if (dataType == 'script') (1,eval)(result) - else if (dataType == 'xml') result = xhr.responseXML - else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result) - } catch (e) { error = e } - - if (error) return ajaxError(error, 'parsererror', xhr, settings, deferred) - } - - ajaxSuccess(result, xhr, settings, deferred) - } else { - ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred) - } - } - } - - if (ajaxBeforeSend(xhr, settings) === false) { - xhr.abort() - ajaxError(null, 'abort', xhr, settings, deferred) - return xhr - } - - var async = 'async' in settings ? settings.async : true - xhr.open(settings.type, settings.url, async, settings.username, settings.password) - - if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name] - - for (name in headers) nativeSetHeader.apply(xhr, headers[name]) - - if (settings.timeout > 0) abortTimeout = setTimeout(function(){ - xhr.onreadystatechange = empty - xhr.abort() - ajaxError(null, 'timeout', xhr, settings, deferred) - }, settings.timeout) - - // avoid sending empty string (#319) - xhr.send(settings.data ? settings.data : null) - return xhr - } - - // handle optional data/success arguments - function parseArguments(url, data, success, dataType) { - if ($.isFunction(data)) dataType = success, success = data, data = undefined - if (!$.isFunction(success)) dataType = success, success = undefined - return { - url: url - , data: data - , success: success - , dataType: dataType - } - } - - $.get = function(/* url, data, success, dataType */){ - return $.ajax(parseArguments.apply(null, arguments)) - } - - $.post = function(/* url, data, success, dataType */){ - var options = parseArguments.apply(null, arguments) - options.type = 'POST' - return $.ajax(options) - } - - $.getJSON = function(/* url, data, success */){ - var options = parseArguments.apply(null, arguments) - options.dataType = 'json' - return $.ajax(options) - } - - $.fn.load = function(url, data, success){ - if (!this.length) return this - var self = this, parts = url.split(/\s/), selector, - options = parseArguments(url, data, success), - callback = options.success - if (parts.length > 1) options.url = parts[0], selector = parts[1] - options.success = function(response){ - self.html(selector ? - $('
      ').html(response.replace(rscript, "")).find(selector) - : response) - callback && callback.apply(self, arguments) - } - $.ajax(options) - return this - } - - var escape = encodeURIComponent - - function serialize(params, obj, traditional, scope){ - var type, array = $.isArray(obj), hash = $.isPlainObject(obj) - $.each(obj, function(key, value) { - type = $.type(value) - if (scope) key = traditional ? scope : - scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']' - // handle data in serializeArray() format - if (!scope && array) params.add(value.name, value.value) - // recurse into nested objects - else if (type == "array" || (!traditional && type == "object")) - serialize(params, value, traditional, key) - else params.add(key, value) - }) - } - - $.param = function(obj, traditional){ - var params = [] - params.add = function(key, value) { - if ($.isFunction(value)) value = value() - if (value == null) value = "" - this.push(escape(key) + '=' + escape(value)) - } - serialize(params, obj, traditional) - return params.join('&').replace(/%20/g, '+') - } -})(Zepto) - -;(function($){ - $.fn.serializeArray = function() { - var name, type, result = [], - add = function(value) { - if (value.forEach) return value.forEach(add) - result.push({ name: name, value: value }) - } - if (this[0]) $.each(this[0].elements, function(_, field){ - type = field.type, name = field.name - if (name && field.nodeName.toLowerCase() != 'fieldset' && - !field.disabled && type != 'submit' && type != 'reset' && type != 'button' && type != 'file' && - ((type != 'radio' && type != 'checkbox') || field.checked)) - add($(field).val()) - }) - return result - } - - $.fn.serialize = function(){ - var result = [] - this.serializeArray().forEach(function(elm){ - result.push(encodeURIComponent(elm.name) + '=' + encodeURIComponent(elm.value)) - }) - return result.join('&') - } - - $.fn.submit = function(callback) { - if (0 in arguments) this.bind('submit', callback) - else if (this.length) { - var event = $.Event('submit') - this.eq(0).trigger(event) - if (!event.isDefaultPrevented()) this.get(0).submit() - } - return this - } - -})(Zepto) - -;(function(){ - // getComputedStyle shouldn't freak out when called - // without a valid element as argument - try { - getComputedStyle(undefined) - } catch(e) { - var nativeGetComputedStyle = getComputedStyle - window.getComputedStyle = function(element, pseudoElement){ - try { - return nativeGetComputedStyle(element, pseudoElement) - } catch(e) { - return null - } - } - } -})() - - - exports('zepto', Zepto) -}); \ No newline at end of file