-
Notifications
You must be signed in to change notification settings - Fork 3
/
cavendish.plugins.min.js
2 lines (2 loc) · 3.82 KB
/
cavendish.plugins.min.js
1
2
// Generated by CoffeeScript 1.3.3
(function(){var e,t,n,r,i,s,o,u=function(e,t){return function(){return e.apply(t,arguments)}},a={}.hasOwnProperty,f=function(e,t){function r(){this.constructor=e}for(var n in t)a.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};e=jQuery,o=function(){function t(t){this.cavendish=t,this.options=this.cavendish.options=e.extend(!0,{},this.defaults(),this.cavendish.options)}return t.prototype.setup=function(){},t.prototype.transition=function(){},t.prototype.extensions=function(){return[]},t.prototype.defaults=function(){return{class_names:{active:"active",disabled:"disabled"}}},t}(),s=function(t){function n(){return this.defaults=u(this.defaults,this),n.__super__.constructor.apply(this,arguments)}return f(n,t),n.prototype.setup=function(){var e=this;this.show=this.cavendish.show,this.options.player_pause&&this.show.hover(function(){return e.stop()},function(){return e.start()});if(this.options.player_start)return this.start()},n.prototype.start=function(){var e=this;return this.show.addClass(this.options.class_names.playing),this.timeout=setInterval(function(){return e.cavendish.next()},this.options.slideTimeout)},n.prototype.stop=function(){return this.show.removeClass(this.options.class_names.playing),clearInterval(this.timeout)},n.prototype.defaults=function(){return e.extend(!0,{},n.__super__.defaults.apply(this,arguments),{player_start:!0,player_pause:!0,slideTimeout:2e3,class_names:{playing:"cavendish-playing"}})},n}(o),n=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return f(t,e),t.prototype.setup=function(){return this.cavendish.show.trigger("cavendish-setup",[this.cavendish])},t.prototype.transition=function(){return this.cavendish.show.trigger("cavendish-transition",[this.cavendish])},t}(o),r=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return f(n,t),n.prototype.setup=function(){var t=this;return this.pager=e(this.cavendish.options.pagerSelector,this.cavendish.show),this.pager.find(this.cavendish.options.pagerItemSelector).each(function(n,r){return e(r).click(function(){return t.cavendish.goto(n),!1})})},n.prototype.transition=function(){return this.pager.find(this.cavendish.options.pagerItemSelector).removeClass(this.cavendish.options.class_names.active).eq(this.cavendish.index).addClass(this.cavendish.options.class_names.active)},n.prototype.defaults=function(){return e.extend(!0,{},n.__super__.defaults.apply(this,arguments),{pagerSelector:".cavendish-pager",pagerItemSelector:"li"})},n}(o),t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return f(n,t),n.prototype.setup=function(){var t=this;return this.next=e(".cavendish-next").click(function(){return t.cavendish.next(),!1}),this.prev=e(".cavendish-prev").click(function(){return t.cavendish.prev(),!1})},n.prototype.transition=function(){var e;if(!this.cavendish.options.loop)return e=this.cavendish.index+1===this.cavendish.length,this.next.toggleClass(this.cavendish.options.class_names.disabled,e),this.prev.toggleClass(this.cavendish.options.class_names.disabled,this.cavendish.index===0)},n}(o),i=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return f(n,t),n.prototype.setup=function(){var t=this;return this.background=this.cavendish.show.find(this.cavendish.options.panSelector),this.background.find(this.cavendish.options.panChildSelector).each(function(t,n){return e(n).css("left",t*100+"%")})},n.prototype.transition=function(){return this.background.css("left",this.cavendish.index*-100*this.cavendish.options.panFactor+"%")},n.prototype.defaults=function(){return e.extend(!0,{},n.__super__.defaults.apply(this,arguments),{panFactor:1,panSelector:".cavendish-pan",panChildSelector:"> li"})},n}(o),e.fn.cavendish.plugins={player:s,events:n,pager:r,arrows:t,pan:i}}).call(this);