vendor: 3,409 bytes, lines 1-108
1+function ($) { 2 'use strict'; 3 // TAB CLASS DEFINITION 4 // ==================== 5 var Tab = function (element) { 6 // jscs:disable requireDollarBeforejQueryAssignment 7 this.element = $(element) 8 // jscs:enable requireDollarBeforejQueryAssignment 9 } 10 Tab.VERSION = '1.0' 11 Tab.TRANSITION_DURATION = 150 12 Tab.prototype.show = function () { 13 var $this = this.element 14 var $ul = $this.closest('ul:not(.dropdown-menu)') 15 var selector = $this.data('target') 16 if (!selector) { 17 selector = $this.attr('href') 18 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 19 } 20 if ($this.parent('li').hasClass('active')) return 21 var $previous = $ul.find('.active:last a') 22 var hideEvent = $.Event('hide.bs.tab', { 23 relatedTarget: $this[0] 24 }) 25 var showEvent = $.Event('show.bs.tab', { 26 relatedTarget: $previous[0] 27 }) 28 $previous.trigger(hideEvent) 29 $this.trigger(showEvent) 30 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return 31 var $target = $(selector) 32 this.activate($this.closest('li'), $ul) 33 this.activate($target, $target.parent(), function () { 34 $previous.trigger({ 35 type: 'hidden.bs.tab', 36 relatedTarget: $this[0] 37 }) 38 $this.trigger({ 39 type: 'shown.bs.tab', 40 relatedTarget: $previous[0] 41 }) 42 }) 43 } 44 Tab.prototype.activate = function (element, container, callback) { 45 var $active = container.find('> .active') 46 var transition = callback 47 && $.support.transition 48 && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) 49 function next() { 50 $active 51 .removeClass('active') 52 .find('> .dropdown-menu > .active') 53 .removeClass('active') 54 .end() 55 .find('[data-toggle="tab"]') 56 .attr('aria-expanded', false) 57 element 58 .addClass('active') 59 .find('[data-toggle="tab"]') 60 .attr('aria-expanded', true) 61 if (transition) { 62 element[0].offsetWidth // reflow for transition 63 element.addClass('in') 64 } else { 65 element.removeClass('fade') 66 } 67 if (element.parent('.dropdown-menu').length) { 68 element 69 .closest('li.dropdown') 70 .addClass('active') 71 .end() 72 .find('[data-toggle="tab"]') 73 .attr('aria-expanded', true) 74 } 75 callback && callback() 76 } 77 next() 78 $active.removeClass('in') 79 } 80 // TAB PLUGIN DEFINITION 81 // ===================== 82 function Plugin(option) { 83 return this.each(function () { 84 var $this = $(this) 85 var data = $this.data('bs.tab') 86 if (!data) $this.data('bs.tab', (data = new Tab(this))) 87 if (typeof option == 'string') data[option]() 88 }) 89 } 90 var old = $.fn.tab 91 $.fn.tab = Plugin 92 $.fn.tab.Constructor = Tab 93 // TAB NO CONFLICT 94 // =============== 95 $.fn.tab.noConflict = function () { 96 $.fn.tab = old 97 return this 98 } 99 // TAB DATA-API 100 // ============ 101 var clickHandler = function (e) { 102 e.preventDefault() 103 Plugin.call($(this), 'show') 104 } 105 $(document) 106 .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) 107 .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) 108}(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.