anjlab-bootstrap-rails 2.3.1.2 → 3.0.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/Rakefile +42 -26
- data/lib/bootstrap-rails.rb +5 -6
- data/lib/bootstrap-rails/engine.rb +2 -9
- data/lib/bootstrap-rails/version.rb +1 -1
- data/test/test_helper.rb +2 -2
- data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.eot +0 -0
- data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.otf +0 -0
- data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.svg +175 -0
- data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.ttf +0 -0
- data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.woff +0 -0
- data/vendor/assets/javascripts/twitter/bootstrap.js +4 -5
- data/vendor/assets/javascripts/twitter/bootstrap/affix.js +50 -47
- data/vendor/assets/javascripts/twitter/bootstrap/alert.js +32 -35
- data/vendor/assets/javascripts/twitter/bootstrap/button.js +37 -37
- data/vendor/assets/javascripts/twitter/bootstrap/carousel.js +123 -127
- data/vendor/assets/javascripts/twitter/bootstrap/collapse.js +81 -95
- data/vendor/assets/javascripts/twitter/bootstrap/dropdown.js +61 -81
- data/vendor/assets/javascripts/twitter/bootstrap/modal.js +146 -151
- data/vendor/assets/javascripts/twitter/bootstrap/popover.js +53 -58
- data/vendor/assets/javascripts/twitter/bootstrap/scrollspy.js +99 -105
- data/vendor/assets/javascripts/twitter/bootstrap/tab.js +70 -81
- data/vendor/assets/javascripts/twitter/bootstrap/tooltip.js +246 -254
- data/vendor/assets/javascripts/twitter/bootstrap/transition.js +24 -37
- data/vendor/assets/stylesheets/twitter/bootstrap.scss +1 -1
- data/vendor/{frameworks/twitter/bootstrap/accordion.scss → assets/stylesheets/twitter/bootstrap/_accordion.scss} +2 -2
- data/vendor/assets/stylesheets/twitter/bootstrap/_alerts.scss +92 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_badges.scss +58 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_bootstrap.scss +64 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_breadcrumbs.scss +28 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_button-groups.scss +170 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_buttons.scss +160 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_carousel.scss +191 -0
- data/vendor/{frameworks/twitter/bootstrap/close.scss → assets/stylesheets/twitter/bootstrap/_close.scss} +7 -6
- data/vendor/{frameworks/twitter/bootstrap/code.scss → assets/stylesheets/twitter/bootstrap/_code.scss} +14 -14
- data/vendor/{frameworks/twitter/bootstrap/component-animations.scss → assets/stylesheets/twitter/bootstrap/_component-animations.scss} +1 -0
- data/vendor/{frameworks/twitter/bootstrap/dropdowns.scss → assets/stylesheets/twitter/bootstrap/_dropdowns.scss} +46 -57
- data/vendor/assets/stylesheets/twitter/bootstrap/_forms.scss +464 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_glyphicons.scss +200 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_grid.scss +65 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_jumbotron.scss +32 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_labels.scss +70 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_list-group.scss +96 -0
- data/vendor/{frameworks/twitter/bootstrap/media.scss → assets/stylesheets/twitter/bootstrap/_media.scss} +0 -1
- data/vendor/assets/stylesheets/twitter/bootstrap/_mixins.scss +510 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_modals.scss +137 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_navbar.scss +356 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_navs.scss +249 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_normalize.scss +396 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_pager.scss +54 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_pagination.scss +87 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_panels.scss +96 -0
- data/vendor/{frameworks/twitter/bootstrap/popovers.scss → assets/stylesheets/twitter/bootstrap/_popovers.scss} +32 -32
- data/vendor/assets/stylesheets/twitter/bootstrap/_print.scss +74 -0
- data/vendor/{frameworks/twitter/bootstrap/progress-bars.scss → assets/stylesheets/twitter/bootstrap/_progress-bars.scss} +40 -44
- data/vendor/assets/stylesheets/twitter/bootstrap/_responsive-utilities.scss +77 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_scaffolding.scss +83 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_tables.scss +242 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_thumbnails.scss +43 -0
- data/vendor/{frameworks/twitter/bootstrap/tooltip.scss → assets/stylesheets/twitter/bootstrap/_tooltip.scss} +20 -19
- data/vendor/assets/stylesheets/twitter/bootstrap/_type.scss +253 -0
- data/vendor/{frameworks/twitter/bootstrap/utilities.scss → assets/stylesheets/twitter/bootstrap/_utilities.scss} +17 -5
- data/vendor/assets/stylesheets/twitter/bootstrap/_variables.scss +416 -0
- data/vendor/{frameworks/twitter/bootstrap/wells.scss → assets/stylesheets/twitter/bootstrap/_wells.scss} +5 -5
- metadata +49 -53
- data/lib/bootstrap-rails/ie_hex_str.rb +0 -16
- data/test/ie_hex_str_test.rb +0 -26
- data/vendor/assets/images/twitter/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/twitter/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/twitter/bootstrap/typeahead.js +0 -335
- data/vendor/assets/stylesheets/twitter/bootstrap-responsive.scss +0 -1
- data/vendor/frameworks/twitter/bootstrap.scss +0 -1
- data/vendor/frameworks/twitter/bootstrap/alerts.scss +0 -79
- data/vendor/frameworks/twitter/bootstrap/bootstrap.scss +0 -63
- data/vendor/frameworks/twitter/bootstrap/breadcrumbs.scss +0 -24
- data/vendor/frameworks/twitter/bootstrap/button-groups.scss +0 -230
- data/vendor/frameworks/twitter/bootstrap/buttons.scss +0 -228
- data/vendor/frameworks/twitter/bootstrap/carousel.scss +0 -158
- data/vendor/frameworks/twitter/bootstrap/forms.scss +0 -690
- data/vendor/frameworks/twitter/bootstrap/grid.scss +0 -21
- data/vendor/frameworks/twitter/bootstrap/hero-unit.scss +0 -25
- data/vendor/frameworks/twitter/bootstrap/labels-badges.scss +0 -83
- data/vendor/frameworks/twitter/bootstrap/layouts.scss +0 -16
- data/vendor/frameworks/twitter/bootstrap/mixins.scss +0 -704
- data/vendor/frameworks/twitter/bootstrap/modals.scss +0 -95
- data/vendor/frameworks/twitter/bootstrap/navbar.scss +0 -496
- data/vendor/frameworks/twitter/bootstrap/navs.scss +0 -409
- data/vendor/frameworks/twitter/bootstrap/pager.scss +0 -43
- data/vendor/frameworks/twitter/bootstrap/pagination.scss +0 -123
- data/vendor/frameworks/twitter/bootstrap/reset.scss +0 -216
- data/vendor/frameworks/twitter/bootstrap/responsive-1200px-min.scss +0 -28
- data/vendor/frameworks/twitter/bootstrap/responsive-767px-max.scss +0 -189
- data/vendor/frameworks/twitter/bootstrap/responsive-768px-979px.scss +0 -19
- data/vendor/frameworks/twitter/bootstrap/responsive-navbar.scss +0 -189
- data/vendor/frameworks/twitter/bootstrap/responsive-utilities.scss +0 -59
- data/vendor/frameworks/twitter/bootstrap/responsive.scss +0 -48
- data/vendor/frameworks/twitter/bootstrap/scaffolding.scss +0 -53
- data/vendor/frameworks/twitter/bootstrap/sprites.scss +0 -197
- data/vendor/frameworks/twitter/bootstrap/tables.scss +0 -235
- data/vendor/frameworks/twitter/bootstrap/thumbnails.scss +0 -53
- data/vendor/frameworks/twitter/bootstrap/type.scss +0 -246
- data/vendor/frameworks/twitter/bootstrap/variables.scss +0 -295
@@ -1,8 +1,8 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* http://twitter.github.com/bootstrap/javascript.html#
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: tooltip.js v3.0.0
|
3
|
+
* http://twitter.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,334 @@
|
|
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)
|
68
55
|
|
69
|
-
|
70
|
-
options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options)
|
56
|
+
var triggers = this.options.trigger.split(' ')
|
71
57
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
58
|
+
for (var i = triggers.length; i--;) {
|
59
|
+
var trigger = triggers[i]
|
60
|
+
|
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'
|
66
|
+
|
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
|
+
}
|
78
71
|
|
79
|
-
|
72
|
+
this.options.selector ?
|
73
|
+
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
|
74
|
+
this.fixTitle()
|
75
|
+
}
|
76
|
+
|
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 (e) {
|
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 = $(e.currentTarget)[this.type](options).data('bs.' + this.type)
|
94
103
|
|
95
|
-
|
96
|
-
self.hoverState = 'in'
|
97
|
-
this.timeout = setTimeout(function() {
|
98
|
-
if (self.hoverState == 'in') self.show()
|
99
|
-
}, self.options.delay.show)
|
100
|
-
}
|
104
|
+
if (!self.options.delay || !self.options.delay.show) return self.show()
|
101
105
|
|
102
|
-
|
103
|
-
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
106
|
+
clearTimeout(this.timeout)
|
104
107
|
|
105
|
-
|
106
|
-
|
108
|
+
self.hoverState = 'in'
|
109
|
+
this.timeout = setTimeout(function() {
|
110
|
+
if (self.hoverState == 'in') self.show()
|
111
|
+
}, self.options.delay.show)
|
112
|
+
}
|
107
113
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
114
|
+
Tooltip.prototype.leave = function (e) {
|
115
|
+
var self = $(e.currentTarget)[this.type](this._options).data('bs.' + this.type)
|
116
|
+
|
117
|
+
if (this.timeout) clearTimeout(this.timeout)
|
118
|
+
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
113
119
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
, placement
|
120
|
-
, tp
|
121
|
-
, e = $.Event('show')
|
120
|
+
self.hoverState = 'out'
|
121
|
+
this.timeout = setTimeout(function() {
|
122
|
+
if (self.hoverState == 'out') self.hide()
|
123
|
+
}, self.options.delay.hide)
|
124
|
+
}
|
122
125
|
|
123
|
-
|
124
|
-
|
125
|
-
if (e.isDefaultPrevented()) return
|
126
|
-
$tip = this.tip()
|
127
|
-
this.setContent()
|
126
|
+
Tooltip.prototype.show = function () {
|
127
|
+
var e = $.Event('show.bs.'+ this.type)
|
128
128
|
|
129
|
-
|
130
|
-
|
131
|
-
}
|
129
|
+
if (this.hasContent() && this.enabled) {
|
130
|
+
this.$element.trigger(e)
|
132
131
|
|
133
|
-
|
134
|
-
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
135
|
-
this.options.placement
|
132
|
+
if (e.isDefaultPrevented()) return
|
136
133
|
|
137
|
-
|
138
|
-
.detach()
|
139
|
-
.css({ top: 0, left: 0, display: 'block' })
|
134
|
+
var $tip = this.tip()
|
140
135
|
|
141
|
-
|
136
|
+
this.setContent()
|
142
137
|
|
143
|
-
|
138
|
+
if (this.options.animation) $tip.addClass('fade')
|
144
139
|
|
145
|
-
|
146
|
-
|
140
|
+
var placement = typeof this.options.placement == 'function' ?
|
141
|
+
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
142
|
+
this.options.placement
|
147
143
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
144
|
+
$tip
|
145
|
+
.detach()
|
146
|
+
.css({ top: 0, left: 0, display: 'block' })
|
147
|
+
|
148
|
+
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
149
|
+
|
150
|
+
var tp
|
151
|
+
var pos = this.getPosition()
|
152
|
+
var actualWidth = $tip[0].offsetWidth
|
153
|
+
var actualHeight = $tip[0].offsetHeight
|
154
|
+
|
155
|
+
switch (placement) {
|
156
|
+
case 'bottom':
|
157
|
+
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
|
158
|
+
break
|
159
|
+
case 'top':
|
160
|
+
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
|
161
|
+
break
|
162
|
+
case 'left':
|
163
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
|
164
|
+
break
|
165
|
+
case 'right':
|
166
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
|
167
|
+
break
|
165
168
|
}
|
169
|
+
|
170
|
+
this.applyPlacement(tp, placement)
|
171
|
+
this.$element.trigger('shown.bs.' + this.type)
|
166
172
|
}
|
173
|
+
}
|
167
174
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
, actualHeight
|
174
|
-
, delta
|
175
|
-
, replace
|
175
|
+
Tooltip.prototype.applyPlacement = function(offset, placement) {
|
176
|
+
var replace
|
177
|
+
var $tip = this.tip()
|
178
|
+
var width = $tip[0].offsetWidth
|
179
|
+
var height = $tip[0].offsetHeight
|
176
180
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
+
$tip
|
182
|
+
.offset(offset)
|
183
|
+
.addClass(placement)
|
184
|
+
.addClass('in')
|
181
185
|
|
182
|
-
|
183
|
-
|
186
|
+
var actualWidth = $tip[0].offsetWidth
|
187
|
+
var actualHeight = $tip[0].offsetHeight
|
184
188
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
+
if (placement == 'top' && actualHeight != height) {
|
190
|
+
replace = true
|
191
|
+
offset.top = offset.top + height - actualHeight
|
192
|
+
}
|
189
193
|
|
190
|
-
|
191
|
-
|
194
|
+
if (placement == 'bottom' || placement == 'top') {
|
195
|
+
var delta = 0
|
192
196
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
$tip.offset(offset)
|
197
|
-
actualWidth = $tip[0].offsetWidth
|
198
|
-
actualHeight = $tip[0].offsetHeight
|
199
|
-
}
|
197
|
+
if (offset.left < 0){
|
198
|
+
delta = offset.left * -2
|
199
|
+
offset.left = 0
|
200
200
|
|
201
|
-
|
202
|
-
|
203
|
-
|
201
|
+
$tip.offset(offset)
|
202
|
+
|
203
|
+
actualWidth = $tip[0].offsetWidth
|
204
|
+
actualHeight = $tip[0].offsetHeight
|
204
205
|
}
|
205
206
|
|
206
|
-
|
207
|
+
this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
|
208
|
+
} else {
|
209
|
+
this.replaceArrow(actualHeight - height, actualHeight, 'top')
|
207
210
|
}
|
208
211
|
|
209
|
-
|
210
|
-
|
211
|
-
.arrow()
|
212
|
-
.css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
|
213
|
-
}
|
212
|
+
if (replace) $tip.offset(offset)
|
213
|
+
}
|
214
214
|
|
215
|
-
|
216
|
-
|
217
|
-
|
215
|
+
Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
|
216
|
+
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
|
217
|
+
}
|
218
218
|
|
219
|
-
|
220
|
-
|
221
|
-
|
219
|
+
Tooltip.prototype.setContent = function () {
|
220
|
+
var $tip = this.tip()
|
221
|
+
var title = this.getTitle()
|
222
222
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
, e = $.Event('hide')
|
223
|
+
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
|
224
|
+
$tip.removeClass('fade in top bottom left right')
|
225
|
+
}
|
227
226
|
|
228
|
-
|
229
|
-
|
227
|
+
Tooltip.prototype.hide = function () {
|
228
|
+
var that = this
|
229
|
+
var $tip = this.tip()
|
230
|
+
var e = $.Event('hide.bs.' + this.type)
|
230
231
|
|
231
|
-
|
232
|
+
this.$element.trigger(e)
|
232
233
|
|
233
|
-
|
234
|
-
var timeout = setTimeout(function () {
|
235
|
-
$tip.off($.support.transition.end).detach()
|
236
|
-
}, 500)
|
234
|
+
if (e.isDefaultPrevented()) return
|
237
235
|
|
238
|
-
|
239
|
-
clearTimeout(timeout)
|
240
|
-
$tip.detach()
|
241
|
-
})
|
242
|
-
}
|
236
|
+
$tip.removeClass('in')
|
243
237
|
|
244
|
-
|
245
|
-
|
238
|
+
function removeWithAnimation() {
|
239
|
+
var timeout = setTimeout(function () {
|
240
|
+
$tip.off($.support.transition.end).detach()
|
241
|
+
}, 500)
|
242
|
+
|
243
|
+
$tip.one($.support.transition.end, function () {
|
244
|
+
clearTimeout(timeout)
|
246
245
|
$tip.detach()
|
246
|
+
})
|
247
|
+
}
|
247
248
|
|
248
|
-
|
249
|
+
$.support.transition && this.$tip.hasClass('fade') ?
|
250
|
+
removeWithAnimation() :
|
251
|
+
$tip.detach()
|
249
252
|
|
250
|
-
|
251
|
-
}
|
253
|
+
this.$element.trigger('hidden.bs.' + this.type)
|
252
254
|
|
253
|
-
|
254
|
-
|
255
|
-
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
256
|
-
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
|
257
|
-
}
|
258
|
-
}
|
255
|
+
return this
|
256
|
+
}
|
259
257
|
|
260
|
-
|
261
|
-
|
258
|
+
Tooltip.prototype.fixTitle = function () {
|
259
|
+
var $e = this.$element
|
260
|
+
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
261
|
+
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
|
262
262
|
}
|
263
|
+
}
|
263
264
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
width: el.offsetWidth
|
268
|
-
, height: el.offsetHeight
|
269
|
-
}, this.$element.offset())
|
270
|
-
}
|
265
|
+
Tooltip.prototype.hasContent = function () {
|
266
|
+
return this.getTitle()
|
267
|
+
}
|
271
268
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
269
|
+
Tooltip.prototype.getPosition = function () {
|
270
|
+
var el = this.$element[0]
|
271
|
+
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
|
272
|
+
width: el.offsetWidth
|
273
|
+
, height: el.offsetHeight
|
274
|
+
}, this.$element.offset())
|
275
|
+
}
|
276
276
|
|
277
|
-
|
278
|
-
|
277
|
+
Tooltip.prototype.getTitle = function () {
|
278
|
+
var title
|
279
|
+
var $e = this.$element
|
280
|
+
var o = this.options
|
279
281
|
|
280
|
-
|
281
|
-
|
282
|
+
title = $e.attr('data-original-title')
|
283
|
+
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
282
284
|
|
283
|
-
|
284
|
-
|
285
|
-
}
|
285
|
+
return title
|
286
|
+
}
|
286
287
|
|
287
|
-
|
288
|
-
|
289
|
-
|
288
|
+
Tooltip.prototype.tip = function () {
|
289
|
+
return this.$tip = this.$tip || $(this.options.template)
|
290
|
+
}
|
290
291
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
this.$element = null
|
295
|
-
this.options = null
|
296
|
-
}
|
297
|
-
}
|
292
|
+
Tooltip.prototype.arrow =function(){
|
293
|
+
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
|
294
|
+
}
|
298
295
|
|
299
|
-
|
300
|
-
|
296
|
+
Tooltip.prototype.validate = function () {
|
297
|
+
if (!this.$element[0].parentNode) {
|
298
|
+
this.hide()
|
299
|
+
this.$element = null
|
300
|
+
this.options = null
|
301
301
|
}
|
302
|
+
}
|
302
303
|
|
303
|
-
|
304
|
-
|
305
|
-
|
304
|
+
Tooltip.prototype.enable = function () {
|
305
|
+
this.enabled = true
|
306
|
+
}
|
306
307
|
|
307
|
-
|
308
|
-
|
309
|
-
|
308
|
+
Tooltip.prototype.disable = function () {
|
309
|
+
this.enabled = false
|
310
|
+
}
|
310
311
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
}
|
312
|
+
Tooltip.prototype.toggleEnabled = function () {
|
313
|
+
this.enabled = !this.enabled
|
314
|
+
}
|
315
315
|
|
316
|
-
|
317
|
-
|
318
|
-
|
316
|
+
Tooltip.prototype.toggle = function (e) {
|
317
|
+
var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this
|
318
|
+
self.tip().hasClass('in') ? self.hide() : self.show()
|
319
|
+
}
|
319
320
|
|
321
|
+
Tooltip.prototype.destroy = function () {
|
322
|
+
this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
|
320
323
|
}
|
321
324
|
|
322
325
|
|
323
|
-
|
324
|
-
|
326
|
+
// TOOLTIP PLUGIN DEFINITION
|
327
|
+
// =========================
|
325
328
|
|
326
329
|
var old = $.fn.tooltip
|
327
330
|
|
328
|
-
$.fn.tooltip = function (
|
331
|
+
$.fn.tooltip = function (option) {
|
329
332
|
return this.each(function () {
|
330
|
-
var $this
|
331
|
-
|
332
|
-
|
333
|
-
|
333
|
+
var $this = $(this)
|
334
|
+
var data = $this.data('bs.tooltip')
|
335
|
+
var options = typeof option == 'object' && option
|
336
|
+
|
337
|
+
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
|
334
338
|
if (typeof option == 'string') data[option]()
|
335
339
|
})
|
336
340
|
}
|
337
341
|
|
338
342
|
$.fn.tooltip.Constructor = Tooltip
|
339
343
|
|
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
344
|
|
353
|
-
|
354
|
-
|
345
|
+
// TOOLTIP NO CONFLICT
|
346
|
+
// ===================
|
355
347
|
|
356
348
|
$.fn.tooltip.noConflict = function () {
|
357
349
|
$.fn.tooltip = old
|