PageSourceSearch

https://portal.clipnews.gr/assets/af9d413d/bootstrap-tab.js

js clipnews.gr collected 2026-09-24 13:12:42 UTC 3,520 bytes, 137 lines download raw bytes

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