bootstrap-on-rails 0.0.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +16 -7
  4. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  5. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +47 -47
  6. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  7. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  8. data/app/assets/javascripts/bootstrap/affix.js +48 -32
  9. data/app/assets/javascripts/bootstrap/alert.js +14 -20
  10. data/app/assets/javascripts/bootstrap/button.js +34 -33
  11. data/app/assets/javascripts/bootstrap/carousel.js +60 -54
  12. data/app/assets/javascripts/bootstrap/collapse.js +27 -36
  13. data/app/assets/javascripts/bootstrap/dropdown.js +36 -39
  14. data/app/assets/javascripts/bootstrap/modal.js +90 -56
  15. data/app/assets/javascripts/bootstrap/popover.js +21 -25
  16. data/app/assets/javascripts/bootstrap/scrollspy.js +56 -44
  17. data/app/assets/javascripts/bootstrap/tab.js +17 -24
  18. data/app/assets/javascripts/bootstrap/tooltip.js +158 -87
  19. data/app/assets/javascripts/bootstrap/transition.js +24 -21
  20. data/app/assets/stylesheets/bootstrap/alerts.less +4 -3
  21. data/app/assets/stylesheets/bootstrap/badges.less +27 -23
  22. data/app/assets/stylesheets/bootstrap/bootstrap.less +3 -2
  23. data/app/assets/stylesheets/bootstrap/breadcrumbs.less +4 -1
  24. data/app/assets/stylesheets/bootstrap/button-groups.less +36 -49
  25. data/app/assets/stylesheets/bootstrap/buttons.less +16 -17
  26. data/app/assets/stylesheets/bootstrap/carousel.less +18 -6
  27. data/app/assets/stylesheets/bootstrap/close.less +0 -0
  28. data/app/assets/stylesheets/bootstrap/code.less +16 -1
  29. data/app/assets/stylesheets/bootstrap/component-animations.less +6 -4
  30. data/app/assets/stylesheets/bootstrap/dropdowns.less +33 -10
  31. data/app/assets/stylesheets/bootstrap/forms.less +236 -60
  32. data/app/assets/stylesheets/bootstrap/glyphicons.less +5 -9
  33. data/app/assets/stylesheets/bootstrap/grid.less +40 -49
  34. data/app/assets/stylesheets/bootstrap/input-groups.less +51 -21
  35. data/app/assets/stylesheets/bootstrap/jumbotron.less +15 -7
  36. data/app/assets/stylesheets/bootstrap/labels.less +7 -1
  37. data/app/assets/stylesheets/bootstrap/list-group.less +47 -4
  38. data/app/assets/stylesheets/bootstrap/media.less +0 -0
  39. data/app/assets/stylesheets/bootstrap/mixins.less +35 -854
  40. data/app/assets/stylesheets/bootstrap/mixins/alerts.less +14 -0
  41. data/app/assets/stylesheets/bootstrap/mixins/background-variant.less +8 -0
  42. data/app/assets/stylesheets/bootstrap/mixins/border-radius.less +18 -0
  43. data/app/assets/stylesheets/bootstrap/mixins/buttons.less +50 -0
  44. data/app/assets/stylesheets/bootstrap/mixins/center-block.less +7 -0
  45. data/app/assets/stylesheets/bootstrap/mixins/clearfix.less +22 -0
  46. data/app/assets/stylesheets/bootstrap/mixins/forms.less +81 -0
  47. data/app/assets/stylesheets/bootstrap/mixins/gradients.less +59 -0
  48. data/app/assets/stylesheets/bootstrap/mixins/grid-framework.less +91 -0
  49. data/app/assets/stylesheets/bootstrap/mixins/grid.less +122 -0
  50. data/app/assets/stylesheets/bootstrap/mixins/hide-text.less +21 -0
  51. data/app/assets/stylesheets/bootstrap/mixins/image.less +34 -0
  52. data/app/assets/stylesheets/bootstrap/mixins/labels.less +12 -0
  53. data/app/assets/stylesheets/bootstrap/mixins/list-group.less +29 -0
  54. data/app/assets/stylesheets/bootstrap/mixins/nav-divider.less +10 -0
  55. data/app/assets/stylesheets/bootstrap/mixins/nav-vertical-align.less +9 -0
  56. data/app/assets/stylesheets/bootstrap/mixins/opacity.less +8 -0
  57. data/app/assets/stylesheets/bootstrap/mixins/pagination.less +23 -0
  58. data/app/assets/stylesheets/bootstrap/mixins/panels.less +24 -0
  59. data/app/assets/stylesheets/bootstrap/mixins/progress-bar.less +10 -0
  60. data/app/assets/stylesheets/bootstrap/mixins/reset-filter.less +8 -0
  61. data/app/assets/stylesheets/bootstrap/mixins/resize.less +6 -0
  62. data/app/assets/stylesheets/bootstrap/mixins/responsive-visibility.less +15 -0
  63. data/app/assets/stylesheets/bootstrap/mixins/size.less +10 -0
  64. data/app/assets/stylesheets/bootstrap/mixins/tab-focus.less +9 -0
  65. data/app/assets/stylesheets/bootstrap/mixins/table-row.less +28 -0
  66. data/app/assets/stylesheets/bootstrap/mixins/text-emphasis.less +8 -0
  67. data/app/assets/stylesheets/bootstrap/mixins/text-overflow.less +8 -0
  68. data/app/assets/stylesheets/bootstrap/mixins/vendor-prefixes.less +224 -0
  69. data/app/assets/stylesheets/bootstrap/modals.less +38 -20
  70. data/app/assets/stylesheets/bootstrap/navbar.less +103 -72
  71. data/app/assets/stylesheets/bootstrap/navs.less +3 -23
  72. data/app/assets/stylesheets/bootstrap/normalize.less +153 -134
  73. data/app/assets/stylesheets/bootstrap/pager.less +5 -5
  74. data/app/assets/stylesheets/bootstrap/pagination.less +6 -3
  75. data/app/assets/stylesheets/bootstrap/panels.less +117 -46
  76. data/app/assets/stylesheets/bootstrap/popovers.less +12 -12
  77. data/app/assets/stylesheets/bootstrap/print.less +0 -4
  78. data/app/assets/stylesheets/bootstrap/progress-bars.less +27 -14
  79. data/app/assets/stylesheets/bootstrap/responsive-embed.less +34 -0
  80. data/app/assets/stylesheets/bootstrap/responsive-utilities.less +109 -124
  81. data/app/assets/stylesheets/bootstrap/scaffolding.less +34 -3
  82. data/app/assets/stylesheets/bootstrap/tables.less +23 -26
  83. data/app/assets/stylesheets/bootstrap/theme.less +12 -1
  84. data/app/assets/stylesheets/bootstrap/thumbnails.less +10 -4
  85. data/app/assets/stylesheets/bootstrap/tooltip.less +1 -1
  86. data/app/assets/stylesheets/bootstrap/type.less +151 -117
  87. data/app/assets/stylesheets/bootstrap/utilities.less +1 -0
  88. data/app/assets/stylesheets/bootstrap/variables.less +399 -190
  89. data/app/assets/stylesheets/bootstrap/wells.less +1 -1
  90. data/bootstrap-on-rails.gemspec +1 -1
  91. data/lib/bootstrap-on-rails/version.rb +1 -1
  92. metadata +33 -3
@@ -1,33 +1,26 @@
1
1
  /* ========================================================================
2
- * Bootstrap: button.js v3.0.2
2
+ * Bootstrap: button.js v3.2.0
3
3
  * http://getbootstrap.com/javascript/#buttons
4
4
  * ========================================================================
5
- * Copyright 2013 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.
5
+ * Copyright 2011-2014 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
18
7
  * ======================================================================== */
19
8
 
20
9
 
21
- +function ($) { "use strict";
10
+ +function ($) {
11
+ 'use strict';
22
12
 
23
13
  // BUTTON PUBLIC CLASS DEFINITION
24
14
  // ==============================
25
15
 
26
16
  var Button = function (element, options) {
27
- this.$element = $(element)
28
- this.options = $.extend({}, Button.DEFAULTS, options)
17
+ this.$element = $(element)
18
+ this.options = $.extend({}, Button.DEFAULTS, options)
19
+ this.isLoading = false
29
20
  }
30
21
 
22
+ Button.VERSION = '3.2.0'
23
+
31
24
  Button.DEFAULTS = {
32
25
  loadingText: 'loading...'
33
26
  }
@@ -40,38 +33,43 @@
40
33
 
41
34
  state = state + 'Text'
42
35
 
43
- if (!data.resetText) $el.data('resetText', $el[val]())
36
+ if (data.resetText == null) $el.data('resetText', $el[val]())
44
37
 
45
- $el[val](data[state] || this.options[state])
38
+ $el[val](data[state] == null ? this.options[state] : data[state])
46
39
 
47
40
  // push to event loop to allow forms to submit
48
- setTimeout(function () {
49
- state == 'loadingText' ?
50
- $el.addClass(d).attr(d, d) :
51
- $el.removeClass(d).removeAttr(d);
52
- }, 0)
41
+ setTimeout($.proxy(function () {
42
+ if (state == 'loadingText') {
43
+ this.isLoading = true
44
+ $el.addClass(d).attr(d, d)
45
+ } else if (this.isLoading) {
46
+ this.isLoading = false
47
+ $el.removeClass(d).removeAttr(d)
48
+ }
49
+ }, this), 0)
53
50
  }
54
51
 
55
52
  Button.prototype.toggle = function () {
53
+ var changed = true
56
54
  var $parent = this.$element.closest('[data-toggle="buttons"]')
57
55
 
58
56
  if ($parent.length) {
59
57
  var $input = this.$element.find('input')
60
- .prop('checked', !this.$element.hasClass('active'))
61
- .trigger('change')
62
- if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
58
+ if ($input.prop('type') == 'radio') {
59
+ if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
60
+ else $parent.find('.active').removeClass('active')
61
+ }
62
+ if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
63
63
  }
64
64
 
65
- this.$element.toggleClass('active')
65
+ if (changed) this.$element.toggleClass('active')
66
66
  }
67
67
 
68
68
 
69
69
  // BUTTON PLUGIN DEFINITION
70
70
  // ========================
71
71
 
72
- var old = $.fn.button
73
-
74
- $.fn.button = function (option) {
72
+ function Plugin(option) {
75
73
  return this.each(function () {
76
74
  var $this = $(this)
77
75
  var data = $this.data('bs.button')
@@ -84,6 +82,9 @@
84
82
  })
85
83
  }
86
84
 
85
+ var old = $.fn.button
86
+
87
+ $.fn.button = Plugin
87
88
  $.fn.button.Constructor = Button
88
89
 
89
90
 
@@ -99,10 +100,10 @@
99
100
  // BUTTON DATA-API
100
101
  // ===============
101
102
 
102
- $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
103
+ $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
103
104
  var $btn = $(e.target)
104
105
  if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
105
- $btn.button('toggle')
106
+ Plugin.call($btn, 'toggle')
106
107
  e.preventDefault()
107
108
  })
108
109
 
@@ -1,30 +1,20 @@
1
1
  /* ========================================================================
2
- * Bootstrap: carousel.js v3.0.2
2
+ * Bootstrap: carousel.js v3.2.0
3
3
  * http://getbootstrap.com/javascript/#carousel
4
4
  * ========================================================================
5
- * Copyright 2013 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.
5
+ * Copyright 2011-2014 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
18
7
  * ======================================================================== */
19
8
 
20
9
 
21
- +function ($) { "use strict";
10
+ +function ($) {
11
+ 'use strict';
22
12
 
23
13
  // CAROUSEL CLASS DEFINITION
24
14
  // =========================
25
15
 
26
16
  var Carousel = function (element, options) {
27
- this.$element = $(element)
17
+ this.$element = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
28
18
  this.$indicators = this.$element.find('.carousel-indicators')
29
19
  this.options = options
30
20
  this.paused =
@@ -34,17 +24,29 @@
34
24
  this.$items = null
35
25
 
36
26
  this.options.pause == 'hover' && this.$element
37
- .on('mouseenter', $.proxy(this.pause, this))
38
- .on('mouseleave', $.proxy(this.cycle, this))
27
+ .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
28
+ .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
39
29
  }
40
30
 
31
+ Carousel.VERSION = '3.2.0'
32
+
41
33
  Carousel.DEFAULTS = {
42
- interval: 5000
43
- , pause: 'hover'
44
- , wrap: true
34
+ interval: 5000,
35
+ pause: 'hover',
36
+ wrap: true
37
+ }
38
+
39
+ Carousel.prototype.keydown = function (e) {
40
+ switch (e.which) {
41
+ case 37: this.prev(); break
42
+ case 39: this.next(); break
43
+ default: return
44
+ }
45
+
46
+ e.preventDefault()
45
47
  }
46
48
 
47
- Carousel.prototype.cycle = function (e) {
49
+ Carousel.prototype.cycle = function (e) {
48
50
  e || (this.paused = false)
49
51
 
50
52
  this.interval && clearInterval(this.interval)
@@ -56,20 +58,18 @@
56
58
  return this
57
59
  }
58
60
 
59
- Carousel.prototype.getActiveIndex = function () {
60
- this.$active = this.$element.find('.item.active')
61
- this.$items = this.$active.parent().children()
62
-
63
- return this.$items.index(this.$active)
61
+ Carousel.prototype.getItemIndex = function (item) {
62
+ this.$items = item.parent().children('.item')
63
+ return this.$items.index(item || this.$active)
64
64
  }
65
65
 
66
66
  Carousel.prototype.to = function (pos) {
67
67
  var that = this
68
- var activeIndex = this.getActiveIndex()
68
+ var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
69
69
 
70
70
  if (pos > (this.$items.length - 1) || pos < 0) return
71
71
 
72
- if (this.sliding) return this.$element.one('slid', function () { that.to(pos) })
72
+ if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
73
73
  if (activeIndex == pos) return this.pause().cycle()
74
74
 
75
75
  return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
@@ -78,7 +78,7 @@
78
78
  Carousel.prototype.pause = function (e) {
79
79
  e || (this.paused = true)
80
80
 
81
- if (this.$element.find('.next, .prev').length && $.support.transition.end) {
81
+ if (this.$element.find('.next, .prev').length && $.support.transition) {
82
82
  this.$element.trigger($.support.transition.end)
83
83
  this.cycle(true)
84
84
  }
@@ -111,44 +111,47 @@
111
111
  $next = this.$element.find('.item')[fallback]()
112
112
  }
113
113
 
114
- this.sliding = true
114
+ if ($next.hasClass('active')) return (this.sliding = false)
115
115
 
116
- isCycling && this.pause()
116
+ var relatedTarget = $next[0]
117
+ var slideEvent = $.Event('slide.bs.carousel', {
118
+ relatedTarget: relatedTarget,
119
+ direction: direction
120
+ })
121
+ this.$element.trigger(slideEvent)
122
+ if (slideEvent.isDefaultPrevented()) return
117
123
 
118
- var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
124
+ this.sliding = true
119
125
 
120
- if ($next.hasClass('active')) return
126
+ isCycling && this.pause()
121
127
 
122
128
  if (this.$indicators.length) {
123
129
  this.$indicators.find('.active').removeClass('active')
124
- this.$element.one('slid', function () {
125
- var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
126
- $nextIndicator && $nextIndicator.addClass('active')
127
- })
130
+ var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
131
+ $nextIndicator && $nextIndicator.addClass('active')
128
132
  }
129
133
 
134
+ var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
130
135
  if ($.support.transition && this.$element.hasClass('slide')) {
131
- this.$element.trigger(e)
132
- if (e.isDefaultPrevented()) return
133
136
  $next.addClass(type)
134
137
  $next[0].offsetWidth // force reflow
135
138
  $active.addClass(direction)
136
139
  $next.addClass(direction)
137
140
  $active
138
- .one($.support.transition.end, function () {
141
+ .one('bsTransitionEnd', function () {
139
142
  $next.removeClass([type, direction].join(' ')).addClass('active')
140
143
  $active.removeClass(['active', direction].join(' '))
141
144
  that.sliding = false
142
- setTimeout(function () { that.$element.trigger('slid') }, 0)
145
+ setTimeout(function () {
146
+ that.$element.trigger(slidEvent)
147
+ }, 0)
143
148
  })
144
- .emulateTransitionEnd(600)
149
+ .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
145
150
  } else {
146
- this.$element.trigger(e)
147
- if (e.isDefaultPrevented()) return
148
151
  $active.removeClass('active')
149
152
  $next.addClass('active')
150
153
  this.sliding = false
151
- this.$element.trigger('slid')
154
+ this.$element.trigger(slidEvent)
152
155
  }
153
156
 
154
157
  isCycling && this.cycle()
@@ -160,9 +163,7 @@
160
163
  // CAROUSEL PLUGIN DEFINITION
161
164
  // ==========================
162
165
 
163
- var old = $.fn.carousel
164
-
165
- $.fn.carousel = function (option) {
166
+ function Plugin(option) {
166
167
  return this.each(function () {
167
168
  var $this = $(this)
168
169
  var data = $this.data('bs.carousel')
@@ -176,6 +177,9 @@
176
177
  })
177
178
  }
178
179
 
180
+ var old = $.fn.carousel
181
+
182
+ $.fn.carousel = Plugin
179
183
  $.fn.carousel.Constructor = Carousel
180
184
 
181
185
 
@@ -192,15 +196,17 @@
192
196
  // =================
193
197
 
194
198
  $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
195
- var $this = $(this), href
196
- var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
199
+ var href
200
+ var $this = $(this)
201
+ var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
202
+ if (!$target.hasClass('carousel')) return
197
203
  var options = $.extend({}, $target.data(), $this.data())
198
204
  var slideIndex = $this.attr('data-slide-to')
199
205
  if (slideIndex) options.interval = false
200
206
 
201
- $target.carousel(options)
207
+ Plugin.call($target, options)
202
208
 
203
- if (slideIndex = $this.attr('data-slide-to')) {
209
+ if (slideIndex) {
204
210
  $target.data('bs.carousel').to(slideIndex)
205
211
  }
206
212
 
@@ -210,7 +216,7 @@
210
216
  $(window).on('load', function () {
211
217
  $('[data-ride="carousel"]').each(function () {
212
218
  var $carousel = $(this)
213
- $carousel.carousel($carousel.data())
219
+ Plugin.call($carousel, $carousel.data())
214
220
  })
215
221
  })
216
222
 
@@ -1,24 +1,14 @@
1
1
  /* ========================================================================
2
- * Bootstrap: collapse.js v3.0.2
2
+ * Bootstrap: collapse.js v3.2.0
3
3
  * http://getbootstrap.com/javascript/#collapse
4
4
  * ========================================================================
5
- * Copyright 2013 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.
5
+ * Copyright 2011-2014 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
18
7
  * ======================================================================== */
19
8
 
20
9
 
21
- +function ($) { "use strict";
10
+ +function ($) {
11
+ 'use strict';
22
12
 
23
13
  // COLLAPSE PUBLIC CLASS DEFINITION
24
14
  // ================================
@@ -32,6 +22,8 @@
32
22
  if (this.options.toggle) this.toggle()
33
23
  }
34
24
 
25
+ Collapse.VERSION = '3.2.0'
26
+
35
27
  Collapse.DEFAULTS = {
36
28
  toggle: true
37
29
  }
@@ -53,7 +45,7 @@
53
45
  if (actives && actives.length) {
54
46
  var hasData = actives.data('bs.collapse')
55
47
  if (hasData && hasData.transitioning) return
56
- actives.collapse('hide')
48
+ Plugin.call(actives, 'hide')
57
49
  hasData || actives.data('bs.collapse', null)
58
50
  }
59
51
 
@@ -61,18 +53,17 @@
61
53
 
62
54
  this.$element
63
55
  .removeClass('collapse')
64
- .addClass('collapsing')
65
- [dimension](0)
56
+ .addClass('collapsing')[dimension](0)
66
57
 
67
58
  this.transitioning = 1
68
59
 
69
60
  var complete = function () {
70
61
  this.$element
71
62
  .removeClass('collapsing')
72
- .addClass('in')
73
- [dimension]('auto')
63
+ .addClass('collapse in')[dimension]('')
74
64
  this.transitioning = 0
75
- this.$element.trigger('shown.bs.collapse')
65
+ this.$element
66
+ .trigger('shown.bs.collapse')
76
67
  }
77
68
 
78
69
  if (!$.support.transition) return complete.call(this)
@@ -80,9 +71,8 @@
80
71
  var scrollSize = $.camelCase(['scroll', dimension].join('-'))
81
72
 
82
73
  this.$element
83
- .one($.support.transition.end, $.proxy(complete, this))
84
- .emulateTransitionEnd(350)
85
- [dimension](this.$element[0][scrollSize])
74
+ .one('bsTransitionEnd', $.proxy(complete, this))
75
+ .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
86
76
  }
87
77
 
88
78
  Collapse.prototype.hide = function () {
@@ -94,9 +84,7 @@
94
84
 
95
85
  var dimension = this.dimension()
96
86
 
97
- this.$element
98
- [dimension](this.$element[dimension]())
99
- [0].offsetHeight
87
+ this.$element[dimension](this.$element[dimension]())[0].offsetHeight
100
88
 
101
89
  this.$element
102
90
  .addClass('collapsing')
@@ -117,7 +105,7 @@
117
105
 
118
106
  this.$element
119
107
  [dimension](0)
120
- .one($.support.transition.end, $.proxy(complete, this))
108
+ .one('bsTransitionEnd', $.proxy(complete, this))
121
109
  .emulateTransitionEnd(350)
122
110
  }
123
111
 
@@ -129,19 +117,21 @@
129
117
  // COLLAPSE PLUGIN DEFINITION
130
118
  // ==========================
131
119
 
132
- var old = $.fn.collapse
133
-
134
- $.fn.collapse = function (option) {
120
+ function Plugin(option) {
135
121
  return this.each(function () {
136
122
  var $this = $(this)
137
123
  var data = $this.data('bs.collapse')
138
124
  var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
139
125
 
126
+ if (!data && options.toggle && option == 'show') option = !option
140
127
  if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
141
128
  if (typeof option == 'string') data[option]()
142
129
  })
143
130
  }
144
131
 
132
+ var old = $.fn.collapse
133
+
134
+ $.fn.collapse = Plugin
145
135
  $.fn.collapse.Constructor = Collapse
146
136
 
147
137
 
@@ -157,11 +147,12 @@
157
147
  // COLLAPSE DATA-API
158
148
  // =================
159
149
 
160
- $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
161
- var $this = $(this), href
150
+ $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
151
+ var href
152
+ var $this = $(this)
162
153
  var target = $this.attr('data-target')
163
154
  || e.preventDefault()
164
- || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
155
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
165
156
  var $target = $(target)
166
157
  var data = $target.data('bs.collapse')
167
158
  var option = data ? 'toggle' : $this.data()
@@ -169,11 +160,11 @@
169
160
  var $parent = parent && $(parent)
170
161
 
171
162
  if (!data || !data.transitioning) {
172
- if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
163
+ if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
173
164
  $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
174
165
  }
175
166
 
176
- $target.collapse(option)
167
+ Plugin.call($target, option)
177
168
  })
178
169
 
179
170
  }(jQuery);