-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgquery.min.js
2 lines (2 loc) · 24.6 KB
/
gquery.min.js
1
2
/* gQuery v1.5.6 | (c) 2020-present, JU Chengren (Ganxiaozhe) | [email protected] | gquery.cn/license */
"use strict";function _defineProperty(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var _slicedToArray=function(){function t(t,e){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=window||self,t.gQuery=t.$=e()),(window.ActiveXObject||"ActiveXObject"in window)&&(window.location.href="https://gquery.cn/kill-ie?back="+window.location.href),console.log("%c gQuery 1.5.6 %c gquery.cn \n","color: #fff; background: #030307; padding:5px 0; margin-top: 1em;","background: #efefef; color: #333; padding:5px 0;")}(window,function(){function t(t,e,n){var i=this;if(this._fncQueue=void 0===n?[]:n,this._delayCompleted=!1,this._$real=t,"number"==typeof e&&e>=0&&e<1/0)this.timeoutKey=window.setTimeout(function(){i._performDummyQueueActions()},e);else if(null!==e&&"object"===(void 0===e?"undefined":_typeof(e))&&"function"==typeof e.promise)e.then(function(){i._performDummyQueueActions()});else{if("string"!=typeof e)return t;t.one(e,function(){i._performDummyQueueActions()})}}var e=function t(e,n){return new t.fn.init(e,n)};e.fn=e.prototype={constructor:e,gquery:"1.5.6",init:function(t,n){var i=void 0===t?"undefined":_typeof(t),r=[];switch(i){case"function":return void("loading"!=document.readyState?t():document.addEventListener("DOMContentLoaded",t));case"object":if(e.isWindow(t)){r=[window];break}if(void 0!==t.gquery){r=t;break}Array.isArray(t)?t.map(function(t){$.isNode(t)&&r.push(t)}):r.push(t);break;case"string":try{r=document.querySelectorAll(t)}catch(e){r=$.parse.html(t)}}switch(n){case"push":for(var o=this.length,a=r.length-1;a>=0;a--){for(var s=!0,c=this.length-1;c>=0;c--)this[c]===r[a]&&(s=!1);s&&(this.length+=1,this[o+a]=r[a])}break;default:this.length=r.length;for(var u=r.length-1;u>=0;u--)this[u]=r[u]}return this},push:function(t){return this.init(t,"push")},each:function(t,e){e||(e=t,t=this);for(var n=0,i=t.length;n<i&&0!=e.call(t[n],n,t[n-1]);n++);return this},find:function(t,e,n){var i=Object.create(this),r=[],o=void 0;for(this.each(function(i){if($.isNode(this)){e&&$(this).is(t)&&r.push(this);var a=n?this.children:this.querySelectorAll(t);for(o=0;o<a.length;o++)n&&!$(a[o]).is(t)||r.push(a[o])}}),r=$.array.unique(r),i.length=r.length,o=r.length-1;o>=0;o--)i[o]=r[o];return i},is:function(t){var e=!1;return this.each(function(n){var i=this.matches||this.matchesSelector||this.msMatchesSelector||this.mozMatchesSelector||this.webkitMatchesSelector||this.oMatchesSelector;if("function"==typeof i&&i.call(this,t))return e=!0,!1}),e},exist:function(){var t=!1;return this.each(function(e){if(document.body.contains(this))return t=!0,!1}),t},eq:function(t){return $(this[t])},parent:function(t,e){var n=Object.create(this),i=[],r=void 0;for(this.each(function(n){for(var r=this.parentNode;t&&r&&!$(r).is(t);){if(!e){r=void 0;break}r=r.parentNode}r&&i.push(r)}),i=$.array.unique(i),n.length=i.length,r=i.length-1;r>=0;r--)n[r]=i[r];return n},next:function(t){var e=Object.create(this),n=[],i=void 0,r=void 0;for(this.each(function(r){i=this.nextElementSibling,null===i||t&&!i.matches(t)||n.push(i),delete e[r]}),n=$.array.unique(n),e.length=n.length,r=n.length-1;r>=0;r--)e[r]=n[r];return e},remove:function(t,e){return void 0===e&&(e=!1),(void 0===t?this:this.find(t,!1,e)).each(function(){if(null===this.parentNode)return!0;this.parentNode.removeChild(this)}),this},empty:function(t){return(void 0===t?this:this.find(t)).each(function(){for(;this.firstChild;)this.removeChild(this.firstChild)})},text:function(t){return n.thvEach.call(this,"innerText",t)},html:function(t){return n.thvEach.call(this,"innerHTML",t)},val:function(t){return n.thvEach.call(this,"value",t)},ohtml:function(t){return n.thvEach.call(this,"outerHTML",t)},width:function(t){if(void 0!==t)return isNaN(t)||(t+="px"),this.each(function(){this.style.width=t});var e=[],n=void 0;return this.each(function(){n=this.offsetWidth,void 0===n&&(n="function"==typeof this.getBoundingClientRect?this.getBoundingClientRect().width.toFixed(2):0),e.push(parseFloat(n))}),e.length>1?e:e[0]},height:function(t){if(void 0!==t)return isNaN(t)||(t+="px"),this.each(function(){this.style.height=t});var e=[],n=void 0;return this.each(function(){n=this.offsetHeight,void 0===n&&(n="function"==typeof this.getBoundingClientRect?this.getBoundingClientRect().height.toFixed(2):0),e.push(parseFloat(n))}),e.length>1?e:e[0]},offset:function(t){if("object"===(void 0===t?"undefined":_typeof(t)))return this.each(function(){for(var e in t)isNaN(t[e])||(t[e]+="px"),this.style[e]=t[e]});var e=this[0].getBoundingClientRect(),n={top:0==document.body.scrollTop?document.documentElement.scrollTop:document.body.scrollTop,left:0==document.body.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft};t&&(n.top=0,n.left=0);var i=$(this[0]),r={top:e.top+n.top,left:e.left+n.left,height:i.height(),width:i.width()},o=t?window.innerHeight:document.body.offsetHeight,a=t?window.innerWidth:document.body.offsetWidth;return r.bottom=o-r.top-r.height,r.right=a-r.left-r.width,r},append:function(t){return n.pend.call(this,"appendChild",t)},prepend:function(t){return n.pend.call(this,"insertBefore",t)},insertBefore:function(t){return n.pend.call($(t),"before",this)},before:function(t){return n.pend.call(this,"before",t)},after:function(t){return n.pend.call(this,"after",t)},attr:function(t,e){if(void 0===e&&"string"==typeof t){var n=[],i=void 0;return this.each(function(){i=this.getAttribute(t),null===i&&(i=void 0),n.push(i)}),n.length>1?n:n[0]}return"object"===(void 0===t?"undefined":_typeof(t))?this.each(function(){for(var e in t)this.setAttribute&&this.setAttribute(e,t[e])}):this.each(function(){this.setAttribute&&this.setAttribute(t,e)})},removeAttr:function(t){return t=t.split(" "),this.each(function(){var e=this;t.map(function(t){return e.removeAttribute(t)})})},data:function(t,e){if("object"!==(void 0===t?"undefined":_typeof(t))&&void 0===e){var n=[];return this.each(function(){void 0===this.gQueryData&&(this.gQueryData={}),"string"==typeof t?n.push(this.gQueryData[t]):n.push(this.gQueryData)}),n.length>1?n:n[0]}return this.each(function(){if(void 0===this.gQueryData&&(this.gQueryData={}),"object"===(void 0===t?"undefined":_typeof(t)))for(var n in t)this.gQueryData[n]=t[n];else this.gQueryData[t]=e})},removeData:function(t){return this.each(function(){void 0===this.gQueryData&&(this.gQueryData={}),delete this.gQueryData[t]})},hasClass:function(t){t=t.split(" ");var e=!0;return this.each(function(){var n=this;t.map(function(t){n.classList.contains(t)||(e=!1)})}),e},addClass:function(t){return t=t.split(" "),this.each(function(){var e=this;t.map(function(t){return e.classList.add(t)})})},removeClass:function(t){return t=t.split(" "),this.each(function(){var e=this;t.map(function(t){return e.classList.remove(t)})})},toggleClass:function(t){return t=t.split(" "),this.each(function(){var e=this;t.map(function(t){return e.classList.toggle(t)})})},css:function(t,e){function n(t,e,n){var i=/!important\s?$/,r="";i.test(n)&&(r="important",n=n.replace(i,"")),t.style.setProperty(e,n,r)}if(void 0!==e)return this.each(function(){n(this,t,e)});if("string"==typeof t){var i=[];return this.each(function(){i.push(getComputedStyle(this)[t])}),i.length>1?i:i[0]}return this.each(function(){for(var e in t)n(this,e,t[e])})},show:function(t){return this.each(function(){this.style.display="","none"==getComputedStyle(this).display&&(this.style.display=t||"block")})},hide:function(){return this.each(function(){this.style.display="none"})},animate:function(t,e,n){return void 0===(void 0===e?"undefined":_typeof(e))&&(e=500),"object"!==(void 0===e?"undefined":_typeof(e))&&(e={duration:parseInt(e)}),e.duration||(e.duration=500),e.timing||(e.timing="linear"),e.delay||(e.delay=0),this.each(function(){function i(){$.animation.array.push(r),$.animation.start()}var r={elem:this,callback:n,props:t,calc:$.animation.preCalc(t,this),opts:e,start:null};e.delay>0?setTimeout(i,e.delay):i()})},stop:function(){return this.each(function(){this.__gQueryStop=!0})},fadeIn:function(t,e){return t||(t=500),this.each(function(){$(this).show().stop().animate({opacity:1},t,function(){e&&e.call(this)})})},fadeOut:function(t,e){return t||(t=500),this.each(function(){$(this).stop().animate({opacity:0},t,function(){this.style.display="none",e&&e.call(this)})})},fadeToggle:function(t,e){return t||(t=500),"function"==typeof e||(e=function(){}),this.each(function(){"none"==this.style.display?$(this).fadeIn(t,e):$(this).fadeOut(t,e)})},slideUp:function(t,e){return t||(t=500),this.each(function(){$(this).stop().animate({height:"0px"},t,function(){this.style.display="none",e&&e.call(this)})})},slideDown:function(t,e){return t||(t=500),this.each(function(){var n=$(this).css("height"),i=$(this).css({display:"",height:""}),r=this.offsetHeight;this.style.height=n,i.stop().animate({height:r+"px"},t,function(){e&&e.call(this)})})},slideToggle:function(t,e){return t||(t=500),"function"==typeof e||(e=function(){}),this.each(function(){"none"==this.style.display?$(this).slideDown(t,e):$(this).slideUp(t,e)})},on:function(t,e,i,r){var o=n.onArgs(arguments),a=_slicedToArray(o,4);t=a[0],e=a[1],i=a[2],r=a[3],e&&void 0===r.capture&&(r.capture=!0);var s=function(t,n){var i=$.array.finder(["mouseenter","mouseleave","mousemove","mouseover","mouseout"],n);return e?function(n){var r=this.querySelectorAll(e),o=!1,a=void 0;for(a=r.length-1;a>=0&&!1===o;a--)i?r[a]===n.target&&(o=r[a]):r[a].contains(n.target)&&(o=r[a]);o&&t.call(o,n)}:t},c=void 0;return"function"==typeof i?(c=s(i,t),this.each(function(){$.event.add(this,t,c,r)})):this.each(function(){for(var e in t)c=s(t[e],e),$.event.add(this,e,c,r)})},one:function(t,e,i,r){var o=n.onArgs(arguments),a=_slicedToArray(o,4);return t=a[0],e=a[1],i=a[2],r=a[3],r.once=!0,this.on(t,e,i,r)},off:function(t,e){return void 0===e&&(e=!1),t||(t="*"),t=t.split(" "),this.each(function(){var n=this;t.map(function(t){return $.event.remove(n,t,e)})})},trigger:function(t,e){e||(e={}),t=t.split(" ");var n=t.map(function(t){return new CustomEvent(t,{detail:e})});return this.each(function(){var t=this;n.map(function(e){return t.dispatchEvent(e)})})},click:function(t){return"function"==typeof t?this.each(function(){$.event.add(this,"click",t)}):this.trigger("click")},select:function(){switch(this[0].tagName.toLowerCase()){case"input":case"textarea":this[0].select();break;default:window.getSelection().selectAllChildren(this[0])}return this},load:function(t,e,n){var i=this,r=t.trim().split(" ");"function"==typeof e&&(n=e,e=!1),$.fetch(r[0],e,"text").then(function(t){r.length>1?(r.splice(0,1),i.html($(t).find(r.join(" "),!0).html())):i.html(t),"function"==typeof n&&n.call(i)})},extend:function(t){for(var e in t)"object"===_typeof(t[e])?this[e]=$.extend(!0,this[e],t[e]):this[e]=t[e];return this}},e.fn.init.prototype=e.fn;var n={thvEach:function(t,e){var n=Array.isArray(e);if(void 0===e||n&&0==e.length){var i=[];return this.each(function(){i.push(this[t])}),n?i:i.join("")}return n?this.each(function(n){this[t]=e[n]}):this.each(function(){this[t]=e})},pend:function(t,e){var n="string"==typeof e?$.parse.html(e):e.gquery?e:[e];return this.each(function(){var e=n.length,i=void 0,r=void 0;for(i=0;i<e;i++)r=n[i].cloneNode(!0),"insertBefore"==t?this[t](r,this.firstChild):this[t](r)})},onArgs:function(t){var e=t[0],n=t[1],i=t[2],r=t[3];return 3==t.length&&"function"!=typeof i&&(r=i,i=n,n=!1),2==t.length&&("function"==typeof n?(i=n,n=!1):"object"===(void 0===n?"undefined":_typeof(n))&&(r=n,n=!1)),"object"===(void 0===r?"undefined":_typeof(r))||(r={}),[e,n,i,r]}};return t.prototype._addToQueue=function(t,e){return this._fncQueue.unshift({fnc:t,arg:e}),this._delayCompleted?this._performDummyQueueActions():this},t.prototype._performDummyQueueActions=function(){this._delayCompleted=!0;for(var t=void 0;this._fncQueue.length>0;){if(t=this._fncQueue.pop(),"wait"===t.fnc)return t.arg.push(this._fncQueue),this._$real=this._$real[t.fnc].apply(this._$real,t.arg);this._$real=this._$real[t.fnc].apply(this._$real,t.arg)}return this},e.fn.wait=function(e,n){return new t(this,e,n)},e.waitUpdate=function(){for(var n in e.fn)"function"==typeof e.fn[n]&&e.fn.hasOwnProperty(n)&&(t.prototype[n]=function(t){return function(){var e=Array.prototype.slice.call(arguments);return this._addToQueue(t,e)}}(n))},e.waitUpdate(),e.debugger=!1,e.extend=function(t){if(1==arguments.length){for(var n in t)"object"===_typeof(t[n])?this[n]=$.extend(!0,this[n],t[n]):this[n]=t[n];return e.waitUpdate(),this}var i=!1,r=arguments.length,o=1,a=void 0,s=void 0,c=void 0,u=void 0,f=void 0,h=void 0,l=arguments[0]||{};for("boolean"==typeof l&&(i=l,l=arguments[o]||{},o++),"object"!==(void 0===l?"undefined":_typeof(l))&&(l={});o<r;o++)if(null!=(s=arguments[o]))for(a in s)c=l[a],u=s[a],l!==u&&(i&&u&&(e.isPlainObject(u)||(h=Array.isArray(u)))?(h?(h=!1,f=c&&Array.isArray(c)?c:[]):f=c&&e.isPlainObject(c)?c:{},l[a]=e.extend(i,f,u)):void 0!==u&&(l[a]=u));return l},e.each=function(t,e){if("object"===(void 0===t?"undefined":_typeof(t))){for(var n in t)if(!1===e.call(t[n],n,t[n]))break;return!0}[].every.call(t,function(t,n){return!1!==e.call(t,n,t)})},e.copy=function(t){"object"===(void 0===t?"undefined":_typeof(t))&&(t=$(t).text()),$("body").append("<textarea id='gQuery-copyTemp'>"+t+"</textarea>"),$("#gQuery-copyTemp").select(),document.execCommand("Copy"),$("#gQuery-copyTemp").remove()},e.fetch=function(t,n,i){var r={method:"GET"};if("object"===(void 0===t?"undefined":_typeof(t))&&(r=$.extend(r,t),t=t.url),"object"===(void 0===n?"undefined":_typeof(n)))if(r.method="POST","[object FormData]"==Object.prototype.toString.call(n))r.body=n;else{r.body=new FormData;for(var o in n)r.body.append(o,n[o])}else"string"==typeof n&&("string"==typeof i?(r.method="POST",r.body=n):i=n);if(!i)return fetch(t,r);var a=void 0;return fetch(t,r).then(function(t){if(!t.ok)throw new Error("Network response was not ok.");return e.debugger&&(a=t.clone()),t[i]()}).catch(function(t){throw a&&a.ok&&a.text().then(function(t){console.error(t)}),new Error(t)})},e.global="undefined"!=typeof window?window:global,e.isWindow=function(t){return"[object Window]"===Object.prototype.toString.call(t)},e.isNode=function(t){var e=Object.prototype.toString.call(t);return e.indexOf("HTML")>-1&&e.indexOf("Element")>-1},e.isPlainObject=function(t){var e=void 0;return"[object Object]"===Object.prototype.toString.call(t)&&(null===(e=Object.getPrototypeOf(t))||e==Object.getPrototypeOf({}))},e.ui="Missing gQuery UI components.",e.array={unique:function(t,e){var n={};return"node"==e||$.isNode(t[0])?t.filter(function(t,e,n){return n.indexOf(t,0)===e}):(t.forEach(function(t){var e=void 0===t?"undefined":_typeof(t),i=t;"object"===e&&(t=JSON.stringify(t)),n[t+"::"+e]=i}),Object.keys(n).map(function(t){return n[t]}))},finder:function(t,e,n){"object"===(void 0===n?"undefined":_typeof(n))||(n={}),void 0===n.limit&&(n.limit=1);for(var i="object"===(void 0===e?"undefined":_typeof(e)),r=void 0,o=[],a=0;a<t.length;a++)if(i){r=!0;for(var s in e)t[a][s]==e[s]||(r=!1);if(r&&o.push({index:a,array:t[a]}),n.limit>0&&o.length>=n.limit)break}else if(t[a]==e&&o.push({index:a,array:t[a]}),n.limit>0&&o.length>=n.limit)break;return n.array?o:o.length>1?o:o[0]},has:function(t,e){return void 0!==this.finder(t,e)}},e.event={add:function(t,e,n,i){"object"===(void 0===i?"undefined":_typeof(i))||(i={}),void 0===i.capture&&(i.capture=!1);var r=e.split("."),o=r.splice(0,1);r.length>0&&(i.__flag={}),r.map(function(t){i.__flag[t]=!0});var a=function(r){return!0===i.once&&$.event.remove(t,e,i),n.call(t,r)},s=t.gQueryEvents,c={fn:a,opts:i};void 0===s?s=_defineProperty({},o,[c]):"object"!==_typeof(s[o])?s[o]=[c]:s[o].push(c),t.gQueryEvents=s;var u=s[o][s[o].length-1];t.addEventListener(o,u.fn,u.opts)},remove:function(t,e,n){function i(e,n){var i=r[e];for(a=i.length-1;a>=0;a--){if(!n){if("continue"===function(){var t=1,e=i[a].opts.__flag||{};if(o.length<1&&Object.keys(e).length<1&&(t=0),o.map(function(n){e[n]&&(t=0)}),t)return"continue"}())continue}t.removeEventListener(e,i[a].fn,i[a].opts),r[e].splice(a,1),r[e].length<1&&delete r[e]}}var r=t.gQueryEvents,o=e.split("."),a=void 0;if(e=o.splice(0,1),void 0!==r)return"*"==e?void Object.keys(r).map(function(t){return i(t,!0)}):void("object"===_typeof(r[e])&&i(e))}},e.get={browserSpec:function(){var t=navigator.userAgent,e=void 0,n=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(n[1])?(e=/\brv[ :]+(\d+)/g.exec(t)||[],{name:"IE",version:e[1]||""}):"Chrome"===n[1]&&null!=(e=t.match(/\b(OPR|Edge)\/(\d+)/))?{name:e[1].replace("OPR","Opera"),version:e[2]}:(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&n.splice(1,1,e[1]),{name:n[0],version:n[1],isMobile:/Mobi/i.test(t),touchPoints:navigator.maxTouchPoints||"ontouchstart"in document.documentElement||0})},queryParam:function(t,e){if(void 0===e&&(e=t,t=window.location.href),t.indexOf("?")<0)return null;var n=new RegExp("(^|&)"+e+"=([^&]*)(&|$)","i"),i=t.replace(/.*?\?/g,"").match(n);return null!=i?decodeURI(i[2]):null},json:function(t,e){return $.fetch(t,e,"text").then(function(t){return $.parse.json(t)})}},e.parse={html:function(t){if("string"==typeof t){var e=document.createElement("template");return e.innerHTML=t,e.content.childNodes}return t},json:function(t){if("object"===(void 0===t?"undefined":_typeof(t)))return t;if(""===t)return{};var e=void 0;try{e=JSON.parse(t)}catch(t){}try{e||(e=Function('"use strict";return ('+t+")")())}catch(t){throw new Error(t)}return e},number:function(t){return"string"==typeof t?parseInt(t.replace(/[^\d]/g,"")):t}},e.cookie={get:function(t,e){function n(t){return t.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}for(var i={},r=0,o=document.cookie?document.cookie.split("; "):[];r<o.length;r++){var a=o[r].split("="),s=a.slice(1).join("=");e||'"'!==s.charAt(0)||(s=s.slice(1,-1));try{var c=n(a[0]);if(s=n(s),e)try{s=JSON.parse(s)}catch(t){}if(i[c]=s,t===c)break}catch(t){}}return t?i[t]:i},set:function(t,e,n){n=$.extend({path:"/"},n),"number"==typeof n.expires&&(n.expires=new Date(1*new Date+864e5*n.expires)),n.expires=n.expires?n.expires.toUTCString():"";var i="";for(var r in n)n[r]&&(i+="; "+r,!0!==n[r]&&(i+="="+String(n[r]).split(";")[0]));return"object"===(void 0===e?"undefined":_typeof(e))&&(e=JSON.stringify(e)),document.cookie=t+"="+e+i},remove:function(t,e){$.cookie.set(t,"",$.extend(e,{expires:-1}))}},e.storage={IKEY:"$$GQ$EXP$$",local:function(){return $.global.localStorage},set:function(t,e,n){if("object"==(void 0===e?"undefined":_typeof(e))&&(e=JSON.stringify(e)),void 0!==n){e=$.date.parse(n).getTime()+this.IKEY+e}this.local().setItem(t,e)},get:function(t,e){var n=this.local().getItem(t);if(null===n)return null;var i=n.indexOf(this.IKEY);if(i>-1){if(parseInt(n.substr(0,i))<(new Date).getTime())return this.remove(t),null;n=n.substr(i+this.IKEY.length)}if("array"==e||"object"==e)try{n=$.parse.json(n)}catch(t){throw new Error("Parsing!")}return n},remove:function(t){this.local().removeItem(t)},clear:function(){this.local().clear()},push:function(t,e,n){var i=this.get(t);if(i){try{var r=JSON.parse(i);Array.isArray(r)?(r.push(e),i=r):(i=JSON.parse("["+i+"]"),i.push(e))}catch(t){i="["+JSON.stringify(i)+"]",i=JSON.parse(i),i.push(e)}return"unique"==n&&(i=$.array.unique(i)),this.set(t,JSON.stringify(i)),this.get(t,"array")}return e="["+JSON.stringify(e)+"]",this.set(t,e),this.get(t)}},e.sessionStorage=e.extend({},e.storage),e.sessionStorage.local=function(){return $.global.sessionStorage},e.animation={array:[],running:!1,preCalc:function(t,e){var n=this,i={};return $.each(t,function(t,r){var o=n.toCalc(r);if(!1===o)return!0;var a=n.getPrefix(r),s=e.style[t];if(void 0===s)return!0;""===s&&(s=getComputedStyle(e)[t]);var c=n.toCalc(s);if(a!=n.getPrefix(s)){e.style[t]="100"+a;var u=getComputedStyle(e)[t];c=c/n.toCalc(u)*100,e.style[t]=s}i[t]={from:c,to:o,suffix:a}}),i},toCalc:function(t){if(""===t)return!1;if(isNaN(t)){if(!/^[-\d]/.test(t)||t.lastIndexOf("-")>0)return!1;if(t=t.replace(/[^-.\d]/g,""),t.replace(/[^\.]/g,"").length>1)return!1}return parseFloat(t)},getPrefix:function(t){return String(t).replace(/[-.\d]/g,"")},start:function(){this.running||(this.running=!0,this.tick())},tick:function(){var t=$.animation;t.running&&(!1===document.hidden&&window.requestAnimationFrame?window.requestAnimationFrame(t.tick):window.setTimeout(t.tick,13),t.process())}},e.animation.process=function(){var t=this.array,e=Date.now();$.each(t,function(n,i){if("object"!==_typeof(i.opts))return!0;var r=i.opts.duration;if(null==i.start)i.start=e,i.end=e+r,i.elem.__gQueryStop=!1;else if(i.elem.__gQueryStop)return t.splice(n,1),!0;i.curr=r-(i.end-e),$.each(i.calc,function(t,e){e.curr||(e.curr=e.from,e.diff=Math.abs(e.to-e.from),e.re=e.from>e.to),e.curr=i.curr/r*e.diff,e.re?e.curr=Math.max(e.from-e.curr,e.to):e.curr=Math.min(e.from+e.curr,e.to),i.elem.style[t]=e.curr+e.suffix,e.from===e.to&&delete i.calc[t]}),e>=i.end&&("function"==typeof i.callback&&i.callback.call(i.elem),t.splice(n,1))}),t.length<1&&(this.running=!1)},e.chain=function(t){function e(){return new(Function.prototype.bind.apply(e.prototype.init,[null].concat(Array.prototype.slice.call(arguments))))}return e.fn=e.prototype=t,e.fn.init.prototype=e.prototype,e},e.date=new e.chain({gquery:!0,init:function(){var t=arguments[0];return this.date=$.date.parse(t),this.initDate()},calc:function(t){var e=Object.create(this);return e.date=$.date.calc(e.date,t),this.initDate(e)},initDate:function(t){"object"!==(void 0===t?"undefined":_typeof(t))&&(t=this),t.timestamp=t.date.getTime();var e=t.date;return t._y=e.getFullYear(),t._m=e.getMonth()+1,t._d=e.getDate(),t._h=e.getHours(),t._i=e.getMinutes(),t._s=e.getSeconds(),t},format:function(t){function e(e,n){t=t.replace(new RegExp(e,"g"),n)}var n=$.extend({},this);return n._m<10&&(n._m="0"+n._m),n._d<10&&(n._d="0"+n._d),n._h<10&&(n._h="0"+n._h),n._i<10&&(n._i="0"+n._i),n._s<10&&(n._s="0"+n._s),n._dt=n._y+"-"+n._m+"-"+n._d+" "+n._h+":"+n._i+":"+n._s,"string"!=typeof t?n._dt:(e("yyyy",n._y),e("yy",String(n._y).substr(-2)),e("mm",n._m),e("m",this._m),e("dd",n._d),e("d",this._d),e("hh",n._h),e("h",this._h),e("ii",n._i),e("i",this._i),e("ss",n._s),e("s",this._s),t)},diff:function(t){function e(t){return Math.floor(t)}t=$.date.parse(t);var n={},i={},r=this.date.getTime(),o=t.getTime();return n._ms=r-o,n._s=e(n._ms/1e3),n._i=e(n._s/60),n._h=e(n._i/60),n._d=e(n._h/24),i._ms=Math.abs(n._ms),n.d=e(i._ms/864e5),i.df_h=i._ms%864e5,n.h=e(i.df_h/36e5),i.df_i=i.df_h%36e5,n.i=e(i.df_i/6e4),i.df_s=i.df_i%6e4,n.s=e(i.df_s/1e3),n.ms=i.df_s%1e3,this._df=n,this},ago:function(t){t||(t="");var e=this._df;return"object"!==(void 0===e?"undefined":_typeof(e))?"现在":e._ms<0?"未来":e.d>0?e.d>=30?(e.mon=Math.floor(e.d/30),e.mon>=12?(e.year=Math.floor(e.mon/12),e.year+t+"年前"):e.mon+t+"个月前"):1==e.d?"昨天":2==e.d?"前天":e.d+t+"天前":e.h>0?e.h+t+"小时前":e.i>0?e.i+t+"分钟前":e.s>0?e.s+t+"秒前":e.ms>0?"刚刚":0===e.ms?"现在":"未知"}}),e.date.parse=function(t,n){var i=void 0===t?"undefined":_typeof(t),r=void 0===n?"undefined":_typeof(n),o=void 0,a={};return t instanceof e.date&&(t=t.date),t&&t instanceof Date?"string"!==r?t:this.calc(t,n):"string"===i&&/^[+-]/.test(t)?this.calc(new Date,t):"string"===i?(o=new Date(t),isNaN(o.getTime())&&(o=new Date(t.replace(/-/g,"/"))),o):"number"===i?(a.len=13-String(t).length,0!=a.len&&(t=a.len<0?t/Math.pow(10,Math.abs(a.len)):t*Math.pow(10,a.len)),new Date(Math.round(t))):new Date},e.date.calc=function(t,e,n){if(!n){e=e.replace(/\s/g,"").replace(/([\+\-])/g," $1").split(" ");for(var i=0;i<e.length;i++)e[i]&&(t=$.date.calc(t,e[i],!0));return t}var r=t.getTime(),o=!/^-/.test(e),a={};switch(e=e.replace(/[\+\- ]/g,""),a.num=e.replace(/[^\d]/g,""),a.typ=e.replace(a.num,""),a.num=parseInt(a.num),o&&(a.num*=-1),a.typ){case"y":case"year":case"years":t.setYear(t.getFullYear()-a.num),r=t.getTime();break;case"m":case"mon":case"month":case"months":t.setMonth(t.getMonth()-a.num),r=t.getTime();break;case"d":case"day":case"days":r-=864e5*a.num;break;case"h":case"hour":case"hours":r-=36e5*a.num;break;case"i":case"min":case"minute":case"minutes":r-=6e4*a.num;break;case"s":case"sec":case"second":case"seconds":r-=1e3*a.num;break;case"ms":case"millisecond":case"milliseconds":r-=a.num}return new Date(r)},e});