PageSourceSearch

https://www.archives.gov/sites/all/themes/nara/assets/javascripts/bootstrap/tab.js?tluiwm

js archives.gov collected 2026-09-25 06:08:18 UTC 2,999 bytes, 128 lines download raw bytes

vendor: 2,999 bytes, lines 1-128
1/* ========================================================================
2 * Bootstrap: tab.js v3.2.0
3 * http://getbootstrap.com/javascript/#tabs
4 * ========================================================================
5 * Copyright 2011-2014 Twitter, Inc.
6 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 * ======================================================================== */
8
9
10+function ($) {
11  'use strict';
12
13  // TAB CLASS DEFINITION
14  // ====================
15
16  var Tab = function (element) {
17    this.element = $(element)
18  }
19
20  Tab.VERSION = '3.2.0'
21
22  Tab.prototype.show = function () {
23    var $this    = this.element
24    var $ul      = $this.closest('ul:not(.dropdown-menu)')
25    var selector = $this.data('target')
26
27    if (!selector) {
28      selector = $this.attr('href')
29      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
30    }
31
32    if ($this.parent('li').hasClass('active')) return
33
34    var previous = $ul.find('.active:last a')[0]
35    var e        = $.Event('show.bs.tab', {
36      relatedTarget: previous
37    })
38
39    $this.trigger(e)
40
41    if (e.isDefaultPrevented()) return
42
43    var $target = $(selector)
44
45    this.activate($this.closest('li'), $ul)
46    this.activate($target, $target.parent(), function () {
47      $this.trigger({
48        type: 'shown.bs.tab',
49        relatedTarget: previous
50      })
51    })
52  }
53
54  Tab.prototype.activate = function (element, container, callback) {
55    var $active    = container.find('> .active')
56    var transition = callback
57      && $.support.transition
58      && $active.hasClass('fade')
59
60    function next() {
61      $active
62        .removeClass('active')
63        .find('> .dropdown-menu > .active')
64        .removeClass('active')
65
66      element.addClass('active')
67
68      if (transition) {
69        element[0].offsetWidth // reflow for transition
70        element.addClass('in')
71      } else {
72        element.removeClass('fade')
73      }
74
75      if (element.parent('.dropdown-menu')) {
76        element.closest('li.dropdown').addClass('active')
77      }
78
79      callback && callback()
80    }
81
82    transition ?
83      $active
84        .one('bsTransitionEnd', next)
85        .emulateTransitionEnd(150) :
86      next()
87
88    $active.removeClass('in')
89  }
90
91
92  // TAB PLUGIN DEFINITION
93  // =====================
94
95  function Plugin(option) {
96    return this.each(function () {
97      var $this = $(this)
98      var data  = $this.data('bs.tab')
99
100      if (!data) $this.data('bs.tab', (data = new Tab(this)))
101      if (typeof option == 'string') data[option]()
102    })
103  }
104
105  var old = $.fn.tab
106
107  $.fn.tab             = Plugin
108  $.fn.tab.Constructor = Tab
109
110
111  // TAB NO CONFLICT
112  // ===============
113
114  $.fn.tab.noConflict = function () {
115    $.fn.tab = old
116    return this
117  }
118
119
120  // TAB DATA-API
121  // ============
122
123  $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
124    e.preventDefault()
125    Plugin.call($(this), 'show')
126  })
127
128}(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.