1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
|
!function(a){function b(){var a=navigator.userAgent.toLowerCase();return a.indexOf("msie")>-1?parseInt(a.split("msie")[1]):!1}function c(){var a=!1,b=document.createElement("p");for(var c in p)if(p.hasOwnProperty(c)&&void 0!==b.style[c]){a={property:c};break}return document.body.appendChild(b),a.property&&(b.style[a.property]="translate3d(1px,1px,1px)",a.has3d="none"!=window.getComputedStyle(b).getPropertyValue(p[a.property])),document.body.removeChild(b),a}function d(a){var b=document.createElement("p").style,c=["ms","O","Moz","Webkit"];if(""==b[a])return a;a=a.charAt(0).toUpperCase()+a.slice(1);for(var d=0,e=c.length;e>d;d++)if(""==b[c[d]+a])return c[d]+a}function e(b,c,d,e,f){e=!!e,b&&(f?b.removeEventListener?b.removeEventListener(c,d,e):a(b).off(c):b.addEventListener?b.addEventListener(c,d,e):a(b).on(c,d))}function f(a,b){var c=" "+a.className+" ";return b=" "+b+" ",c.replace(/[\r\n\t\f]+/g," ").indexOf(b)>-1?!0:!1}function g(){var a="ontouchstart"in window;return a?["touchstart","touchmove","touchend","touchcancel"]:["mousedown","mousemove","mouseup","mouseleave"]}function h(a){function b(a){var b,c=q[a];if(c.params.transform){var d=c.layer.css(p[c.params.transform.property]).match(/(-?[0-9\.]+)/g);b=d.length>6?d[13]:d[4]}else b=c.layer.css("left");return parseInt(b)}function c(){m.isSlide&&(m.isThumbs?h():k.params.transition&&e()),m={},k.root.removeClass(k.params._dragging)}function d(){var b,c=k.params.slidesOnScreen;(0==k.current&&m.shiftX>0||k.current+c-1==k.last&&m.shiftX<0)&&(m.shiftX=m.shiftX/3),b=m.shiftX+m.startShift,k.layer.css(t.setIndent(a,Math.round(b),"px"))}function e(){if(Math.abs(m.shiftX)>.05*k.viewportWidth){var b,c=m.shiftX/k.viewportWidth*k.params.slidesOnScreen;b=m.shiftX<0?k.current-Math.floor(c):k.current-Math.ceil(c),0>b&&(b=0),b+k.params.slidesOnScreen-1>k.last&&(b=k.last-k.params.slidesOnScreen+1),t.go(a,b)}else t.go(a,k.current)}function g(){var b=m.shiftX+m.thumbsStartX,c=-1*(k.thumbsLayerWidth-k.thumbsWidth);b>0&&(b/=3),c>b&&(b=c+(b-c)/3),k.thumbsIndent=b,k.thumbsLayer.css(t.setIndent(a,k.thumbsIndent,"px"))}function h(){if(k.thumbsDragging&&m.isSlide){var b=m.shiftX<0?-1:1;m.t2=new Date,k.thumbsIndent=i(k.thumbsIndent,b),k.thumbsLayer.css("transition-duration",".24s").css(t.setIndent(a,k.thumbsIndent,"px"))}}function i(a,b){var c,d,e=Math.abs(10*m.shiftX/(m.t2-m.t1));return c=b*parseInt(Math.pow(e,2))+a,d=k.thumbs.outerWidth()-k.thumbsLayer.outerWidth(),c>0?0:d>c?d:c}function j(a,b){for(var c=0,d=a.length;d>c;c++)k.events.push({element:a[c],event:b,handler:function(a){return a.preventDefault&&a.preventDefault(),!1}})}var k=q[a],l=k.thumbs,m={},n=k.viewport[0].getElementsByTagName("a"),o=k.viewport[0].getElementsByTagName("img");s.onStart=function(a){k.freeze||(m.x1=a.clientX||a.touches&&a.touches[0].clientX,m.y1=a.clientY||a.touches&&a.touches[0].clientY,m.t1=new Date,m.isPressed=!0,m.isThumbs=f(this,k.params.thumbs),m.thumbsStartX=k.thumbsIndent,k.layer.css("transition-duration","0s"),k.thumbsLayer.css("transition-duration","0s"))},s.onMove=function(e){if(m.isPressed&&!k.freeze){if(m.shiftX=(e.clientX||e.touches&&e.touches[0].clientX)-m.x1,m.shiftY=(e.clientY||e.touches&&e.touches[0].clientY)-m.y1,m.shiftXAbs=Math.abs(m.shiftX),m.shiftYAbs=Math.abs(m.shiftY),m.isMultitouch=m.isMultitouch||!!e.touches&&e.touches.length>1,m.isMultitouch)return void c();m.isSlide||m.isScroll||(m.shiftYAbs>=5&&m.shiftYAbs>m.shiftXAbs&&(m.isScroll=!0),m.shiftXAbs>=5&&m.shiftXAbs>m.shiftYAbs&&(k.root.addClass(k.params._dragging),m.isSlide=!0,m.startShift=b(a))),m.isSlide&&(m.isThumbs?k.thumbsDragging&&g():k.params.transition&&d(),e.preventDefault&&e.preventDefault())}},s.onEnd=function(b){if(!m.isSlide&&!m.isScroll&&m.isPressed){if(f(b.target,k.params.prev)&&t.prev(a),f(b.target,k.params.next)&&t.next(a),f(b.target,k.params.thumbImg)||f(b.target,k.params.thumb)){var d=parseInt(b.target.getAttribute("data-rel"));d+k.params.slidesOnScreen-1>k.last&&(d=k.last-k.params.slidesOnScreen+1),t.go(a,d)}b.stopPropagation&&b.preventDefault&&(b.stopPropagation(),b.preventDefault())}c()},k.events.push({element:k.viewpor
|