| 2 |
!function(t,e,i,o){var n="easyTicker",s={direction:"up",easing:"swing",speed:"slow",interval:2e3,height:"auto",gap:15,visible:0,mousePause:!0,controls:{up:"",down:"",toggle:"",playText:"Play",stopText:"Stop"},callbacks:{before:!1,after:!1}};function a(e,o){var n=this;function a(){0==n.timer&&(n.timer=setInterval(function(){r(n.opts.direction)},n.opts.interval),t(n.opts.controls.toggle).addClass("et-run").html(n.opts.controls.stopText))}function l(){clearInterval(n.timer),n.timer=0,t(n.opts.controls.toggle).removeClass("et-run").html(n.opts.controls.playText)}function r(t){var e,i,o;if(n.elem.is(":visible")){"up"==t?(e=":first-child",i="-=",o="appendTo"):(e=":last-child",i="+=",o="prependTo");var s=n.targ.children(e),a=s.outerHeight();"function"==typeof n.opts.callbacks.before&&n.opts.callbacks.before.call(n,n.targ,s),n.targ.stop(!0,!0).animate({top:i+a+"px"},n.opts.speed,n.opts.easing,function(){s.hide()[o](n.targ).fadeIn(),n.targ.css("top",0),p(!0),"function"==typeof n.opts.callbacks.after&&n.opts.callbacks.after.call(n,n.targ,s)})}}function c(t){l(),r("up"==t?"up":"down")}function p(e){var i,o;"auto"==n.opts.height&&(n.opts.visible>0?function(e){var i=0;n.targ.children().removeClass("et-item-visible"),n.targ.children(":lt("+n.opts.visible+")").each(function(){i+=t(this).outerHeight(),t(this).addClass("et-item-visible")}),i+=n.opts.gap*(n.opts.visible-1),e?n.elem.stop(!0,!0).animate({height:i},n.opts.speed):n.elem.css("height",i)}(e):(i=0,o=n.elem.css("display"),n.elem.css("display","block"),n.targ.children().each(function(){i+=t(this).outerHeight()}),i+=n.opts.gap*(n.opts.visible-1),n.elem.css({display:o,height:i}))),e||clearInterval(n.heightTimer)}return n.opts=t.extend({},s,o),n.elem=t(e),n.targ=t(e).children(":first-child"),n.timer=0,n.elem.children().css("margin",0).children().css("margin-bottom",n.opts.gap),n.elem.css({position:"relative",height:n.opts.height,overflow:"hidden"}),n.targ.css({position:"absolute",margin:0}),n.heightTimer=setInterval(function(){p(!1)},100),a(),function(){var t,e;void 0!==i.hidden?(t="hidden",e="visibilitychange"):void 0!==i.msHidden?(t="msHidden",e="msvisibilitychange"):void 0!==i.webkitHidden&&(t="webkitHidden",e="webkitvisibilitychange");i.addEventListener(e,function(){i[t]?l():a()},!1)}(),n.opts.mousePause&&n.elem.on("mouseenter",function(){n.timerTemp=n.timer,l()}).on("mouseleave",function(){0!==n.timerTemp&&a()}),t(n.opts.controls.up).on("click",function(t){t.preventDefault(),c("up")}),t(n.opts.controls.down).on("click",function(t){t.preventDefault(),c("down")}),t(n.opts.controls.toggle).on("click",function(t){t.preventDefault(),0==n.timer?a():l()}),{up:function(){c("up")},down:function(){c("down")},start:a,stop:l,options:n.opts}}t.fn[n]=function(e){return this.each(function(){t.data(this,n)||t.data(this,n,new a(this,e))})}}(jQuery,window,document); |