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: modal.js v3.1.1
2
+ * Bootstrap: modal.js v3.3.6
3
3
  * http://getbootstrap.com/javascript/#modals
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
 
@@ -14,10 +14,15 @@
14
14
  // ======================
15
15
 
16
16
  var Modal = function (element, options) {
17
- this.options = options
18
- this.$element = $(element)
19
- this.$backdrop =
20
- this.isShown = null
17
+ this.options = options
18
+ this.$body = $(document.body)
19
+ this.$element = $(element)
20
+ this.$dialog = this.$element.find('.modal-dialog')
21
+ this.$backdrop = null
22
+ this.isShown = null
23
+ this.originalBodyPad = null
24
+ this.scrollbarWidth = 0
25
+ this.ignoreBackdropClick = false
21
26
 
22
27
  if (this.options.remote) {
23
28
  this.$element
@@ -28,6 +33,11 @@
28
33
  }
29
34
  }
30
35
 
36
+ Modal.VERSION = '3.3.6'
37
+
38
+ Modal.TRANSITION_DURATION = 300
39
+ Modal.BACKDROP_TRANSITION_DURATION = 150
40
+
31
41
  Modal.DEFAULTS = {
32
42
  backdrop: true,
33
43
  keyboard: true,
@@ -35,7 +45,7 @@
35
45
  }
36
46
 
37
47
  Modal.prototype.toggle = function (_relatedTarget) {
38
- return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
48
+ return this.isShown ? this.hide() : this.show(_relatedTarget)
39
49
  }
40
50
 
41
51
  Modal.prototype.show = function (_relatedTarget) {
@@ -48,40 +58,51 @@
48
58
 
49
59
  this.isShown = true
50
60
 
61
+ this.checkScrollbar()
62
+ this.setScrollbar()
63
+ this.$body.addClass('modal-open')
64
+
51
65
  this.escape()
66
+ this.resize()
52
67
 
53
68
  this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
54
69
 
70
+ this.$dialog.on('mousedown.dismiss.bs.modal', function () {
71
+ that.$element.one('mouseup.dismiss.bs.modal', function (e) {
72
+ if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
73
+ })
74
+ })
75
+
55
76
  this.backdrop(function () {
56
77
  var transition = $.support.transition && that.$element.hasClass('fade')
57
78
 
58
79
  if (!that.$element.parent().length) {
59
- that.$element.appendTo(document.body) // don't move modals dom position
80
+ that.$element.appendTo(that.$body) // don't move modals dom position
60
81
  }
61
82
 
62
83
  that.$element
63
84
  .show()
64
85
  .scrollTop(0)
65
86
 
87
+ that.adjustDialog()
88
+
66
89
  if (transition) {
67
90
  that.$element[0].offsetWidth // force reflow
68
91
  }
69
92
 
70
- that.$element
71
- .addClass('in')
72
- .attr('aria-hidden', false)
93
+ that.$element.addClass('in')
73
94
 
74
95
  that.enforceFocus()
75
96
 
76
97
  var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
77
98
 
78
99
  transition ?
79
- that.$element.find('.modal-dialog') // wait for modal to slide in
80
- .one($.support.transition.end, function () {
81
- that.$element.focus().trigger(e)
100
+ that.$dialog // wait for modal to slide in
101
+ .one('bsTransitionEnd', function () {
102
+ that.$element.trigger('focus').trigger(e)
82
103
  })
83
- .emulateTransitionEnd(300) :
84
- that.$element.focus().trigger(e)
104
+ .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
105
+ that.$element.trigger('focus').trigger(e)
85
106
  })
86
107
  }
87
108
 
@@ -97,18 +118,21 @@
97
118
  this.isShown = false
98
119
 
99
120
  this.escape()
121
+ this.resize()
100
122
 
101
123
  $(document).off('focusin.bs.modal')
102
124
 
103
125
  this.$element
104
126
  .removeClass('in')
105
- .attr('aria-hidden', true)
106
127
  .off('click.dismiss.bs.modal')
128
+ .off('mouseup.dismiss.bs.modal')
129
+
130
+ this.$dialog.off('mousedown.dismiss.bs.modal')
107
131
 
108
132
  $.support.transition && this.$element.hasClass('fade') ?
109
133
  this.$element
110
- .one($.support.transition.end, $.proxy(this.hideModal, this))
111
- .emulateTransitionEnd(300) :
134
+ .one('bsTransitionEnd', $.proxy(this.hideModal, this))
135
+ .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
112
136
  this.hideModal()
113
137
  }
114
138
 
@@ -117,18 +141,26 @@
117
141
  .off('focusin.bs.modal') // guard against infinite focus loop
118
142
  .on('focusin.bs.modal', $.proxy(function (e) {
119
143
  if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
120
- this.$element.focus()
144
+ this.$element.trigger('focus')
121
145
  }
122
146
  }, this))
123
147
  }
124
148
 
125
149
  Modal.prototype.escape = function () {
126
150
  if (this.isShown && this.options.keyboard) {
127
- this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
151
+ this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
128
152
  e.which == 27 && this.hide()
129
153
  }, this))
130
154
  } else if (!this.isShown) {
131
- this.$element.off('keyup.dismiss.bs.modal')
155
+ this.$element.off('keydown.dismiss.bs.modal')
156
+ }
157
+ }
158
+
159
+ Modal.prototype.resize = function () {
160
+ if (this.isShown) {
161
+ $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
162
+ } else {
163
+ $(window).off('resize.bs.modal')
132
164
  }
133
165
  }
134
166
 
@@ -136,7 +168,9 @@
136
168
  var that = this
137
169
  this.$element.hide()
138
170
  this.backdrop(function () {
139
- that.removeBackdrop()
171
+ that.$body.removeClass('modal-open')
172
+ that.resetAdjustments()
173
+ that.resetScrollbar()
140
174
  that.$element.trigger('hidden.bs.modal')
141
175
  })
142
176
  }
@@ -147,19 +181,25 @@
147
181
  }
148
182
 
149
183
  Modal.prototype.backdrop = function (callback) {
184
+ var that = this
150
185
  var animate = this.$element.hasClass('fade') ? 'fade' : ''
151
186
 
152
187
  if (this.isShown && this.options.backdrop) {
153
188
  var doAnimate = $.support.transition && animate
154
189
 
155
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
156
- .appendTo(document.body)
190
+ this.$backdrop = $(document.createElement('div'))
191
+ .addClass('modal-backdrop ' + animate)
192
+ .appendTo(this.$body)
157
193
 
158
194
  this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
195
+ if (this.ignoreBackdropClick) {
196
+ this.ignoreBackdropClick = false
197
+ return
198
+ }
159
199
  if (e.target !== e.currentTarget) return
160
200
  this.options.backdrop == 'static'
161
- ? this.$element[0].focus.call(this.$element[0])
162
- : this.hide.call(this)
201
+ ? this.$element[0].focus()
202
+ : this.hide()
163
203
  }, this))
164
204
 
165
205
  if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
@@ -170,31 +210,84 @@
170
210
 
171
211
  doAnimate ?
172
212
  this.$backdrop
173
- .one($.support.transition.end, callback)
174
- .emulateTransitionEnd(150) :
213
+ .one('bsTransitionEnd', callback)
214
+ .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
175
215
  callback()
176
216
 
177
217
  } else if (!this.isShown && this.$backdrop) {
178
218
  this.$backdrop.removeClass('in')
179
219
 
220
+ var callbackRemove = function () {
221
+ that.removeBackdrop()
222
+ callback && callback()
223
+ }
180
224
  $.support.transition && this.$element.hasClass('fade') ?
181
225
  this.$backdrop
182
- .one($.support.transition.end, callback)
183
- .emulateTransitionEnd(150) :
184
- callback()
226
+ .one('bsTransitionEnd', callbackRemove)
227
+ .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
228
+ callbackRemove()
185
229
 
186
230
  } else if (callback) {
187
231
  callback()
188
232
  }
189
233
  }
190
234
 
235
+ // these following methods are used to handle overflowing modals
236
+
237
+ Modal.prototype.handleUpdate = function () {
238
+ this.adjustDialog()
239
+ }
240
+
241
+ Modal.prototype.adjustDialog = function () {
242
+ var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
243
+
244
+ this.$element.css({
245
+ paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
246
+ paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
247
+ })
248
+ }
249
+
250
+ Modal.prototype.resetAdjustments = function () {
251
+ this.$element.css({
252
+ paddingLeft: '',
253
+ paddingRight: ''
254
+ })
255
+ }
256
+
257
+ Modal.prototype.checkScrollbar = function () {
258
+ var fullWindowWidth = window.innerWidth
259
+ if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
260
+ var documentElementRect = document.documentElement.getBoundingClientRect()
261
+ fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
262
+ }
263
+ this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
264
+ this.scrollbarWidth = this.measureScrollbar()
265
+ }
266
+
267
+ Modal.prototype.setScrollbar = function () {
268
+ var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
269
+ this.originalBodyPad = document.body.style.paddingRight || ''
270
+ if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
271
+ }
272
+
273
+ Modal.prototype.resetScrollbar = function () {
274
+ this.$body.css('padding-right', this.originalBodyPad)
275
+ }
276
+
277
+ Modal.prototype.measureScrollbar = function () { // thx walsh
278
+ var scrollDiv = document.createElement('div')
279
+ scrollDiv.className = 'modal-scrollbar-measure'
280
+ this.$body.append(scrollDiv)
281
+ var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
282
+ this.$body[0].removeChild(scrollDiv)
283
+ return scrollbarWidth
284
+ }
285
+
191
286
 
192
287
  // MODAL PLUGIN DEFINITION
193
288
  // =======================
194
289
 
195
- var old = $.fn.modal
196
-
197
- $.fn.modal = function (option, _relatedTarget) {
290
+ function Plugin(option, _relatedTarget) {
198
291
  return this.each(function () {
199
292
  var $this = $(this)
200
293
  var data = $this.data('bs.modal')
@@ -206,6 +299,9 @@
206
299
  })
207
300
  }
208
301
 
302
+ var old = $.fn.modal
303
+
304
+ $.fn.modal = Plugin
209
305
  $.fn.modal.Constructor = Modal
210
306
 
211
307
 
@@ -224,20 +320,18 @@
224
320
  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
225
321
  var $this = $(this)
226
322
  var href = $this.attr('href')
227
- var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
323
+ var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
228
324
  var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
229
325
 
230
326
  if ($this.is('a')) e.preventDefault()
231
327
 
232
- $target
233
- .modal(option, this)
234
- .one('hide', function () {
235
- $this.is(':visible') && $this.focus()
328
+ $target.one('show.bs.modal', function (showEvent) {
329
+ if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
330
+ $target.one('hidden.bs.modal', function () {
331
+ $this.is(':visible') && $this.trigger('focus')
236
332
  })
333
+ })
334
+ Plugin.call($target, option, this)
237
335
  })
238
336
 
239
- $(document)
240
- .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
241
- .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
242
-
243
337
  }(jQuery);
@@ -1,8 +1,8 @@
1
1
  /* ========================================================================
2
- * Bootstrap: popover.js v3.1.1
2
+ * Bootstrap: popover.js v3.3.6
3
3
  * http://getbootstrap.com/javascript/#popovers
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,11 +19,13 @@
19
19
 
20
20
  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
21
21
 
22
+ Popover.VERSION = '3.3.6'
23
+
22
24
  Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
23
25
  placement: 'right',
24
26
  trigger: 'click',
25
27
  content: '',
26
- template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
28
+ template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
27
29
  })
28
30
 
29
31
 
@@ -44,7 +46,7 @@
44
46
  var content = this.getContent()
45
47
 
46
48
  $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
47
- $tip.find('.popover-content')[ // we use append for html objects to maintain js events
49
+ $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
48
50
  this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
49
51
  ](content)
50
52
 
@@ -70,32 +72,28 @@
70
72
  }
71
73
 
72
74
  Popover.prototype.arrow = function () {
73
- return this.$arrow = this.$arrow || this.tip().find('.arrow')
74
- }
75
-
76
- Popover.prototype.tip = function () {
77
- if (!this.$tip) this.$tip = $(this.options.template)
78
- return this.$tip
75
+ return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
79
76
  }
80
77
 
81
78
 
82
79
  // POPOVER PLUGIN DEFINITION
83
80
  // =========================
84
81
 
85
- var old = $.fn.popover
86
-
87
- $.fn.popover = function (option) {
82
+ function Plugin(option) {
88
83
  return this.each(function () {
89
84
  var $this = $(this)
90
85
  var data = $this.data('bs.popover')
91
86
  var options = typeof option == 'object' && option
92
87
 
93
- if (!data && option == 'destroy') return
88
+ if (!data && /destroy|hide/.test(option)) return
94
89
  if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
95
90
  if (typeof option == 'string') data[option]()
96
91
  })
97
92
  }
98
93
 
94
+ var old = $.fn.popover
95
+
96
+ $.fn.popover = Plugin
99
97
  $.fn.popover.Constructor = Popover
100
98
 
101
99
 
@@ -1,8 +1,8 @@
1
1
  /* ========================================================================
2
- * Bootstrap: scrollspy.js v3.1.1
2
+ * Bootstrap: scrollspy.js v3.3.6
3
3
  * http://getbootstrap.com/javascript/#scrollspy
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
 
@@ -14,36 +14,45 @@
14
14
  // ==========================
15
15
 
16
16
  function ScrollSpy(element, options) {
17
- var href
18
- var process = $.proxy(this.process, this)
19
-
20
- this.$element = $(element).is('body') ? $(window) : $(element)
21
- this.$body = $('body')
22
- this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
17
+ this.$body = $(document.body)
18
+ this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
23
19
  this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
24
- this.selector = (this.options.target
25
- || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
26
- || '') + ' .nav li > a'
27
- this.offsets = $([])
28
- this.targets = $([])
20
+ this.selector = (this.options.target || '') + ' .nav li > a'
21
+ this.offsets = []
22
+ this.targets = []
29
23
  this.activeTarget = null
24
+ this.scrollHeight = 0
30
25
 
26
+ this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
31
27
  this.refresh()
32
28
  this.process()
33
29
  }
34
30
 
31
+ ScrollSpy.VERSION = '3.3.6'
32
+
35
33
  ScrollSpy.DEFAULTS = {
36
34
  offset: 10
37
35
  }
38
36
 
37
+ ScrollSpy.prototype.getScrollHeight = function () {
38
+ return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
39
+ }
40
+
39
41
  ScrollSpy.prototype.refresh = function () {
40
- var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
42
+ var that = this
43
+ var offsetMethod = 'offset'
44
+ var offsetBase = 0
45
+
46
+ this.offsets = []
47
+ this.targets = []
48
+ this.scrollHeight = this.getScrollHeight()
41
49
 
42
- this.offsets = $([])
43
- this.targets = $([])
50
+ if (!$.isWindow(this.$scrollElement[0])) {
51
+ offsetMethod = 'position'
52
+ offsetBase = this.$scrollElement.scrollTop()
53
+ }
44
54
 
45
- var self = this
46
- var $targets = this.$body
55
+ this.$body
47
56
  .find(this.selector)
48
57
  .map(function () {
49
58
  var $el = $(this)
@@ -53,50 +62,53 @@
53
62
  return ($href
54
63
  && $href.length
55
64
  && $href.is(':visible')
56
- && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
65
+ && [[$href[offsetMethod]().top + offsetBase, href]]) || null
57
66
  })
58
67
  .sort(function (a, b) { return a[0] - b[0] })
59
68
  .each(function () {
60
- self.offsets.push(this[0])
61
- self.targets.push(this[1])
69
+ that.offsets.push(this[0])
70
+ that.targets.push(this[1])
62
71
  })
63
72
  }
64
73
 
65
74
  ScrollSpy.prototype.process = function () {
66
75
  var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
67
- var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
68
- var maxScroll = scrollHeight - this.$scrollElement.height()
76
+ var scrollHeight = this.getScrollHeight()
77
+ var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
69
78
  var offsets = this.offsets
70
79
  var targets = this.targets
71
80
  var activeTarget = this.activeTarget
72
81
  var i
73
82
 
83
+ if (this.scrollHeight != scrollHeight) {
84
+ this.refresh()
85
+ }
86
+
74
87
  if (scrollTop >= maxScroll) {
75
- return activeTarget != (i = targets.last()[0]) && this.activate(i)
88
+ return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
76
89
  }
77
90
 
78
- if (activeTarget && scrollTop <= offsets[0]) {
79
- return activeTarget != (i = targets[0]) && this.activate(i)
91
+ if (activeTarget && scrollTop < offsets[0]) {
92
+ this.activeTarget = null
93
+ return this.clear()
80
94
  }
81
95
 
82
96
  for (i = offsets.length; i--;) {
83
97
  activeTarget != targets[i]
84
98
  && scrollTop >= offsets[i]
85
- && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
86
- && this.activate( targets[i] )
99
+ && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
100
+ && this.activate(targets[i])
87
101
  }
88
102
  }
89
103
 
90
104
  ScrollSpy.prototype.activate = function (target) {
91
105
  this.activeTarget = target
92
106
 
93
- $(this.selector)
94
- .parentsUntil(this.options.target, '.active')
95
- .removeClass('active')
107
+ this.clear()
96
108
 
97
109
  var selector = this.selector +
98
- '[data-target="' + target + '"],' +
99
- this.selector + '[href="' + target + '"]'
110
+ '[data-target="' + target + '"],' +
111
+ this.selector + '[href="' + target + '"]'
100
112
 
101
113
  var active = $(selector)
102
114
  .parents('li')
@@ -111,13 +123,17 @@
111
123
  active.trigger('activate.bs.scrollspy')
112
124
  }
113
125
 
126
+ ScrollSpy.prototype.clear = function () {
127
+ $(this.selector)
128
+ .parentsUntil(this.options.target, '.active')
129
+ .removeClass('active')
130
+ }
131
+
114
132
 
115
133
  // SCROLLSPY PLUGIN DEFINITION
116
134
  // ===========================
117
135
 
118
- var old = $.fn.scrollspy
119
-
120
- $.fn.scrollspy = function (option) {
136
+ function Plugin(option) {
121
137
  return this.each(function () {
122
138
  var $this = $(this)
123
139
  var data = $this.data('bs.scrollspy')
@@ -128,6 +144,9 @@
128
144
  })
129
145
  }
130
146
 
147
+ var old = $.fn.scrollspy
148
+
149
+ $.fn.scrollspy = Plugin
131
150
  $.fn.scrollspy.Constructor = ScrollSpy
132
151
 
133
152
 
@@ -143,10 +162,10 @@
143
162
  // SCROLLSPY DATA-API
144
163
  // ==================
145
164
 
146
- $(window).on('load', function () {
165
+ $(window).on('load.bs.scrollspy.data-api', function () {
147
166
  $('[data-spy="scroll"]').each(function () {
148
167
  var $spy = $(this)
149
- $spy.scrollspy($spy.data())
168
+ Plugin.call($spy, $spy.data())
150
169
  })
151
170
  })
152
171