!function(o){PPTimeline=function(i,t){this.node=t,this.timeline=this.node.find(".pp-timeline"),this.items=this.node.find(".pp-timeline-vertical .pp-timeline-item"),this.connector=this.node.find(".pp-timeline-vertical .pp-timeline-connector"),this.progressBar=this.node.find(".pp-timeline-vertical .pp-timeline-connector-inner"),this.markerClass=this.node.find(".pp-timeline-vertical .pp-timeline-marker-wrapper"),"undefined"!=typeof i.window&&(this.window=i.window),this.init()},PPTimeline.prototype={node:"",items:"",connector:"",progressBar:"",window:o(window),winHeight:0,scrollTop:0,lastWinHeight:-1,lastScrollTop:-1,isScrolling:!1,isResizing:!1,isAnimating:!1,animationClass:"bounce-in",init:function(){"vertical"==this.timeline.data("timeline-layout")&&(this.winHeight=o(window).height(),this.scrollTop=this.window.scrollTop(),this.bindEvents(),this.requestAnimation(),this.revealItems())},bindEvents:function(){this.window.on("scroll",o.proxy(function(){this.scrollTop=this.window.scrollTop(),this.requestAnimation(),this.revealItems()},this)),o(window).on("resize",o.proxy(function(){this.scrollTop=this.window.scrollTop(),this.winHeight=o(window).height(),this.requestAnimation()},this))},requestAnimation:function(){this.isAnimating||requestAnimationFrame(this.reboot.bind(this)),this.isAnimating=!0},revealItems:function(){var i=this;this.items.each(function(){o(this).offset().top<=i.window.scrollTop()+.95*o(window).outerHeight()&&o(this).hasClass("pp-timeline-item-hidden")&&o(this).removeClass("pp-timeline-item-hidden").addClass(i.animationClass)})},setup:function(){var i=this,t=this.items.last().find(this.markerClass).outerHeight();this.connector.css({top:i.items.first().find(i.markerClass).offset().top-i.items.first().offset().top,bottom:i.node.offset().top+i.node.outerHeight()-i.items.last().find(i.markerClass).offset().top-t/2})},reboot:function(){this.isAnimating=!1,this.winHeight!==this.lastWinHeight&&this.setup(),this.start.bind(this)()},start:function(){this.scrollTop===this.lastScrollTop&&this.winHeight===this.lastWinHeight||(this.lastScrollTop=this.scrollTop,this.lastWinHeight=this.winHeight,this.progress())},progress:function(){var i=this,t=o(window);this.items.each(function(){o(this).find(i.markerClass).offset().top<i.window.scrollTop()+t.outerHeight()/2?o(this).addClass("pp-timeline-item-active"):o(this).removeClass("pp-timeline-item-active")});var s=this.items.last().find(this.markerClass).offset().top,e=this.items.last().find(this.markerClass).outerHeight(),n=this.window.scrollTop()-this.progressBar.offset().top+t.outerHeight()/2;s<=this.window.scrollTop()+t.outerHeight()/2&&(n=s-this.progressBar.offset().top),n+=e/2,this.progressBar.css("height",n+"px")}}}(jQuery);