UNPKG

ollie-controller

Version:

A tool to control Ollie from your computer

2 lines 5.51 kB
/*! jquery.flipster, built 2014-07-23 */ !function(a){a.fn.flipster=function(b){var c="string"==typeof b?!0:!1;if(c)var d=b,e=Array.prototype.slice.call(arguments,1);else var f={itemContainer:"ul",itemSelector:"li",style:"coverflow",start:"center",enableKeyboard:!0,enableMousewheel:!0,enableTouch:!0,enableNav:!1,enableNavButtons:!1,onItemSwitch:a.noop,disableRotation:!1,navPosition:"before",prevText:"Previous",nextText:"next"},g=a.extend({},f,b),h=a(window);return this.each(function(){function b(){z=0}function f(){r.height(i()),q.css("height","auto"),"carousel"===g.style&&r.width(s.width())}function i(){var b=0;return s.each(function(){a(this).height()>b&&(b=a(this).height())}),b}function j(){if(g.enableNav&&s.length>1){var b=[],c=[],d=[];s.each(function(){var e=a(this).data("flip-category"),f=a(this).attr("id"),g=a(this).attr("title");if("undefined"!=typeof e&&a.inArray(e,b)<0&&(b.push(e),d[e]='<li class="flip-nav-category"><a href="#" class="flip-nav-category-link" data-flip-category="'+e+'">'+e+'</a>\n<ul class="flip-nav-items">\n'),a.inArray(f,c)<0){c.push(f);var h='<a href="#'+f+'" class="flip-nav-item-link">'+g+"</a></li>\n";"undefined"!=typeof e?d[e]=d[e]+'<li class="flip-nav-item">'+h:d[f]='<li class="flip-nav-item no-category">'+h}});var e='<ul class="flipster-nav">\n';for(var f in b)d[b[f]]=d[b[f]]+"</ul>\n</li>\n";for(var h in d)e+=d[h];e+="</ul>",t="after"!=g.navPosition.toLowerCase()?a(e).prependTo(q):a(e).appendTo(q),u=t.find("a").on("click",function(b){var c;c=a(this).hasClass("flip-nav-category-link")?s.filter("[data-flip-category='"+a(this).data("flip-category")+"']"):a(this.hash),c.length&&(n(c),b.preventDefault())})}}function k(){if(g.enableNav&&s.length>1){var b=a(s[x]);t.find(".flip-nav-current").removeClass("flip-nav-current"),u.filter("[href='#"+b.attr("id")+"']").addClass("flip-nav-current"),u.filter("[data-flip-category='"+b.data("flip-category")+"']").parent().addClass("flip-nav-current")}}function l(){g.enableNavButtons&&s.length>1&&(q.find(".flipto-prev, .flipto-next").remove(),q.append("<a href='#' class='flipto-prev'>"+g.prevText+"</a> <a href='#' class='flipto-next'>"+g.nextText+"</a>"),q.children(".flipto-prev").on("click",function(a){n("left"),a.preventDefault()}),q.children(".flipto-next").on("click",function(a){n("right"),a.preventDefault()}))}function m(){var b=a(s[x]).addClass("flip-current");if(s.removeClass("flip-prev flip-next flip-current flip-past flip-future no-transition"),"carousel"===g.style){s.addClass("flip-hidden");var c=a(s[x+1]),d=a(s[x+2]),e=a(s[x-1]),h=a(s[x-2]);0===x?(e=s.last(),h=e.prev()):1===x?h=s.last():x===s.length-2?d=s.first():x===s.length-1&&(c=s.first(),d=a(s[1])),d.removeClass("flip-hidden").addClass("flip-future"),h.removeClass("flip-hidden").addClass("flip-past"),c.removeClass("flip-hidden").addClass("flip-next"),e.removeClass("flip-hidden").addClass("flip-prev")}else{var i=b.outerWidth()/2,j=0,l=r.width(),m=b.outerWidth(),n=s.index(b)*m/2+i/2;s.removeClass("flip-hidden");for(var o=0;o<s.length;o++){var p=a(s[o]),q=p.outerWidth();x>o?p.addClass("flip-past").css({"z-index":o,left:o*q/2+"px"}):o>x&&p.addClass("flip-future").css({"z-index":s.length-o,left:o*q/2+i+"px"})}b.css({"z-index":s.length+1,left:n+"px"}),j=n+m/2-l/2;var t=-1*j+"px";if(w){var u=a(".flip-past"),v=a(".flip-future");for(a(".flip-current").css("zoom","1.0"),o=0;o<u.length;o++)a(u[o]).css("zoom",100-5*(u.length-o)+"%");for(o=0;o<v.length;o++)a(v[o]).css("zoom",100-5*(o+1)+"%");r.animate({left:t},333)}else r.css("left",t)}b.addClass("flip-current").removeClass("flip-prev flip-next flip-past flip-future flip-hidden"),f(),k(),g.onItemSwitch.call(this)}function n(a){s.length>1&&("left"===a?x>0?x--:x=s.length-1:"right"===a?x<s.length-1?x++:x=0:x="number"==typeof a?a:s.index(a),m())}function o(){q.addClass("flipster flipster-active flipster-"+g.style).css("visibility","hidden"),g.disableRotation&&q.addClass("no-rotate"),r=q.find(g.itemContainer).addClass("flip-items"),s=r.find(g.itemSelector).addClass("flip-item flip-hidden").wrapInner("<div class='flip-content' />");var c=!1,d=document.createElement("b");d.innerHTML="<!--[if IE 9]><i></i><![endif]-->";var e=1===d.getElementsByTagName("i").length;(c||e)&&(w=!0,r.addClass("compatibility")),j(),l(),g.start&&s.length>1&&(x="center"===g.start?!s.length%2?s.length/2+1:Math.floor(s.length/2):g.start),f(),q.hide().css("visibility","visible").fadeIn(400,function(){m()}),h.resize(function(){f(),m()}),s.on("click",function(b){a(this).hasClass("flip-current")||b.preventDefault(),n(s.index(this))}),g.enableKeyboard&&s.length>1&&(h.on("keydown.flipster",function(a){if(z++,z%7===0||1===z){var b=a.which;37===b?(a.preventDefault(),n("left")):39===b&&(a.preventDefault(),n("right"))}}),h.on("keyup.flipster",function(){z=0})),g.enableMousewheel&&s.length>1&&q.on("mousewheel.flipster",function(a){v=window.setTimeout(b,500),z++,(z%4===0||1===z)&&(window.clearTimeout(v),n(a.originalEvent.wheelDelta/120>0?"left":"right"),a.preventDefault())}),g.enableTouch&&s.length>1&&(q.on("touchstart.flipster",function(a){y=a.originalEvent.targetTouches[0].screenX}),q.on("touchmove.flipster",function(a){a.preventDefault();var b=a.originalEvent.targetTouches[0].screenX,c=b-y;c>s[0].clientWidth/1.75?(n("left"),y=b):c<-1*(s[0].clientWidth/1.75)&&(n("right"),y=b)}),q.on("touchend.flipster",function(){y=0}))}var p,q=a(this);if(c)return p=q.data("methods"),p[d].apply(this,e);var r,s,t,u,v,w,x=0,y=0,z=0;p={jump:n},q.data("methods",p),q.hasClass("flipster-active")||o()})}}(jQuery);