You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DSWMS/微信公众号/公众号模板/js/zepto.min.js

6 lines
32 KiB
JavaScript

2 years ago
!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t)}(this,function(t){var e=function(){function e(t){return null==t?t+"":W[Y.call(t)]||"object"}function n(t){return"function"==e(t)}function r(t){return null!=t&&t==t.window}function i(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function o(t){return"object"==e(t)}function a(t){return o(t)&&!r(t)&&Object.getPrototypeOf(t)==Object.prototype}function s(t){var e=!!t&&"length"in t&&t.length,n=C.type(t);return"function"!=n&&!r(t)&&("array"==n||0===e||"number"==typeof e&&e>0&&e-1 in t)}function u(t){return L.call(t,function(t){return null!=t})}function c(t){return t.length>0?C.fn.concat.apply([],t):t}function l(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 f(t){return t in k?k[t]:k[t]=RegExp("(^|\\s)"+t+"(\\s|$)")}function h(t,e){return"number"!=typeof e||Z[l(t)]?e:e+"px"}function p(t){var e,n;return F[t]||(e=$.createElement(t),$.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),F[t]=n),F[t]}function d(t){return"children"in t?D.call(t.children):C.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function m(t,e){var n,r=t?t.length:0;for(n=0;r>n;n++)this[n]=t[n];this.length=r,this.selector=e||""}function g(t,e,n){for(w in e)n&&(a(e[w])||te(e[w]))?(a(e[w])&&!a(t[w])&&(t[w]={}),te(e[w])&&!te(t[w])&&(t[w]=[]),g(t[w],e[w],n)):e[w]!==j&&(t[w]=e[w])}function v(t,e){return null==e?C(t):C(t).filter(e)}function y(t,e,r,i){return n(e)?e.call(t,r,i):e}function x(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function b(t,e){var n=t.className||"",r=n&&n.baseVal!==j;return e===j?r?n.baseVal:n:void(r?n.baseVal=e:t.className=e)}function E(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?C.parseJSON(t):t):t}catch(e){return t}}function T(t,e){e(t);for(var n=0,r=t.childNodes.length;r>n;n++)T(t.childNodes[n],e)}var j,w,C,S,N,O,P=[],A=P.concat,L=P.filter,D=P.slice,$=t.document,F={},k={},Z={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},M=/^\s*<(\w+|!)[^>]*>/,z=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,q=/^(?:body|html)$/i,_=/([A-Z])/g,I=["val","css","html","text","data","width","height","offset"],H=["after","prepend","before","append"],V=$.createElement("table"),B=$.createElement("tr"),X={tr:$.createElement("tbody"),tbody:V,thead:V,tfoot:V,td:B,th:B,"*":$.createElement("div")},U=/complete|loaded|interactive/,J=/^[\w-]*$/,W={},Y=W.toString,G={},K=$.createElement("div"),Q={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},te=Array.isArray||function(t){return t instanceof Array};return G.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=K).appendChild(t),r=~G.qsa(i,e).indexOf(t),o&&K.removeChild(t),r},N=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},O=function(t){return L.call(t,function(e,n){return t.indexOf(e)==n})},G.fragment=function(t,e,n){var r,i,o;return z.test(t)&&(r=C($.createElement(RegExp.$1))),r||(t.replace&&(t=t.replace(R,"<$1></$2>")),e===j&&(e=M.test(t)&&RegExp.$1),e in X||(e="*"),o=X[e],o.innerHTML=""+t,r=C.each(D.call(o.childNodes),function(){o.removeChild(this)})),a(n)&&(i=C(r),C.each(n,function(t,e){I.indexOf(t)>-1?i[t](e):i.attr(t,e)})),r},G.Z=function(t,e){return new m(t,e)},G.isZ=function(t){return t instanceof G.Z},G.init=function(t,e){var r;if(!t)return G.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&M.test(t))r=G.fragment(t,RegExp.$1,e),t=null;else{if(e!==j)return C(e).find(t);r=G.qsa(
(function(d){var e={},g=d.fn.data,b=d.camelCase,c=d.expando="Zepto"+(+new Date()),i=[];function f(m,k){var n=m[c],j=n&&e[n];if(k===undefined){return j||h(m)}else{if(j){if(k in j){return j[k]}var l=b(k);if(l in j){return j[l]}}return g.call(d(m),k)}}function h(l,k,m){var n=l[c]||(l[c]=++d.uuid),j=e[n]||(e[n]=a(l));if(k!==undefined){j[b(k)]=m}return j}function a(k){var j={};d.each(k.attributes||i,function(m,l){if(l.name.indexOf("data-")==0){j[b(l.name.replace("data-",""))]=d.zepto.deserializeValue(l.value)}});return j}d.fn.data=function(j,k){return k===undefined?d.isPlainObject(j)?this.each(function(l,m){d.each(j,function(n,o){h(m,n,o)})}):(0 in this?f(this[0],j):undefined):this.each(function(){h(this,j,k)})};d.data=function(k,j,l){return d(k).data(j,l)};d.hasData=function(k){var l=k[c],j=l&&e[l];return j?!d.isEmptyObject(j):false};d.fn.removeData=function(j){if(typeof j=="string"){j=j.split(/\s+/)}return this.each(function(){var l=this[c],k=l&&e[l];if(k){d.each(j||k,function(m){delete k[j?b(this):m]})}})};["remove","empty"].forEach(function(j){var k=d.fn[j];d.fn[j]=function(){var l=this.find("*");if(j==="remove"){l=l.add(this)}l.removeData();return k.call(this)}})})(Zepto);
/*selector*/
!function(t){function n(n){return n=t(n),!(!n.width()&&!n.height())&&"none"!==n.css("display")}function e(t,n){t=t.replace(/=#\]/g,'="#"]');var e,r,i=s.exec(t);if(i&&i[2]in o&&(e=o[i[2]],r=i[3],t=i[1],r)){var u=Number(r);r=isNaN(u)?r.replace(/^["']|["']$/g,""):u}return n(t,e,r)}var r=t.zepto,i=r.qsa,u=r.matches,o=t.expr[":"]={visible:function(){return n(this)?this:void 0},hidden:function(){return n(this)?void 0:this},selected:function(){return this.selected?this:void 0},checked:function(){return this.checked?this:void 0},parent:function(){return this.parentNode},first:function(t){return 0===t?this:void 0},last:function(t,n){return t===n.length-1?this:void 0},eq:function(t,n,e){return t===e?this:void 0},contains:function(n,e,r){return t(this).text().indexOf(r)>-1?this:void 0},has:function(t,n,e){return r.qsa(this,e).length?this:void 0}},s=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),c=/^\s*>/,a="Zepto"+ +new Date;r.qsa=function(n,u){return e(u,function(e,o,s){try{var h;!e&&o?e="*":c.test(e)&&(h=t(n).addClass(a),e="."+a+" "+e);var f=i(n,e)}catch(d){throw console.error("error performing selector: %o",u),d}finally{h&&h.removeClass(a)}return o?r.uniq(t.map(f,function(t,n){return o.call(t,n,f,s)})):f})},r.matches=function(t,n){return e(n,function(n,e,r){return!(n&&!u(t,n)||e&&e.call(t,null,r)!==t)})}}(Zepto);
/*手势*/
!function(t){function e(t){return"tagName"in t?t:t.parentNode}function n(t,e,n,i){var o=Math.abs(t-e),r=Math.abs(n-i);return o>=r?t-e>0?"Left":"Right":n-i>0?"Up":"Down"}function i(){d=null,u.last&&(u.el.trigger("longTap"),u={})}function o(){d&&clearTimeout(d),d=null}function r(){a&&clearTimeout(a),s&&clearTimeout(s),c&&clearTimeout(c),d&&clearTimeout(d),a=s=c=d=null,u={}}var a,s,c,d,u={},l=750;t(document).ready(function(){var f,h;t(document.body).bind("touchstart",function(n){f=Date.now(),h=f-(u.last||f),u.el=t(e(n.touches[0].target)),a&&clearTimeout(a),u.x1=n.touches[0].pageX,u.y1=n.touches[0].pageY,h>0&&250>=h&&(u.isDoubleTap=!0),u.last=f,d=setTimeout(i,l)}).bind("touchmove",function(t){o(),u.x2=t.touches[0].pageX,u.y2=t.touches[0].pageY,Math.abs(u.x1-u.x2)>10&&t.preventDefault()}).bind("touchend",function(){o(),u.x2&&Math.abs(u.x1-u.x2)>30||u.y2&&Math.abs(u.y1-u.y2)>30?c=setTimeout(function(){u.el.trigger("swipe"),u.el.trigger("swipe"+n(u.x1,u.x2,u.y1,u.y2)),u={}},0):"last"in u&&(s=setTimeout(function(){var e=t.Event("tap");e.cancelTouch=r,u.el.trigger(e),u.isDoubleTap?(u.el.trigger("doubleTap"),u={}):a=setTimeout(function(){a=null,u.el.trigger("singleTap"),u={}},250)},0))}).bind("touchcancel",r),t(window).bind("scroll",r)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(e){t.fn[e]=function(t){return this.bind(e,t)}})}(Zepto);