less-rails-bootstrap 2.3.3 → 3.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.md +4 -0
- data/README.md +7 -11
- data/lib/less/rails/bootstrap/version.rb +1 -1
- data/scripts/update_bootstrap.sh +37 -8
- data/test/cases/usage_css_spec.rb +15 -12
- data/test/cases/usage_js_spec.rb +4 -4
- data/test/dummy_app/app/assets/stylesheets/fonts.css.less +2 -0
- data/test/dummy_app/app/assets/stylesheets/framework.css.less +4 -2
- data/test/dummy_app/app/assets/stylesheets/individual.css.less +2 -2
- data/test/spec_helper.rb +1 -2
- data/vendor/assets/javascripts/twitter/bootstrap.js +0 -1
- data/vendor/assets/javascripts/twitter/bootstrap/affix.js +58 -49
- data/vendor/assets/javascripts/twitter/bootstrap/alert.js +36 -37
- data/vendor/assets/javascripts/twitter/bootstrap/button.js +41 -39
- data/vendor/assets/javascripts/twitter/bootstrap/carousel.js +131 -125
- data/vendor/assets/javascripts/twitter/bootstrap/collapse.js +108 -96
- data/vendor/assets/javascripts/twitter/bootstrap/dropdown.js +72 -87
- data/vendor/assets/javascripts/twitter/bootstrap/modal.js +149 -155
- data/vendor/assets/javascripts/twitter/bootstrap/popover.js +60 -59
- data/vendor/assets/javascripts/twitter/bootstrap/scrollspy.js +103 -107
- data/vendor/assets/javascripts/twitter/bootstrap/tab.js +73 -82
- data/vendor/assets/javascripts/twitter/bootstrap/tooltip.js +258 -255
- data/vendor/assets/javascripts/twitter/bootstrap/transition.js +34 -38
- data/vendor/frameworks/twitter/bootstrap/accordion.less +9 -12
- data/vendor/frameworks/twitter/bootstrap/alerts.less +43 -53
- data/vendor/frameworks/twitter/bootstrap/bootstrap.less +21 -21
- data/vendor/frameworks/twitter/bootstrap/breadcrumbs.less +7 -8
- data/vendor/frameworks/twitter/bootstrap/button-groups.less +93 -151
- data/vendor/frameworks/twitter/bootstrap/buttons.less +93 -164
- data/vendor/frameworks/twitter/bootstrap/carousel.less +110 -63
- data/vendor/frameworks/twitter/bootstrap/close.less +18 -17
- data/vendor/frameworks/twitter/bootstrap/code.less +14 -20
- data/vendor/frameworks/twitter/bootstrap/component-animations.less +10 -3
- data/vendor/frameworks/twitter/bootstrap/dropdowns.less +66 -143
- data/vendor/frameworks/twitter/bootstrap/forms.less +281 -548
- data/vendor/frameworks/twitter/bootstrap/grid.less +194 -11
- data/vendor/frameworks/twitter/bootstrap/media.less +8 -7
- data/vendor/frameworks/twitter/bootstrap/mixins.less +290 -446
- data/vendor/frameworks/twitter/bootstrap/modals.less +92 -51
- data/vendor/frameworks/twitter/bootstrap/navbar.less +285 -402
- data/vendor/frameworks/twitter/bootstrap/navs.less +176 -348
- data/vendor/frameworks/twitter/bootstrap/pager.less +45 -33
- data/vendor/frameworks/twitter/bootstrap/pagination.less +89 -104
- data/vendor/frameworks/twitter/bootstrap/popovers.less +53 -51
- data/vendor/frameworks/twitter/bootstrap/progress-bars.less +28 -45
- data/vendor/frameworks/twitter/bootstrap/responsive-utilities.less +92 -32
- data/vendor/frameworks/twitter/bootstrap/scaffolding.less +60 -18
- data/vendor/frameworks/twitter/bootstrap/tables.less +131 -164
- data/vendor/frameworks/twitter/bootstrap/thumbnails.less +20 -31
- data/vendor/frameworks/twitter/bootstrap/tooltip.less +45 -20
- data/vendor/frameworks/twitter/bootstrap/type.less +84 -99
- data/vendor/frameworks/twitter/bootstrap/utilities.less +17 -5
- data/vendor/frameworks/twitter/bootstrap/variables.less +446 -179
- data/vendor/frameworks/twitter/bootstrap/wells.less +5 -5
- metadata +41 -44
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/twitter/bootstrap/typeahead.js +0 -335
- data/vendor/assets/stylesheets/twitter/bootstrap-responsive.css.less +0 -1
- data/vendor/assets/stylesheets/twitter/bootstrap.css.less +0 -1
- data/vendor/frameworks/twitter/bootstrap.less +0 -1
- data/vendor/frameworks/twitter/bootstrap/hero-unit.less +0 -25
- data/vendor/frameworks/twitter/bootstrap/labels-badges.less +0 -84
- data/vendor/frameworks/twitter/bootstrap/layouts.less +0 -16
- data/vendor/frameworks/twitter/bootstrap/reset.less +0 -216
- data/vendor/frameworks/twitter/bootstrap/responsive-1200px-min.less +0 -28
- data/vendor/frameworks/twitter/bootstrap/responsive-767px-max.less +0 -193
- data/vendor/frameworks/twitter/bootstrap/responsive-768px-979px.less +0 -19
- data/vendor/frameworks/twitter/bootstrap/responsive-navbar.less +0 -189
- data/vendor/frameworks/twitter/bootstrap/responsive.less +0 -48
- data/vendor/frameworks/twitter/bootstrap/sprites.less +0 -197
@@ -1,8 +1,8 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* http://
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: tooltip.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#affix
|
4
4
|
* Inspired by the original jQuery.tipsy by Jason Frame
|
5
|
-
*
|
5
|
+
* ========================================================================
|
6
6
|
* Copyright 2012 Twitter, Inc.
|
7
7
|
*
|
8
8
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -16,342 +16,345 @@
|
|
16
16
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
17
|
* See the License for the specific language governing permissions and
|
18
18
|
* limitations under the License.
|
19
|
-
*
|
19
|
+
* ======================================================================== */
|
20
20
|
|
21
21
|
|
22
|
-
|
22
|
+
+function ($) { "use strict";
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
/* TOOLTIP PUBLIC CLASS DEFINITION
|
28
|
-
* =============================== */
|
24
|
+
// TOOLTIP PUBLIC CLASS DEFINITION
|
25
|
+
// ===============================
|
29
26
|
|
30
27
|
var Tooltip = function (element, options) {
|
28
|
+
this.type =
|
29
|
+
this.options =
|
30
|
+
this.enabled =
|
31
|
+
this.timeout =
|
32
|
+
this.hoverState =
|
33
|
+
this.$element = null
|
34
|
+
|
31
35
|
this.init('tooltip', element, options)
|
32
36
|
}
|
33
37
|
|
34
|
-
Tooltip.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
,
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
this.type = type
|
46
|
-
this.$element = $(element)
|
47
|
-
this.options = this.getOptions(options)
|
48
|
-
this.enabled = true
|
49
|
-
|
50
|
-
triggers = this.options.trigger.split(' ')
|
51
|
-
|
52
|
-
for (i = triggers.length; i--;) {
|
53
|
-
trigger = triggers[i]
|
54
|
-
if (trigger == 'click') {
|
55
|
-
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
|
56
|
-
} else if (trigger != 'manual') {
|
57
|
-
eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
|
58
|
-
eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
|
59
|
-
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
|
60
|
-
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
|
61
|
-
}
|
62
|
-
}
|
38
|
+
Tooltip.DEFAULTS = {
|
39
|
+
animation: true
|
40
|
+
, placement: 'top'
|
41
|
+
, selector: false
|
42
|
+
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
43
|
+
, trigger: 'hover focus'
|
44
|
+
, title: ''
|
45
|
+
, delay: 0
|
46
|
+
, html: false
|
47
|
+
, container: false
|
48
|
+
}
|
63
49
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
50
|
+
Tooltip.prototype.init = function (type, element, options) {
|
51
|
+
this.enabled = true
|
52
|
+
this.type = type
|
53
|
+
this.$element = $(element)
|
54
|
+
this.options = this.getOptions(options)
|
55
|
+
|
56
|
+
var triggers = this.options.trigger.split(' ')
|
57
|
+
|
58
|
+
for (var i = triggers.length; i--;) {
|
59
|
+
var trigger = triggers[i]
|
68
60
|
|
69
|
-
|
70
|
-
|
61
|
+
if (trigger == 'click') {
|
62
|
+
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
|
63
|
+
} else if (trigger != 'manual') {
|
64
|
+
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
|
65
|
+
var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
|
71
66
|
|
72
|
-
|
73
|
-
options.
|
74
|
-
show: options.delay
|
75
|
-
, hide: options.delay
|
76
|
-
}
|
67
|
+
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
|
68
|
+
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
|
77
69
|
}
|
70
|
+
}
|
71
|
+
|
72
|
+
this.options.selector ?
|
73
|
+
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
|
74
|
+
this.fixTitle()
|
75
|
+
}
|
78
76
|
|
79
|
-
|
77
|
+
Tooltip.prototype.getDefaults = function () {
|
78
|
+
return Tooltip.DEFAULTS
|
79
|
+
}
|
80
|
+
|
81
|
+
Tooltip.prototype.getOptions = function (options) {
|
82
|
+
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
|
83
|
+
|
84
|
+
if (options.delay && typeof options.delay == 'number') {
|
85
|
+
options.delay = {
|
86
|
+
show: options.delay
|
87
|
+
, hide: options.delay
|
88
|
+
}
|
80
89
|
}
|
81
90
|
|
82
|
-
|
83
|
-
|
84
|
-
, options = {}
|
85
|
-
, self
|
91
|
+
return options
|
92
|
+
}
|
86
93
|
|
87
|
-
|
88
|
-
|
89
|
-
|
94
|
+
Tooltip.prototype.enter = function (obj) {
|
95
|
+
var defaults = this.getDefaults()
|
96
|
+
var options = {}
|
90
97
|
|
91
|
-
|
98
|
+
this._options && $.each(this._options, function (key, value) {
|
99
|
+
if (defaults[key] != value) options[key] = value
|
100
|
+
})
|
92
101
|
|
93
|
-
|
102
|
+
var self = obj instanceof this.constructor ?
|
103
|
+
obj : $(obj.currentTarget)[this.type](options).data('bs.' + this.type)
|
94
104
|
|
95
|
-
|
96
|
-
self.hoverState = 'in'
|
97
|
-
this.timeout = setTimeout(function() {
|
98
|
-
if (self.hoverState == 'in') self.show()
|
99
|
-
}, self.options.delay.show)
|
100
|
-
}
|
105
|
+
clearTimeout(self.timeout)
|
101
106
|
|
102
|
-
|
103
|
-
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
107
|
+
if (!self.options.delay || !self.options.delay.show) return self.show()
|
104
108
|
|
105
|
-
|
106
|
-
|
109
|
+
self.hoverState = 'in'
|
110
|
+
self.timeout = setTimeout(function () {
|
111
|
+
if (self.hoverState == 'in') self.show()
|
112
|
+
}, self.options.delay.show)
|
113
|
+
}
|
107
114
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
}, self.options.delay.hide)
|
112
|
-
}
|
115
|
+
Tooltip.prototype.leave = function (obj) {
|
116
|
+
var self = obj instanceof this.constructor ?
|
117
|
+
obj : $(obj.currentTarget)[this.type](this._options).data('bs.' + this.type)
|
113
118
|
|
114
|
-
|
115
|
-
var $tip
|
116
|
-
, pos
|
117
|
-
, actualWidth
|
118
|
-
, actualHeight
|
119
|
-
, placement
|
120
|
-
, tp
|
121
|
-
, e = $.Event('show')
|
122
|
-
|
123
|
-
if (this.hasContent() && this.enabled) {
|
124
|
-
this.$element.trigger(e)
|
125
|
-
if (e.isDefaultPrevented()) return
|
126
|
-
$tip = this.tip()
|
127
|
-
this.setContent()
|
128
|
-
|
129
|
-
if (this.options.animation) {
|
130
|
-
$tip.addClass('fade')
|
131
|
-
}
|
132
|
-
|
133
|
-
placement = typeof this.options.placement == 'function' ?
|
134
|
-
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
135
|
-
this.options.placement
|
119
|
+
clearTimeout(self.timeout)
|
136
120
|
|
137
|
-
|
138
|
-
.detach()
|
139
|
-
.css({ top: 0, left: 0, display: 'block' })
|
121
|
+
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
140
122
|
|
141
|
-
|
123
|
+
self.hoverState = 'out'
|
124
|
+
self.timeout = setTimeout(function () {
|
125
|
+
if (self.hoverState == 'out') self.hide()
|
126
|
+
}, self.options.delay.hide)
|
127
|
+
}
|
142
128
|
|
143
|
-
|
129
|
+
Tooltip.prototype.show = function () {
|
130
|
+
var e = $.Event('show.bs.'+ this.type)
|
144
131
|
|
145
|
-
|
146
|
-
|
132
|
+
if (this.hasContent() && this.enabled) {
|
133
|
+
this.$element.trigger(e)
|
147
134
|
|
148
|
-
|
149
|
-
case 'bottom':
|
150
|
-
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
|
151
|
-
break
|
152
|
-
case 'top':
|
153
|
-
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
|
154
|
-
break
|
155
|
-
case 'left':
|
156
|
-
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
|
157
|
-
break
|
158
|
-
case 'right':
|
159
|
-
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
|
160
|
-
break
|
161
|
-
}
|
162
|
-
|
163
|
-
this.applyPlacement(tp, placement)
|
164
|
-
this.$element.trigger('shown')
|
165
|
-
}
|
166
|
-
}
|
135
|
+
if (e.isDefaultPrevented()) return
|
167
136
|
|
168
|
-
, applyPlacement: function(offset, placement){
|
169
137
|
var $tip = this.tip()
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
138
|
+
|
139
|
+
this.setContent()
|
140
|
+
|
141
|
+
if (this.options.animation) $tip.addClass('fade')
|
142
|
+
|
143
|
+
var placement = typeof this.options.placement == 'function' ?
|
144
|
+
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
145
|
+
this.options.placement
|
146
|
+
|
147
|
+
var autoToken = /\s?auto?\s?/i
|
148
|
+
var autoPlace = autoToken.test(placement)
|
149
|
+
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
|
176
150
|
|
177
151
|
$tip
|
178
|
-
.
|
152
|
+
.detach()
|
153
|
+
.css({ top: 0, left: 0, display: 'block' })
|
179
154
|
.addClass(placement)
|
180
|
-
.addClass('in')
|
181
155
|
|
182
|
-
|
183
|
-
actualHeight = $tip[0].offsetHeight
|
156
|
+
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
184
157
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
158
|
+
var pos = this.getPosition()
|
159
|
+
var actualWidth = $tip[0].offsetWidth
|
160
|
+
var actualHeight = $tip[0].offsetHeight
|
161
|
+
|
162
|
+
if (autoPlace) {
|
163
|
+
var $parent = this.$element.parent()
|
189
164
|
|
190
|
-
|
191
|
-
|
165
|
+
var orgPlacement = placement
|
166
|
+
var docScroll = document.documentElement.scrollTop || document.body.scrollTop
|
167
|
+
var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
|
168
|
+
var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
|
169
|
+
var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
|
192
170
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
actualHeight = $tip[0].offsetHeight
|
199
|
-
}
|
171
|
+
placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
|
172
|
+
placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
|
173
|
+
placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
|
174
|
+
placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
|
175
|
+
placement
|
200
176
|
|
201
|
-
|
202
|
-
|
203
|
-
|
177
|
+
$tip
|
178
|
+
.removeClass(orgPlacement)
|
179
|
+
.addClass(placement)
|
204
180
|
}
|
205
181
|
|
206
|
-
|
182
|
+
var tp = placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
183
|
+
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
184
|
+
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
|
185
|
+
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
|
186
|
+
|
187
|
+
this.applyPlacement(tp, placement)
|
188
|
+
this.$element.trigger('shown.bs.' + this.type)
|
207
189
|
}
|
190
|
+
}
|
208
191
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
192
|
+
Tooltip.prototype.applyPlacement = function(offset, placement) {
|
193
|
+
var replace
|
194
|
+
var $tip = this.tip()
|
195
|
+
var width = $tip[0].offsetWidth
|
196
|
+
var height = $tip[0].offsetHeight
|
197
|
+
|
198
|
+
// manually read margins because getBoundingClientRect includes difference
|
199
|
+
offset.top = offset.top + parseInt($tip.css('margin-top'), 10)
|
200
|
+
offset.left = offset.left + parseInt($tip.css('margin-left'), 10)
|
201
|
+
|
202
|
+
$tip
|
203
|
+
.offset(offset)
|
204
|
+
.addClass('in')
|
205
|
+
|
206
|
+
var actualWidth = $tip[0].offsetWidth
|
207
|
+
var actualHeight = $tip[0].offsetHeight
|
208
|
+
|
209
|
+
if (placement == 'top' && actualHeight != height) {
|
210
|
+
replace = true
|
211
|
+
offset.top = offset.top + height - actualHeight
|
213
212
|
}
|
214
213
|
|
215
|
-
|
216
|
-
var
|
217
|
-
|
214
|
+
if (placement == 'bottom' || placement == 'top') {
|
215
|
+
var delta = 0
|
216
|
+
|
217
|
+
if (offset.left < 0){
|
218
|
+
delta = offset.left * -2
|
219
|
+
offset.left = 0
|
218
220
|
|
219
|
-
|
220
|
-
|
221
|
+
$tip.offset(offset)
|
222
|
+
|
223
|
+
actualWidth = $tip[0].offsetWidth
|
224
|
+
actualHeight = $tip[0].offsetHeight
|
225
|
+
}
|
226
|
+
|
227
|
+
this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
|
228
|
+
} else {
|
229
|
+
this.replaceArrow(actualHeight - height, actualHeight, 'top')
|
221
230
|
}
|
222
231
|
|
223
|
-
|
224
|
-
|
225
|
-
, $tip = this.tip()
|
226
|
-
, e = $.Event('hide')
|
232
|
+
if (replace) $tip.offset(offset)
|
233
|
+
}
|
227
234
|
|
228
|
-
|
229
|
-
|
235
|
+
Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
|
236
|
+
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
|
237
|
+
}
|
230
238
|
|
231
|
-
|
239
|
+
Tooltip.prototype.setContent = function () {
|
240
|
+
var $tip = this.tip()
|
241
|
+
var title = this.getTitle()
|
232
242
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
}, 500)
|
243
|
+
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
|
244
|
+
$tip.removeClass('fade in top bottom left right')
|
245
|
+
}
|
237
246
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
}
|
247
|
+
Tooltip.prototype.hide = function () {
|
248
|
+
var that = this
|
249
|
+
var $tip = this.tip()
|
250
|
+
var e = $.Event('hide.bs.' + this.type)
|
243
251
|
|
244
|
-
|
245
|
-
removeWithAnimation() :
|
246
|
-
$tip.detach()
|
252
|
+
this.$element.trigger(e)
|
247
253
|
|
248
|
-
|
254
|
+
if (e.isDefaultPrevented()) return
|
249
255
|
|
250
|
-
|
251
|
-
}
|
256
|
+
$tip.removeClass('in')
|
252
257
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
}
|
258
|
+
$.support.transition && this.$tip.hasClass('fade') ?
|
259
|
+
$tip
|
260
|
+
.one($.support.transition.end, $tip.detach)
|
261
|
+
.emulateTransitionEnd(150) :
|
262
|
+
$tip.detach()
|
259
263
|
|
260
|
-
|
261
|
-
return this.getTitle()
|
262
|
-
}
|
264
|
+
this.$element.trigger('hidden.bs.' + this.type)
|
263
265
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
266
|
+
return this
|
267
|
+
}
|
268
|
+
|
269
|
+
Tooltip.prototype.fixTitle = function () {
|
270
|
+
var $e = this.$element
|
271
|
+
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
272
|
+
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
|
270
273
|
}
|
274
|
+
}
|
271
275
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
, o = this.options
|
276
|
+
Tooltip.prototype.hasContent = function () {
|
277
|
+
return this.getTitle()
|
278
|
+
}
|
276
279
|
|
277
|
-
|
278
|
-
|
280
|
+
Tooltip.prototype.getPosition = function () {
|
281
|
+
var el = this.$element[0]
|
282
|
+
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
|
283
|
+
width: el.offsetWidth
|
284
|
+
, height: el.offsetHeight
|
285
|
+
}, this.$element.offset())
|
286
|
+
}
|
279
287
|
|
280
|
-
|
281
|
-
|
288
|
+
Tooltip.prototype.getTitle = function () {
|
289
|
+
var title
|
290
|
+
var $e = this.$element
|
291
|
+
var o = this.options
|
282
292
|
|
283
|
-
|
284
|
-
|
285
|
-
}
|
293
|
+
title = $e.attr('data-original-title')
|
294
|
+
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
286
295
|
|
287
|
-
|
288
|
-
|
289
|
-
}
|
296
|
+
return title
|
297
|
+
}
|
290
298
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
this.$element = null
|
295
|
-
this.options = null
|
296
|
-
}
|
297
|
-
}
|
299
|
+
Tooltip.prototype.tip = function () {
|
300
|
+
return this.$tip = this.$tip || $(this.options.template)
|
301
|
+
}
|
298
302
|
|
299
|
-
|
300
|
-
|
301
|
-
|
303
|
+
Tooltip.prototype.arrow =function(){
|
304
|
+
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
|
305
|
+
}
|
302
306
|
|
303
|
-
|
304
|
-
|
307
|
+
Tooltip.prototype.validate = function () {
|
308
|
+
if (!this.$element[0].parentNode) {
|
309
|
+
this.hide()
|
310
|
+
this.$element = null
|
311
|
+
this.options = null
|
305
312
|
}
|
313
|
+
}
|
306
314
|
|
307
|
-
|
308
|
-
|
309
|
-
|
315
|
+
Tooltip.prototype.enable = function () {
|
316
|
+
this.enabled = true
|
317
|
+
}
|
310
318
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
}
|
319
|
+
Tooltip.prototype.disable = function () {
|
320
|
+
this.enabled = false
|
321
|
+
}
|
315
322
|
|
316
|
-
|
317
|
-
|
318
|
-
|
323
|
+
Tooltip.prototype.toggleEnabled = function () {
|
324
|
+
this.enabled = !this.enabled
|
325
|
+
}
|
326
|
+
|
327
|
+
Tooltip.prototype.toggle = function (e) {
|
328
|
+
var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this
|
329
|
+
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
|
330
|
+
}
|
319
331
|
|
332
|
+
Tooltip.prototype.destroy = function () {
|
333
|
+
this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
|
320
334
|
}
|
321
335
|
|
322
336
|
|
323
|
-
|
324
|
-
|
337
|
+
// TOOLTIP PLUGIN DEFINITION
|
338
|
+
// =========================
|
325
339
|
|
326
340
|
var old = $.fn.tooltip
|
327
341
|
|
328
|
-
$.fn.tooltip = function (
|
342
|
+
$.fn.tooltip = function (option) {
|
329
343
|
return this.each(function () {
|
330
|
-
var $this
|
331
|
-
|
332
|
-
|
333
|
-
|
344
|
+
var $this = $(this)
|
345
|
+
var data = $this.data('bs.tooltip')
|
346
|
+
var options = typeof option == 'object' && option
|
347
|
+
|
348
|
+
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
|
334
349
|
if (typeof option == 'string') data[option]()
|
335
350
|
})
|
336
351
|
}
|
337
352
|
|
338
353
|
$.fn.tooltip.Constructor = Tooltip
|
339
354
|
|
340
|
-
$.fn.tooltip.defaults = {
|
341
|
-
animation: true
|
342
|
-
, placement: 'top'
|
343
|
-
, selector: false
|
344
|
-
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
345
|
-
, trigger: 'hover focus'
|
346
|
-
, title: ''
|
347
|
-
, delay: 0
|
348
|
-
, html: false
|
349
|
-
, container: false
|
350
|
-
}
|
351
|
-
|
352
355
|
|
353
|
-
|
354
|
-
|
356
|
+
// TOOLTIP NO CONFLICT
|
357
|
+
// ===================
|
355
358
|
|
356
359
|
$.fn.tooltip.noConflict = function () {
|
357
360
|
$.fn.tooltip = old
|