1/* Swipe 2.0, (C) Brad Birdsall 2012, MIT license */ 2function Swipe(e,t){"use strict";function c(){o=s.children,u=new Array(o.length),a=e.getBoundingClientRect().width||e.offsetWidth,s.style.width=o.length*a+"px";var t=o.length;while(t--){var n=o[t];n.style.width=a+"px",n.setAttribute("data-index",t),i.transitions&&(n.style.left=t*-a+"px",b(t,f>t?-a:f<t?a:0,0))}i.transitions||(s.style.left=f*-a+"px"),e.style.visibility="visible"}function h(e,t){i.addEventListener?e.addEventListener("click",t,!1):window.attachEvent&&e.attachEvent("onclick",t)}function p(e){e.returnValue=!1,e.preventDefault&&e.preventDefault()}function d(){var e=t.menu.childNodes;for(var n=0;n<e.length;n++)if(e[n].className&&e[n].className.indexOf("slider-prev")!=-1)h(e[n],function(e){p(e),N(),m()});else if(e[n].className&&e[n].className.indexOf("slider-next")!=-1)h(e[n],function(e){p(e),N(),g()});else if(e[n].className&&e[n].className.indexOf("slider-menu")!=-1){t.menu=e[n];for(var r=0;r<o.length;r++){var i=document.createElement("b");i.innerHTML="â¢",i.setAttribute("data-index",r),r==f&&(i.className="active"),h(i,function(e){return function(t){p(t),N(),y(parseInt(this.getAttribute?this.getAttribute("data-index"):e.attributes["data-index"].nodeValue))}}(i)),t.menu.appendChild(i)}}}function v(){for(var e=0;e<o.length;e++){var n=t.menu.children[e];n.className=parseInt(n.getAttribute?n.getAttribute("data-index"):n.attributes["data-index"].nodeValue)==f?"active":""}}function m(){f?y(f-1):t.continuous&&y(o.length-1)}function g(){f<o.length-1?y(f+1):t.continuous&&y(0)}function y(e,n){if(f==e)return;if(i.transitions){var s=Math.abs(f-e)-1,u=Math.abs(f-e)/(f-e);while(s--)b((e>f?e:f)-s-1,a*u,0);b(f,a*u,n||l),b(e,0,n||l)}else E(f*-a,e*-a,n||l);f=e,t.menu&&v(),r(t.callback&&t.callback(f,o[f]))}function b(e,t,n){w(e,t,n),u[e]=t}function w(e,t,n){var r=o[e],i=r&&r.style;if(!i)return;i.webkitTransitionDuration=i.MozTransitionDuration=i.msTransitionDuration=i.OTransitionDuration=i.transitionDuration=n+"ms",i.webkitTransform="translate("+t+"px,0)"+"translateZ(0)",i.msTransform=i.MozTransform=i.OTransform="translateX("+t+"px)"}function E(e,n,r){if(!r){s.style.left=n+"px";return}var i=+(new Date),u=setInterval(function(){var a=+(new Date)-i;if(a>r){s.style.left=n+"px",S&&T(),t.transitionEnd&&t.transitionEnd.call(event,f,o[f]),clearInterval(u);return}s.style.left=(n-e)*(Math.floor(a/r*100)/100)+e+"px"},4)}function T(){x=setTimeout(g,S)}function N(){S=0,clearTimeout(x)}var n=function(){},r=function(e){setTimeout(e||n,0)},i={addEventListener:!!window.addEventListener,touch:"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,transitions:function(e){var t=["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"];for(var n in t)if(e.style[t[n]]!==undefined)return!0;return!1}(document.createElement("swipe"))};if(!e)return;var s=e.children[0],o,u,a;t=t||{};var f=parseInt(t.startSlide,10)||0,l=t.speed||300,S=t.auto||0,x,C={},k={},L,A={handleEvent:function(e){switch(e.type){case"touchstart":this.start(e);break;case"touchmove":this.move(e);break;case"touchend":r(this.end(e));break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":r(this.transitionEnd(e));break;case"resize":r(c.call())}t.stopPropagation&&e.stopPropagation()},start:function(e){var t=e.touches[0];C={x:t.pageX,y:t.pageY,time:+(new Date)},L=undefined,k={},s.addEventListener("touchmove",this,!1),s.addEventListener("touchend",this,!1)},move:function(e){if(e.touches.length>1||e.scale&&e.scale!==1)return;t.disableScroll&&e.preventDefault();var n=e.touches[0];k={x:n.pageX-C.x,y:n.pageY-C.y},typeof L=="undefined"&&(L=!!(L||Math.abs(k.x)<Math.abs(k.y))),L||(e.preventDefault(),N(),k.x=k.x/(!f&&k.x>0||f==o.length-1&&k.x<0?Math.abs(k.x)/a+1:1),w(f-1,k.x+u[f-1],0),w(f,k.x+u[f],0),w(f+1,k.x+u[f+1],0))},end:function(e){var n=+(new Date)-C.time,r=Number(n)<250&&Math.abs(k.x)>20||Math.abs(k.x)>a/2,i=!f&&k.x>0||f==o.length-1&&k.x<0,c=k.x<0;L||(r&&!i?(c?(b(f-1,-a,0),b(f,u[f]-a,l),b(f+1,u[f+1]-a,l),f+=1):(b(f+1,a,0),b(f,u[f]+a,l),b(f-1,u[f-1]+a,l),f+=-1),t.menu&&v(),t.callback&&t.callback(f,o[f])):(b(f-1,-a,l),b(f,0,l),b(f+1,a,l))),s.removeEventListener("touchmove",A,!1),s.removeEventListener("touchend",A,!1)},transitionEnd:function(e){parseInt(e.target.getAttribute?e.target.getAttribute("data-index"):e.target.attributes["data-index"].nodeValue,10)==f&&(S&&T(),t.transitionEnd&&t.transitionEnd.call(e,f,o[f]))}};return c(),t.menu&&d(),S&&T(),i.addEventListener?(i.touch&&s.addEventListener("touchstart",A,!1),i.transitions&&(s.addEventListener("webkitTransitionEnd",A,!1),s.addEventListener("msTransitionEnd",A,!1),s.addEventListener("oTransitionEnd",A,!1),s.addEventListener("otransitionend",A,!1),s.addEventListener("transitionend",A,!1)),window.addEventListener("resize",A,!1)):window.onresize=function(){c()},{setup:function(){c()},slide:function(e,t){y(e,t)},prev:function(){N(),m()},next:function(){N(),g()},getPos:function(){return f},kill:function(){N(),s.style.width="auto",s.style.left=0;var e=o.length;while(e--){var t=o[e];t.style.width="100%",t.style.left=0,i.transitions&&w(e,0,0)}i.addEventListener?(s.removeEventListener("touchstart",A,!1),s.removeEventListener("webkitTransitionEnd",A,!1),s.removeEventListener("msTransitionEnd",A,!1),s.removeEventListener("oTransitionEnd",A,!1),s.removeEventListener("otransitionend",A,!1),s.removeEventListener("transitionend",A,!1),window.removeEventListener("resize",A,!1)):window.onresize=null}}};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.