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