UNPKG

ts-query

Version:

its simple library for dom control.

1 lines 29.6 kB
var $=function(t,n){"use strict";function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}var i="prototype",r="constructor",s=console,o=Array,a=function(t){this._state={},this._node=t},u=a.prototype;u.attr=function(t,n){return a._hasVal(n)?void this._node.setAttribute(t,n):this._node.getAttribute(t)||""},u.addClass=function(t){if(!this.hasClass(t)){var n=this._node.className.split(" ");n.push(t),this._node.className=c.trim(n.join(" "))}},u.removeClass=function(t){if(this.hasClass(t)){var n=this._node.className.split(" ");n.splice(n.indexOf(t),1),this._node.className=c.trim(n.join(" "))}},u.css=function(t,n){return"object"==typeof t?(c.forEach(t,function(t,n){this._setCss(n,t)},this),this):a._hasVal(n)?void this._setCss(t,n):this._getCss(t)},u.hide=function(){var t=this.css("display");return"none"!=t&&(this._state.display=t,this.css("display","none")),this},u.show=function(){var t=this.css("display");return"none"===t&&this.css("display",this._state.display||"block"),this},u.toggleDisplay=function(t){return a._hasVal(t)||(t="none"==this.css("display")),t?this.show():this.hide()},u.toggleClass=function(t,n){return a._hasVal(n)||(n=!this.hasClass(t)),n?this.addClass(t):this.removeClass(t)},u.val=function(t){return a._hasVal(t)?void(this._node.value=t):this._node.value||""},u.hasClass=function(t){return-1!=this._node.className.split(" ").indexOf(t)},u.removeAttr=function(t){this._node.removeAttribute(t)},["width","height"].forEach(function(t){u[t]=function(n){return a._hasVal(n)?void this._setCss(t,"number"==typeof n?n+"px":n):this._node[c.camelCase("client "+t)]||parseInt(this._getCss(t))||0}}),u.html=function(t){return a._hasVal(t)?void(this._node.innerHTML=t):this._node.innerHTML},u.remove=function(){this._remove(),this._node.parentNode&&this._node.parentNode.removeChild(this._node)},u._remove=function(){},u._setCss=function(t,n){var e;t=c.camelCase(t),t in a.test.style||(a._activePrefix?(e=c.camelCase(a._activePrefix+t),e in a.test.style?t=e:s.warn("Не корректный стиль!",t,n)):a._prefexes.some(function(n){var e=c.camelCase(n+t);return e in a.test.style?(a._activePrefix=n,t=e,!0):void 0})||s.warn("Не удалось найти префикс!",t,n)),this._node.style[t]=n},u._getCss=function(t){t=c.camelCase(t);var n=[this._node.style,getComputedStyle(this._node)],e=n[0][t]||n[1][t]||"",i=function(t,i){return n.some(function(n){var r=c.camelCase(t);return r in n?(e=n[r],i?i():!1,!0):void 0})};return e||(a._activePrefix?i(a._activePrefix+t)||s.warn("Не удалось получить стиль!",t):a._prefexes.some(function(n){return i(n+t,function(){a._activePrefix=n})})||s.warn("Не удалось получить стиль и префикс!",t)),e},a._hasVal=function(t){return void 0!=t},a._createE=function(t){return new a(t)},a._activePrefix="",a._prefexes=["-moz-","-ms-","-webkit-","-o-"],a.test=n.createElement("DIV");var c=function l(t){return this instanceof l?void o[i].forEach.call(arguments,function(t){this.add(t)},this):new l(t)};c[i]=[],c[i][r]=c;var h=c.prototype;["addClass","removeClass","toggleClass","removeAttr","show","hide","toggleDisplay"].forEach(function(t){h[t]=function(n){return this._toAll(t,[n]),this}}),["val","html","width","height"].forEach(function(t){h[t]=function(n){return this._setOrGet(t,n)}}),["attr"].forEach(function(t){h[t]=function(n,e){return this._setOrGet(t,e,n)}}),h.add=function(t){return o.isArray(t)?t.forEach(this.add,this):this._toElem(t).forEach(function(t){this.push(t)},this),this},h.hasClass=function(t){return this._has()?this[0].hasClass(t):!1},h.find=function(t){return this._has()?new c(o[i].slice.call(this[0]._node.querySelectorAll(t))):this},h.clone=function(){return this._has()?new c(this[0]._node.cloneNode(!0)):this},h.css=function(t,n){return"object"==typeof t?this._toAll("css",[t]):a._hasVal(n)?this._toAll("css",[t,n]):this[0].css(t)},h.each=function(t){return this.forEach(function(n,e){t(this.eq(e),n._node,e)},this),this},h.children=function(){return this._has()?new c(o[i].slice.call(this[0]._node.childNodes)):this},h.eq=function(t){return this._has()?new c(this[t||0]):this},h.get=function(t){return this._has()?this[t||0]._node:null},h.parent=function(){return this._has()?new c(this[0]._node.parentNode):this},h.append=function(t){return this._has()?void this._toElem(t,!0).forEach(function(t){this[0]._node.appendChild(t._node)},this):this},h.prepend=function(t){return this._has()?void this._toElem(t,!0).forEach(function(t){var n=o[i].filter.call(this[0]._node.childNodes,function(t){return c.isElement(t)});n.length?this[0]._node.insertBefore(t._node,n[0]):this[0]._node.appendChild(t._node)},this):this},h._toElem=function(t,e){return c.isElement(t)?[a._createE(t)]:t instanceof a?[t]:t instanceof c?[t[0]]:"string"==typeof t?/<.+?>/.test(t)?c.parse(t).map(function(t){return a._createE(t)}):e?[{_node:document.createTextNode(t)}]:o[i].slice.call(n.querySelectorAll(t)).map(function(t){return a._createE(t)}):(s.log("wrong param!",t),[])},h._toAll=function(t,n){return this.forEach(function(e){e[t].apply(e,n)}),this},h._has=function(){return this.length?!0:(s.warn("not length!"),!1)},h._setOrGet=function(t,n,e){if(!this._has())return this;if(a._hasVal(n)){var i=e?[e,n]:[n];return this._toAll(t,i),this}return this[0][t](e)},c.parse=function(t){var e=n.createElement("div");return e.innerHTML=t,o[i].filter.call(e.childNodes,function(t){return c.isElement(t)})},c.random=function(t,n){return Math.random()*(n-t)+t},c.randomInt=function(t,n){return Math.floor(Math.random()*(n-t+1))+t},c.trim=function(){return"trim"in String[i]?function(t){return t.trim()}:function(t){return(t||"").replace(/^\s+|\s+$/g,"")}}(),c.camelCase=function(t){return t.split(/[^\d\w]/).map(function(t,n){return n?t.charAt(0).toUpperCase()+t.substr(1):t}).join("")},c.guuid=function(){return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},c.isElement=function(t){return t instanceof Node&&1==t.nodeType},c.forEach=function(t,n,e,i){o.isArray(t)?t.forEach(function(t,r){n.call(e||this,t,r,i)}):Object.keys(t).forEach(function(r){n.call(e||this,t[r],r,i)})},c.some=function(t,n,e,i){return o.isArray(t)?t.some(function(t,r){return n.call(e||this,t,r,i)}):Object.keys(t).some(function(r){return n.call(e||this,t[r],r,i)})},c.every=function(t,n,e,i){return!c.some(t,function(t,r){return!n.call(e||this,t,r,i)})},c.findFirst=function(t,n,e,i){var r={id:null,value:null};return c.some(t,function(t,s){return n.call(e||window,t,s,i)?(r={id:s,value:t},!0):void 0}),r},c.floor=function(t){return t+.5<<0},c.roundTo=function(t,n){var e=Math.pow(10,n);return c.floor(t*e)/e},c.addPlugin=function(t){t(c,a)},c.events={},c.isPointer=!1;var m=function(t){t="on"+t;var n=document.createElement("div");n.setAttribute(t,"");var e="function"==typeof n[t];return"undefined"!=typeof n[t]&&(n[t]=null),n.removeAttribute(t),e},f={mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},mobile:{start:"touchstart",move:"touchmove",end:"touchend"},win:{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}};return function(){window.navigator.msPointerEnabled?(c.events=f.win,c.isPointer=!0):c.events=m("touchmove")?f.mobile:f.mouse}(),window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}(),c}(window.$window||window,window.$document||document);!function(t,n){$.addPlugin(function(t,n){"use strict";var e="prototype",i=t[e],r=n[e],s=Array,o="_ID_",a=function(t,n){var e=function(){};e.prototype=n.prototype,t.prototype=new e,t.prototype.constructor=t},e="prototype",i=t[e],s=Array,o="__ID__",u=window.$document||document,a=function(t,n){var e=function(){};e.prototype=n.prototype,t.prototype=new e,t.prototype.constructor=t},c=function(){this.type=null};c[e].init=function(t){this.originEvent=t.originEvent},c[e].getPrefix=function(){return"User:"},c[e].getEventString=function(){return this.getPrefix()+this.type},c[e].getClone=function(){return Object.create(this)};var e="prototype",i=t[e],s=Array,o="__ID__",u=window.$document||document,a=function(t,n){var e=function(){};e.prototype=n.prototype,t.prototype=new e,t.prototype.constructor=t},h=function(t,n,e){this.init(t),this.status=e,this.type="touch",this.coordinates={x:n.pageX,y:n.pageY},this.time=n.time};a(h,c),h[e].getEventString=function(){return c[e].getEventString.call(this)+":"+this.status};var e="prototype",i=t[e],s=Array,o="__ID__",u=window.$document||document,a=function(t,n){var e=function(){};e.prototype=n.prototype,t.prototype=new e,t.prototype.constructor=t},m=function(t,n,e){this.init(t),this.type="move",this.startCoordinates=m.getStartCoordinates(e),this.coordinates=m.getCoordinates(n),this.startTime=e.touch.time,this.lastTime=Date.now(),this.currentDistance(e),this.currentSpeed(e),this.initSwipeSpeed(e)};a(m,c),m[e].currentDistance=function(t){this.distanceX=this.coordinates.x-this.startCoordinates.x,this.distanceY=this.coordinates.y-this.startCoordinates.y,this.distance=Math.sqrt(Math.pow(this.distanceX,2)+Math.pow(this.distanceY,2)),t.move?(this.lastDistanceX=this.distanceX-t.move.distanceX,this.lastDistanceY=this.distanceY-t.move.distanceY,this.lastDistance=this.distance-t.move.distance):(this.lastDistance=0,this.lastDistanceX=0,this.lastDistanceY=0)},m[e].currentSpeed=function(t){var n,e=this.lastTime-this.startTime;this.speedX=this.distanceX/e,this.speedY=this.distanceY/e,this.speed=this.distance/e,t.move?(n=this.lastTime-t.move.lastTime,this.lastSpeedX=this.lastDistanceX/n,this.lastSpeedY=this.lastDistanceY/n,this.lastSpeed=this.lastDistance/n):(this.lastSpeed=0,this.lastDistanceX=0,this.lastDistanceY=0)},m[e].initSwipeSpeed=function(t){this.hasSwipeSpeed=t.move&&t.move.hasSwipeSpeed?!0:this.lastSpeed>m.swipeSpeed},m.getStartCoordinates=function(t){return{x:t.touch.coordinates.x,y:t.touch.coordinates.y}},m.getCoordinates=function(t){return{x:t.pageX,y:t.pageY}},m.swipeSpeed=.5;var e="prototype",i=t[e],s=Array,o="__ID__",u=window.$document||document,a=function(t,n){var e=function(){};e.prototype=n.prototype,t.prototype=new e,t.prototype.constructor=t},f=function(t,n,e){this.init(t),this.type="swipe",this.direction="left",this.startCoordinates=f.getStartCoordinates(e),this.vector=f.getVector(n,e),this.isHorizontal=f.isHorizontal(this.vector),this.direction=this.isHorizontal?f.getDirection(this.vector.x,"left","right"):f.getDirection(this.vector.y,"up","down")};a(f,c),f[e].getEventString=function(){return c.prototype.getEventString.call(this)+":"+(this.isHorizontal?"horizontal:":"vertical:")+this.direction},f.getStartCoordinates=function(t){return{x:t.touch.coordinates.x,y:t.touch.coordinates.y}},f.getVector=function(t,n){return{x:t.pageX-n.touch.coordinates.x,y:t.pageY-n.touch.coordinates.y}},f.isHorizontal=function(t){return Math.abs(t.x)/Math.abs(t.y||1e-5)>f.horizontalFactor},f.getDirection=function(t,n,e){return 0>t?n:e},f.horizontalFactor=2/3;var e="prototype",i=t[e],s=Array,o="__ID__",u=window.$document||document,a=function(t,n){var e=function(){};e.prototype=n.prototype,t.prototype=new e,t.prototype.constructor=t},l=function(t,n){this.init(t),this.type="tap",this.coordinates={x:n.pageX,y:n.pageY},this.time=n.time};a(l,c);var e="prototype",i=t[e],s=Array,o="__ID__",u=window.$document||document,a=function(t,n){var e=function(){};e.prototype=n.prototype,t.prototype=new e,t.prototype.constructor=t},d=function(t,n,e,i){this.startDistance=0,this.distance=0,this.deltaDistance=0,this.angle=0,this.deltaAngle=0,this.zoom=1,this.deltaZoom=0,this.init(t),this.type="multiTouch",this.vector={x:e.pageX-n.pageX,y:e.pageY-n.pageY},this.distance=Math.sqrt(Math.pow(this.vector.x,2)+Math.pow(this.vector.y,2)),this.angle=180*Math.atan(this.vector.y/this.vector.x)/Math.PI,i?(this.startDistance=i.startDistance,this.deltaAngle=this.angle-i.angle,this.deltaDistance=this.distance-i.distance,this.zoom=this.distance/this.startDistance,this.deltaZoom=this.zoom-i.zoom):this.startDistance=this.distance};a(d,c),n[e]=r,r.on=function(n,e,i){this._events||(this._events={}),this._ID||(this._ID=t._add(this),this._node[o]=this._ID),this._events[n]||(this._events[n]=[]);var r={event:n,handler:e,context:i||new t(this)};if(this._events[n].push(r),0!=n.indexOf("User")){var s=function(t){return e.call(i||this,t)};r.originHandler=s,this._node.addEventListener(n,s,!1)}else this._hasCustom||this._addCustom()},r.off=function(n,e){return this._events?(t.forEach(this._events,function(t,i){n&&n!=i||(t=t.filter(function(t){return e&&e!=t.handler?!0:(this._node.removeEventListener(i,t.originHandler||t.handler),!1)},this)),0==t.length&&delete this._events[i]},this),this._hasCustom&&!t.some(this._events,function(t,n){return 0==n.indexOf("User")})&&this._removeCustom(),void(Object.keys(this._events).length||(t._remove(this._ID),this._node[o]=null,this._ID=null))):this},r.trigger=function(t,e){return this._events?t?(e||(e=[]),s.isArray(e)||(e=[e]),n._splitEvents(t).forEach(function(i,r){this._events[i]&&this._startUserEvent(i,n._currentArgs(t,r,e.slice()))},this),this):(console.log("Неверные параметры!"),this):this},r._remove=function(){this.off()},r._startUserEvent=function(t,n){this._events[t].forEach(function(t){t.handler.apply(t.context,n)})},r._addCustom=function(){this._hasCustom=!0;var n=this;this._start=function(t){t.preventDefault(),n._onStart(t)},this._node.addEventListener(t.events.start,this._start,!1)},r._onStart=function(e){var i=this;n._fingers=n._fingers.concat(n._getTouches(e,!0)),this._createTouchEvent(e,n._fingers.slice(),"start");var r=function(t){t.preventDefault(),i._onMove(t)},s=function(e){e.preventDefault(),i._onEnd(e),n._fingers.length||(u.removeEventListener(t.events.move,r),u.removeEventListener(t.events.end,s),i.__hasEvents=!1)};this.__hasEvents||(u.addEventListener(t.events.move,r,!1),u.addEventListener(t.events.end,s,!1),this.__hasEvents=!0)},r._onMove=function(t){var e=n._getFingers(t);1==e.length?this._createMoveEvent(t,e):this._createMultitouch(t,e)},r._onEnd=function(e){var i=n._getTouches(e,!0),r=n._getFingers(e,i,!0);this._createSwipe(e,r),this._createTapEvent(e,r),this._createTouchEvent(e,r,"end"),n._clearEvents(r),n._fingers=n._fingers.filter(function(e){return!t.some(i,n._getFingerById,n,e.identifier)})},r._createTouchEvent=function(t,n,e){n.forEach(function(n){this._startEvent(new h(t,n,e),n)},this)},r._createMoveEvent=function(t,e){var i=e[0];this._startEvent(new m(t,i,n._Event.fingers[i.identifier]),i)},r._createMultitouch=function(t,e){e=e.sort(function(t,n){return t.time-n.time}),this._startEvent(new d(t,e[0],e[1],n._Event.multitouch))},r._createTapEvent=function(t,e){e.forEach(function(e){n._isTap(e)&&this._startEvent(new l(t,e),e)},this)},r._createSwipe=function(t,e){e.forEach(function(e){n._isSwipe(e)&&this._startEvent(new f(t,e,n._Event.fingers[e.identifier]),e)},this)},r._removeCustom=function(){this._hasCustom=!1,this._node.removeEventListener(t.events.start,this._start)},r._startEvent=function(t,e){e?(n._Event.fingers[e.identifier]||(n._Event.fingers[e.identifier]={}),n._Event.fingers[e.identifier][t.type]=t):n._Event.multitouch=t,this.trigger(t.getEventString(),[t.getClone()])},n._isTap=function(t){return n._Event.fingers[t.identifier]?n._Event.fingers[t.identifier].touch?n._Event.fingers[t.identifier].move&&n._Event.fingers[t.identifier].move.distance>15?!1:Date.now()-n._Event.fingers[t.identifier].touch.time<n._tapTime:n._message("Нет тача!","warn"):!1},n._isSwipe=function(t){return n._Event.fingers[t.identifier]&&n._Event.fingers[t.identifier].move&&n._Event.fingers[t.identifier].move.distance>30&&n._Event.fingers[t.identifier].move.hasSwipeSpeed&&Date.now()-n._Event.fingers[t.identifier].touch.time<n._tapTime},n._getTouches=function(i,r){var o=[];if(t.isPointer){if(!i.pointerId)return n._message("Нет идентификатора пальца!");o.push(n._getFingerData(i))}else if(i.touches){var a=r?i.changedTouches:i.touches;o=s[e].map.call(a,function(t){return n._getFingerData(t)})}else o.push(n._getFingerData(i));return o},n._getFingers=function(e,i,r){var s;return i=i||n._getTouches(e),r&&(s=n._fingers.filter(function(e){return t.some(i,n._getFingerById,n,e.identifier)})),n._fingers=n._fingers.map(function(e){var r=t.findFirst(s||i,n._getFingerById,n,e.identifier);return null!=r.id?n._getFingerData(r.value,e.time):e}),s||n._fingers.slice()},n._getFingerById=function(t,n,e){return t.identifier==e},n._fingers=[],n._message=function(t,n,e){return console[n||"error"](t),e||!1},n._tapTime=300,n._Event={multitouch:null,fingers:{}},n._clearEvents=function(t){1==t.length&&(n._Event.multitouch=null),t.forEach(function(t){delete n._Event.fingers[t.identifier]})},n._getFingerData=function(t,n){return{time:n||t.timeStamp||Date.now(),identifier:t.identifier||t.pointerId||0,pageX:t.pageX,pageY:t.pageY,target:t.target}},n._currentArgs=function(t,n,e){var i=t.split(":");return i.splice(0,n+1),i.concat(e)},n._splitEvents=function(t){for(var n=t.split(":"),e=[],i=0;i<n.length;i++)e.push(n.slice(0,i+1).join(":"));return e},n._createE=function(e){return t._getById(e[o])||new n(e)},t._elems={},t._add=function(n){for(var e;!e||e in this._elems;)e=t.guuid();return this._elems[e]=n,e},t._remove=function(t){delete this._elems[t]},t._getById=function(t){return this._elems[t]||null},["on","off","trigger"].forEach(function(t){i[t]=function(){return this._toAll(t,s[e].slice.call(arguments))}})})}(window.$window||window,window.$document||document),function(t,n){$.addPlugin(function(t,n){"use strict";var e=function(){var t=[].slice.call(arguments),n=this;if(t.length)for(var i=t.length;i--;)Math.abs(t[i])<e.SMALL_NUMBER&&(t[i]=0);if(n.setIdentity(),16==t.length)n.m11=n.a=t[0],n.m12=n.b=t[1],n.m13=t[2],n.m14=t[3],n.m21=n.c=t[4],n.m22=n.d=t[5],n.m23=t[6],n.m24=t[7],n.m31=t[8],n.m32=t[9],n.m33=t[10],n.m34=t[11],n.m41=n.e=t[12],n.m42=n.f=t[13],n.m43=t[14],n.m44=t[15];else if(6==t.length)this.affine=!0,n.m11=n.a=t[0],n.m12=n.b=t[1],n.m14=n.e=t[4],n.m21=n.c=t[2],n.m22=n.d=t[3],n.m24=n.f=t[5];else if(1===t.length&&"string"==typeof t[0])n.setMatrixValue(t[0]);else if(t.length>0)throw new TypeError("Invalid Matrix Value")};e.SMALL_NUMBER=1e-6,e.Rotate=function(t,n,i){t*=Math.PI/180,n*=Math.PI/180,i*=Math.PI/180;var r=Math.cos(t),s=-Math.sin(t),o=Math.cos(n),a=-Math.sin(n),u=Math.cos(i),c=-Math.sin(i),h=new e;return h.m11=h.a=o*u,h.m12=h.b=-o*c,h.m13=a,h.m21=h.c=s*a*u+r*c,h.m22=h.d=r*u-s*a*c,h.m23=-s*o,h.m31=s*c-r*a*u,h.m32=s*u+r*a*c,h.m33=r*o,h},e.RotateAxisAngle=function(t,n,i,r){r*=Math.PI/360;var s=Math.sin(r),o=Math.cos(r),a=s*s,u=Math.sqrt(t*t+n*n+i*i);0===u?(t=0,n=0,i=1):(t/=u,n/=u,i/=u);var c=t*t,h=n*n,m=i*i,f=new e;return f.m11=f.a=1-2*(h+m)*a,f.m12=f.b=2*(t*n*a+i*s*o),f.m13=2*(t*i*a-n*s*o),f.m21=f.c=2*(n*t*a-i*s*o),f.m22=f.d=1-2*(m+c)*a,f.m23=2*(n*i*a+t*s*o),f.m31=2*(i*t*a+n*s*o),f.m32=2*(i*n*a-t*s*o),f.m33=1-2*(c+h)*a,f.m14=f.m24=f.m34=0,f.m41=f.e=f.m42=f.f=f.m43=0,f.m44=1,f},e.ScaleX=function(t){var n=new e;return n.m11=n.a=t,n},e.ScaleY=function(t){var n=new e;return n.m22=n.d=t,n},e.ScaleZ=function(t){var n=new e;return n.m33=t,n},e.Scale=function(t,n,i){var r=new e;return r.m11=r.a=t,r.m22=r.d=n,r.m33=i,r},e.SkewX=function(t){t*=Math.PI/180;var n=new e;return n.m21=n.c=Math.tan(t),n},e.SkewY=function(t){t*=Math.PI/180;var n=new e;return n.m12=n.b=Math.tan(t),n},e.Translate=function(t,n,i){var r=new e;return r.m41=r.e=t,r.m42=r.f=n,r.m43=i,r},e.multiply=function(t,n){var i=n.m11*t.m11+n.m12*t.m21+n.m13*t.m31+n.m14*t.m41,r=n.m11*t.m12+n.m12*t.m22+n.m13*t.m32+n.m14*t.m42,s=n.m11*t.m13+n.m12*t.m23+n.m13*t.m33+n.m14*t.m43,o=n.m11*t.m14+n.m12*t.m24+n.m13*t.m34+n.m14*t.m44,a=n.m21*t.m11+n.m22*t.m21+n.m23*t.m31+n.m24*t.m41,u=n.m21*t.m12+n.m22*t.m22+n.m23*t.m32+n.m24*t.m42,c=n.m21*t.m13+n.m22*t.m23+n.m23*t.m33+n.m24*t.m43,h=n.m21*t.m14+n.m22*t.m24+n.m23*t.m34+n.m24*t.m44,m=n.m31*t.m11+n.m32*t.m21+n.m33*t.m31+n.m34*t.m41,f=n.m31*t.m12+n.m32*t.m22+n.m33*t.m32+n.m34*t.m42,l=n.m31*t.m13+n.m32*t.m23+n.m33*t.m33+n.m34*t.m43,d=n.m31*t.m14+n.m32*t.m24+n.m33*t.m34+n.m34*t.m44,_=n.m41*t.m11+n.m42*t.m21+n.m43*t.m31+n.m44*t.m41,p=n.m41*t.m12+n.m42*t.m22+n.m43*t.m32+n.m44*t.m42,v=n.m41*t.m13+n.m42*t.m23+n.m43*t.m33+n.m44*t.m43,g=n.m41*t.m14+n.m42*t.m24+n.m43*t.m34+n.m44*t.m44;return new e(i,r,s,o,a,u,c,h,m,f,l,d,_,p,v,g)},e.prototype.setMatrixValue=function(t){t=String(t).trim();var n=this;if(n.setIdentity(),"none"==t)return n;var e,i,r=t.slice(0,t.indexOf("("));if("matrix3d"==r){for(e=t.slice(9,-1).split(","),i=e.length;i--;)e[i]=parseFloat(e[i]);n.m11=n.a=e[0],n.m12=n.b=e[1],n.m13=e[2],n.m14=e[3],n.m21=n.c=e[4],n.m22=n.d=e[5],n.m23=e[6],n.m24=e[7],n.m31=e[8],n.m32=e[9],n.m33=e[10],n.m34=e[11],n.m41=n.e=e[12],n.m42=n.f=e[13],n.m43=e[14],n.m44=e[15]}else{if("matrix"!=r)throw new TypeError("Invalid Matrix Value");for(n.affine=!0,e=t.slice(7,-1).split(","),i=e.length;i--;)e[i]=parseFloat(e[i]);n.m11=n.a=e[0],n.m12=n.b=e[2],n.m41=n.e=e[4],n.m21=n.c=e[1],n.m22=n.d=e[3],n.m42=n.f=e[5]}return n},e.prototype.multiply=function(t){return e.multiply(this,t)},e.prototype.inverse=function(){throw new Error("the inverse() method is not implemented (yet).")},e.prototype.translate=function(t,n,i){return null==i&&(i=0),e.multiply(this,e.Translate(t,n,i))},e.prototype.scale=function(t,n,i){return null==n&&(n=t),null==i&&(i=1),e.multiply(this,e.Scale(t,n,i))},e.prototype.rotate=function(t,n,i){return null==n&&(n=t),null==i&&(i=t),e.multiply(this,e.Rotate(t,n,i))},e.prototype.rotateAxisAngle=function(t,n,i,r){return null==n&&(n=t),null==i&&(i=t),e.multiply(this,e.RotateAxisAngle(t,n,i,r))},e.prototype.skewX=function(t){return e.multiply(this,e.SkewX(t))},e.prototype.skewY=function(t){return e.multiply(this,e.SkewY(t))},e.prototype.toString=function(){var t=this;return this.affine?"matrix("+[t.a,t.b,t.c,t.d,t.e,t.f].join(", ")+")":"matrix3d("+[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44].join(", ")+")"},e.prototype.setIdentity=function(){var t=this;return t.m11=t.a=1,t.m12=t.b=0,t.m13=0,t.m14=0,t.m21=t.c=0,t.m22=t.d=1,t.m23=0,t.m24=0,t.m31=0,t.m32=0,t.m33=1,t.m34=0,t.m41=t.e=0,t.m42=t.f=0,t.m43=0,t.m44=1,this},e.prototype.transform=function(t){var n=this,e=n.m11*t.x+n.m12*t.y+n.m13*t.z+n.m14*t.w,i=n.m21*t.x+n.m22*t.y+n.m23*t.z+n.m24*t.w,r=n.m31*t.x+n.m32*t.y+n.m33*t.z+n.m34*t.w,s=n.m41*t.x+n.m42*t.y+n.m43*t.z+n.m44*t.w;return t.x=e/s,t.y=i/s,t.z=r/s,t},e.prototype.toFullString=function(){var t=this;return[[t.m11,t.m12,t.m13,t.m14].join(", "),[t.m21,t.m22,t.m23,t.m24].join(", "),[t.m31,t.m32,t.m33,t.m34].join(", "),[t.m41,t.m42,t.m43,t.m44].join(", ")].join("\n")};var i="prototype",r=n[i],s=t[i],o=(Array,180/Math.PI),a=window.MSCSSMatrix||window.WebKitCSSMatrix||e;r.transform=function(e){var i=this._getCss("transform");return this._t&&this._t.cache==i||(this._t=n._parseMatrix(i)),n._hasVal(e)?(t.forEach(e,function(n,e){t.forEach(n,function(t,n){this._t[e][n]=t},this)},this),this._t.cache=n._createMatrix(this._t),this._setCss("transform",this._t.cache),void 0):{translate:{x:this._t.translate.x,y:this._t.translate.y,z:this._t.translate.z},scale:{x:this._t.scale.x,y:this._t.scale.y,z:this._t.scale.z},rotate:{x:this._t.rotate.x,y:this._t.rotate.y,z:this._t.rotate.z}}},n._parseMatrix=function(n){var e;e="none"==n?new a:new a(n);var i=Math.sqrt(e.m11*e.m11+e.m12*e.m12+e.m13*e.m13),r=Math.sqrt(e.m21*e.m21+e.m22*e.m22+e.m23*e.m23),s=Math.sqrt(e.m31*e.m31+e.m32*e.m32+e.m33*e.m33),u=Math.atan2(-e.m32/s,e.m33/s)/o,c=Math.asin(e.m31/s)/o,h=Math.atan2(-e.m21/r,e.m11/i)/o;(1===e.m21||-1===e.m21)&&(u=0,c=e.m21*-Math.PI/2,h=e.m21*Math.atan2(e.m23/r,e.m22/r)/o);var m=e.m41/i,f=e.m42/i,l=e.m43/i;return{translate:{x:t.floor(m),y:t.floor(f),z:t.floor(l)},rotate:{x:t.floor(u),y:t.floor(c),z:t.floor(h)},scale:{x:t.roundTo(i,4),y:t.roundTo(r,4),z:t.roundTo(s,4)},cache:n}},n._createMatrix=function(t){return(new a).translate(t.translate.x,t.translate.y,t.translate.z).rotate(t.rotate.x,t.rotate.y,t.rotate.z).scale(t.scale.x,t.scale.y,t.scale.z).toString().replace(/\.0+?([\),])/g,"$1")};var u={scale:function(t){return{x:t,y:t}},rotate:function(t){return{z:t}}};["translate","scale","rotate"].forEach(function(t){s[t]=function(e){if(n._hasVal(e)){var i={};return"object"==typeof e?(i[t]=e,this._toAll("transform",[i])):(i[t]=u[t](e),this._toAll("transform",[i]))}return this[0].transform().rotate}}),s.transform=function(t){return this._setOrGet("transform",t)}})}(window.$window||window,window.$document||document),function(t,n){"use strict";$.addPlugin(function(t,n){var e={linear:function(t){return t},get:function(t){return-1>t&&(t=-1),t>1&&(t=1),function(n){return 0==t?n:0>t?n*(n*-t+1+t):n*((2-n)*t+(1-t))}},getPowIn:function(t){return function(n){return Math.pow(n,t)}},getPowOut:function(t){return function(n){return 1-Math.pow(1-n,t)}},getPowInOut:function(t){return function(n){return(n*=2)<1?.5*Math.pow(n,t):1-.5*Math.abs(Math.pow(2-n,t))}},sineIn:function(t){return 1-Math.cos(t*Math.PI/2)},sineOut:function(t){return Math.sin(t*Math.PI/2)},sineInOut:function(t){return-.5*(Math.cos(Math.PI*t)-1)},getBackIn:function(t){return function(n){return n*n*((t+1)*n-t)}},getBackOut:function(t){return function(n){return--n*n*((t+1)*n+t)+1}},getBackInOut:function(t){return t*=1.525,function(n){return(n*=2)<1?.5*n*n*((t+1)*n-t):.5*((n-=2)*n*((t+1)*n+t)+2)}},circIn:function(t){return-(Math.sqrt(1-t*t)-1)},circOut:function(t){return Math.sqrt(1- --t*t)},circInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},bounceIn:function(t){return 1-e.bounceOut(1-t)},bounceOut:function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return.5>t?.5*e.bounceIn(2*t):.5*e.bounceOut(2*t-1)+.5},getElasticIn:function(t,n){var e=2*Math.PI;return function(i){if(0==i||1==i)return i;var r=n/e*Math.asin(1/t);return-(t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*e/n))}},getElasticOut:function(t,n){var e=2*Math.PI;return function(i){if(0==i||1==i)return i;var r=n/e*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-r)*e/n)+1}},getElasticInOut:function(t,n){var e=2*Math.PI;return function(i){var r=n/e*Math.asin(1/t);return(i*=2)<1?-.5*t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*e/n):t*Math.pow(2,-10*(i-=1))*Math.sin((i-r)*e/n)*.5+1}}};e.backOut=e.getBackOut(1.7),e.backIn=e.getBackIn(1.7),e.backInOut=e.getBackInOut(1.7),e.elasticIn=e.getElasticIn(1,.3),e.elasticInOut=e.getElasticInOut(1,.3*1.5),e.elasticOut=e.getElasticOut(1,.3),e.quadIn=e.getPowIn(2),e.quadOut=e.getPowOut(2),e.quadInOut=e.getPowInOut(2),e.cubicIn=e.getPowIn(3),e.cubicOut=e.getPowOut(3),e.cubicInOut=e.getPowInOut(3),e.quartIn=e.getPowIn(4),e.quartOut=e.getPowOut(4),e.quartInOut=e.getPowInOut(4),e.quintIn=e.getPowIn(5),e.quintOut=e.getPowOut(5),e.quintInOut=e.getPowInOut(5);var i="prototype",r=(t[i],n[i],function(){this.active=0,this.step=1,this.animations=[]});r[i].delay=function(t){var n=this;return this.animations.push({start:function(){setTimeout(function(){n._endAnimation()},t)}}),1==this.animations.length&&requestAnimationFrame(function(){n.animations[0].start(!0)}),this},r[i].revers=function(){var t=this;return this.animations.push({start:function(){t.step=-1*t.step,t._endAnimation()}}),this},r[i]._endAnimation=function(){var t=this;requestAnimationFrame(function(){var n=t.animations[t.active];n.success&&n.success(),t.active+=t.step,t.active in t.animations?t.animations[t.active].start(t.step>0):t.success&&t.success(t)})},r[i].onEnd=function(t){this.success=t},r[i].play=function(){this.active=0,this.step=1,this.animations[0].start(!0)},r[i].animate=function(n){var i,r,a,u=this,c=s(n.timeFunction)||e.linear,h=n.duration||300,m=o(n,c),f=0,l=n.loop||1,d={stop:function(){t._removeAnimation(_)},end:function(){this.stop(),a(c(1))},onEnd:function(){-1!=n.loop&&f++,f==l?u._endAnimation():(r=n.yoyo?!r:r,this._start(r))},success:n.success,start:function(t){r=t,f=0,this._start(t)},_start:function(n){i=Date.now(),a=n?m.play:m.reverse,t._addAnimation(_)}},_=function(){var n=(Date.now()-i)/h;n>1&&(n=1),a(n),1==n&&(t._removeAnimation(_),d.onEnd())};return this.animations.push(d),1==this.animations.length&&requestAnimationFrame(function(){u.animations[0].start(!0)}),this};var s=function(t){return t?"string"==typeof t?t in e?e[t]:(console.warn("Не удалось найти ф-цию времени!"),null):t:null},o=function(n,e){if(n.step)return function(t){return n.step(e(t),t)};var i={},r={},o={},a={},u={},c=/[^a-z]/g;return n.exists||(n.exists={}),n.timeFunctions||(n.timeFunctions={}),t.forEach(n.start,function(t,h){o[h]=n.exists[h]||(t+"").replace(c,"")||(n.end[h]+"").replace(c,""),i[h]=parseFloat(t),r[h]=parseFloat(n.end[h]),u[h]=r[h]-i[h],0==u[h]?(delete i[h],delete r[h],delete o[h]):a[h]=s(n.timeFunctions[h])||e}),{play:function(t){var e={};Object.keys(o).forEach(function(n){e[n]=i[n]+u[n]*a[n](t)+o[n]}),n.apply(e,t)},reverse:function(t){var e={};Object.keys(o).forEach(function(n){e[n]=r[n]-u[n]*a[n](t)+o[n]}),n.apply(e,t)}}};t._animations=[],t.timeFunctions=e,t._addAnimation=function(t){this._animations.push(t),1==this._animations.length&&this._tick()},t._removeAnimation=function(t){this._animations.splice(this._animations.indexOf(t),1)},t._tick=function(){requestAnimationFrame(function n(){t._animations.length&&(t._animations.forEach(function(t){t()}),requestAnimationFrame(n))})},t.animate=function(t){var n=new r;return n.animate(t),n},t.delay=function(t){var n=new r;return n.delay(t),n}})}(window.$window||window,window.$document||document);