twitter-bootstrap-rails 3.2.0 → 5.0.0

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 (148) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +263 -247
  3. data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  4. data/app/assets/fonts/glyphicons-halflings-regular.svg +273 -214
  5. data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  6. data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  7. data/app/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
  8. data/app/assets/javascripts/twitter/bootstrap/affix.js +60 -35
  9. data/app/assets/javascripts/twitter/bootstrap/alert.js +15 -9
  10. data/app/assets/javascripts/twitter/bootstrap/button.js +33 -20
  11. data/app/assets/javascripts/twitter/bootstrap/carousel.js +79 -47
  12. data/app/assets/javascripts/twitter/bootstrap/collapse.js +84 -43
  13. data/app/assets/javascripts/twitter/bootstrap/dropdown.js +65 -47
  14. data/app/assets/javascripts/twitter/bootstrap/modal.js +138 -44
  15. data/app/assets/javascripts/twitter/bootstrap/popover.js +12 -14
  16. data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +57 -38
  17. data/app/assets/javascripts/twitter/bootstrap/tab.js +54 -24
  18. data/app/assets/javascripts/twitter/bootstrap/tooltip.js +202 -87
  19. data/app/assets/javascripts/twitter/bootstrap/transition.js +19 -8
  20. data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +1 -1
  21. data/app/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +1 -1
  22. data/app/helpers/bootstrap_flash_helper.rb +8 -3
  23. data/app/helpers/form_errors_helper.rb +11 -11
  24. data/app/helpers/glyph_helper.rb +7 -3
  25. data/app/helpers/modal_helper.rb +9 -13
  26. data/app/helpers/navbar_helper.rb +5 -2
  27. data/app/helpers/twitter_breadcrumbs_helper.rb +4 -1
  28. data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +5 -5
  29. data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.css +3 -4
  30. data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +7 -15
  31. data/lib/generators/bootstrap/layout/templates/layout.html.erb +5 -5
  32. data/lib/generators/bootstrap/layout/templates/layout.html.haml +3 -3
  33. data/lib/generators/bootstrap/layout/templates/layout.html.slim +3 -5
  34. data/lib/generators/bootstrap/themed/templates/_form.html.erb +12 -9
  35. data/lib/generators/bootstrap/themed/templates/_form.html.haml +7 -5
  36. data/lib/generators/bootstrap/themed/templates/_form.html.slim +8 -6
  37. data/lib/generators/bootstrap/themed/templates/edit.html.slim +1 -1
  38. data/lib/generators/bootstrap/themed/templates/index.html.erb +2 -0
  39. data/lib/generators/bootstrap/themed/templates/index.html.haml +1 -0
  40. data/lib/generators/bootstrap/themed/templates/index.html.slim +4 -3
  41. data/lib/generators/bootstrap/themed/templates/new.html.slim +1 -1
  42. data/lib/generators/bootstrap/themed/templates/show.html.slim +1 -1
  43. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +1 -1
  44. data/lib/twitter/bootstrap/rails/breadcrumbs.rb +24 -13
  45. data/lib/twitter/bootstrap/rails/engine.rb +17 -12
  46. data/lib/twitter/bootstrap/rails/version.rb +1 -1
  47. data/spec/lib/breadcrumbs_spec.rb +42 -17
  48. data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +10 -4
  49. data/spec/lib/twitter_bootstrap_rails/bootstrap_flash_helper_spec.rb +128 -0
  50. data/spec/lib/twitter_bootstrap_rails/form_errors_helper_spec.rb +148 -0
  51. data/spec/lib/twitter_bootstrap_rails/glyph_helper_spec.rb +24 -0
  52. data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +2 -2
  53. data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +62 -12
  54. data/spec/spec_helper.rb +5 -1
  55. data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +1 -3
  56. data/vendor/toolkit/twitter/bootstrap/alerts.less +5 -0
  57. data/vendor/toolkit/twitter/bootstrap/badges.less +14 -3
  58. data/vendor/toolkit/twitter/bootstrap/bootstrap.less +6 -1
  59. data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +0 -0
  60. data/vendor/toolkit/twitter/bootstrap/button-groups.less +13 -14
  61. data/vendor/toolkit/twitter/bootstrap/buttons.less +14 -7
  62. data/vendor/toolkit/twitter/bootstrap/carousel.less +34 -7
  63. data/vendor/toolkit/twitter/bootstrap/close.less +1 -0
  64. data/vendor/toolkit/twitter/bootstrap/code.less +0 -0
  65. data/vendor/toolkit/twitter/bootstrap/component-animations.less +3 -1
  66. data/vendor/toolkit/twitter/bootstrap/dropdowns.less +9 -8
  67. data/vendor/toolkit/twitter/bootstrap/forms.less +110 -41
  68. data/vendor/toolkit/twitter/bootstrap/glyphicons.less +75 -3
  69. data/vendor/toolkit/twitter/bootstrap/grid.less +0 -0
  70. data/vendor/toolkit/twitter/bootstrap/input-groups.less +8 -3
  71. data/vendor/toolkit/twitter/bootstrap/jumbotron.less +10 -4
  72. data/vendor/toolkit/twitter/bootstrap/labels.less +0 -0
  73. data/vendor/toolkit/twitter/bootstrap/list-group.less +11 -13
  74. data/vendor/toolkit/twitter/bootstrap/media.less +40 -30
  75. data/vendor/toolkit/twitter/bootstrap/mixins/alerts.less +0 -0
  76. data/vendor/toolkit/twitter/bootstrap/mixins/background-variant.less +2 -1
  77. data/vendor/toolkit/twitter/bootstrap/mixins/border-radius.less +0 -0
  78. data/vendor/toolkit/twitter/bootstrap/mixins/buttons.less +19 -6
  79. data/vendor/toolkit/twitter/bootstrap/mixins/center-block.less +0 -0
  80. data/vendor/toolkit/twitter/bootstrap/mixins/clearfix.less +0 -0
  81. data/vendor/toolkit/twitter/bootstrap/mixins/forms.less +0 -0
  82. data/vendor/toolkit/twitter/bootstrap/mixins/gradients.less +0 -0
  83. data/vendor/toolkit/twitter/bootstrap/mixins/grid-framework.less +4 -4
  84. data/vendor/toolkit/twitter/bootstrap/mixins/grid.less +4 -4
  85. data/vendor/toolkit/twitter/bootstrap/mixins/hide-text.less +2 -2
  86. data/vendor/toolkit/twitter/bootstrap/mixins/image.less +0 -0
  87. data/vendor/toolkit/twitter/bootstrap/mixins/labels.less +1 -1
  88. data/vendor/toolkit/twitter/bootstrap/mixins/list-group.less +2 -1
  89. data/vendor/toolkit/twitter/bootstrap/mixins/nav-divider.less +0 -0
  90. data/vendor/toolkit/twitter/bootstrap/mixins/nav-vertical-align.less +0 -0
  91. data/vendor/toolkit/twitter/bootstrap/mixins/opacity.less +0 -0
  92. data/vendor/toolkit/twitter/bootstrap/mixins/pagination.less +2 -1
  93. data/vendor/toolkit/twitter/bootstrap/mixins/panels.less +0 -0
  94. data/vendor/toolkit/twitter/bootstrap/mixins/progress-bar.less +0 -0
  95. data/vendor/toolkit/twitter/bootstrap/mixins/reset-filter.less +0 -0
  96. data/vendor/toolkit/twitter/bootstrap/mixins/reset-text.less +18 -0
  97. data/vendor/toolkit/twitter/bootstrap/mixins/resize.less +0 -0
  98. data/vendor/toolkit/twitter/bootstrap/mixins/responsive-visibility.less +1 -1
  99. data/vendor/toolkit/twitter/bootstrap/mixins/size.less +0 -0
  100. data/vendor/toolkit/twitter/bootstrap/mixins/tab-focus.less +0 -0
  101. data/vendor/toolkit/twitter/bootstrap/mixins/table-row.less +0 -0
  102. data/vendor/toolkit/twitter/bootstrap/mixins/text-emphasis.less +2 -1
  103. data/vendor/toolkit/twitter/bootstrap/mixins/text-overflow.less +0 -0
  104. data/vendor/toolkit/twitter/bootstrap/mixins/vendor-prefixes.less +8 -5
  105. data/vendor/toolkit/twitter/bootstrap/mixins.less +1 -0
  106. data/vendor/toolkit/twitter/bootstrap/modals.less +3 -3
  107. data/vendor/toolkit/twitter/bootstrap/navbar.less +6 -1
  108. data/vendor/toolkit/twitter/bootstrap/navs.less +1 -1
  109. data/vendor/toolkit/twitter/bootstrap/normalize.less +12 -13
  110. data/vendor/toolkit/twitter/bootstrap/pager.less +1 -2
  111. data/vendor/toolkit/twitter/bootstrap/pagination.less +5 -4
  112. data/vendor/toolkit/twitter/bootstrap/panels.less +27 -4
  113. data/vendor/toolkit/twitter/bootstrap/popovers.less +5 -7
  114. data/vendor/toolkit/twitter/bootstrap/print.less +96 -96
  115. data/vendor/toolkit/twitter/bootstrap/progress-bars.less +1 -14
  116. data/vendor/toolkit/twitter/bootstrap/responsive-embed.less +10 -9
  117. data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +0 -0
  118. data/vendor/toolkit/twitter/bootstrap/scaffolding.less +12 -1
  119. data/vendor/toolkit/twitter/bootstrap/tables.less +6 -5
  120. data/vendor/toolkit/twitter/bootstrap/theme.less +47 -16
  121. data/vendor/toolkit/twitter/bootstrap/thumbnails.less +1 -1
  122. data/vendor/toolkit/twitter/bootstrap/tooltip.less +13 -7
  123. data/vendor/toolkit/twitter/bootstrap/type.less +2 -8
  124. data/vendor/toolkit/twitter/bootstrap/utilities.less +0 -1
  125. data/vendor/toolkit/twitter/bootstrap/variables.less +36 -14
  126. data/vendor/toolkit/twitter/bootstrap/wells.less +0 -0
  127. metadata +76 -52
  128. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  129. data/app/assets/fonts/fontawesome-webfont.svg +0 -504
  130. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  131. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  132. data/app/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  133. data/app/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  134. data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +0 -4
  135. data/vendor/static-source/fontawesome.less +0 -8
  136. data/vendor/toolkit/fontawesome/bordered-pulled.less +0 -16
  137. data/vendor/toolkit/fontawesome/core.less +0 -12
  138. data/vendor/toolkit/fontawesome/fixed-width.less +0 -6
  139. data/vendor/toolkit/fontawesome/font-awesome.less +0 -17
  140. data/vendor/toolkit/fontawesome/icons.less +0 -506
  141. data/vendor/toolkit/fontawesome/larger.less +0 -13
  142. data/vendor/toolkit/fontawesome/list.less +0 -19
  143. data/vendor/toolkit/fontawesome/mixins.less +0 -20
  144. data/vendor/toolkit/fontawesome/path.less +0 -14
  145. data/vendor/toolkit/fontawesome/rotated-flipped.less +0 -9
  146. data/vendor/toolkit/fontawesome/spinning.less +0 -32
  147. data/vendor/toolkit/fontawesome/stacked.less +0 -20
  148. data/vendor/toolkit/fontawesome/variables.less +0 -515
@@ -1,8 +1,8 @@
1
1
  /* ========================================================================
2
- * Bootstrap: affix.js v3.1.1
2
+ * Bootstrap: affix.js v3.3.6
3
3
  * http://getbootstrap.com/javascript/#affix
4
4
  * ========================================================================
5
- * Copyright 2011-2014 Twitter, Inc.
5
+ * Copyright 2011-2015 Twitter, Inc.
6
6
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
7
  * ======================================================================== */
8
8
 
@@ -15,28 +15,54 @@
15
15
 
16
16
  var Affix = function (element, options) {
17
17
  this.options = $.extend({}, Affix.DEFAULTS, options)
18
- this.$window = $(window)
18
+
19
+ this.$target = $(this.options.target)
19
20
  .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
20
21
  .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
21
22
 
22
23
  this.$element = $(element)
23
- this.affixed =
24
- this.unpin =
24
+ this.affixed = null
25
+ this.unpin = null
25
26
  this.pinnedOffset = null
26
27
 
27
28
  this.checkPosition()
28
29
  }
29
30
 
30
- Affix.RESET = 'affix affix-top affix-bottom'
31
+ Affix.VERSION = '3.3.6'
32
+
33
+ Affix.RESET = 'affix affix-top affix-bottom'
31
34
 
32
35
  Affix.DEFAULTS = {
33
- offset: 0
36
+ offset: 0,
37
+ target: window
38
+ }
39
+
40
+ Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
41
+ var scrollTop = this.$target.scrollTop()
42
+ var position = this.$element.offset()
43
+ var targetHeight = this.$target.height()
44
+
45
+ if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
46
+
47
+ if (this.affixed == 'bottom') {
48
+ if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
49
+ return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
50
+ }
51
+
52
+ var initializing = this.affixed == null
53
+ var colliderTop = initializing ? scrollTop : position.top
54
+ var colliderHeight = initializing ? targetHeight : height
55
+
56
+ if (offsetTop != null && scrollTop <= offsetTop) return 'top'
57
+ if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
58
+
59
+ return false
34
60
  }
35
61
 
36
62
  Affix.prototype.getPinnedOffset = function () {
37
63
  if (this.pinnedOffset) return this.pinnedOffset
38
64
  this.$element.removeClass(Affix.RESET).addClass('affix')
39
- var scrollTop = this.$window.scrollTop()
65
+ var scrollTop = this.$target.scrollTop()
40
66
  var position = this.$element.offset()
41
67
  return (this.pinnedOffset = position.top - scrollTop)
42
68
  }
@@ -48,43 +74,41 @@
48
74
  Affix.prototype.checkPosition = function () {
49
75
  if (!this.$element.is(':visible')) return
50
76
 
51
- var scrollHeight = $(document).height()
52
- var scrollTop = this.$window.scrollTop()
53
- var position = this.$element.offset()
77
+ var height = this.$element.height()
54
78
  var offset = this.options.offset
55
79
  var offsetTop = offset.top
56
80
  var offsetBottom = offset.bottom
57
-
58
- if (this.affixed == 'top') position.top += scrollTop
81
+ var scrollHeight = Math.max($(document).height(), $(document.body).height())
59
82
 
60
83
  if (typeof offset != 'object') offsetBottom = offsetTop = offset
61
84
  if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
62
85
  if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
63
86
 
64
- var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
65
- offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
66
- offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
87
+ var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
67
88
 
68
- if (this.affixed === affix) return
69
- if (this.unpin) this.$element.css('top', '')
89
+ if (this.affixed != affix) {
90
+ if (this.unpin != null) this.$element.css('top', '')
70
91
 
71
- var affixType = 'affix' + (affix ? '-' + affix : '')
72
- var e = $.Event(affixType + '.bs.affix')
92
+ var affixType = 'affix' + (affix ? '-' + affix : '')
93
+ var e = $.Event(affixType + '.bs.affix')
73
94
 
74
- this.$element.trigger(e)
95
+ this.$element.trigger(e)
75
96
 
76
- if (e.isDefaultPrevented()) return
97
+ if (e.isDefaultPrevented()) return
77
98
 
78
- this.affixed = affix
79
- this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
99
+ this.affixed = affix
100
+ this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
80
101
 
81
- this.$element
82
- .removeClass(Affix.RESET)
83
- .addClass(affixType)
84
- .trigger($.Event(affixType.replace('affix', 'affixed')))
102
+ this.$element
103
+ .removeClass(Affix.RESET)
104
+ .addClass(affixType)
105
+ .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
106
+ }
85
107
 
86
108
  if (affix == 'bottom') {
87
- this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
109
+ this.$element.offset({
110
+ top: scrollHeight - height - offsetBottom
111
+ })
88
112
  }
89
113
  }
90
114
 
@@ -92,9 +116,7 @@
92
116
  // AFFIX PLUGIN DEFINITION
93
117
  // =======================
94
118
 
95
- var old = $.fn.affix
96
-
97
- $.fn.affix = function (option) {
119
+ function Plugin(option) {
98
120
  return this.each(function () {
99
121
  var $this = $(this)
100
122
  var data = $this.data('bs.affix')
@@ -105,6 +127,9 @@
105
127
  })
106
128
  }
107
129
 
130
+ var old = $.fn.affix
131
+
132
+ $.fn.affix = Plugin
108
133
  $.fn.affix.Constructor = Affix
109
134
 
110
135
 
@@ -127,10 +152,10 @@
127
152
 
128
153
  data.offset = data.offset || {}
129
154
 
130
- if (data.offsetBottom) data.offset.bottom = data.offsetBottom
131
- if (data.offsetTop) data.offset.top = data.offsetTop
155
+ if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
156
+ if (data.offsetTop != null) data.offset.top = data.offsetTop
132
157
 
133
- $spy.affix(data)
158
+ Plugin.call($spy, data)
134
159
  })
135
160
  })
136
161
 
@@ -1,8 +1,8 @@
1
1
  /* ========================================================================
2
- * Bootstrap: alert.js v3.1.1
2
+ * Bootstrap: alert.js v3.3.6
3
3
  * http://getbootstrap.com/javascript/#alerts
4
4
  * ========================================================================
5
- * Copyright 2011-2014 Twitter, Inc.
5
+ * Copyright 2011-2015 Twitter, Inc.
6
6
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
7
  * ======================================================================== */
8
8
 
@@ -18,6 +18,10 @@
18
18
  $(el).on('click', dismiss, this.close)
19
19
  }
20
20
 
21
+ Alert.VERSION = '3.3.6'
22
+
23
+ Alert.TRANSITION_DURATION = 150
24
+
21
25
  Alert.prototype.close = function (e) {
22
26
  var $this = $(this)
23
27
  var selector = $this.attr('data-target')
@@ -32,7 +36,7 @@
32
36
  if (e) e.preventDefault()
33
37
 
34
38
  if (!$parent.length) {
35
- $parent = $this.hasClass('alert') ? $this : $this.parent()
39
+ $parent = $this.closest('.alert')
36
40
  }
37
41
 
38
42
  $parent.trigger(e = $.Event('close.bs.alert'))
@@ -42,13 +46,14 @@
42
46
  $parent.removeClass('in')
43
47
 
44
48
  function removeElement() {
45
- $parent.trigger('closed.bs.alert').remove()
49
+ // detach from parent, fire event then clean up data
50
+ $parent.detach().trigger('closed.bs.alert').remove()
46
51
  }
47
52
 
48
53
  $.support.transition && $parent.hasClass('fade') ?
49
54
  $parent
50
- .one($.support.transition.end, removeElement)
51
- .emulateTransitionEnd(150) :
55
+ .one('bsTransitionEnd', removeElement)
56
+ .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
52
57
  removeElement()
53
58
  }
54
59
 
@@ -56,9 +61,7 @@
56
61
  // ALERT PLUGIN DEFINITION
57
62
  // =======================
58
63
 
59
- var old = $.fn.alert
60
-
61
- $.fn.alert = function (option) {
64
+ function Plugin(option) {
62
65
  return this.each(function () {
63
66
  var $this = $(this)
64
67
  var data = $this.data('bs.alert')
@@ -68,6 +71,9 @@
68
71
  })
69
72
  }
70
73
 
74
+ var old = $.fn.alert
75
+
76
+ $.fn.alert = Plugin
71
77
  $.fn.alert.Constructor = Alert
72
78
 
73
79
 
@@ -1,8 +1,8 @@
1
1
  /* ========================================================================
2
- * Bootstrap: button.js v3.1.1
2
+ * Bootstrap: button.js v3.3.6
3
3
  * http://getbootstrap.com/javascript/#buttons
4
4
  * ========================================================================
5
- * Copyright 2011-2014 Twitter, Inc.
5
+ * Copyright 2011-2015 Twitter, Inc.
6
6
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
7
  * ======================================================================== */
8
8
 
@@ -19,6 +19,8 @@
19
19
  this.isLoading = false
20
20
  }
21
21
 
22
+ Button.VERSION = '3.3.6'
23
+
22
24
  Button.DEFAULTS = {
23
25
  loadingText: 'loading...'
24
26
  }
@@ -29,14 +31,14 @@
29
31
  var val = $el.is('input') ? 'val' : 'html'
30
32
  var data = $el.data()
31
33
 
32
- state = state + 'Text'
33
-
34
- if (!data.resetText) $el.data('resetText', $el[val]())
34
+ state += 'Text'
35
35
 
36
- $el[val](data[state] || this.options[state])
36
+ if (data.resetText == null) $el.data('resetText', $el[val]())
37
37
 
38
38
  // push to event loop to allow forms to submit
39
39
  setTimeout($.proxy(function () {
40
+ $el[val](data[state] == null ? this.options[state] : data[state])
41
+
40
42
  if (state == 'loadingText') {
41
43
  this.isLoading = true
42
44
  $el.addClass(d).attr(d, d)
@@ -54,22 +56,26 @@
54
56
  if ($parent.length) {
55
57
  var $input = this.$element.find('input')
56
58
  if ($input.prop('type') == 'radio') {
57
- if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
58
- else $parent.find('.active').removeClass('active')
59
+ if ($input.prop('checked')) changed = false
60
+ $parent.find('.active').removeClass('active')
61
+ this.$element.addClass('active')
62
+ } else if ($input.prop('type') == 'checkbox') {
63
+ if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
64
+ this.$element.toggleClass('active')
59
65
  }
60
- if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
66
+ $input.prop('checked', this.$element.hasClass('active'))
67
+ if (changed) $input.trigger('change')
68
+ } else {
69
+ this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
70
+ this.$element.toggleClass('active')
61
71
  }
62
-
63
- if (changed) this.$element.toggleClass('active')
64
72
  }
65
73
 
66
74
 
67
75
  // BUTTON PLUGIN DEFINITION
68
76
  // ========================
69
77
 
70
- var old = $.fn.button
71
-
72
- $.fn.button = function (option) {
78
+ function Plugin(option) {
73
79
  return this.each(function () {
74
80
  var $this = $(this)
75
81
  var data = $this.data('bs.button')
@@ -82,6 +88,9 @@
82
88
  })
83
89
  }
84
90
 
91
+ var old = $.fn.button
92
+
93
+ $.fn.button = Plugin
85
94
  $.fn.button.Constructor = Button
86
95
 
87
96
 
@@ -97,11 +106,15 @@
97
106
  // BUTTON DATA-API
98
107
  // ===============
99
108
 
100
- $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
101
- var $btn = $(e.target)
102
- if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
103
- $btn.button('toggle')
104
- e.preventDefault()
105
- })
109
+ $(document)
110
+ .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
111
+ var $btn = $(e.target)
112
+ if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
113
+ Plugin.call($btn, 'toggle')
114
+ if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault()
115
+ })
116
+ .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
117
+ $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
118
+ })
106
119
 
107
120
  }(jQuery);
@@ -1,8 +1,8 @@
1
1
  /* ========================================================================
2
- * Bootstrap: carousel.js v3.1.1
2
+ * Bootstrap: carousel.js v3.3.6
3
3
  * http://getbootstrap.com/javascript/#carousel
4
4
  * ========================================================================
5
- * Copyright 2011-2014 Twitter, Inc.
5
+ * Copyright 2011-2015 Twitter, Inc.
6
6
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
7
  * ======================================================================== */
8
8
 
@@ -17,24 +17,42 @@
17
17
  this.$element = $(element)
18
18
  this.$indicators = this.$element.find('.carousel-indicators')
19
19
  this.options = options
20
- this.paused =
21
- this.sliding =
22
- this.interval =
23
- this.$active =
20
+ this.paused = null
21
+ this.sliding = null
22
+ this.interval = null
23
+ this.$active = null
24
24
  this.$items = null
25
25
 
26
- this.options.pause == 'hover' && this.$element
27
- .on('mouseenter', $.proxy(this.pause, this))
28
- .on('mouseleave', $.proxy(this.cycle, this))
26
+ this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
27
+
28
+ this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
29
+ .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
30
+ .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
29
31
  }
30
32
 
33
+ Carousel.VERSION = '3.3.6'
34
+
35
+ Carousel.TRANSITION_DURATION = 600
36
+
31
37
  Carousel.DEFAULTS = {
32
38
  interval: 5000,
33
39
  pause: 'hover',
34
- wrap: true
40
+ wrap: true,
41
+ keyboard: true
42
+ }
43
+
44
+ Carousel.prototype.keydown = function (e) {
45
+ if (/input|textarea/i.test(e.target.tagName)) return
46
+ switch (e.which) {
47
+ case 37: this.prev(); break
48
+ case 39: this.next(); break
49
+ default: return
50
+ }
51
+
52
+ e.preventDefault()
35
53
  }
36
54
 
37
- Carousel.prototype.cycle = function (e) {
55
+ Carousel.prototype.cycle = function (e) {
38
56
  e || (this.paused = false)
39
57
 
40
58
  this.interval && clearInterval(this.interval)
@@ -46,23 +64,31 @@
46
64
  return this
47
65
  }
48
66
 
49
- Carousel.prototype.getActiveIndex = function () {
50
- this.$active = this.$element.find('.item.active')
51
- this.$items = this.$active.parent().children()
67
+ Carousel.prototype.getItemIndex = function (item) {
68
+ this.$items = item.parent().children('.item')
69
+ return this.$items.index(item || this.$active)
70
+ }
52
71
 
53
- return this.$items.index(this.$active)
72
+ Carousel.prototype.getItemForDirection = function (direction, active) {
73
+ var activeIndex = this.getItemIndex(active)
74
+ var willWrap = (direction == 'prev' && activeIndex === 0)
75
+ || (direction == 'next' && activeIndex == (this.$items.length - 1))
76
+ if (willWrap && !this.options.wrap) return active
77
+ var delta = direction == 'prev' ? -1 : 1
78
+ var itemIndex = (activeIndex + delta) % this.$items.length
79
+ return this.$items.eq(itemIndex)
54
80
  }
55
81
 
56
82
  Carousel.prototype.to = function (pos) {
57
83
  var that = this
58
- var activeIndex = this.getActiveIndex()
84
+ var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
59
85
 
60
86
  if (pos > (this.$items.length - 1) || pos < 0) return
61
87
 
62
- if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
88
+ if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
63
89
  if (activeIndex == pos) return this.pause().cycle()
64
90
 
65
- return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
91
+ return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
66
92
  }
67
93
 
68
94
  Carousel.prototype.pause = function (e) {
@@ -90,22 +116,20 @@
90
116
 
91
117
  Carousel.prototype.slide = function (type, next) {
92
118
  var $active = this.$element.find('.item.active')
93
- var $next = next || $active[type]()
119
+ var $next = next || this.getItemForDirection(type, $active)
94
120
  var isCycling = this.interval
95
121
  var direction = type == 'next' ? 'left' : 'right'
96
- var fallback = type == 'next' ? 'first' : 'last'
97
122
  var that = this
98
123
 
99
- if (!$next.length) {
100
- if (!this.options.wrap) return
101
- $next = this.$element.find('.item')[fallback]()
102
- }
124
+ if ($next.hasClass('active')) return (this.sliding = false)
103
125
 
104
- if ($next.hasClass('active')) return this.sliding = false
105
-
106
- var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
107
- this.$element.trigger(e)
108
- if (e.isDefaultPrevented()) return
126
+ var relatedTarget = $next[0]
127
+ var slideEvent = $.Event('slide.bs.carousel', {
128
+ relatedTarget: relatedTarget,
129
+ direction: direction
130
+ })
131
+ this.$element.trigger(slideEvent)
132
+ if (slideEvent.isDefaultPrevented()) return
109
133
 
110
134
  this.sliding = true
111
135
 
@@ -113,30 +137,31 @@
113
137
 
114
138
  if (this.$indicators.length) {
115
139
  this.$indicators.find('.active').removeClass('active')
116
- this.$element.one('slid.bs.carousel', function () {
117
- var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
118
- $nextIndicator && $nextIndicator.addClass('active')
119
- })
140
+ var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
141
+ $nextIndicator && $nextIndicator.addClass('active')
120
142
  }
121
143
 
144
+ var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
122
145
  if ($.support.transition && this.$element.hasClass('slide')) {
123
146
  $next.addClass(type)
124
147
  $next[0].offsetWidth // force reflow
125
148
  $active.addClass(direction)
126
149
  $next.addClass(direction)
127
150
  $active
128
- .one($.support.transition.end, function () {
151
+ .one('bsTransitionEnd', function () {
129
152
  $next.removeClass([type, direction].join(' ')).addClass('active')
130
153
  $active.removeClass(['active', direction].join(' '))
131
154
  that.sliding = false
132
- setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
155
+ setTimeout(function () {
156
+ that.$element.trigger(slidEvent)
157
+ }, 0)
133
158
  })
134
- .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
159
+ .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
135
160
  } else {
136
161
  $active.removeClass('active')
137
162
  $next.addClass('active')
138
163
  this.sliding = false
139
- this.$element.trigger('slid.bs.carousel')
164
+ this.$element.trigger(slidEvent)
140
165
  }
141
166
 
142
167
  isCycling && this.cycle()
@@ -148,9 +173,7 @@
148
173
  // CAROUSEL PLUGIN DEFINITION
149
174
  // ==========================
150
175
 
151
- var old = $.fn.carousel
152
-
153
- $.fn.carousel = function (option) {
176
+ function Plugin(option) {
154
177
  return this.each(function () {
155
178
  var $this = $(this)
156
179
  var data = $this.data('bs.carousel')
@@ -164,6 +187,9 @@
164
187
  })
165
188
  }
166
189
 
190
+ var old = $.fn.carousel
191
+
192
+ $.fn.carousel = Plugin
167
193
  $.fn.carousel.Constructor = Carousel
168
194
 
169
195
 
@@ -179,26 +205,32 @@
179
205
  // CAROUSEL DATA-API
180
206
  // =================
181
207
 
182
- $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
183
- var $this = $(this), href
184
- var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
208
+ var clickHandler = function (e) {
209
+ var href
210
+ var $this = $(this)
211
+ var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
212
+ if (!$target.hasClass('carousel')) return
185
213
  var options = $.extend({}, $target.data(), $this.data())
186
214
  var slideIndex = $this.attr('data-slide-to')
187
215
  if (slideIndex) options.interval = false
188
216
 
189
- $target.carousel(options)
217
+ Plugin.call($target, options)
190
218
 
191
- if (slideIndex = $this.attr('data-slide-to')) {
219
+ if (slideIndex) {
192
220
  $target.data('bs.carousel').to(slideIndex)
193
221
  }
194
222
 
195
223
  e.preventDefault()
196
- })
224
+ }
225
+
226
+ $(document)
227
+ .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
228
+ .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
197
229
 
198
230
  $(window).on('load', function () {
199
231
  $('[data-ride="carousel"]').each(function () {
200
232
  var $carousel = $(this)
201
- $carousel.carousel($carousel.data())
233
+ Plugin.call($carousel, $carousel.data())
202
234
  })
203
235
  })
204
236