bootstrap-generators 3.2.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -3
  3. data/Rakefile +9 -18
  4. data/lib/bootstrap/generators/version.rb +1 -1
  5. data/lib/generators/bootstrap/install/templates/assets/stylesheets/bootstrap-variables.less +31 -21
  6. data/lib/generators/bootstrap/install/templates/assets/stylesheets/bootstrap-variables.scss +38 -24
  7. data/lib/generators/bootstrap/install/templates/assets/stylesheets/starter.scss +2 -1
  8. data/lib/generators/bootstrap/install/templates/form_builders/form_builder/_form.html.erb +3 -3
  9. data/lib/generators/bootstrap/install/templates/form_builders/form_builder/_form.html.haml +5 -3
  10. data/lib/generators/bootstrap/install/templates/form_builders/form_builder/_form.html.slim +7 -4
  11. data/lib/generators/bootstrap/install/templates/layouts/starter.html.erb +10 -9
  12. data/lib/generators/bootstrap/install/templates/layouts/starter.html.haml +12 -9
  13. data/lib/generators/bootstrap/install/templates/layouts/starter.html.slim +15 -11
  14. data/readme-template.md.erb +3 -1
  15. data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +1 -1
  16. data/vendor/assets/javascripts/bootstrap/affix.js +43 -23
  17. data/vendor/assets/javascripts/bootstrap/alert.js +6 -4
  18. data/vendor/assets/javascripts/bootstrap/button.js +16 -10
  19. data/vendor/assets/javascripts/bootstrap/carousel.js +27 -10
  20. data/vendor/assets/javascripts/bootstrap/collapse.js +69 -28
  21. data/vendor/assets/javascripts/bootstrap/dropdown.js +20 -10
  22. data/vendor/assets/javascripts/bootstrap/modal.js +67 -23
  23. data/vendor/assets/javascripts/bootstrap/popover.js +13 -7
  24. data/vendor/assets/javascripts/bootstrap/scrollspy.js +12 -7
  25. data/vendor/assets/javascripts/bootstrap/tab.js +41 -16
  26. data/vendor/assets/javascripts/bootstrap/tooltip.js +60 -39
  27. data/vendor/assets/javascripts/bootstrap/transition.js +1 -1
  28. data/vendor/assets/stylesheets/bootstrap.css.erb +332 -203
  29. data/vendor/assets/stylesheets/bootstrap.css.map +1 -0
  30. data/vendor/twitter/bootstrap/less/badges.less +7 -1
  31. data/vendor/twitter/bootstrap/less/button-groups.less +16 -13
  32. data/vendor/twitter/bootstrap/less/buttons.less +7 -4
  33. data/vendor/twitter/bootstrap/less/carousel.less +24 -0
  34. data/vendor/twitter/bootstrap/less/code.less +1 -0
  35. data/vendor/twitter/bootstrap/less/component-animations.less +5 -2
  36. data/vendor/twitter/bootstrap/less/dropdowns.less +3 -5
  37. data/vendor/twitter/bootstrap/less/forms.less +46 -40
  38. data/vendor/twitter/bootstrap/less/glyphicons.less +2 -1
  39. data/vendor/twitter/bootstrap/less/jumbotron.less +6 -5
  40. data/vendor/twitter/bootstrap/less/list-group.less +1 -8
  41. data/vendor/twitter/bootstrap/less/media.less +27 -36
  42. data/vendor/twitter/bootstrap/less/mixins/buttons.less +2 -0
  43. data/vendor/twitter/bootstrap/less/mixins/forms.less +5 -1
  44. data/vendor/twitter/bootstrap/less/mixins/grid-framework.less +2 -2
  45. data/vendor/twitter/bootstrap/less/mixins/image.less +0 -1
  46. data/vendor/twitter/bootstrap/less/mixins/labels.less +1 -1
  47. data/vendor/twitter/bootstrap/less/mixins/vendor-prefixes.less +6 -3
  48. data/vendor/twitter/bootstrap/less/modals.less +3 -5
  49. data/vendor/twitter/bootstrap/less/navbar.less +30 -25
  50. data/vendor/twitter/bootstrap/less/navs.less +3 -1
  51. data/vendor/twitter/bootstrap/less/normalize.less +5 -3
  52. data/vendor/twitter/bootstrap/less/pager.less +1 -2
  53. data/vendor/twitter/bootstrap/less/pagination.less +1 -1
  54. data/vendor/twitter/bootstrap/less/panels.less +21 -3
  55. data/vendor/twitter/bootstrap/less/popovers.less +6 -4
  56. data/vendor/twitter/bootstrap/less/print.less +102 -96
  57. data/vendor/twitter/bootstrap/less/progress-bars.less +1 -19
  58. data/vendor/twitter/bootstrap/less/responsive-embed.less +2 -1
  59. data/vendor/twitter/bootstrap/less/scaffolding.less +1 -1
  60. data/vendor/twitter/bootstrap/less/tables.less +11 -10
  61. data/vendor/twitter/bootstrap/less/theme.less +23 -9
  62. data/vendor/twitter/bootstrap/less/thumbnails.less +1 -1
  63. data/vendor/twitter/bootstrap/less/tooltip.less +12 -4
  64. data/vendor/twitter/bootstrap/less/type.less +0 -11
  65. data/vendor/twitter/bootstrap/less/utilities.less +0 -1
  66. data/vendor/twitter/bootstrap/less/variables.less +31 -21
  67. data/vendor/twitter/bootstrap/sass/_bootstrap-compass.scss +7 -0
  68. data/vendor/twitter/bootstrap/sass/_bootstrap-mincer.scss +17 -0
  69. data/vendor/twitter/bootstrap/sass/_bootstrap-sprockets.scss +7 -0
  70. data/vendor/twitter/bootstrap/sass/_bootstrap.scss +50 -0
  71. data/vendor/twitter/bootstrap/sass/{_alerts.scss → bootstrap/_alerts.scss} +0 -0
  72. data/vendor/twitter/bootstrap/sass/{_badges.scss → bootstrap/_badges.scss} +7 -1
  73. data/vendor/twitter/bootstrap/sass/{_breadcrumbs.scss → bootstrap/_breadcrumbs.scss} +0 -0
  74. data/vendor/twitter/bootstrap/sass/{_button-groups.scss → bootstrap/_button-groups.scss} +18 -15
  75. data/vendor/twitter/bootstrap/sass/{_buttons.scss → bootstrap/_buttons.scss} +8 -5
  76. data/vendor/twitter/bootstrap/sass/{_carousel.scss → bootstrap/_carousel.scss} +25 -1
  77. data/vendor/twitter/bootstrap/sass/{_close.scss → bootstrap/_close.scss} +0 -0
  78. data/vendor/twitter/bootstrap/sass/{_code.scss → bootstrap/_code.scss} +1 -0
  79. data/vendor/twitter/bootstrap/sass/{_component-animations.scss → bootstrap/_component-animations.scss} +5 -2
  80. data/vendor/twitter/bootstrap/sass/{_dropdowns.scss → bootstrap/_dropdowns.scss} +4 -6
  81. data/vendor/twitter/bootstrap/sass/{_forms.scss → bootstrap/_forms.scss} +53 -43
  82. data/vendor/twitter/bootstrap/sass/{_glyphicons.scss → bootstrap/_glyphicons.scss} +7 -10
  83. data/vendor/twitter/bootstrap/sass/{_grid.scss → bootstrap/_grid.scss} +4 -4
  84. data/vendor/twitter/bootstrap/sass/{_input-groups.scss → bootstrap/_input-groups.scss} +0 -0
  85. data/vendor/twitter/bootstrap/sass/{_jumbotron.scss → bootstrap/_jumbotron.scss} +6 -5
  86. data/vendor/twitter/bootstrap/sass/{_labels.scss → bootstrap/_labels.scss} +0 -0
  87. data/vendor/twitter/bootstrap/sass/{_list-group.scss → bootstrap/_list-group.scss} +1 -8
  88. data/vendor/twitter/bootstrap/sass/bootstrap/_media.scss +47 -0
  89. data/vendor/twitter/bootstrap/sass/{_mixins.scss → bootstrap/_mixins.scss} +0 -0
  90. data/vendor/twitter/bootstrap/sass/{_modals.scss → bootstrap/_modals.scss} +4 -6
  91. data/vendor/twitter/bootstrap/sass/{_navbar.scss → bootstrap/_navbar.scss} +36 -33
  92. data/vendor/twitter/bootstrap/sass/{_navs.scss → bootstrap/_navs.scss} +5 -3
  93. data/vendor/twitter/bootstrap/sass/{_normalize.scss → bootstrap/_normalize.scss} +5 -3
  94. data/vendor/twitter/bootstrap/sass/{_pager.scss → bootstrap/_pager.scss} +2 -3
  95. data/vendor/twitter/bootstrap/sass/{_pagination.scss → bootstrap/_pagination.scss} +1 -1
  96. data/vendor/twitter/bootstrap/sass/{_panels.scss → bootstrap/_panels.scss} +22 -4
  97. data/vendor/twitter/bootstrap/sass/{_popovers.scss → bootstrap/_popovers.scss} +6 -4
  98. data/vendor/twitter/bootstrap/sass/bootstrap/_print.scss +107 -0
  99. data/vendor/twitter/bootstrap/sass/{_progress-bars.scss → bootstrap/_progress-bars.scss} +2 -20
  100. data/vendor/twitter/bootstrap/sass/{_responsive-embed.scss → bootstrap/_responsive-embed.scss} +2 -1
  101. data/vendor/twitter/bootstrap/sass/{_responsive-utilities.scss → bootstrap/_responsive-utilities.scss} +0 -0
  102. data/vendor/twitter/bootstrap/sass/{_scaffolding.scss → bootstrap/_scaffolding.scss} +3 -3
  103. data/vendor/twitter/bootstrap/sass/{_tables.scss → bootstrap/_tables.scss} +11 -10
  104. data/vendor/twitter/bootstrap/sass/{_theme.scss → bootstrap/_theme.scss} +27 -13
  105. data/vendor/twitter/bootstrap/sass/{_thumbnails.scss → bootstrap/_thumbnails.scss} +2 -2
  106. data/vendor/twitter/bootstrap/sass/{_tooltip.scss → bootstrap/_tooltip.scss} +12 -4
  107. data/vendor/twitter/bootstrap/sass/{_type.scss → bootstrap/_type.scss} +10 -16
  108. data/vendor/twitter/bootstrap/sass/{_utilities.scss → bootstrap/_utilities.scss} +3 -4
  109. data/vendor/twitter/bootstrap/sass/{_variables.scss → bootstrap/_variables.scss} +38 -24
  110. data/vendor/twitter/bootstrap/sass/{_wells.scss → bootstrap/_wells.scss} +0 -0
  111. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_alerts.scss +0 -0
  112. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_background-variant.scss +0 -0
  113. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_border-radius.scss +0 -0
  114. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_buttons.scss +2 -0
  115. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_center-block.scss +0 -0
  116. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_clearfix.scss +0 -0
  117. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_forms.scss +5 -1
  118. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_gradients.scss +0 -0
  119. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_grid-framework.scss +0 -0
  120. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_grid.scss +2 -2
  121. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_hide-text.scss +1 -1
  122. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_image.scss +0 -1
  123. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_labels.scss +1 -1
  124. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_list-group.scss +0 -0
  125. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_nav-divider.scss +0 -0
  126. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_nav-vertical-align.scss +0 -0
  127. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_opacity.scss +0 -0
  128. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_pagination.scss +0 -0
  129. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_panels.scss +0 -0
  130. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_progress-bar.scss +1 -1
  131. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_reset-filter.scss +0 -0
  132. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_resize.scss +0 -0
  133. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_responsive-visibility.scss +0 -0
  134. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_size.scss +0 -0
  135. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_tab-focus.scss +0 -0
  136. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_table-row.scss +0 -0
  137. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_text-emphasis.scss +0 -0
  138. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_text-overflow.scss +0 -0
  139. data/vendor/twitter/bootstrap/sass/{mixins → bootstrap/mixins}/_vendor-prefixes.scss +6 -3
  140. metadata +76 -72
  141. data/vendor/twitter/bootstrap/sass/_media.scss +0 -56
  142. data/vendor/twitter/bootstrap/sass/_print.scss +0 -101
  143. data/vendor/twitter/bootstrap/sass/bootstrap.scss +0 -50
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: collapse.js v3.2.0
2
+ * Bootstrap: collapse.js v3.3.1
3
3
  * http://getbootstrap.com/javascript/#collapse
4
4
  * ========================================================================
5
5
  * Copyright 2011-2014 Twitter, Inc.
@@ -16,16 +16,25 @@
16
16
  var Collapse = function (element, options) {
17
17
  this.$element = $(element)
18
18
  this.options = $.extend({}, Collapse.DEFAULTS, options)
19
+ this.$trigger = $(this.options.trigger).filter('[href="#' + element.id + '"], [data-target="#' + element.id + '"]')
19
20
  this.transitioning = null
20
21
 
21
- if (this.options.parent) this.$parent = $(this.options.parent)
22
+ if (this.options.parent) {
23
+ this.$parent = this.getParent()
24
+ } else {
25
+ this.addAriaAndCollapsedClass(this.$element, this.$trigger)
26
+ }
27
+
22
28
  if (this.options.toggle) this.toggle()
23
29
  }
24
30
 
25
- Collapse.VERSION = '3.2.0'
31
+ Collapse.VERSION = '3.3.1'
32
+
33
+ Collapse.TRANSITION_DURATION = 350
26
34
 
27
35
  Collapse.DEFAULTS = {
28
- toggle: true
36
+ toggle: true,
37
+ trigger: '[data-toggle="collapse"]'
29
38
  }
30
39
 
31
40
  Collapse.prototype.dimension = function () {
@@ -36,17 +45,21 @@
36
45
  Collapse.prototype.show = function () {
37
46
  if (this.transitioning || this.$element.hasClass('in')) return
38
47
 
48
+ var activesData
49
+ var actives = this.$parent && this.$parent.find('> .panel').children('.in, .collapsing')
50
+
51
+ if (actives && actives.length) {
52
+ activesData = actives.data('bs.collapse')
53
+ if (activesData && activesData.transitioning) return
54
+ }
55
+
39
56
  var startEvent = $.Event('show.bs.collapse')
40
57
  this.$element.trigger(startEvent)
41
58
  if (startEvent.isDefaultPrevented()) return
42
59
 
43
- var actives = this.$parent && this.$parent.find('> .panel > .in')
44
-
45
60
  if (actives && actives.length) {
46
- var hasData = actives.data('bs.collapse')
47
- if (hasData && hasData.transitioning) return
48
61
  Plugin.call(actives, 'hide')
49
- hasData || actives.data('bs.collapse', null)
62
+ activesData || actives.data('bs.collapse', null)
50
63
  }
51
64
 
52
65
  var dimension = this.dimension()
@@ -54,6 +67,11 @@
54
67
  this.$element
55
68
  .removeClass('collapse')
56
69
  .addClass('collapsing')[dimension](0)
70
+ .attr('aria-expanded', true)
71
+
72
+ this.$trigger
73
+ .removeClass('collapsed')
74
+ .attr('aria-expanded', true)
57
75
 
58
76
  this.transitioning = 1
59
77
 
@@ -72,7 +90,7 @@
72
90
 
73
91
  this.$element
74
92
  .one('bsTransitionEnd', $.proxy(complete, this))
75
- .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
93
+ .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
76
94
  }
77
95
 
78
96
  Collapse.prototype.hide = function () {
@@ -88,17 +106,21 @@
88
106
 
89
107
  this.$element
90
108
  .addClass('collapsing')
91
- .removeClass('collapse')
92
- .removeClass('in')
109
+ .removeClass('collapse in')
110
+ .attr('aria-expanded', false)
111
+
112
+ this.$trigger
113
+ .addClass('collapsed')
114
+ .attr('aria-expanded', false)
93
115
 
94
116
  this.transitioning = 1
95
117
 
96
118
  var complete = function () {
97
119
  this.transitioning = 0
98
120
  this.$element
99
- .trigger('hidden.bs.collapse')
100
121
  .removeClass('collapsing')
101
122
  .addClass('collapse')
123
+ .trigger('hidden.bs.collapse')
102
124
  }
103
125
 
104
126
  if (!$.support.transition) return complete.call(this)
@@ -106,13 +128,40 @@
106
128
  this.$element
107
129
  [dimension](0)
108
130
  .one('bsTransitionEnd', $.proxy(complete, this))
109
- .emulateTransitionEnd(350)
131
+ .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
110
132
  }
111
133
 
112
134
  Collapse.prototype.toggle = function () {
113
135
  this[this.$element.hasClass('in') ? 'hide' : 'show']()
114
136
  }
115
137
 
138
+ Collapse.prototype.getParent = function () {
139
+ return $(this.options.parent)
140
+ .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
141
+ .each($.proxy(function (i, element) {
142
+ var $element = $(element)
143
+ this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
144
+ }, this))
145
+ .end()
146
+ }
147
+
148
+ Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
149
+ var isOpen = $element.hasClass('in')
150
+
151
+ $element.attr('aria-expanded', isOpen)
152
+ $trigger
153
+ .toggleClass('collapsed', !isOpen)
154
+ .attr('aria-expanded', isOpen)
155
+ }
156
+
157
+ function getTargetFromTrigger($trigger) {
158
+ var href
159
+ var target = $trigger.attr('data-target')
160
+ || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
161
+
162
+ return $(target)
163
+ }
164
+
116
165
 
117
166
  // COLLAPSE PLUGIN DEFINITION
118
167
  // ==========================
@@ -123,7 +172,7 @@
123
172
  var data = $this.data('bs.collapse')
124
173
  var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
125
174
 
126
- if (!data && options.toggle && option == 'show') option = !option
175
+ if (!data && options.toggle && option == 'show') options.toggle = false
127
176
  if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
128
177
  if (typeof option == 'string') data[option]()
129
178
  })
@@ -148,21 +197,13 @@
148
197
  // =================
149
198
 
150
199
  $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
151
- var href
152
200
  var $this = $(this)
153
- var target = $this.attr('data-target')
154
- || e.preventDefault()
155
- || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
156
- var $target = $(target)
157
- var data = $target.data('bs.collapse')
158
- var option = data ? 'toggle' : $this.data()
159
- var parent = $this.attr('data-parent')
160
- var $parent = parent && $(parent)
161
201
 
162
- if (!data || !data.transitioning) {
163
- if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
164
- $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
165
- }
202
+ if (!$this.attr('data-target')) e.preventDefault()
203
+
204
+ var $target = getTargetFromTrigger($this)
205
+ var data = $target.data('bs.collapse')
206
+ var option = data ? 'toggle' : $.extend({}, $this.data(), { trigger: this })
166
207
 
167
208
  Plugin.call($target, option)
168
209
  })
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: dropdown.js v3.2.0
2
+ * Bootstrap: dropdown.js v3.3.1
3
3
  * http://getbootstrap.com/javascript/#dropdowns
4
4
  * ========================================================================
5
5
  * Copyright 2011-2014 Twitter, Inc.
@@ -19,7 +19,7 @@
19
19
  $(element).on('click.bs.dropdown', this.toggle)
20
20
  }
21
21
 
22
- Dropdown.VERSION = '3.2.0'
22
+ Dropdown.VERSION = '3.3.1'
23
23
 
24
24
  Dropdown.prototype.toggle = function (e) {
25
25
  var $this = $(this)
@@ -42,7 +42,9 @@
42
42
 
43
43
  if (e.isDefaultPrevented()) return
44
44
 
45
- $this.trigger('focus')
45
+ $this
46
+ .trigger('focus')
47
+ .attr('aria-expanded', 'true')
46
48
 
47
49
  $parent
48
50
  .toggleClass('open')
@@ -53,7 +55,7 @@
53
55
  }
54
56
 
55
57
  Dropdown.prototype.keydown = function (e) {
56
- if (!/(38|40|27)/.test(e.keyCode)) return
58
+ if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
57
59
 
58
60
  var $this = $(this)
59
61
 
@@ -65,7 +67,7 @@
65
67
  var $parent = getParent($this)
66
68
  var isActive = $parent.hasClass('open')
67
69
 
68
- if (!isActive || (isActive && e.keyCode == 27)) {
70
+ if ((!isActive && e.which != 27) || (isActive && e.which == 27)) {
69
71
  if (e.which == 27) $parent.find(toggle).trigger('focus')
70
72
  return $this.trigger('click')
71
73
  }
@@ -75,10 +77,10 @@
75
77
 
76
78
  if (!$items.length) return
77
79
 
78
- var index = $items.index($items.filter(':focus'))
80
+ var index = $items.index(e.target)
79
81
 
80
- if (e.keyCode == 38 && index > 0) index-- // up
81
- if (e.keyCode == 40 && index < $items.length - 1) index++ // down
82
+ if (e.which == 38 && index > 0) index-- // up
83
+ if (e.which == 40 && index < $items.length - 1) index++ // down
82
84
  if (!~index) index = 0
83
85
 
84
86
  $items.eq(index).trigger('focus')
@@ -88,11 +90,17 @@
88
90
  if (e && e.which === 3) return
89
91
  $(backdrop).remove()
90
92
  $(toggle).each(function () {
91
- var $parent = getParent($(this))
93
+ var $this = $(this)
94
+ var $parent = getParent($this)
92
95
  var relatedTarget = { relatedTarget: this }
96
+
93
97
  if (!$parent.hasClass('open')) return
98
+
94
99
  $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
100
+
95
101
  if (e.isDefaultPrevented()) return
102
+
103
+ $this.attr('aria-expanded', 'false')
96
104
  $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
97
105
  })
98
106
  }
@@ -146,6 +154,8 @@
146
154
  .on('click.bs.dropdown.data-api', clearMenus)
147
155
  .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
148
156
  .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
149
- .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown)
157
+ .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
158
+ .on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown)
159
+ .on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
150
160
 
151
161
  }(jQuery);
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: modal.js v3.2.0
2
+ * Bootstrap: modal.js v3.3.1
3
3
  * http://getbootstrap.com/javascript/#modals
4
4
  * ========================================================================
5
5
  * Copyright 2011-2014 Twitter, Inc.
@@ -30,7 +30,10 @@
30
30
  }
31
31
  }
32
32
 
33
- Modal.VERSION = '3.2.0'
33
+ Modal.VERSION = '3.3.1'
34
+
35
+ Modal.TRANSITION_DURATION = 300
36
+ Modal.BACKDROP_TRANSITION_DURATION = 150
34
37
 
35
38
  Modal.DEFAULTS = {
36
39
  backdrop: true,
@@ -53,10 +56,11 @@
53
56
  this.isShown = true
54
57
 
55
58
  this.checkScrollbar()
59
+ this.setScrollbar()
56
60
  this.$body.addClass('modal-open')
57
61
 
58
- this.setScrollbar()
59
62
  this.escape()
63
+ this.resize()
60
64
 
61
65
  this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
62
66
 
@@ -71,6 +75,9 @@
71
75
  .show()
72
76
  .scrollTop(0)
73
77
 
78
+ if (that.options.backdrop) that.adjustBackdrop()
79
+ that.adjustDialog()
80
+
74
81
  if (transition) {
75
82
  that.$element[0].offsetWidth // force reflow
76
83
  }
@@ -88,7 +95,7 @@
88
95
  .one('bsTransitionEnd', function () {
89
96
  that.$element.trigger('focus').trigger(e)
90
97
  })
91
- .emulateTransitionEnd(300) :
98
+ .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
92
99
  that.$element.trigger('focus').trigger(e)
93
100
  })
94
101
  }
@@ -104,10 +111,8 @@
104
111
 
105
112
  this.isShown = false
106
113
 
107
- this.$body.removeClass('modal-open')
108
-
109
- this.resetScrollbar()
110
114
  this.escape()
115
+ this.resize()
111
116
 
112
117
  $(document).off('focusin.bs.modal')
113
118
 
@@ -119,7 +124,7 @@
119
124
  $.support.transition && this.$element.hasClass('fade') ?
120
125
  this.$element
121
126
  .one('bsTransitionEnd', $.proxy(this.hideModal, this))
122
- .emulateTransitionEnd(300) :
127
+ .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
123
128
  this.hideModal()
124
129
  }
125
130
 
@@ -135,11 +140,19 @@
135
140
 
136
141
  Modal.prototype.escape = function () {
137
142
  if (this.isShown && this.options.keyboard) {
138
- this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
143
+ this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
139
144
  e.which == 27 && this.hide()
140
145
  }, this))
141
146
  } else if (!this.isShown) {
142
- this.$element.off('keyup.dismiss.bs.modal')
147
+ this.$element.off('keydown.dismiss.bs.modal')
148
+ }
149
+ }
150
+
151
+ Modal.prototype.resize = function () {
152
+ if (this.isShown) {
153
+ $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
154
+ } else {
155
+ $(window).off('resize.bs.modal')
143
156
  }
144
157
  }
145
158
 
@@ -147,6 +160,9 @@
147
160
  var that = this
148
161
  this.$element.hide()
149
162
  this.backdrop(function () {
163
+ that.$body.removeClass('modal-open')
164
+ that.resetAdjustments()
165
+ that.resetScrollbar()
150
166
  that.$element.trigger('hidden.bs.modal')
151
167
  })
152
168
  }
@@ -164,14 +180,13 @@
164
180
  var doAnimate = $.support.transition && animate
165
181
 
166
182
  this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
167
- .appendTo(this.$body)
168
-
169
- this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
170
- if (e.target !== e.currentTarget) return
171
- this.options.backdrop == 'static'
172
- ? this.$element[0].focus.call(this.$element[0])
173
- : this.hide.call(this)
174
- }, this))
183
+ .prependTo(this.$element)
184
+ .on('click.dismiss.bs.modal', $.proxy(function (e) {
185
+ if (e.target !== e.currentTarget) return
186
+ this.options.backdrop == 'static'
187
+ ? this.$element[0].focus.call(this.$element[0])
188
+ : this.hide.call(this)
189
+ }, this))
175
190
 
176
191
  if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
177
192
 
@@ -182,7 +197,7 @@
182
197
  doAnimate ?
183
198
  this.$backdrop
184
199
  .one('bsTransitionEnd', callback)
185
- .emulateTransitionEnd(150) :
200
+ .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
186
201
  callback()
187
202
 
188
203
  } else if (!this.isShown && this.$backdrop) {
@@ -195,7 +210,7 @@
195
210
  $.support.transition && this.$element.hasClass('fade') ?
196
211
  this.$backdrop
197
212
  .one('bsTransitionEnd', callbackRemove)
198
- .emulateTransitionEnd(150) :
213
+ .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
199
214
  callbackRemove()
200
215
 
201
216
  } else if (callback) {
@@ -203,14 +218,43 @@
203
218
  }
204
219
  }
205
220
 
221
+ // these following methods are used to handle overflowing modals
222
+
223
+ Modal.prototype.handleUpdate = function () {
224
+ if (this.options.backdrop) this.adjustBackdrop()
225
+ this.adjustDialog()
226
+ }
227
+
228
+ Modal.prototype.adjustBackdrop = function () {
229
+ this.$backdrop
230
+ .css('height', 0)
231
+ .css('height', this.$element[0].scrollHeight)
232
+ }
233
+
234
+ Modal.prototype.adjustDialog = function () {
235
+ var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
236
+
237
+ this.$element.css({
238
+ paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
239
+ paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
240
+ })
241
+ }
242
+
243
+ Modal.prototype.resetAdjustments = function () {
244
+ this.$element.css({
245
+ paddingLeft: '',
246
+ paddingRight: ''
247
+ })
248
+ }
249
+
206
250
  Modal.prototype.checkScrollbar = function () {
207
- if (document.body.clientWidth >= window.innerWidth) return
208
- this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
251
+ this.bodyIsOverflowing = document.body.scrollHeight > document.documentElement.clientHeight
252
+ this.scrollbarWidth = this.measureScrollbar()
209
253
  }
210
254
 
211
255
  Modal.prototype.setScrollbar = function () {
212
256
  var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
213
- if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
257
+ if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
214
258
  }
215
259
 
216
260
  Modal.prototype.resetScrollbar = function () {