twitter-bootstrap-rails 2.2.3 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of twitter-bootstrap-rails might be problematic. Click here for more details.

Files changed (204) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +460 -185
  3. data/Rakefile +7 -1
  4. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  5. data/app/assets/fonts/fontawesome-webfont.svg +640 -0
  6. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  7. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  8. data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  9. data/app/assets/fonts/glyphicons-halflings-regular.svg +229 -0
  10. data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  11. data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  12. data/app/assets/javascripts/twitter/bootstrap.js +12 -0
  13. data/app/assets/javascripts/twitter/bootstrap/affix.js +142 -0
  14. data/app/assets/javascripts/twitter/bootstrap/alert.js +92 -0
  15. data/app/assets/javascripts/twitter/bootstrap/button.js +110 -0
  16. data/app/assets/javascripts/twitter/bootstrap/carousel.js +223 -0
  17. data/app/assets/javascripts/twitter/bootstrap/collapse.js +170 -0
  18. data/app/assets/javascripts/twitter/bootstrap/dropdown.js +151 -0
  19. data/app/assets/javascripts/twitter/bootstrap/modal.js +280 -0
  20. data/app/assets/javascripts/twitter/bootstrap/popover.js +113 -0
  21. data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +170 -0
  22. data/app/assets/javascripts/twitter/bootstrap/tab.js +128 -0
  23. data/app/assets/javascripts/twitter/bootstrap/tooltip.js +457 -0
  24. data/app/assets/javascripts/twitter/bootstrap/transition.js +59 -0
  25. data/{vendor → app}/assets/javascripts/twitter/bootstrap_ujs.js +0 -0
  26. data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +1 -0
  27. data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +2026 -0
  28. data/app/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +1 -0
  29. data/app/helpers/badge_label_helper.rb +16 -0
  30. data/app/helpers/bootstrap_flash_helper.rb +20 -6
  31. data/app/helpers/form_errors_helper.rb +22 -0
  32. data/app/helpers/glyph_helper.rb +13 -5
  33. data/app/helpers/modal_helper.rb +37 -20
  34. data/app/helpers/navbar_helper.rb +209 -0
  35. data/app/helpers/twitter_breadcrumbs_helper.rb +11 -2
  36. data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +9 -9
  37. data/lib/generators/bootstrap/install/install_generator.rb +13 -8
  38. data/lib/generators/bootstrap/install/templates/bootstrap.coffee +2 -3
  39. data/lib/generators/bootstrap/install/templates/bootstrap.js +2 -3
  40. data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +14 -13
  41. data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +11 -5
  42. data/lib/generators/bootstrap/layout/layout_generator.rb +1 -4
  43. data/lib/generators/bootstrap/layout/templates/layout.html.erb +34 -58
  44. data/lib/generators/bootstrap/layout/templates/layout.html.haml +25 -44
  45. data/lib/generators/bootstrap/layout/templates/layout.html.slim +20 -39
  46. data/lib/generators/bootstrap/partial/templates/_login.html.erb +2 -3
  47. data/lib/generators/bootstrap/themed/templates/_form.html.erb +30 -10
  48. data/lib/generators/bootstrap/themed/templates/_form.html.haml +10 -8
  49. data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -9
  50. data/lib/generators/bootstrap/themed/templates/edit.html.erb +1 -2
  51. data/lib/generators/bootstrap/themed/templates/edit.html.haml +1 -1
  52. data/lib/generators/bootstrap/themed/templates/edit.html.slim +2 -2
  53. data/lib/generators/bootstrap/themed/templates/index.html.erb +3 -3
  54. data/lib/generators/bootstrap/themed/templates/index.html.haml +3 -3
  55. data/lib/generators/bootstrap/themed/templates/index.html.slim +5 -6
  56. data/lib/generators/bootstrap/themed/templates/new.html.erb +1 -2
  57. data/lib/generators/bootstrap/themed/templates/new.html.haml +1 -1
  58. data/lib/generators/bootstrap/themed/templates/new.html.slim +2 -2
  59. data/lib/generators/bootstrap/themed/templates/show.html.erb +6 -8
  60. data/lib/generators/bootstrap/themed/templates/show.html.haml +5 -5
  61. data/lib/generators/bootstrap/themed/templates/show.html.slim +7 -8
  62. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +5 -5
  63. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +3 -3
  64. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +4 -4
  65. data/lib/generators/bootstrap/themed/themed_generator.rb +4 -4
  66. data/lib/twitter-bootstrap-rails.rb +4 -4
  67. data/lib/twitter/bootstrap/rails/breadcrumbs.rb +69 -0
  68. data/lib/twitter/bootstrap/rails/engine.rb +17 -7
  69. data/lib/twitter/bootstrap/rails/version.rb +1 -1
  70. data/spec/lib/breadcrumbs_spec.rb +99 -0
  71. data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +30 -0
  72. data/spec/lib/twitter_bootstrap_rails/bootstrap_flash_helper_spec.rb +128 -0
  73. data/spec/lib/twitter_bootstrap_rails/form_errors_helper_spec.rb +148 -0
  74. data/spec/lib/twitter_bootstrap_rails/glyph_helper_spec.rb +24 -0
  75. data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +62 -0
  76. data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +396 -0
  77. data/spec/lib/twitter_bootstrap_rails/uri_state_spec.rb +49 -0
  78. data/spec/spec_helper.rb +21 -0
  79. data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +5990 -195
  80. data/vendor/static-source/bootstrap.less +0 -1
  81. data/vendor/static-source/fontawesome.less +7 -6
  82. data/vendor/static-source/sprites.less +3 -3
  83. data/vendor/toolkit/fontawesome/bordered-pulled.less +16 -0
  84. data/vendor/toolkit/fontawesome/core.less +11 -0
  85. data/vendor/toolkit/fontawesome/fixed-width.less +6 -0
  86. data/vendor/toolkit/fontawesome/font-awesome.less +17 -0
  87. data/vendor/toolkit/fontawesome/icons.less +552 -0
  88. data/vendor/toolkit/fontawesome/larger.less +13 -0
  89. data/vendor/toolkit/fontawesome/list.less +19 -0
  90. data/vendor/toolkit/fontawesome/mixins.less +25 -0
  91. data/vendor/toolkit/fontawesome/path.less +14 -0
  92. data/vendor/toolkit/fontawesome/rotated-flipped.less +20 -0
  93. data/vendor/toolkit/fontawesome/spinning.less +29 -0
  94. data/vendor/toolkit/fontawesome/stacked.less +20 -0
  95. data/vendor/toolkit/fontawesome/variables.less +561 -0
  96. data/vendor/toolkit/twitter/bootstrap/alerts.less +47 -58
  97. data/vendor/toolkit/twitter/bootstrap/badges.less +55 -0
  98. data/vendor/toolkit/twitter/bootstrap/bootstrap.less +26 -39
  99. data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +11 -9
  100. data/vendor/toolkit/twitter/bootstrap/button-groups.less +168 -152
  101. data/vendor/toolkit/twitter/bootstrap/buttons.less +101 -170
  102. data/vendor/toolkit/twitter/bootstrap/carousel.less +150 -65
  103. data/vendor/toolkit/twitter/bootstrap/close.less +20 -19
  104. data/vendor/toolkit/twitter/bootstrap/code.less +38 -30
  105. data/vendor/toolkit/twitter/bootstrap/component-animations.less +12 -3
  106. data/vendor/toolkit/twitter/bootstrap/dropdowns.less +124 -146
  107. data/vendor/toolkit/twitter/bootstrap/forms.less +401 -547
  108. data/vendor/toolkit/twitter/bootstrap/glyphicons.less +234 -0
  109. data/vendor/toolkit/twitter/bootstrap/grid.less +74 -11
  110. data/vendor/toolkit/twitter/bootstrap/input-groups.less +166 -0
  111. data/vendor/toolkit/twitter/bootstrap/jumbotron.less +48 -0
  112. data/vendor/toolkit/twitter/bootstrap/labels.less +64 -0
  113. data/vendor/toolkit/twitter/bootstrap/list-group.less +132 -0
  114. data/vendor/toolkit/twitter/bootstrap/media.less +8 -7
  115. data/vendor/toolkit/twitter/bootstrap/mixins.less +36 -699
  116. data/vendor/toolkit/twitter/bootstrap/mixins/alerts.less +14 -0
  117. data/vendor/toolkit/twitter/bootstrap/mixins/background-variant.less +8 -0
  118. data/vendor/toolkit/twitter/bootstrap/mixins/border-radius.less +18 -0
  119. data/vendor/toolkit/twitter/bootstrap/mixins/buttons.less +52 -0
  120. data/vendor/toolkit/twitter/bootstrap/mixins/center-block.less +7 -0
  121. data/vendor/toolkit/twitter/bootstrap/mixins/clearfix.less +22 -0
  122. data/vendor/toolkit/twitter/bootstrap/mixins/forms.less +85 -0
  123. data/vendor/toolkit/twitter/bootstrap/mixins/gradients.less +59 -0
  124. data/vendor/toolkit/twitter/bootstrap/mixins/grid-framework.less +91 -0
  125. data/vendor/toolkit/twitter/bootstrap/mixins/grid.less +122 -0
  126. data/vendor/toolkit/twitter/bootstrap/mixins/hide-text.less +21 -0
  127. data/vendor/toolkit/twitter/bootstrap/mixins/image.less +33 -0
  128. data/vendor/toolkit/twitter/bootstrap/mixins/labels.less +12 -0
  129. data/vendor/toolkit/twitter/bootstrap/mixins/list-group.less +29 -0
  130. data/vendor/toolkit/twitter/bootstrap/mixins/nav-divider.less +10 -0
  131. data/vendor/toolkit/twitter/bootstrap/mixins/nav-vertical-align.less +9 -0
  132. data/vendor/toolkit/twitter/bootstrap/mixins/opacity.less +8 -0
  133. data/vendor/toolkit/twitter/bootstrap/mixins/pagination.less +23 -0
  134. data/vendor/toolkit/twitter/bootstrap/mixins/panels.less +24 -0
  135. data/vendor/toolkit/twitter/bootstrap/mixins/progress-bar.less +10 -0
  136. data/vendor/toolkit/twitter/bootstrap/mixins/reset-filter.less +8 -0
  137. data/vendor/toolkit/twitter/bootstrap/mixins/resize.less +6 -0
  138. data/vendor/toolkit/twitter/bootstrap/mixins/responsive-visibility.less +15 -0
  139. data/vendor/toolkit/twitter/bootstrap/mixins/size.less +10 -0
  140. data/vendor/toolkit/twitter/bootstrap/mixins/tab-focus.less +9 -0
  141. data/vendor/toolkit/twitter/bootstrap/mixins/table-row.less +28 -0
  142. data/vendor/toolkit/twitter/bootstrap/mixins/text-emphasis.less +8 -0
  143. data/vendor/toolkit/twitter/bootstrap/mixins/text-overflow.less +8 -0
  144. data/vendor/toolkit/twitter/bootstrap/mixins/vendor-prefixes.less +224 -0
  145. data/vendor/toolkit/twitter/bootstrap/modals.less +109 -54
  146. data/vendor/toolkit/twitter/bootstrap/navbar.less +542 -384
  147. data/vendor/toolkit/twitter/bootstrap/navs.less +192 -359
  148. data/vendor/toolkit/twitter/bootstrap/normalize.less +425 -0
  149. data/vendor/toolkit/twitter/bootstrap/pager.less +46 -34
  150. data/vendor/toolkit/twitter/bootstrap/pagination.less +70 -105
  151. data/vendor/toolkit/twitter/bootstrap/panels.less +248 -0
  152. data/vendor/toolkit/twitter/bootstrap/popovers.less +61 -61
  153. data/vendor/toolkit/twitter/bootstrap/print.less +101 -0
  154. data/vendor/toolkit/twitter/bootstrap/progress-bars.less +51 -73
  155. data/vendor/toolkit/twitter/bootstrap/responsive-embed.less +34 -0
  156. data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +177 -42
  157. data/vendor/toolkit/twitter/bootstrap/scaffolding.less +120 -23
  158. data/vendor/toolkit/twitter/bootstrap/tables.less +171 -182
  159. data/vendor/toolkit/twitter/bootstrap/theme.less +260 -0
  160. data/vendor/toolkit/twitter/bootstrap/thumbnails.less +26 -43
  161. data/vendor/toolkit/twitter/bootstrap/tooltip.less +49 -24
  162. data/vendor/toolkit/twitter/bootstrap/type.less +208 -147
  163. data/vendor/toolkit/twitter/bootstrap/utilities.less +33 -7
  164. data/vendor/toolkit/twitter/bootstrap/variables.less +761 -215
  165. data/vendor/toolkit/twitter/bootstrap/wells.less +7 -7
  166. metadata +199 -92
  167. data/lib/generators/bootstrap/partial/templates/_navbar.html.erb +0 -13
  168. data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +0 -42
  169. data/test/lib/breadcrumbs_test.rb +0 -75
  170. data/test/test_helper.rb +0 -8
  171. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  172. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  173. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  174. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  175. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  176. data/vendor/assets/javascripts/twitter/bootstrap.js +0 -13
  177. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-affix.js +0 -117
  178. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +0 -99
  179. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +0 -105
  180. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +0 -207
  181. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +0 -167
  182. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +0 -165
  183. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +0 -247
  184. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +0 -114
  185. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +0 -162
  186. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +0 -144
  187. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +0 -353
  188. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +0 -60
  189. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +0 -335
  190. data/vendor/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +0 -531
  191. data/vendor/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +0 -146
  192. data/vendor/toolkit/fontawesome-ie7.less +0 -350
  193. data/vendor/toolkit/fontawesome.less +0 -532
  194. data/vendor/toolkit/twitter/bootstrap/accordion.less +0 -34
  195. data/vendor/toolkit/twitter/bootstrap/hero-unit.less +0 -25
  196. data/vendor/toolkit/twitter/bootstrap/labels-badges.less +0 -84
  197. data/vendor/toolkit/twitter/bootstrap/layouts.less +0 -16
  198. data/vendor/toolkit/twitter/bootstrap/reset.less +0 -216
  199. data/vendor/toolkit/twitter/bootstrap/responsive-1200px-min.less +0 -28
  200. data/vendor/toolkit/twitter/bootstrap/responsive-767px-max.less +0 -193
  201. data/vendor/toolkit/twitter/bootstrap/responsive-768px-979px.less +0 -19
  202. data/vendor/toolkit/twitter/bootstrap/responsive-navbar.less +0 -189
  203. data/vendor/toolkit/twitter/bootstrap/responsive.less +0 -48
  204. data/vendor/toolkit/twitter/bootstrap/sprites.less +0 -197
@@ -1,144 +0,0 @@
1
- /* ========================================================
2
- * bootstrap-tab.js v2.3.0
3
- * http://twitter.github.com/bootstrap/javascript.html#tabs
4
- * ========================================================
5
- * Copyright 2012 Twitter, Inc.
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- * ======================================================== */
19
-
20
-
21
- !function ($) {
22
-
23
- "use strict"; // jshint ;_;
24
-
25
-
26
- /* TAB CLASS DEFINITION
27
- * ==================== */
28
-
29
- var Tab = function (element) {
30
- this.element = $(element)
31
- }
32
-
33
- Tab.prototype = {
34
-
35
- constructor: Tab
36
-
37
- , show: function () {
38
- var $this = this.element
39
- , $ul = $this.closest('ul:not(.dropdown-menu)')
40
- , selector = $this.attr('data-target')
41
- , previous
42
- , $target
43
- , e
44
-
45
- if (!selector) {
46
- selector = $this.attr('href')
47
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
48
- }
49
-
50
- if ( $this.parent('li').hasClass('active') ) return
51
-
52
- previous = $ul.find('.active:last a')[0]
53
-
54
- e = $.Event('show', {
55
- relatedTarget: previous
56
- })
57
-
58
- $this.trigger(e)
59
-
60
- if (e.isDefaultPrevented()) return
61
-
62
- $target = $(selector)
63
-
64
- this.activate($this.parent('li'), $ul)
65
- this.activate($target, $target.parent(), function () {
66
- $this.trigger({
67
- type: 'shown'
68
- , relatedTarget: previous
69
- })
70
- })
71
- }
72
-
73
- , activate: function ( element, container, callback) {
74
- var $active = container.find('> .active')
75
- , transition = callback
76
- && $.support.transition
77
- && $active.hasClass('fade')
78
-
79
- function next() {
80
- $active
81
- .removeClass('active')
82
- .find('> .dropdown-menu > .active')
83
- .removeClass('active')
84
-
85
- element.addClass('active')
86
-
87
- if (transition) {
88
- element[0].offsetWidth // reflow for transition
89
- element.addClass('in')
90
- } else {
91
- element.removeClass('fade')
92
- }
93
-
94
- if ( element.parent('.dropdown-menu') ) {
95
- element.closest('li.dropdown').addClass('active')
96
- }
97
-
98
- callback && callback()
99
- }
100
-
101
- transition ?
102
- $active.one($.support.transition.end, next) :
103
- next()
104
-
105
- $active.removeClass('in')
106
- }
107
- }
108
-
109
-
110
- /* TAB PLUGIN DEFINITION
111
- * ===================== */
112
-
113
- var old = $.fn.tab
114
-
115
- $.fn.tab = function ( option ) {
116
- return this.each(function () {
117
- var $this = $(this)
118
- , data = $this.data('tab')
119
- if (!data) $this.data('tab', (data = new Tab(this)))
120
- if (typeof option == 'string') data[option]()
121
- })
122
- }
123
-
124
- $.fn.tab.Constructor = Tab
125
-
126
-
127
- /* TAB NO CONFLICT
128
- * =============== */
129
-
130
- $.fn.tab.noConflict = function () {
131
- $.fn.tab = old
132
- return this
133
- }
134
-
135
-
136
- /* TAB DATA-API
137
- * ============ */
138
-
139
- $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
140
- e.preventDefault()
141
- $(this).tab('show')
142
- })
143
-
144
- }(window.jQuery);
@@ -1,353 +0,0 @@
1
- /* ===========================================================
2
- * bootstrap-tooltip.js v2.3.0
3
- * http://twitter.github.com/bootstrap/javascript.html#tooltips
4
- * Inspired by the original jQuery.tipsy by Jason Frame
5
- * ===========================================================
6
- * Copyright 2012 Twitter, Inc.
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- * ========================================================== */
20
-
21
-
22
- !function ($) {
23
-
24
- "use strict"; // jshint ;_;
25
-
26
-
27
- /* TOOLTIP PUBLIC CLASS DEFINITION
28
- * =============================== */
29
-
30
- var Tooltip = function (element, options) {
31
- this.init('tooltip', element, options)
32
- }
33
-
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
- }
63
-
64
- this.options.selector ?
65
- (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
66
- this.fixTitle()
67
- }
68
-
69
- , getOptions: function (options) {
70
- options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options)
71
-
72
- if (options.delay && typeof options.delay == 'number') {
73
- options.delay = {
74
- show: options.delay
75
- , hide: options.delay
76
- }
77
- }
78
-
79
- return options
80
- }
81
-
82
- , enter: function (e) {
83
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
84
-
85
- if (!self.options.delay || !self.options.delay.show) return self.show()
86
-
87
- clearTimeout(this.timeout)
88
- self.hoverState = 'in'
89
- this.timeout = setTimeout(function() {
90
- if (self.hoverState == 'in') self.show()
91
- }, self.options.delay.show)
92
- }
93
-
94
- , leave: function (e) {
95
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
96
-
97
- if (this.timeout) clearTimeout(this.timeout)
98
- if (!self.options.delay || !self.options.delay.hide) return self.hide()
99
-
100
- self.hoverState = 'out'
101
- this.timeout = setTimeout(function() {
102
- if (self.hoverState == 'out') self.hide()
103
- }, self.options.delay.hide)
104
- }
105
-
106
- , show: function () {
107
- var $tip
108
- , pos
109
- , actualWidth
110
- , actualHeight
111
- , placement
112
- , tp
113
- , e = $.Event('show')
114
-
115
- if (this.hasContent() && this.enabled) {
116
- this.$element.trigger(e)
117
- if (e.isDefaultPrevented()) return
118
- $tip = this.tip()
119
- this.setContent()
120
-
121
- if (this.options.animation) {
122
- $tip.addClass('fade')
123
- }
124
-
125
- placement = typeof this.options.placement == 'function' ?
126
- this.options.placement.call(this, $tip[0], this.$element[0]) :
127
- this.options.placement
128
-
129
- $tip
130
- .detach()
131
- .css({ top: 0, left: 0, display: 'block' })
132
-
133
- this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
134
-
135
- pos = this.getPosition()
136
-
137
- actualWidth = $tip[0].offsetWidth
138
- actualHeight = $tip[0].offsetHeight
139
-
140
- switch (placement) {
141
- case 'bottom':
142
- tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
143
- break
144
- case 'top':
145
- tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
146
- break
147
- case 'left':
148
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
149
- break
150
- case 'right':
151
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
152
- break
153
- }
154
-
155
- this.applyPlacement(tp, placement)
156
- this.$element.trigger('shown')
157
- }
158
- }
159
-
160
- , applyPlacement: function(offset, placement){
161
- var $tip = this.tip()
162
- , width = $tip[0].offsetWidth
163
- , height = $tip[0].offsetHeight
164
- , actualWidth
165
- , actualHeight
166
- , delta
167
- , replace
168
-
169
- $tip
170
- .offset(offset)
171
- .addClass(placement)
172
- .addClass('in')
173
-
174
- actualWidth = $tip[0].offsetWidth
175
- actualHeight = $tip[0].offsetHeight
176
-
177
- if (placement == 'top' && actualHeight != height) {
178
- offset.top = offset.top + height - actualHeight
179
- replace = true
180
- }
181
-
182
- if (placement == 'bottom' || placement == 'top') {
183
- delta = 0
184
-
185
- if (offset.left < 0){
186
- delta = offset.left * -2
187
- offset.left = 0
188
- $tip.offset(offset)
189
- actualWidth = $tip[0].offsetWidth
190
- actualHeight = $tip[0].offsetHeight
191
- }
192
-
193
- this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
194
- } else {
195
- this.replaceArrow(actualHeight - height, actualHeight, 'top')
196
- }
197
-
198
- if (replace) $tip.offset(offset)
199
- }
200
-
201
- , replaceArrow: function(delta, dimension, position){
202
- this
203
- .arrow()
204
- .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
205
- }
206
-
207
- , setContent: function () {
208
- var $tip = this.tip()
209
- , title = this.getTitle()
210
-
211
- $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
212
- $tip.removeClass('fade in top bottom left right')
213
- }
214
-
215
- , hide: function () {
216
- var that = this
217
- , $tip = this.tip()
218
- , e = $.Event('hide')
219
-
220
- this.$element.trigger(e)
221
- if (e.isDefaultPrevented()) return
222
-
223
- $tip.removeClass('in')
224
-
225
- function removeWithAnimation() {
226
- var timeout = setTimeout(function () {
227
- $tip.off($.support.transition.end).detach()
228
- }, 500)
229
-
230
- $tip.one($.support.transition.end, function () {
231
- clearTimeout(timeout)
232
- $tip.detach()
233
- })
234
- }
235
-
236
- $.support.transition && this.$tip.hasClass('fade') ?
237
- removeWithAnimation() :
238
- $tip.detach()
239
-
240
- this.$element.trigger('hidden')
241
-
242
- return this
243
- }
244
-
245
- , fixTitle: function () {
246
- var $e = this.$element
247
- if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
248
- $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
249
- }
250
- }
251
-
252
- , hasContent: function () {
253
- return this.getTitle()
254
- }
255
-
256
- , getPosition: function () {
257
- var el = this.$element[0]
258
- return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
259
- width: el.offsetWidth
260
- , height: el.offsetHeight
261
- }, this.$element.offset())
262
- }
263
-
264
- , getTitle: function () {
265
- var title
266
- , $e = this.$element
267
- , o = this.options
268
-
269
- title = $e.attr('data-original-title')
270
- || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
271
-
272
- return title
273
- }
274
-
275
- , tip: function () {
276
- return this.$tip = this.$tip || $(this.options.template)
277
- }
278
-
279
- , arrow: function(){
280
- return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
281
- }
282
-
283
- , validate: function () {
284
- if (!this.$element[0].parentNode) {
285
- this.hide()
286
- this.$element = null
287
- this.options = null
288
- }
289
- }
290
-
291
- , enable: function () {
292
- this.enabled = true
293
- }
294
-
295
- , disable: function () {
296
- this.enabled = false
297
- }
298
-
299
- , toggleEnabled: function () {
300
- this.enabled = !this.enabled
301
- }
302
-
303
- , toggle: function (e) {
304
- var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
305
- self.tip().hasClass('in') ? self.hide() : self.show()
306
- }
307
-
308
- , destroy: function () {
309
- this.hide().$element.off('.' + this.type).removeData(this.type)
310
- }
311
-
312
- }
313
-
314
-
315
- /* TOOLTIP PLUGIN DEFINITION
316
- * ========================= */
317
-
318
- var old = $.fn.tooltip
319
-
320
- $.fn.tooltip = function ( option ) {
321
- return this.each(function () {
322
- var $this = $(this)
323
- , data = $this.data('tooltip')
324
- , options = typeof option == 'object' && option
325
- if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
326
- if (typeof option == 'string') data[option]()
327
- })
328
- }
329
-
330
- $.fn.tooltip.Constructor = Tooltip
331
-
332
- $.fn.tooltip.defaults = {
333
- animation: true
334
- , placement: 'top'
335
- , selector: false
336
- , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
337
- , trigger: 'hover focus'
338
- , title: ''
339
- , delay: 0
340
- , html: false
341
- , container: false
342
- }
343
-
344
-
345
- /* TOOLTIP NO CONFLICT
346
- * =================== */
347
-
348
- $.fn.tooltip.noConflict = function () {
349
- $.fn.tooltip = old
350
- return this
351
- }
352
-
353
- }(window.jQuery);