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,34 +1,26 @@
1
1
  /* ========================================================================
2
- * Bootstrap: dropdown.js v3.0.2
2
+ * Bootstrap: dropdown.js v3.2.0
3
3
  * http://getbootstrap.com/javascript/#dropdowns
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
  // DROPDOWN CLASS DEFINITION
24
14
  // =========================
25
15
 
26
16
  var backdrop = '.dropdown-backdrop'
27
- var toggle = '[data-toggle=dropdown]'
17
+ var toggle = '[data-toggle="dropdown"]'
28
18
  var Dropdown = function (element) {
29
- var $el = $(element).on('click.bs.dropdown', this.toggle)
19
+ $(element).on('click.bs.dropdown', this.toggle)
30
20
  }
31
21
 
22
+ Dropdown.VERSION = '3.2.0'
23
+
32
24
  Dropdown.prototype.toggle = function (e) {
33
25
  var $this = $(this)
34
26
 
@@ -41,19 +33,20 @@
41
33
 
42
34
  if (!isActive) {
43
35
  if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
44
- // if mobile we we use a backdrop because click events don't delegate
36
+ // if mobile we use a backdrop because click events don't delegate
45
37
  $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
46
38
  }
47
39
 
48
- $parent.trigger(e = $.Event('show.bs.dropdown'))
40
+ var relatedTarget = { relatedTarget: this }
41
+ $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
49
42
 
50
43
  if (e.isDefaultPrevented()) return
51
44
 
45
+ $this.trigger('focus')
46
+
52
47
  $parent
53
48
  .toggleClass('open')
54
- .trigger('shown.bs.dropdown')
55
-
56
- $this.focus()
49
+ .trigger('shown.bs.dropdown', relatedTarget)
57
50
  }
58
51
 
59
52
  return false
@@ -73,11 +66,12 @@
73
66
  var isActive = $parent.hasClass('open')
74
67
 
75
68
  if (!isActive || (isActive && e.keyCode == 27)) {
76
- if (e.which == 27) $parent.find(toggle).focus()
77
- return $this.click()
69
+ if (e.which == 27) $parent.find(toggle).trigger('focus')
70
+ return $this.trigger('click')
78
71
  }
79
72
 
80
- var $items = $('[role=menu] li:not(.divider):visible a', $parent)
73
+ var desc = ' li:not(.divider):visible a'
74
+ var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
81
75
 
82
76
  if (!$items.length) return
83
77
 
@@ -85,19 +79,21 @@
85
79
 
86
80
  if (e.keyCode == 38 && index > 0) index-- // up
87
81
  if (e.keyCode == 40 && index < $items.length - 1) index++ // down
88
- if (!~index) index=0
82
+ if (!~index) index = 0
89
83
 
90
- $items.eq(index).focus()
84
+ $items.eq(index).trigger('focus')
91
85
  }
92
86
 
93
- function clearMenus() {
87
+ function clearMenus(e) {
88
+ if (e && e.which === 3) return
94
89
  $(backdrop).remove()
95
- $(toggle).each(function (e) {
90
+ $(toggle).each(function () {
96
91
  var $parent = getParent($(this))
92
+ var relatedTarget = { relatedTarget: this }
97
93
  if (!$parent.hasClass('open')) return
98
- $parent.trigger(e = $.Event('hide.bs.dropdown'))
94
+ $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
99
95
  if (e.isDefaultPrevented()) return
100
- $parent.removeClass('open').trigger('hidden.bs.dropdown')
96
+ $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
101
97
  })
102
98
  }
103
99
 
@@ -106,7 +102,7 @@
106
102
 
107
103
  if (!selector) {
108
104
  selector = $this.attr('href')
109
- selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
105
+ selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
110
106
  }
111
107
 
112
108
  var $parent = selector && $(selector)
@@ -118,18 +114,19 @@
118
114
  // DROPDOWN PLUGIN DEFINITION
119
115
  // ==========================
120
116
 
121
- var old = $.fn.dropdown
122
-
123
- $.fn.dropdown = function (option) {
117
+ function Plugin(option) {
124
118
  return this.each(function () {
125
119
  var $this = $(this)
126
- var data = $this.data('dropdown')
120
+ var data = $this.data('bs.dropdown')
127
121
 
128
- if (!data) $this.data('dropdown', (data = new Dropdown(this)))
122
+ if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
129
123
  if (typeof option == 'string') data[option].call($this)
130
124
  })
131
125
  }
132
126
 
127
+ var old = $.fn.dropdown
128
+
129
+ $.fn.dropdown = Plugin
133
130
  $.fn.dropdown.Constructor = Dropdown
134
131
 
135
132
 
@@ -148,7 +145,7 @@
148
145
  $(document)
149
146
  .on('click.bs.dropdown.data-api', clearMenus)
150
147
  .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
151
- .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
152
- .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
148
+ .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)
153
150
 
154
151
  }(jQuery);
@@ -1,45 +1,45 @@
1
1
  /* ========================================================================
2
- * Bootstrap: modal.js v3.0.2
2
+ * Bootstrap: modal.js v3.2.0
3
3
  * http://getbootstrap.com/javascript/#modals
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
  // MODAL CLASS DEFINITION
24
14
  // ======================
25
15
 
26
16
  var Modal = function (element, options) {
27
- this.options = options
28
- this.$element = $(element)
29
- this.$backdrop =
30
- this.isShown = null
31
-
32
- if (this.options.remote) this.$element.load(this.options.remote)
17
+ this.options = options
18
+ this.$body = $(document.body)
19
+ this.$element = $(element)
20
+ this.$backdrop =
21
+ this.isShown = null
22
+ this.scrollbarWidth = 0
23
+
24
+ if (this.options.remote) {
25
+ this.$element
26
+ .find('.modal-content')
27
+ .load(this.options.remote, $.proxy(function () {
28
+ this.$element.trigger('loaded.bs.modal')
29
+ }, this))
30
+ }
33
31
  }
34
32
 
33
+ Modal.VERSION = '3.2.0'
34
+
35
35
  Modal.DEFAULTS = {
36
- backdrop: true
37
- , keyboard: true
38
- , show: true
36
+ backdrop: true,
37
+ keyboard: true,
38
+ show: true
39
39
  }
40
40
 
41
41
  Modal.prototype.toggle = function (_relatedTarget) {
42
- return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
42
+ return this.isShown ? this.hide() : this.show(_relatedTarget)
43
43
  }
44
44
 
45
45
  Modal.prototype.show = function (_relatedTarget) {
@@ -52,18 +52,24 @@
52
52
 
53
53
  this.isShown = true
54
54
 
55
+ this.checkScrollbar()
56
+ this.$body.addClass('modal-open')
57
+
58
+ this.setScrollbar()
55
59
  this.escape()
56
60
 
57
- this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
61
+ this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
58
62
 
59
63
  this.backdrop(function () {
60
64
  var transition = $.support.transition && that.$element.hasClass('fade')
61
65
 
62
66
  if (!that.$element.parent().length) {
63
- that.$element.appendTo(document.body) // don't move modals dom position
67
+ that.$element.appendTo(that.$body) // don't move modals dom position
64
68
  }
65
69
 
66
- that.$element.show()
70
+ that.$element
71
+ .show()
72
+ .scrollTop(0)
67
73
 
68
74
  if (transition) {
69
75
  that.$element[0].offsetWidth // force reflow
@@ -79,11 +85,11 @@
79
85
 
80
86
  transition ?
81
87
  that.$element.find('.modal-dialog') // wait for modal to slide in
82
- .one($.support.transition.end, function () {
83
- that.$element.focus().trigger(e)
88
+ .one('bsTransitionEnd', function () {
89
+ that.$element.trigger('focus').trigger(e)
84
90
  })
85
91
  .emulateTransitionEnd(300) :
86
- that.$element.focus().trigger(e)
92
+ that.$element.trigger('focus').trigger(e)
87
93
  })
88
94
  }
89
95
 
@@ -98,6 +104,9 @@
98
104
 
99
105
  this.isShown = false
100
106
 
107
+ this.$body.removeClass('modal-open')
108
+
109
+ this.resetScrollbar()
101
110
  this.escape()
102
111
 
103
112
  $(document).off('focusin.bs.modal')
@@ -105,11 +114,11 @@
105
114
  this.$element
106
115
  .removeClass('in')
107
116
  .attr('aria-hidden', true)
108
- .off('click.dismiss.modal')
117
+ .off('click.dismiss.bs.modal')
109
118
 
110
119
  $.support.transition && this.$element.hasClass('fade') ?
111
120
  this.$element
112
- .one($.support.transition.end, $.proxy(this.hideModal, this))
121
+ .one('bsTransitionEnd', $.proxy(this.hideModal, this))
113
122
  .emulateTransitionEnd(300) :
114
123
  this.hideModal()
115
124
  }
@@ -119,7 +128,7 @@
119
128
  .off('focusin.bs.modal') // guard against infinite focus loop
120
129
  .on('focusin.bs.modal', $.proxy(function (e) {
121
130
  if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
122
- this.$element.focus()
131
+ this.$element.trigger('focus')
123
132
  }
124
133
  }, this))
125
134
  }
@@ -138,7 +147,6 @@
138
147
  var that = this
139
148
  this.$element.hide()
140
149
  this.backdrop(function () {
141
- that.removeBackdrop()
142
150
  that.$element.trigger('hidden.bs.modal')
143
151
  })
144
152
  }
@@ -149,16 +157,16 @@
149
157
  }
150
158
 
151
159
  Modal.prototype.backdrop = function (callback) {
152
- var that = this
160
+ var that = this
153
161
  var animate = this.$element.hasClass('fade') ? 'fade' : ''
154
162
 
155
163
  if (this.isShown && this.options.backdrop) {
156
164
  var doAnimate = $.support.transition && animate
157
165
 
158
166
  this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
159
- .appendTo(document.body)
167
+ .appendTo(this.$body)
160
168
 
161
- this.$element.on('click.dismiss.modal', $.proxy(function (e) {
169
+ this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
162
170
  if (e.target !== e.currentTarget) return
163
171
  this.options.backdrop == 'static'
164
172
  ? this.$element[0].focus.call(this.$element[0])
@@ -173,31 +181,56 @@
173
181
 
174
182
  doAnimate ?
175
183
  this.$backdrop
176
- .one($.support.transition.end, callback)
184
+ .one('bsTransitionEnd', callback)
177
185
  .emulateTransitionEnd(150) :
178
186
  callback()
179
187
 
180
188
  } else if (!this.isShown && this.$backdrop) {
181
189
  this.$backdrop.removeClass('in')
182
190
 
183
- $.support.transition && this.$element.hasClass('fade')?
191
+ var callbackRemove = function () {
192
+ that.removeBackdrop()
193
+ callback && callback()
194
+ }
195
+ $.support.transition && this.$element.hasClass('fade') ?
184
196
  this.$backdrop
185
- .one($.support.transition.end, callback)
197
+ .one('bsTransitionEnd', callbackRemove)
186
198
  .emulateTransitionEnd(150) :
187
- callback()
199
+ callbackRemove()
188
200
 
189
201
  } else if (callback) {
190
202
  callback()
191
203
  }
192
204
  }
193
205
 
206
+ Modal.prototype.checkScrollbar = function () {
207
+ if (document.body.clientWidth >= window.innerWidth) return
208
+ this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
209
+ }
210
+
211
+ Modal.prototype.setScrollbar = function () {
212
+ var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
213
+ if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
214
+ }
215
+
216
+ Modal.prototype.resetScrollbar = function () {
217
+ this.$body.css('padding-right', '')
218
+ }
219
+
220
+ Modal.prototype.measureScrollbar = function () { // thx walsh
221
+ var scrollDiv = document.createElement('div')
222
+ scrollDiv.className = 'modal-scrollbar-measure'
223
+ this.$body.append(scrollDiv)
224
+ var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
225
+ this.$body[0].removeChild(scrollDiv)
226
+ return scrollbarWidth
227
+ }
228
+
194
229
 
195
230
  // MODAL PLUGIN DEFINITION
196
231
  // =======================
197
232
 
198
- var old = $.fn.modal
199
-
200
- $.fn.modal = function (option, _relatedTarget) {
233
+ function Plugin(option, _relatedTarget) {
201
234
  return this.each(function () {
202
235
  var $this = $(this)
203
236
  var data = $this.data('bs.modal')
@@ -209,6 +242,9 @@
209
242
  })
210
243
  }
211
244
 
245
+ var old = $.fn.modal
246
+
247
+ $.fn.modal = Plugin
212
248
  $.fn.modal.Constructor = Modal
213
249
 
214
250
 
@@ -227,20 +263,18 @@
227
263
  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
228
264
  var $this = $(this)
229
265
  var href = $this.attr('href')
230
- var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
231
- var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
266
+ var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
267
+ var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
232
268
 
233
- e.preventDefault()
269
+ if ($this.is('a')) e.preventDefault()
234
270
 
235
- $target
236
- .modal(option, this)
237
- .one('hide', function () {
238
- $this.is(':visible') && $this.focus()
271
+ $target.one('show.bs.modal', function (showEvent) {
272
+ if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
273
+ $target.one('hidden.bs.modal', function () {
274
+ $this.is(':visible') && $this.trigger('focus')
239
275
  })
276
+ })
277
+ Plugin.call($target, option, this)
240
278
  })
241
279
 
242
- $(document)
243
- .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
244
- .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
245
-
246
280
  }(jQuery);
@@ -1,24 +1,14 @@
1
1
  /* ========================================================================
2
- * Bootstrap: popover.js v3.0.2
2
+ * Bootstrap: popover.js v3.2.0
3
3
  * http://getbootstrap.com/javascript/#popovers
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
  // POPOVER PUBLIC CLASS DEFINITION
24
14
  // ===============================
@@ -29,11 +19,13 @@
29
19
 
30
20
  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
31
21
 
32
- Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
33
- placement: 'right'
34
- , trigger: 'click'
35
- , content: ''
36
- , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
22
+ Popover.VERSION = '3.2.0'
23
+
24
+ Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
25
+ placement: 'right',
26
+ trigger: 'click',
27
+ content: '',
28
+ template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
37
29
  })
38
30
 
39
31
 
@@ -54,7 +46,9 @@
54
46
  var content = this.getContent()
55
47
 
56
48
  $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
57
- $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
49
+ $tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events
50
+ this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
51
+ ](content)
58
52
 
59
53
  $tip.removeClass('fade top bottom left right in')
60
54
 
@@ -78,7 +72,7 @@
78
72
  }
79
73
 
80
74
  Popover.prototype.arrow = function () {
81
- return this.$arrow = this.$arrow || this.tip().find('.arrow')
75
+ return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
82
76
  }
83
77
 
84
78
  Popover.prototype.tip = function () {
@@ -90,19 +84,21 @@
90
84
  // POPOVER PLUGIN DEFINITION
91
85
  // =========================
92
86
 
93
- var old = $.fn.popover
94
-
95
- $.fn.popover = function (option) {
87
+ function Plugin(option) {
96
88
  return this.each(function () {
97
89
  var $this = $(this)
98
90
  var data = $this.data('bs.popover')
99
91
  var options = typeof option == 'object' && option
100
92
 
93
+ if (!data && option == 'destroy') return
101
94
  if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
102
95
  if (typeof option == 'string') data[option]()
103
96
  })
104
97
  }
105
98
 
99
+ var old = $.fn.popover
100
+
101
+ $.fn.popover = Plugin
106
102
  $.fn.popover.Constructor = Popover
107
103
 
108
104