PageSourceSearch

https://anver.com/wp-content/plugins/easy-responsive-tabs/assets/js/bootstrap-dropdown.js?ver=3.1

js anver.com collected 2026-09-26 05:36:17 UTC 5,087 bytes, 161 lines download raw bytes

vendor: 5,087 bytes, lines 1-161
1/* ========================================================================
2 * Bootstrap: dropdown.js v3.0.0
3 * http://twbs.github.com/bootstrap/javascript.html#dropdowns
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//if (typeof(Dropdown.prototype.toggle) == 'undefined') {
21+function ($) { "use strict";
22
23    // DROPDOWN CLASS DEFINITION
24    // =========================
25    if ($.fn.dropdown) {
26        return false;
27    }
28
29    var backdrop = '.dropdown-backdrop'
30    var toggle   = '[data-toggle=dropdown]';
31
32    var Dropdown = function (element) {
33        console.log('first');
34        $(element).unbind('show.bs.dropdown');
35        var $el = $(element).on('click.bs.dropdown', this.toggle)
36    };
37    console.log(Dropdown);
38    Dropdown.prototype.toggle = function (e) {
39        var $this = $(this)
40
41        if ($this.is('.disabled, :disabled')) return
42
43        var $parent  = getParent($this)
44        var isActive = $parent.hasClass('open')
45
46        clearMenus()
47
48        if (!isActive) {
49            if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
50                // if mobile we we use a backdrop because click events don't delegate
51                $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
52            }
53
54            $parent.trigger(e = $.Event('show.bs.dropdown'))
55
56            if (e.isDefaultPrevented()) return
57
58            $parent
59                .toggleClass('open')
60                .trigger('shown.bs.dropdown')
61            $this.focus()
62        }
63
64        return false
65    }
66
67    Dropdown.prototype.keydown = function (e) {
68        if (!/(38|40|27)/.test(e.keyCode)) return
69
70        var $this = $(this)
71
72        e.preventDefault()
73        e.stopPropagation()
74
75        if ($this.is('.disabled, :disabled')) return
76
77        var $parent  = getParent($this)
78        var isActive = $parent.hasClass('open')
79
80        if (!isActive || (isActive && e.keyCode == 27)) {
81            if (e.which == 27) $parent.find(toggle).focus()
82
83            return $this.click()
84        }
85
86        var $items = $('[role=menu] li:not(.divider):visible a', $parent)
87
88        if (!$items.length) return
89
90        var index = $items.index($items.filter(':focus'))
91
92        if (e.keyCode == 38 && index > 0)                 index--                        // up
93        if (e.keyCode == 40 && index < $items.length - 1) index++                        // down
94        if (!~index)                                      index=0
95
96        $items.eq(index).focus()
97    }
98
99    function clearMenus() {
100        $(backdrop).remove()
101        $(toggle).each(function (e) {
102            var $parent = getParent($(this))
103            if (!$parent.hasClass('open')) return
104            $parent.trigger(e = $.Event('hide.bs.dropdown'))
105            if (e.isDefaultPrevented()) return
106            $parent.removeClass('open').trigger('hidden.bs.dropdown')
107        })
108    }
109
110    function getParent($this) {
111        var selector = $this.attr('data-target')
112
113        if (!selector) {
114            selector = $this.attr('href')
115            selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
116        }
117
118        var $parent = selector && $(selector)
119
120        return $parent && $parent.length ? $parent : $this.parent()
121    }
122
123
124    // DROPDOWN PLUGIN DEFINITION
125    // ==========================
126
127    var old = $.fn.dropdown
128
129    $.fn.dropdown = function (option) {
130        return this.each(function () {
131            var $this = $(this)
132            var data  = $this.data('dropdown')
133
134            if (!data) $this.data('dropdown', (data = new Dropdown(this)))
135            if (typeof option == 'string') data[option].call($this)
136        })
137    }
138
139    $.fn.dropdown.Constructor = Dropdown
140
141
142    // DROPDOWN NO CONFLICT
143    // ====================
144
145    $.fn.dropdown.noConflict = function () {
146        $.fn.dropdown = old
147        return this
148    }
149
150
151    // APPLY TO STANDARD DROPDOWN ELEMENTS
152    // ===================================
153
154    $(document)
155        .on('click.bs.dropdown.data-api', clearMenus)
156        .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
157        .on('click.bs.dropdown.data-api'  , toggle, Dropdown.prototype.toggle)
158        .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
159
160}(window.jQuery);
161//}

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.