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.

7 lines
33 KiB
JavaScript

2 years ago
/* Zepto v1.0-1-ga3cab6c - polyfill zepto detect event ajax form fx - zeptojs.com/license */
(function(a){String.prototype.trim===a&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),Array.prototype.reduce===a&&(Array.prototype.reduce=function(b){if(this===void 0||this===null)throw new TypeError;var c=Object(this),d=c.length>>>0,e=0,f;if(typeof b!="function")throw new TypeError;if(d==0&&arguments.length==1)throw new TypeError;if(arguments.length>=2)f=arguments[1];else do{if(e in c){f=c[e++];break}if(++e>=d)throw new TypeError}while(!0);while(e<d)e in c&&(f=b.call(a,f,c[e],e,c)),e++;return f})})();var Zepto=function(){function E(a){return a==null?String(a):y[z.call(a)]||"object"}function F(a){return E(a)=="function"}function G(a){return a!=null&&a==a.window}function H(a){return a!=null&&a.nodeType==a.DOCUMENT_NODE}function I(a){return E(a)=="object"}function J(a){return I(a)&&!G(a)&&a.__proto__==Object.prototype}function K(a){return a instanceof Array}function L(a){return typeof a.length=="number"}function M(a){return g.call(a,function(a){return a!=null})}function N(a){return a.length>0?c.fn.concat.apply([],a):a}function O(a){return a.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 P(a){return a in j?j[a]:j[a]=new RegExp("(^|\\s)"+a+"(\\s|$)")}function Q(a,b){return typeof b=="number"&&!l[O(a)]?b+"px":b}function R(a){var b,c;return i[a]||(b=h.createElement(a),h.body.appendChild(b),c=k(b,"").getPropertyValue("display"),b.parentNode.removeChild(b),c=="none"&&(c="block"),i[a]=c),i[a]}function S(a){return"children"in a?f.call(a.children):c.map(a.childNodes,function(a){if(a.nodeType==1)return a})}function T(c,d,e){for(b in d)e&&(J(d[b])||K(d[b]))?(J(d[b])&&!J(c[b])&&(c[b]={}),K(d[b])&&!K(c[b])&&(c[b]=[]),T(c[b],d[b],e)):d[b]!==a&&(c[b]=d[b])}function U(b,d){return d===a?c(b):c(b).filter(d)}function V(a,b,c,d){return F(b)?b.call(a,c,d):b}function W(a,b,c){c==null?a.removeAttribute(b):a.setAttribute(b,c)}function X(b,c){var d=b.className,e=d&&d.baseVal!==a;if(c===a)return e?d.baseVal:d;e?d.baseVal=c:b.className=c}function Y(a){var b;try{return a?a=="true"||(a=="false"?!1:a=="null"?null:isNaN(b=Number(a))?/^[\[\{]/.test(a)?c.parseJSON(a):a:b):a}catch(d){return a}}function Z(a,b){b(a);for(var c in a.childNodes)Z(a.childNodes[c],b)}var a,b,c,d,e=[],f=e.slice,g=e.filter,h=window.document,i={},j={},k=h.defaultView.getComputedStyle,l={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},m=/^\s*<(\w+|!)[^>]*>/,n=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,o=/^(?:body|html)$/i,p=["val","css","html","text","data","width","height","offset"],q=["after","prepend","before","append"],r=h.createElement("table"),s=h.createElement("tr"),t={tr:h.createElement("tbody"),tbody:r,thead:r,tfoot:r,td:s,th:s,"*":h.createElement("div")},u=/complete|loaded|interactive/,v=/^\.([\w-]+)$/,w=/^#([\w-]*)$/,x=/^[\w-]+$/,y={},z=y.toString,A={},B,C,D=h.createElement("div");return A.matches=function(a,b){if(!a||a.nodeType!==1)return!1;var c=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector;if(c)return c.call(a,b);var d,e=a.parentNode,f=!e;return f&&(e=D).appendChild(a),d=~A.qsa(e,b).indexOf(a),f&&D.removeChild(a),d},B=function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})},C=function(a){return g.call(a,function(b,c){return a.indexOf(b)==c})},A.fragment=function(b,d,e){b.replace&&(b=b.replace(n,"<$1></$2>")),d===a&&(d=m.test(b)&&RegExp.$1),d in t||(d="*");var g,h,i=t[d];return i.innerHTML=""+b,h=c.each(f.call(i.childNodes),function(){i.removeChild(this)}),J(e)&&(g=c(h),c.each(e,function(a,b){p.indexOf(a)>-1?g[a](b):g.attr(a,b)})),h},A.Z=function(a,b){return a=a||[],a.__proto__=c.fn,a.selector=b||"",a},A.isZ=function(a){return a instanceof A.Z},A.init=function(b,d){if(!b)return A.Z();if(F(b))return c(h).ready(b);if(A.isZ(b))return b;var e;if(K(b))e=M(b);else if(I(b))e=[J(b)?c.extend({},b):b],b=null;else if(m.test(b))e=A.fragment(b.trim(),RegExp.$1,d),b=null;else{if(d!==a)return c(d).find(b);e=A.qsa(h,b)}return A.Z(e,b)
/*zepto-touch*/
;(function(i){var g={},b,k,h,e=750,a;function c(m){return"tagName" in m?m:m.parentNode}function j(n,m,p,o){var r=Math.abs(n-m),q=Math.abs(p-o);return r>=q?(n-m>0?"Left":"Right"):(p-o>0?"Up":"Down")}function l(){a=null;if(g.last){g.el.trigger("longTap");g={}}}function d(){if(a){clearTimeout(a)}a=null}function f(){if(b){clearTimeout(b)}if(k){clearTimeout(k)}if(h){clearTimeout(h)}if(a){clearTimeout(a)}b=k=h=a=null;g={}}i(document).ready(function(){var m,n;i(document.body).bind("touchstart",function(o){m=Date.now();n=m-(g.last||m);g.el=i(c(o.touches[0].target));b&&clearTimeout(b);g.x1=o.touches[0].pageX;g.y1=o.touches[0].pageY;if(n>0&&n<=250){g.isDoubleTap=true}g.last=m;a=setTimeout(l,e)}).bind("touchmove",function(o){d();g.x2=o.touches[0].pageX;g.y2=o.touches[0].pageY}).bind("touchend",function(o){d();if((g.x2&&Math.abs(g.x1-g.x2)>30)||(g.y2&&Math.abs(g.y1-g.y2)>30)){h=setTimeout(function(){g.el.trigger("swipe");g.el.trigger("swipe"+(j(g.x1,g.x2,g.y1,g.y2)));g={}},0)}else{if("last" in g){k=setTimeout(function(){var p=i.Event("tap");p.cancelTouch=f;g.el.trigger(p);if(g.isDoubleTap){g.el.trigger("doubleTap");g={}}else{b=setTimeout(function(){b=null;g.el.trigger("singleTap");g={}},250)}},0)}}}).bind("touchcancel",f);i(window).bind("scroll",f)});["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(n){i.fn[n]=function(m){return this.bind(n,m)}});if("ontouchstart" in window){}else{i.fn.tap=i.fn.click}})(Zepto);
/*ai.js*/
var ai={touchClick:function(e,c){if("ontouchstart" in window){}else{this.touchClick=this.clickFun;this.clickFun(e,c);return}if(e){var d=0,b=0;e.addEventListener("touchstart",function(f){d=f.touches[0].clientX;b=f.touches[0].clientY;document.addEventListener("touchend",a,false)});function a(h){var g=h.changedTouches[0].clientX;var f=h.changedTouches[0].clientY;if(Math.abs(g-d)<5&&Math.abs(f-b)<5){c.call(e,h)}document.removeEventListener("touchend",a,false)}}},clickFun:function(b,a){b.addEventListener("click",function(c){a.call(b,c)})},ovb:{_version_value:false,_bversion_value:false,_ua:navigator.userAgent,android:function(){var b=this._ua.match(/(Android)\s+([\d.]+)/),a=!!b;if(!this._version_value&&a){this._version_value=b[2]}this.android=function(){return a};return a},ios:function(){var b=this._ua.match(/.*OS\s([\d_]+)/),a=!!b;if(!this._version_value&&a){this._version_value=b[1].replace(/_/g,".")}this.ios=function(){return a};return a},ipod:function(){var b=this._ua.match(/(iPod).*OS\s([\d_]+)/),a=!!b;if(!this._version_value&&a){this._version_value=b[2].replace(/_/g,".")}this.ipod=function(){return a};return a},ipad:function(){var b=this._ua.match(/(iPad).*OS\s([\d_]+)/),a=!!b;if(!this._version_value&&a){this._version_value=b[2].replace(/_/g,".")}this.ipad=function(){return a};return a},iphone:function(){var b=this._ua.match(/(iPhone);.*OS\s([\d_]+)/),a=!!b;if(!this._version_value&&a){this._version_value=b[2].replace(/_/g,".")}this.iphone=function(){return a};return a},kindle:function(){var b=this._ua.match(/Kindle\/([\d.]+)/),a=!!b;if(!this._version_value&&a){this._version_value=b[1]}this.kindle=function(){return a};return a},webkit:function(){var b=this._ua.match(/WebKit\/([\d.]+)/),a=!!b;if(!this._version_value&&a){this._bversion_value=b[1]}this.webkit=function(){return a};return a},uc:function(){var b=this._ua.match(/UC/),a=!!b;this.uc=function(){return a};return a},opera:function(){var b=this._ua.match(/Opera/),a=!!b;this.opera=function(){return a};return a},safari:function(){var b=this._ua.match(/Version.*Safari/),a=!!b;this.safari=function(){return a};return a},silk:function(){var b=this._ua.match(/Silk/),a=!!b;this.silk=function(){return a};return a},version:function(){return this._version_value},bVersion:function(){return this._bversion_value}},a:function(a){return document.querySelectorAll(a)},q:function(a){return document.querySelector(a)},i:function(a){return document.getElementById(a)},c:function(a){return document.getElementsByClassName(a)},hideUrl:function(){window.scrollTo(0,1)},wh:function(){return document.documentElement.clientHeight},ww:function(){return document.documentElement.clientWidth},hv:function(){var a=true;if("orientation" in window){switch(window.orientation){case 90:case -90:a=false;break;case 0:case 180:a=true;break;default:}}else{width=window.innerWidth;height=window.innerHeight;a=height>width?true:false}return a},resize:function(a){this.resize_time=Date.now();window.addEventListener("resize",function(){if(Date.now()-this.resize_time<200){this.resize_time=Date.now()}else{a();this.resize_time=Date.now()}},false)},clone:function(a){function b(){}b.prototype=a;return new b},extend:function(c,a){var b=function(){};b.prototype=a.prototype;c.prototype=new b();c.prototype.constructor=c;c.superclass=a.prototype;if(a.prototype.constructor==Object.prototype.constructor){a.prototype.constructor=a}},styleLoad:function(c,b){var a=document.createElement("style");a.type="text/css";a.src=c;document.head.appendChild(a);a.onload=function(){b()}},scriptLoad:function(c,b){var a=document.createElement("script");a.type="text/javascript";a.src=c;document.head.appendChild(a);a.onload=function(){b()}},touchMovePreventDefault:function(a){a.addEventListener("touchmove",function(b){b.preventDefault()},false)},touchHover:function(c,d){var b=c.className;d=!d?"press":d;c.className=b+" "+d;document.addEventListener("touchend",a,false);document.addEventListener("touchmove",a,false);function a(){c.className=b;document.removeEventListener("touchmove",a,false);document.removeEventListener("touchend",a,false)}},tap:functio