author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/gamma/js/Bootstrap/bootstrap-tab.js | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
Diffstat (limited to 'frontend/gamma/js/Bootstrap/bootstrap-tab.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Bootstrap/bootstrap-tab.js | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-tab.js b/frontend/gamma/js/Bootstrap/bootstrap-tab.js new file mode 100644 index 0000000..d7c7fc7 --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-tab.js | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer 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-tab.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#tabs | ||
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 | /* TAB CLASS DEFINITION | ||
50 | * ==================== */ | ||
51 | |||
52 | var Tab = function (element) { | ||
53 | this.element = $(element) | ||
54 | } | ||
55 | |||
56 | Tab.prototype = { | ||
57 | |||
58 | constructor: Tab | ||
59 | |||
60 | , show: function () { | ||
61 | var $this = this.element | ||
62 | , $ul = $this.closest('ul:not(.dropdown-menu)') | ||
63 | , selector = $this.attr('data-target') | ||
64 | , previous | ||
65 | , $target | ||
66 | , e | ||
67 | |||
68 | if (!selector) { | ||
69 | selector = $this.attr('href') | ||
70 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 | ||
71 | } | ||
72 | |||
73 | if ( $this.parent('li').hasClass('active') ) return | ||
74 | |||
75 | previous = $ul.find('.active:last a')[0] | ||
76 | |||
77 | e = $.Event('show', { | ||
78 | relatedTarget: previous | ||
79 | }) | ||
80 | |||
81 | $this.trigger(e) | ||
82 | |||
83 | if (e.isDefaultPrevented()) return | ||
84 | |||
85 | $target = $(selector) | ||
86 | |||
87 | this.activate($this.parent('li'), $ul) | ||
88 | this.activate($target, $target.parent(), function () { | ||
89 | $this.trigger({ | ||
90 | type: 'shown' | ||
91 | , relatedTarget: previous | ||
92 | }) | ||
93 | }) | ||
94 | } | ||
95 | |||
96 | , activate: function ( element, container, callback) { | ||
97 | var $active = container.find('> .active') | ||
98 | , transition = callback | ||
99 | && $.support.transition | ||
100 | && $active.hasClass('fade') | ||
101 | |||
102 | function next() { | ||
103 | $active | ||
104 | .removeClass('active') | ||
105 | .find('> .dropdown-menu > .active') | ||
106 | .removeClass('active') | ||
107 | |||
108 | element.addClass('active') | ||
109 | |||
110 | if (transition) { | ||
111 | element[0].offsetWidth // reflow for transition | ||
112 | element.addClass('in') | ||
113 | } else { | ||
114 | element.removeClass('fade') | ||
115 | } | ||
116 | |||
117 | if ( element.parent('.dropdown-menu') ) { | ||
118 | element.closest('li.dropdown').addClass('active') | ||
119 | } | ||
120 | |||
121 | callback && callback() | ||
122 | } | ||
123 | |||
124 | transition ? | ||
125 | $active.one($.support.transition.end, next) : | ||
126 | next() | ||
127 | |||
128 | $active.removeClass('in') | ||
129 | } | ||
130 | } | ||
131 | |||
132 | |||
133 | /* TAB PLUGIN DEFINITION | ||
134 | * ===================== */ | ||
135 | |||
136 | var old = $.fn.tab | ||
137 | |||
138 | $.fn.tab = function ( option ) { | ||
139 | return this.each(function () { | ||
140 | var $this = $(this) | ||
141 | , data = $this.data('tab') | ||
142 | if (!data) $this.data('tab', (data = new Tab(this))) | ||
143 | if (typeof option == 'string') data[option]() | ||
144 | }) | ||
145 | } | ||
146 | |||
147 | $.fn.tab.Constructor = Tab | ||
148 | |||
149 | |||
150 | /* TAB NO CONFLICT | ||
151 | * =============== */ | ||
152 | |||
153 | $.fn.tab.noConflict = function () { | ||
154 | $.fn.tab = old | ||
155 | return this | ||
156 | } | ||
157 | |||
158 | |||
159 | /* TAB DATA-API | ||
160 | * ============ */ | ||
161 | |||
162 | $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { | ||
163 | e.preventDefault() | ||
164 | $(this).tab('show') | ||
165 | }) | ||
166 | |||
167 | }(window.jQuery); \ No newline at end of file | ||