PageSourceSearch

https://www.saaten-zeller.de/templates/protostar/js/bootstrap-tab.js

js saaten-zeller.de collected 2026-10-04 13:27:00 UTC 3,437 bytes, 130 lines download raw bytes

1/* ========================================================
2 * bootstrap-tab.js v2.0.0
3 * http://twitter.github.com/bootstrap/javascript.html#tabs
4 * ========================================================
5 * Copyright 2012 Twitter, Inc.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ======================================================== */
19
20
21!function( $ ){
22
23  "use strict"
24
25 /* TAB CLASS DEFINITION
26  * ==================== */
27
28  var Tab = function ( element ) {
29    this.element = $(element)
30  }
31
32  Tab.prototype = {
33
34    constructor: Tab
35
36  , show: function () {
37      var $this = this.element
38        , $ul = $this.closest('ul:not(.dropdown-menu)')
39        , selector = $this.attr('data-target')
40        , previous
41        , $target
42
43      if (!selector) {
44        selector = $this.attr('href')
45        selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
46      }
47
48      if ( $this.parent('li').hasClass('active') ) return
49
50      previous = $ul.find('.active a').last()[0]
51
52      $this.trigger({
53        type: 'show'
54      , relatedTarget: previous
55      })
56
57      $target = $(selector)
58
59      this.activate($this.parent('li'), $ul)
60      this.activate($target, $target.parent(), function () {
61        $this.trigger({
62          type: 'shown'
63        , relatedTarget: previous
64        })
65      })
66    }
67
68  , activate: function ( element, container, callback) {
69      var $active = container.find('> .active')
70        , transition = callback
71            && $.support.transition
72            && $active.hasClass('fade')
73
74      function next() {
75        $active
76          .removeClass('active')
77          .find('> .dropdown-menu > .active')
78          .removeClass('active')
79
80        element.addClass('active')
81
82        if (transition) {
83          element[0].offsetWidth // reflow for transition
84          element.addClass('in')
85        } else {
86          element.removeClass('fade')
87        }
88
89        if ( element.parent('.dropdown-menu') ) {
90          element.closest('li.dropdown').addClass('active')
91        }
92
93        callback && callback()
94      }
95
96      transition ?
97        $active.one($.support.transition.end, next) :
98        next()
99
100      $active.removeClass('in')
101    }
102  }
103
104
105 /* TAB PLUGIN DEFINITION
106  * ===================== */
107
108  $.fn.tab = function ( option ) {
109    return this.each(function () {
110      var $this = $(this)
111        , data = $this.data('tab')
112      if (!data) $this.data('tab', (data = new Tab(this)))
113      if (typeof option == 'string') data[option]()
114    })
115  }
116
117  $.fn.tab.Constructor = Tab
118
119
120 /* TAB DATA-API
121  * ============ */
122
123  $(function () {
124    $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
125      e.preventDefault()
126      $(this).tab('show')
127    })
128  })
129
130}( window.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.