less-rails-bootstrap 2.3.3 → 3.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +7 -11
  4. data/lib/less/rails/bootstrap/version.rb +1 -1
  5. data/scripts/update_bootstrap.sh +37 -8
  6. data/test/cases/usage_css_spec.rb +15 -12
  7. data/test/cases/usage_js_spec.rb +4 -4
  8. data/test/dummy_app/app/assets/stylesheets/fonts.css.less +2 -0
  9. data/test/dummy_app/app/assets/stylesheets/framework.css.less +4 -2
  10. data/test/dummy_app/app/assets/stylesheets/individual.css.less +2 -2
  11. data/test/spec_helper.rb +1 -2
  12. data/vendor/assets/javascripts/twitter/bootstrap.js +0 -1
  13. data/vendor/assets/javascripts/twitter/bootstrap/affix.js +58 -49
  14. data/vendor/assets/javascripts/twitter/bootstrap/alert.js +36 -37
  15. data/vendor/assets/javascripts/twitter/bootstrap/button.js +41 -39
  16. data/vendor/assets/javascripts/twitter/bootstrap/carousel.js +131 -125
  17. data/vendor/assets/javascripts/twitter/bootstrap/collapse.js +108 -96
  18. data/vendor/assets/javascripts/twitter/bootstrap/dropdown.js +72 -87
  19. data/vendor/assets/javascripts/twitter/bootstrap/modal.js +149 -155
  20. data/vendor/assets/javascripts/twitter/bootstrap/popover.js +60 -59
  21. data/vendor/assets/javascripts/twitter/bootstrap/scrollspy.js +103 -107
  22. data/vendor/assets/javascripts/twitter/bootstrap/tab.js +73 -82
  23. data/vendor/assets/javascripts/twitter/bootstrap/tooltip.js +258 -255
  24. data/vendor/assets/javascripts/twitter/bootstrap/transition.js +34 -38
  25. data/vendor/frameworks/twitter/bootstrap/accordion.less +9 -12
  26. data/vendor/frameworks/twitter/bootstrap/alerts.less +43 -53
  27. data/vendor/frameworks/twitter/bootstrap/bootstrap.less +21 -21
  28. data/vendor/frameworks/twitter/bootstrap/breadcrumbs.less +7 -8
  29. data/vendor/frameworks/twitter/bootstrap/button-groups.less +93 -151
  30. data/vendor/frameworks/twitter/bootstrap/buttons.less +93 -164
  31. data/vendor/frameworks/twitter/bootstrap/carousel.less +110 -63
  32. data/vendor/frameworks/twitter/bootstrap/close.less +18 -17
  33. data/vendor/frameworks/twitter/bootstrap/code.less +14 -20
  34. data/vendor/frameworks/twitter/bootstrap/component-animations.less +10 -3
  35. data/vendor/frameworks/twitter/bootstrap/dropdowns.less +66 -143
  36. data/vendor/frameworks/twitter/bootstrap/forms.less +281 -548
  37. data/vendor/frameworks/twitter/bootstrap/grid.less +194 -11
  38. data/vendor/frameworks/twitter/bootstrap/media.less +8 -7
  39. data/vendor/frameworks/twitter/bootstrap/mixins.less +290 -446
  40. data/vendor/frameworks/twitter/bootstrap/modals.less +92 -51
  41. data/vendor/frameworks/twitter/bootstrap/navbar.less +285 -402
  42. data/vendor/frameworks/twitter/bootstrap/navs.less +176 -348
  43. data/vendor/frameworks/twitter/bootstrap/pager.less +45 -33
  44. data/vendor/frameworks/twitter/bootstrap/pagination.less +89 -104
  45. data/vendor/frameworks/twitter/bootstrap/popovers.less +53 -51
  46. data/vendor/frameworks/twitter/bootstrap/progress-bars.less +28 -45
  47. data/vendor/frameworks/twitter/bootstrap/responsive-utilities.less +92 -32
  48. data/vendor/frameworks/twitter/bootstrap/scaffolding.less +60 -18
  49. data/vendor/frameworks/twitter/bootstrap/tables.less +131 -164
  50. data/vendor/frameworks/twitter/bootstrap/thumbnails.less +20 -31
  51. data/vendor/frameworks/twitter/bootstrap/tooltip.less +45 -20
  52. data/vendor/frameworks/twitter/bootstrap/type.less +84 -99
  53. data/vendor/frameworks/twitter/bootstrap/utilities.less +17 -5
  54. data/vendor/frameworks/twitter/bootstrap/variables.less +446 -179
  55. data/vendor/frameworks/twitter/bootstrap/wells.less +5 -5
  56. metadata +41 -44
  57. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  58. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  59. data/vendor/assets/javascripts/twitter/bootstrap/typeahead.js +0 -335
  60. data/vendor/assets/stylesheets/twitter/bootstrap-responsive.css.less +0 -1
  61. data/vendor/assets/stylesheets/twitter/bootstrap.css.less +0 -1
  62. data/vendor/frameworks/twitter/bootstrap.less +0 -1
  63. data/vendor/frameworks/twitter/bootstrap/hero-unit.less +0 -25
  64. data/vendor/frameworks/twitter/bootstrap/labels-badges.less +0 -84
  65. data/vendor/frameworks/twitter/bootstrap/layouts.less +0 -16
  66. data/vendor/frameworks/twitter/bootstrap/reset.less +0 -216
  67. data/vendor/frameworks/twitter/bootstrap/responsive-1200px-min.less +0 -28
  68. data/vendor/frameworks/twitter/bootstrap/responsive-767px-max.less +0 -193
  69. data/vendor/frameworks/twitter/bootstrap/responsive-768px-979px.less +0 -19
  70. data/vendor/frameworks/twitter/bootstrap/responsive-navbar.less +0 -189
  71. data/vendor/frameworks/twitter/bootstrap/responsive.less +0 -48
  72. data/vendor/frameworks/twitter/bootstrap/sprites.less +0 -197
@@ -1,8 +1,8 @@
1
- /* ===========================================================
2
- * bootstrap-tooltip.js v2.3.2
3
- * http://twitter.github.com/bootstrap/javascript.html#tooltips
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
- !function ($) {
22
+ +function ($) { "use strict";
23
23
 
24
- "use strict"; // jshint ;_;
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.prototype = {
35
-
36
- constructor: Tooltip
37
-
38
- , init: function (type, element, options) {
39
- var eventIn
40
- , eventOut
41
- , triggers
42
- , trigger
43
- , i
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
- this.options.selector ?
65
- (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
66
- this.fixTitle()
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
- , getOptions: function (options) {
70
- options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options)
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
- if (options.delay && typeof options.delay == 'number') {
73
- options.delay = {
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
- return options
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
- , enter: function (e) {
83
- var defaults = $.fn[this.type].defaults
84
- , options = {}
85
- , self
91
+ return options
92
+ }
86
93
 
87
- this._options && $.each(this._options, function (key, value) {
88
- if (defaults[key] != value) options[key] = value
89
- }, this)
94
+ Tooltip.prototype.enter = function (obj) {
95
+ var defaults = this.getDefaults()
96
+ var options = {}
90
97
 
91
- self = $(e.currentTarget)[this.type](options).data(this.type)
98
+ this._options && $.each(this._options, function (key, value) {
99
+ if (defaults[key] != value) options[key] = value
100
+ })
92
101
 
93
- if (!self.options.delay || !self.options.delay.show) return self.show()
102
+ var self = obj instanceof this.constructor ?
103
+ obj : $(obj.currentTarget)[this.type](options).data('bs.' + this.type)
94
104
 
95
- clearTimeout(this.timeout)
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
- , leave: function (e) {
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
- if (this.timeout) clearTimeout(this.timeout)
106
- if (!self.options.delay || !self.options.delay.hide) return self.hide()
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
- self.hoverState = 'out'
109
- this.timeout = setTimeout(function() {
110
- if (self.hoverState == 'out') self.hide()
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
- , show: function () {
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
- $tip
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
- this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
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
- pos = this.getPosition()
129
+ Tooltip.prototype.show = function () {
130
+ var e = $.Event('show.bs.'+ this.type)
144
131
 
145
- actualWidth = $tip[0].offsetWidth
146
- actualHeight = $tip[0].offsetHeight
132
+ if (this.hasContent() && this.enabled) {
133
+ this.$element.trigger(e)
147
134
 
148
- switch (placement) {
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
- , width = $tip[0].offsetWidth
171
- , height = $tip[0].offsetHeight
172
- , actualWidth
173
- , actualHeight
174
- , delta
175
- , replace
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
- .offset(offset)
152
+ .detach()
153
+ .css({ top: 0, left: 0, display: 'block' })
179
154
  .addClass(placement)
180
- .addClass('in')
181
155
 
182
- actualWidth = $tip[0].offsetWidth
183
- actualHeight = $tip[0].offsetHeight
156
+ this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
184
157
 
185
- if (placement == 'top' && actualHeight != height) {
186
- offset.top = offset.top + height - actualHeight
187
- replace = true
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
- if (placement == 'bottom' || placement == 'top') {
191
- delta = 0
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
- if (offset.left < 0){
194
- delta = offset.left * -2
195
- offset.left = 0
196
- $tip.offset(offset)
197
- actualWidth = $tip[0].offsetWidth
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
- this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
202
- } else {
203
- this.replaceArrow(actualHeight - height, actualHeight, 'top')
177
+ $tip
178
+ .removeClass(orgPlacement)
179
+ .addClass(placement)
204
180
  }
205
181
 
206
- if (replace) $tip.offset(offset)
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
- , replaceArrow: function(delta, dimension, position){
210
- this
211
- .arrow()
212
- .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
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
- , setContent: function () {
216
- var $tip = this.tip()
217
- , title = this.getTitle()
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
- $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
220
- $tip.removeClass('fade in top bottom left right')
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
- , hide: function () {
224
- var that = this
225
- , $tip = this.tip()
226
- , e = $.Event('hide')
232
+ if (replace) $tip.offset(offset)
233
+ }
227
234
 
228
- this.$element.trigger(e)
229
- if (e.isDefaultPrevented()) return
235
+ Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
236
+ this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
237
+ }
230
238
 
231
- $tip.removeClass('in')
239
+ Tooltip.prototype.setContent = function () {
240
+ var $tip = this.tip()
241
+ var title = this.getTitle()
232
242
 
233
- function removeWithAnimation() {
234
- var timeout = setTimeout(function () {
235
- $tip.off($.support.transition.end).detach()
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
- $tip.one($.support.transition.end, function () {
239
- clearTimeout(timeout)
240
- $tip.detach()
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
- $.support.transition && this.$tip.hasClass('fade') ?
245
- removeWithAnimation() :
246
- $tip.detach()
252
+ this.$element.trigger(e)
247
253
 
248
- this.$element.trigger('hidden')
254
+ if (e.isDefaultPrevented()) return
249
255
 
250
- return this
251
- }
256
+ $tip.removeClass('in')
252
257
 
253
- , fixTitle: function () {
254
- var $e = this.$element
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
- }
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
- , hasContent: function () {
261
- return this.getTitle()
262
- }
264
+ this.$element.trigger('hidden.bs.' + this.type)
263
265
 
264
- , getPosition: function () {
265
- var el = this.$element[0]
266
- return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
267
- width: el.offsetWidth
268
- , height: el.offsetHeight
269
- }, this.$element.offset())
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
- , getTitle: function () {
273
- var title
274
- , $e = this.$element
275
- , o = this.options
276
+ Tooltip.prototype.hasContent = function () {
277
+ return this.getTitle()
278
+ }
276
279
 
277
- title = $e.attr('data-original-title')
278
- || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
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
- return title
281
- }
288
+ Tooltip.prototype.getTitle = function () {
289
+ var title
290
+ var $e = this.$element
291
+ var o = this.options
282
292
 
283
- , tip: function () {
284
- return this.$tip = this.$tip || $(this.options.template)
285
- }
293
+ title = $e.attr('data-original-title')
294
+ || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
286
295
 
287
- , arrow: function(){
288
- return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
289
- }
296
+ return title
297
+ }
290
298
 
291
- , validate: function () {
292
- if (!this.$element[0].parentNode) {
293
- this.hide()
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
- , enable: function () {
300
- this.enabled = true
301
- }
303
+ Tooltip.prototype.arrow =function(){
304
+ return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
305
+ }
302
306
 
303
- , disable: function () {
304
- this.enabled = false
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
- , toggleEnabled: function () {
308
- this.enabled = !this.enabled
309
- }
315
+ Tooltip.prototype.enable = function () {
316
+ this.enabled = true
317
+ }
310
318
 
311
- , toggle: function (e) {
312
- var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
313
- self.tip().hasClass('in') ? self.hide() : self.show()
314
- }
319
+ Tooltip.prototype.disable = function () {
320
+ this.enabled = false
321
+ }
315
322
 
316
- , destroy: function () {
317
- this.hide().$element.off('.' + this.type).removeData(this.type)
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
- /* TOOLTIP PLUGIN DEFINITION
324
- * ========================= */
337
+ // TOOLTIP PLUGIN DEFINITION
338
+ // =========================
325
339
 
326
340
  var old = $.fn.tooltip
327
341
 
328
- $.fn.tooltip = function ( option ) {
342
+ $.fn.tooltip = function (option) {
329
343
  return this.each(function () {
330
- var $this = $(this)
331
- , data = $this.data('tooltip')
332
- , options = typeof option == 'object' && option
333
- if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
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
- /* TOOLTIP NO CONFLICT
354
- * =================== */
356
+ // TOOLTIP NO CONFLICT
357
+ // ===================
355
358
 
356
359
  $.fn.tooltip.noConflict = function () {
357
360
  $.fn.tooltip = old