summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Bootstrap/bootstrap-tooltip.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Bootstrap/bootstrap-tooltip.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Bootstrap/bootstrap-tooltip.js310
1 files changed, 0 insertions, 310 deletions
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-tooltip.js b/frontend/gamma/js/Bootstrap/bootstrap-tooltip.js
deleted file mode 100644
index bdcff7d..0000000
--- a/frontend/gamma/js/Bootstrap/bootstrap-tooltip.js
+++ b/dev/null
@@ -1,310 +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-tooltip.js v2.2.2
26 * http://twitter.github.com/bootstrap/javascript.html#tooltips
27 * Inspired by the original jQuery.tipsy by Jason Frame
28 * ===========================================================
29 * Copyright 2012 Twitter, Inc.
30 *
31 * Licensed under the Apache License, Version 2.0 (the "License");
32 * you may not use this file except in compliance with the License.
33 * You may obtain a copy of the License at
34 *
35 * http://www.apache.org/licenses/LICENSE-2.0
36 *
37 * Unless required by applicable law or agreed to in writing, software
38 * distributed under the License is distributed on an "AS IS" BASIS,
39 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40 * See the License for the specific language governing permissions and
41 * limitations under the License.
42 * ========================================================== */
43
44
45!function ($) {
46
47 "use strict"; // jshint ;_;
48
49
50 /* TOOLTIP PUBLIC CLASS DEFINITION
51 * =============================== */
52
53 var Tooltip = function (element, options) {
54 this.init('tooltip', element, options)
55 }
56
57 Tooltip.prototype = {
58
59 constructor: Tooltip
60
61 , init: function (type, element, options) {
62 var eventIn
63 , eventOut
64
65 this.type = type
66 this.$element = $(element)
67 this.options = this.getOptions(options)
68 this.enabled = true
69
70 if (this.options.trigger == 'click') {
71 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
72 } else if (this.options.trigger != 'manual') {
73 eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
74 eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
75 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
76 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
77 }
78
79 this.options.selector ?
80 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
81 this.fixTitle()
82 }
83
84 , getOptions: function (options) {
85 options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
86
87 if (options.delay && typeof options.delay == 'number') {
88 options.delay = {
89 show: options.delay
90 , hide: options.delay
91 }
92 }
93
94 return options
95 }
96
97 , enter: function (e) {
98 var self = $(e.currentTarget)[this.type](this._options).data(this.type)
99
100 if (!self.options.delay || !self.options.delay.show) return self.show()
101
102 clearTimeout(this.timeout)
103 self.hoverState = 'in'
104 this.timeout = setTimeout(function() {
105 if (self.hoverState == 'in') self.show()
106 }, self.options.delay.show)
107 }
108
109 , leave: function (e) {
110 var self = $(e.currentTarget)[this.type](this._options).data(this.type)
111
112 if (this.timeout) clearTimeout(this.timeout)
113 if (!self.options.delay || !self.options.delay.hide) return self.hide()
114
115 self.hoverState = 'out'
116 this.timeout = setTimeout(function() {
117 if (self.hoverState == 'out') self.hide()
118 }, self.options.delay.hide)
119 }
120
121 , show: function () {
122 var $tip
123 , inside
124 , pos
125 , actualWidth
126 , actualHeight
127 , placement
128 , tp
129
130 if (this.hasContent() && this.enabled) {
131 $tip = this.tip()
132 this.setContent()
133
134 if (this.options.animation) {
135 $tip.addClass('fade')
136 }
137
138 placement = typeof this.options.placement == 'function' ?
139 this.options.placement.call(this, $tip[0], this.$element[0]) :
140 this.options.placement
141
142 inside = /in/.test(placement)
143
144 $tip
145 .detach()
146 .css({ top: 0, left: 0, display: 'block' })
147 .insertAfter(this.$element)
148
149 pos = this.getPosition(inside)
150
151 actualWidth = $tip[0].offsetWidth
152 actualHeight = $tip[0].offsetHeight
153
154 switch (inside ? placement.split(' ')[1] : placement) {
155 case 'bottom':
156 tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
157 break
158 case 'top':
159 tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
160 break
161 case 'left':
162 tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
163 break
164 case 'right':
165 tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
166 break
167 }
168
169 $tip
170 .offset(tp)
171 .addClass(placement)
172 .addClass('in')
173 }
174 }
175
176 , setContent: function () {
177 var $tip = this.tip()
178 , title = this.getTitle()
179
180 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
181 $tip.removeClass('fade in top bottom left right')
182 }
183
184 , hide: function () {
185 var that = this
186 , $tip = this.tip()
187
188 $tip.removeClass('in')
189
190 function removeWithAnimation() {
191 var timeout = setTimeout(function () {
192 $tip.off($.support.transition.end).detach()
193 }, 500)
194
195 $tip.one($.support.transition.end, function () {
196 clearTimeout(timeout)
197 $tip.detach()
198 })
199 }
200
201 $.support.transition && this.$tip.hasClass('fade') ?
202 removeWithAnimation() :
203 $tip.detach()
204
205 return this
206 }
207
208 , fixTitle: function () {
209 var $e = this.$element
210 if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
211 $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
212 }
213 }
214
215 , hasContent: function () {
216 return this.getTitle()
217 }
218
219 , getPosition: function (inside) {
220 return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
221 width: this.$element[0].offsetWidth
222 , height: this.$element[0].offsetHeight
223 })
224 }
225
226 , getTitle: function () {
227 var title
228 , $e = this.$element
229 , o = this.options
230
231 title = $e.attr('data-original-title')
232 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
233
234 return title
235 }
236
237 , tip: function () {
238 return this.$tip = this.$tip || $(this.options.template)
239 }
240
241 , validate: function () {
242 if (!this.$element[0].parentNode) {
243 this.hide()
244 this.$element = null
245 this.options = null
246 }
247 }
248
249 , enable: function () {
250 this.enabled = true
251 }
252
253 , disable: function () {
254 this.enabled = false
255 }
256
257 , toggleEnabled: function () {
258 this.enabled = !this.enabled
259 }
260
261 , toggle: function (e) {
262 var self = $(e.currentTarget)[this.type](this._options).data(this.type)
263 self[self.tip().hasClass('in') ? 'hide' : 'show']()
264 }
265
266 , destroy: function () {
267 this.hide().$element.off('.' + this.type).removeData(this.type)
268 }
269
270 }
271
272
273 /* TOOLTIP PLUGIN DEFINITION
274 * ========================= */
275
276 var old = $.fn.tooltip
277
278 $.fn.tooltip = function ( option ) {
279 return this.each(function () {
280 var $this = $(this)
281 , data = $this.data('tooltip')
282 , options = typeof option == 'object' && option
283 if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
284 if (typeof option == 'string') data[option]()
285 })
286 }
287
288 $.fn.tooltip.Constructor = Tooltip
289
290 $.fn.tooltip.defaults = {
291 animation: true
292 , placement: 'top'
293 , selector: false
294 , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
295 , trigger: 'hover'
296 , title: ''
297 , delay: 0
298 , html: false
299 }
300
301
302 /* TOOLTIP NO CONFLICT
303 * =================== */
304
305 $.fn.tooltip.noConflict = function () {
306 $.fn.tooltip = old
307 return this
308 }
309
310}(window.jQuery); \ No newline at end of file