-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery-tabs.min.js
More file actions
1 lines (1 loc) · 1.82 KB
/
jquery-tabs.min.js
File metadata and controls
1 lines (1 loc) · 1.82 KB
1
(function(){"use strict";var a,b,c,d,e=function(a,b){return function(){return a.apply(b,arguments)}};a=jQuery,b=function(){function b(a,b){this.element=a,this.has_content=b!=null?b:!0}return b.prototype.open=function(){return this.element.show()},b.prototype.close=function(){return this.element.hide()},b.prototype.load=function(b){return a.ajax(b,{dataType:"html",type:"GET",context:this.element}).done(function(a){return this.html(a)}),this.has_content=!0},b}(),c=function(){function c(c){var d;this.element=c,d=a("#"+this.element.attr("data-panel")),this.panel=new b(d,!this.element.data("remote")),this.isActive()?this.panel.has_content||this.panel.load(this.element.find("a").attr("href")):this.panel.close()}return c.prototype.listen=function(a){return a.bind("tab:activate",e(function(a,b,c){if(!this.element.is(b))return this.deactivate();if(!this.isActive())return this.activate(c)},this))},c.prototype.isActive=function(){return this.element.hasClass("active")},c.prototype.activate=function(a){return this.panel.has_content||this.panel.load(a),this.element.addClass("active"),this.panel.open()},c.prototype.deactivate=function(){return this.element.removeClass("active"),this.panel.close()},c}(),d=function(){function b(a){this.element=a,this.register(this.element.find("li")),this.bindEvents(["click","focus"])}return b.prototype.register=function(b){var d;return d=this.element,b.each(function(b,e){var f;return f=new c(a(e)),f.listen(d)})},b.prototype.bindEvents=function(a){var b,c,d,e;e=[];for(c=0,d=a.length;c<d;c++)b=a[c],e.push(this.bind(b));return e},b.prototype.bind=function(b){return this.element.delegate("a",b,function(b){var c;return b.preventDefault(),c=a(b.currentTarget),c.trigger("tab:activate",[c.parent(),c.attr("href")])})},b}(),a.fn.tabs=function(){return this.each(function(){var b,c;return b=a(this),c=new d(b),b})}}).call(this)