|
|
!function(a,b,c,d){a.fn.carousel=function(b){var c,e=a(this),f=a.extend(!0,{},a.fn.carousel.settings,b),g=("."+f.namespace,"module-"+f.namespace,e.selector||""),h=(new Date).getTime(),i=[],j=arguments[0],k="string"==typeof j,l=[].slice.call(arguments,1);return e.each(function(){var b,m=a(this),n=(a(f.selector.arrows),a(f.selector.leftArrow)),o=a(f.selector.rightArrow),p=a(f.selector.content),q=(a(f.selector.navigation),a(f.selector.navItem)),r=(m.selector||"",this),s=m.data("module-"+f.namespace),t=f.className,u=f.namespace,v=f.errors;b={initialize:function(){b.openingAnimation(),b.marquee.autoAdvance(),n.on("click",b.marquee.left),o.on("click",b.marquee.right),q.on("click",b.marquee.change)},destroy:function(){b.verbose("Destroying previous module for",m),m.off(u)},left:function(){var a=p.filter("."+t.active),b=p.index(a),c=p.size(),d=-1!=b-1?b-1:c-1;q.eq(d).trigger("click")},right:function(){var a=p.filter("."+t.active),b=p.index(a),c=p.size(),d=b+1!=c?b+1:0;q.eq(d).trigger("click")},change:function(){var c=a(this),d=q.index(c),e=p.eq(d);b.marquee.autoAdvance(),c.addClass("active").siblings().removeClass("active"),e.addClass("active animated fadeIn").siblings("."+t.active).removeClass("animated fadeIn scaleIn").animate({opacity:0},500,function(){a(this).removeClass("active").removeAttr("style")})},autoAdvance:function(){clearInterval(b.timer),b.timer=setInterval(b.marquee.right,f.duration)},setting:function(c,e){return e===d?f[c]:(a.isPlainObject(c)?(b.verbose("Modifying settings object",c,e),a.extend(!0,f,c)):(b.verbose("Modifying setting",c,e),f[c]=e),void 0)},internal:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?(b.verbose("Modifying internal property",c,e),a.extend(!0,b,c)):(b.verbose("Changing internal method to",e),b[c]=e),void 0)},debug:function(){f.debug&&(f.performance?b.performance.log(arguments):b.debug=Function.prototype.bind.call(console.info,console,f.moduleName+":"))},verbose:function(){f.verbose&&f.debug&&(f.performance?b.performance.log(arguments):b.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"))},error:function(){b.error=Function.prototype.bind.call(console.log,console,f.moduleName+":")},performance:{log:function(a){var c,d,e;f.performance&&(c=(new Date).getTime(),e=h||c,d=c-e,h=c,i.push({Element:r,Name:a[0],Arguments:a[1]||"None","Execution Time":d}),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100))},display:function(){var b=f.moduleName,c=(f.moduleName+": "+g+"("+e.size()+" elements)",0);g&&(b+=" Performance ("+g+")"),(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(b),console.table?(a.each(i,function(a,b){c+=b["Execution Time"]}),console.table(i)):a.each(i,function(a,b){c+=b["Execution Time"],console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.log("Total Execution Time:",c+"ms"),console.groupEnd(),i=[],h=!1)}},invoke:function(c,e,f){var g,h;return e=e||l,f=r||f,"string"==typeof c&&s!==d&&(c=c.split("."),g=c.length-1,a.each(c,function(c,e){return a.isPlainObject(s[e])&&c!=g?(s=s[e],!0):s[e]!==d?(h=s[e],!0):(b.error(v.method),!1)})),a.isFunction(h)?(s.verbose("Executing invoked function",h),h.apply(f,e)):h||!1}},k?(s===d&&b.initialize(),c=b.invoke(j)):(s!==d&&b.destroy(),b.initialize())}),c?c:this},a.fn.carousel.settings={moduleName:"Carousel Module",namespace:"carousel",verbose:!0,debug:!0,performance:!0,duration:5e3,errors:{method:"The method you called is not defined."},selector:{arrows:".arrow",leftArrow:".left.arrow",rightArrow:".right.arrow",content:".content",navigation:".navigation",navItem:".navigation .icon"},className:{active:"active"}}}(jQuery,window,document);
|