mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2024-12-11 10:45:37 +01:00
15 lines
39 KiB
JavaScript
15 lines
39 KiB
JavaScript
|
/*!
|
||
|
* VERSION: 0.17.1
|
||
|
* DATE: 2019-02-28
|
||
|
* UPDATES AND DOCS AT: http://greensock.com
|
||
|
*
|
||
|
* Requires TweenLite and CSSPlugin version 1.17.0 or later (TweenMax contains both TweenLite and CSSPlugin). ThrowPropsPlugin is required for momentum-based continuation of movement after the mouse/touch is released (ThrowPropsPlugin is a membership benefit of Club GreenSock - http://greensock.com/club/).
|
||
|
*
|
||
|
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
|
||
|
* This work is subject to the terms at http://greensock.com/standard-license or for
|
||
|
* Club GreenSock members, the software agreement that was issued with your membership.
|
||
|
*
|
||
|
* @author: Jack Doyle, jack@greensock.com
|
||
|
*/
|
||
|
var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("utils.Draggable",["events.EventDispatcher","TweenLite","plugins.CSSPlugin"],function(a,b,c){var d,e,f,g,h,i,j,k,l,m={css:{},data:"_draggable"},n={css:{},data:"_draggable"},o={css:{},data:"_draggable"},p={css:{}},q=_gsScope._gsDefine.globals,r={},s=function(){return!1},t={style:{},appendChild:s,removeChild:s},u=_gsScope.document||{createElement:function(){return t}},v=u.documentElement||{},w=function(a){return u.createElementNS?u.createElementNS("http://www.w3.org/1999/xhtml",a):u.createElement(a)},x=w("div"),y=[],z=180/Math.PI,A=999999999999999,B=Date.now||function(){return(new Date).getTime()},C=!(u.addEventListener||!u.all),D=u.createElement("div"),E=[],F={},G=0,H=/^(?:a|input|textarea|button|select)$/i,I=0,J=_gsScope.navigator&&-1!==_gsScope.navigator.userAgent.toLowerCase().indexOf("android"),K=0,L={},M={},N=function(a){if("string"==typeof a&&(a=b.selector(a)),!a||a.nodeType)return[a];var c,d=[],e=a.length;for(c=0;c!==e;d.push(a[c++]));return d},O=function(a,b){var c,d={};if(b)for(c in a)d[c]=a[c]*b;else for(c in a)d[c]=a[c];return d},P=function(){for(var a=E.length;--a>-1;)E[a]()},Q=function(a){E.push(a),1===E.length&&b.ticker.addEventListener("tick",P,this,!1,1)},R=function(a){for(var c=E.length;--c>-1;)E[c]===a&&E.splice(c,1);b.to(S,0,{overwrite:"all",delay:15,onComplete:S,data:"_draggable"})},S=function(){E.length||b.ticker.removeEventListener("tick",P)},T=function(a,b){var c;for(c in b)void 0===a[c]&&(a[c]=b[c]);return a},U=function(){return null!=window.pageYOffset?window.pageYOffset:null!=u.scrollTop?u.scrollTop:v.scrollTop||u.body.scrollTop||0},V=function(){return null!=window.pageXOffset?window.pageXOffset:null!=u.scrollLeft?u.scrollLeft:v.scrollLeft||u.body.scrollLeft||0},W=function(a,b){Ka(a,"scroll",b),Y(a.parentNode)||W(a.parentNode,b)},X=function(a,b){La(a,"scroll",b),Y(a.parentNode)||X(a.parentNode,b)},Y=function(a){return!(a&&a!==v&&a!==u&&a!==u.body&&a!==window&&a.nodeType&&a.parentNode)},Z=function(a,b){var c="x"===b?"Width":"Height",d="scroll"+c,e="client"+c,f=u.body;return Math.max(0,Y(a)?Math.max(v[d],f[d])-(window["inner"+c]||v[e]||f[e]):a[d]-a[e])},$=function(a){var b=Y(a),c=Z(a,"x"),d=Z(a,"y");b?a=M:$(a.parentNode),a._gsMaxScrollX=c,a._gsMaxScrollY=d,a._gsScrollX=a.scrollLeft||0,a._gsScrollY=a.scrollTop||0},_=function(a,b){return a=a||window.event,r.pageX=a.clientX+u.body.scrollLeft+v.scrollLeft,r.pageY=a.clientY+u.body.scrollTop+v.scrollTop,b&&(a.returnValue=!1),r},aa=function(a){return a?("string"==typeof a&&(a=b.selector(a)),a.length&&a!==window&&a[0]&&a[0].style&&!a.nodeType&&(a=a[0]),a===window||a.nodeType&&a.style?a:null):a},ba=function(a,b){var c,e,f,g=a.style;if(void 0===g[b]){for(f=["O","Moz","ms","Ms","Webkit"],e=5,c=b.charAt(0).toUpperCase()+b.substr(1);--e>-1&&void 0===g[f[e]+c];);if(0>e)return"";d=3===e?"ms":f[e],b=d+c}return b},ca=function(a,b,c){var d=a.style;d&&(void 0===d[b]&&(b=ba(a,b)),null==c?d.removeProperty?d.removeProperty(b.replace(/([A-Z])/g,"-$1").toLowerCase()):d.removeAttribute(b):void 0!==d[b]&&(d[b]=c))},da="undefined"!=typeof window?window:u.defaultView||{getComputedStyle:function(){}},ea=function(a,b){return da.getComputedStyle(a instanceof Element?a:a.host||(a.parentNode||{}).host||a,b)},fa=/(?:Left|Right|Width)/i,ga=/(?:\d|\-|\+|=|#|\.)*/g,ha=function(a,b,c,d,e){if("px"===d||!d)return c;if("auto"===d||!c)return 0;var f,g=fa.test(b),h=a,i=x.style,j=0>c;return j&&(c=-c),"%"===d&&-1!==b.indexOf("border")?f=c/100*(g?a.clientWidth:a.clientHeight):(i.cssText="border:0 solid red;position:"+ja(a,"position",!0)+";line-height:0;","%"!==d&&h.appendChild?i[g?"borderLeftWidth":"borderTopWidth"]=c+d:(h=a.parentNode||u.body,i[g?"width":"height"]=c+d),h.appendChild(x),f=parseFloat(x[g?"offsetWidth":"offsetHeight"]),h.removeChild(x),0!==f||e||(f=ha(a,b,c,d,!0))),j?-f:f},ia=function(a,b){if("absolute"!==ja(a,"position",!0))return 0;var c="left"===b?"Left":"Top",d=ja(a,"margin"+c,!0);
|
||
|
return f&&(e||d&&Ha.vars.suppressClickOnDrag!==!1)&&a.stopImmediatePropagation(),!c||Ha.pointerEvent&&Ha.pointerEvent.defaultPrevented||e&&i===h?void((Ha.isPressed||d||c)&&(f?i&&a.detail&&c&&!g||(a.preventDefault(),a.preventManipulation&&a.preventManipulation()):a.returnValue=!1)):(i&&e&&(wa=bb),void(va=bb))},vb=function(a){return ma?{x:a.x*ma[0]+a.y*ma[2]+ma[4],y:a.x*ma[1]+a.y*ma[3]+ma[5]}:{x:a.x,y:a.y}};da=Ua.get(this.target),da&&da.kill(),this.startDrag=function(a,b){var c,e,f,g;pb(a||Ha.pointerEvent,!0),b&&!Ha.hitTest(a||Ha.pointerEvent)&&(c=Ya(a||Ha.pointerEvent),e=Ya(d),f=vb({x:c.left+c.width/2,y:c.top+c.height/2}),g=vb({x:e.left+e.width/2,y:e.top+e.height/2}),j-=f.x-g.x,k-=f.y-g.y),Ha.isDragging||(Ha.isDragging=!0,ka(Ha,"dragstart","onDragStart"))},this.drag=qb,this.endDrag=function(a){sb(a||Ha.pointerEvent,!0)},this.timeSinceDrag=function(){return Ha.isDragging?0:(B()-Va)/1e3},this.timeSinceClick=function(){return(B()-bb)/1e3},this.hitTest=function(a,b){return Ua.hitTest(Ha.target,a,b)},this.getDirection=function(a,b){var c,d,e,f,h,i,j="velocity"===a&&g?a:"object"!=typeof a||za?"start":"element";return"element"===j&&(h=Ya(Ha.target),i=Ya(a)),c="start"===j?Ha.x-l:"velocity"===j?g.getVelocity(this.target,Aa):h.left+h.width/2-(i.left+i.width/2),za?0>c?"counter-clockwise":"clockwise":(b=b||2,d="start"===j?Ha.y-r:"velocity"===j?g.getVelocity(this.target,Ba):h.top+h.height/2-(i.top+i.height/2),e=Math.abs(c/d),f=1/b>e?"":0>c?"left":"right",b>e&&(""!==f&&(f+="-"),f+=0>d?"up":"down"),f)},this.applyBounds=function(a){var b,c,e,g,h,i;if(a&&f.bounds!==a)return f.bounds=a,Ha.update(!0);if(eb(!0),fb(),s){if(b=Ha.x,c=Ha.y,b>w?b=w:x>b&&(b=x),c>E?c=E:H>c&&(c=H),(Ha.x!==b||Ha.y!==c)&&(e=!0,Ha.x=Ha.endX=b,za?Ha.endRotation=b:Ha.y=Ha.endY=c,ba=!0,db(!0),Ha.autoScroll&&!Ha.isDragging))for($(d.parentNode),g=d,M.scrollTop=null!=window.pageYOffset?window.pageYOffset:null!=v.scrollTop?v.scrollTop:u.body.scrollTop,M.scrollLeft=null!=window.pageXOffset?window.pageXOffset:null!=v.scrollLeft?v.scrollLeft:u.body.scrollLeft;g&&!i;)i=Y(g.parentNode),h=i?M:g.parentNode,Fa&&h.scrollTop>h._gsMaxScrollY&&(h.scrollTop=h._gsMaxScrollY),Ea&&h.scrollLeft>h._gsMaxScrollX&&(h.scrollLeft=h._gsMaxScrollX),g=h;Ha.isThrowing&&(e||Ha.endX>w||Ha.endX<x||Ha.endY>E||Ha.endY<H)&&ib(f.throwProps,e)}return Ha},this.update=function(a,b,c){var e=Ha.x,f=Ha.y;return jb(!b),a?Ha.applyBounds():(ba&&c&&db(!0),eb(!0)),b&&(rb(Ha.pointerX,Ha.pointerY),ba&&db(!0)),Ha.isPressed&&!b&&(Ea&&Math.abs(e-Ha.x)>.01||Fa&&Math.abs(f-Ha.y)>.01&&!za)&&kb(),Ha.autoScroll&&($(d.parentNode),Wa=Ha.isDragging,db(!0)),Ha.autoScroll&&(X(d,tb),W(d,tb)),Ha},this.enable=function(a){var e,j,k;if("soft"!==a){for(j=Na.length;--j>-1;)k=Na[j],Ka(k,"mousedown",pb),Ka(k,"touchstart",pb),Ka(k,"click",ub,!0),za||f.cursor===!1||ca(k,"cursor",f.cursor||"move"),ca(k,"touchCallout","none"),ca(k,"touchAction",Ea===Fa?"none":Ea?"pan-y":"pan-x"),ua(k)&&ca(k.ownerSVGElement||k,"touchAction",Ea===Fa?"none":Ea?"pan-y":"pan-x"),this.vars.allowContextMenu||Ka(k,"contextmenu",cb);Ra(Na,!1)}return W(d,tb),h=!0,g&&"soft"!==a&&g.track(i||d,ya?"x,y":za?"rotation":"top,left"),i&&i.enable(),d._gsDragID=e="d"+G++,F[e]=this,i&&(i.element._gsDragID=e),b.set(d,{x:"+=0",overwrite:!1,data:"_draggable"}),qa={t:d,data:C?S:d._gsTransform,tween:{},setRatio:C?function(){b.set(d,P)}:c._internals.setTransformRatio||c._internals.set3DTransformRatio},kb(),Ha.update(!0),Ha},this.disable=function(a){var b,c,e=Ha.isDragging;if(!za)for(b=Na.length;--b>-1;)ca(Na[b],"cursor",null);if("soft"!==a){for(b=Na.length;--b>-1;)c=Na[b],ca(c,"touchCallout",null),ca(c,"touchAction",null),La(c,"mousedown",pb),La(c,"touchstart",pb),La(c,"click",ub),La(c,"contextmenu",cb);Ra(Na,!0),ia&&(La(ia,"touchcancel",sb),La(ia,"touchend",sb),La(ia,"touchmove",qb)),La(u,"mouseup",sb),La(u,"mousemove",qb)}return X(d,tb),h=!1,g&&"soft"!==a&&g.untrack(i||d,ya?"x,y":za?"rotation":"top,left"),i&&i.disable(),R(db),Ha.isDragging=Ha.isPressed=ha=!1,e&&ka(Ha,"dragend","onDragEnd"),Ha},this.enabled=function(a,b){return arguments.length?a?Ha.enable(b):Ha.disable(b):h},this.kill=fu
|