summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Bootstrap/bootstrap-dropdown.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Bootstrap/bootstrap-dropdown.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Bootstrap/bootstrap-dropdown.js184
1 files changed, 0 insertions, 184 deletions
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-dropdown.js b/frontend/gamma/js/Bootstrap/bootstrap-dropdown.js
deleted file mode 100644
index 3b77bb3..0000000
--- a/frontend/gamma/js/Bootstrap/bootstrap-dropdown.js
+++ b/dev/null
@@ -1,184 +0,0 @@
1/*
2
3Copyright 2008-2013 Clipperz Srl
4
5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please
7refer to http://www.clipperz.com.
8
9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details.
18
19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21
22*/
23
24/* ============================================================
25 * bootstrap-dropdown.js v2.2.2
26 * http://twitter.github.com/bootstrap/javascript.html#dropdowns
27 * ============================================================
28 * Copyright 2012 Twitter, Inc.
29 *
30 * Licensed under the Apache License, Version 2.0 (the "License");
31 * you may not use this file except in compliance with the License.
32 * You may obtain a copy of the License at
33 *
34 * http://www.apache.org/licenses/LICENSE-2.0
35 *
36 * Unless required by applicable law or agreed to in writing, software
37 * distributed under the License is distributed on an "AS IS" BASIS,
38 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39 * See the License for the specific language governing permissions and
40 * limitations under the License.
41 * ============================================================ */
42
43
44!function ($) {
45
46 "use strict"; // jshint ;_;
47
48
49 /* DROPDOWN CLASS DEFINITION
50 * ========================= */
51
52 var toggle = '[data-toggle=dropdown]'
53 , Dropdown = function (element) {
54 var $el = $(element).on('click.dropdown.data-api', this.toggle)
55 $('html').on('click.dropdown.data-api', function () {
56 $el.parent().removeClass('open')
57 })
58 }
59
60 Dropdown.prototype = {
61
62 constructor: Dropdown
63
64 , toggle: function (e) {
65 var $this = $(this)
66 , $parent
67 , isActive
68
69 if ($this.is('.disabled, :disabled')) return
70
71 $parent = getParent($this)
72
73 isActive = $parent.hasClass('open')
74
75 clearMenus()
76
77 if (!isActive) {
78 $parent.toggleClass('open')
79 }
80
81 $this.focus()
82
83 return false
84 }
85
86 , keydown: function (e) {
87 var $this
88 , $items
89 , $active
90 , $parent
91 , isActive
92 , index
93
94 if (!/(38|40|27)/.test(e.keyCode)) return
95
96 $this = $(this)
97
98 e.preventDefault()
99 e.stopPropagation()
100
101 if ($this.is('.disabled, :disabled')) return
102
103 $parent = getParent($this)
104
105 isActive = $parent.hasClass('open')
106
107 if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
108
109 $items = $('[role=menu] li:not(.divider):visible a', $parent)
110
111 if (!$items.length) return
112
113 index = $items.index($items.filter(':focus'))
114
115 if (e.keyCode == 38 && index > 0) index-- // up
116 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
117 if (!~index) index = 0
118
119 $items
120 .eq(index)
121 .focus()
122 }
123
124 }
125
126 function clearMenus() {
127 $(toggle).each(function () {
128 getParent($(this)).removeClass('open')
129 })
130 }
131
132 function getParent($this) {
133 var selector = $this.attr('data-target')
134 , $parent
135
136 if (!selector) {
137 selector = $this.attr('href')
138 selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
139 }
140
141 $parent = $(selector)
142 $parent.length || ($parent = $this.parent())
143
144 return $parent
145 }
146
147
148 /* DROPDOWN PLUGIN DEFINITION
149 * ========================== */
150
151 var old = $.fn.dropdown
152
153 $.fn.dropdown = function (option) {
154 return this.each(function () {
155 var $this = $(this)
156 , data = $this.data('dropdown')
157 if (!data) $this.data('dropdown', (data = new Dropdown(this)))
158 if (typeof option == 'string') data[option].call($this)
159 })
160 }
161
162 $.fn.dropdown.Constructor = Dropdown
163
164
165 /* DROPDOWN NO CONFLICT
166 * ==================== */
167
168 $.fn.dropdown.noConflict = function () {
169 $.fn.dropdown = old
170 return this
171 }
172
173
174 /* APPLY TO STANDARD DROPDOWN ELEMENTS
175 * =================================== */
176
177 $(document)
178 .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
179 .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
180 .on('touchstart.dropdown.data-api', '.dropdown-menu', function (e) { e.stopPropagation() })
181 .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
182 .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
183
184}(window.jQuery); \ No newline at end of file