indvd00m@0: /* ======================================================== indvd00m@0: * bootstrap-tab.js v2.3.1 indvd00m@0: * http://twitter.github.com/bootstrap/javascript.html#tabs indvd00m@0: * ======================================================== indvd00m@0: * Copyright 2012 Twitter, Inc. indvd00m@0: * indvd00m@0: * Licensed under the Apache License, Version 2.0 (the "License"); indvd00m@0: * you may not use this file except in compliance with the License. indvd00m@0: * You may obtain a copy of the License at indvd00m@0: * indvd00m@0: * http://www.apache.org/licenses/LICENSE-2.0 indvd00m@0: * indvd00m@0: * Unless required by applicable law or agreed to in writing, software indvd00m@0: * distributed under the License is distributed on an "AS IS" BASIS, indvd00m@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. indvd00m@0: * See the License for the specific language governing permissions and indvd00m@0: * limitations under the License. indvd00m@0: * ======================================================== */ indvd00m@0: indvd00m@0: indvd00m@0: !function ($) { indvd00m@0: indvd00m@0: "use strict"; // jshint ;_; indvd00m@0: indvd00m@0: indvd00m@0: /* TAB CLASS DEFINITION indvd00m@0: * ==================== */ indvd00m@0: indvd00m@0: var Tab = function (element) { indvd00m@0: this.element = $(element) indvd00m@0: } indvd00m@0: indvd00m@0: Tab.prototype = { indvd00m@0: indvd00m@0: constructor: Tab indvd00m@0: indvd00m@0: , show: function () { indvd00m@0: var $this = this.element indvd00m@0: , $ul = $this.closest('ul:not(.dropdown-menu)') indvd00m@0: , selector = $this.attr('data-target') indvd00m@0: , previous indvd00m@0: , $target indvd00m@0: , e indvd00m@0: indvd00m@0: if (!selector) { indvd00m@0: selector = $this.attr('href') indvd00m@0: selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 indvd00m@0: } indvd00m@0: indvd00m@0: if ( $this.parent('li').hasClass('active') ) return indvd00m@0: indvd00m@0: previous = $ul.find('.active:last a')[0] indvd00m@0: indvd00m@0: e = $.Event('show', { indvd00m@0: relatedTarget: previous indvd00m@0: }) indvd00m@0: indvd00m@0: $this.trigger(e) indvd00m@0: indvd00m@0: if (e.isDefaultPrevented()) return indvd00m@0: indvd00m@0: $target = $(selector) indvd00m@0: indvd00m@0: this.activate($this.parent('li'), $ul) indvd00m@0: this.activate($target, $target.parent(), function () { indvd00m@0: $this.trigger({ indvd00m@0: type: 'shown' indvd00m@0: , relatedTarget: previous indvd00m@0: }) indvd00m@0: }) indvd00m@0: } indvd00m@0: indvd00m@0: , activate: function ( element, container, callback) { indvd00m@0: var $active = container.find('> .active') indvd00m@0: , transition = callback indvd00m@0: && $.support.transition indvd00m@0: && $active.hasClass('fade') indvd00m@0: indvd00m@0: function next() { indvd00m@0: $active indvd00m@0: .removeClass('active') indvd00m@0: .find('> .dropdown-menu > .active') indvd00m@0: .removeClass('active') indvd00m@0: indvd00m@0: element.addClass('active') indvd00m@0: indvd00m@0: if (transition) { indvd00m@0: element[0].offsetWidth // reflow for transition indvd00m@0: element.addClass('in') indvd00m@0: } else { indvd00m@0: element.removeClass('fade') indvd00m@0: } indvd00m@0: indvd00m@0: if ( element.parent('.dropdown-menu') ) { indvd00m@0: element.closest('li.dropdown').addClass('active') indvd00m@0: } indvd00m@0: indvd00m@0: callback && callback() indvd00m@0: } indvd00m@0: indvd00m@0: transition ? indvd00m@0: $active.one($.support.transition.end, next) : indvd00m@0: next() indvd00m@0: indvd00m@0: $active.removeClass('in') indvd00m@0: } indvd00m@0: } indvd00m@0: indvd00m@0: indvd00m@0: /* TAB PLUGIN DEFINITION indvd00m@0: * ===================== */ indvd00m@0: indvd00m@0: var old = $.fn.tab indvd00m@0: indvd00m@0: $.fn.tab = function ( option ) { indvd00m@0: return this.each(function () { indvd00m@0: var $this = $(this) indvd00m@0: , data = $this.data('tab') indvd00m@0: if (!data) $this.data('tab', (data = new Tab(this))) indvd00m@0: if (typeof option == 'string') data[option]() indvd00m@0: }) indvd00m@0: } indvd00m@0: indvd00m@0: $.fn.tab.Constructor = Tab indvd00m@0: indvd00m@0: indvd00m@0: /* TAB NO CONFLICT indvd00m@0: * =============== */ indvd00m@0: indvd00m@0: $.fn.tab.noConflict = function () { indvd00m@0: $.fn.tab = old indvd00m@0: return this indvd00m@0: } indvd00m@0: indvd00m@0: indvd00m@0: /* TAB DATA-API indvd00m@0: * ============ */ indvd00m@0: indvd00m@0: $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { indvd00m@0: e.preventDefault() indvd00m@0: $(this).tab('show') indvd00m@0: }) indvd00m@0: indvd00m@0: }(window.jQuery);