bootstrap-sass 2.0.4.2 → 2.1.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 bootstrap-sass might be problematic. Click here for more details.

Files changed (57) hide show
  1. data/README.md +3 -6
  2. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  3. data/vendor/assets/javascripts/bootstrap-affix.js +104 -0
  4. data/vendor/assets/javascripts/bootstrap-alert.js +1 -1
  5. data/vendor/assets/javascripts/bootstrap-button.js +1 -1
  6. data/vendor/assets/javascripts/bootstrap-carousel.js +12 -5
  7. data/vendor/assets/javascripts/bootstrap-collapse.js +4 -3
  8. data/vendor/assets/javascripts/bootstrap-dropdown.js +66 -16
  9. data/vendor/assets/javascripts/bootstrap-modal.js +95 -74
  10. data/vendor/assets/javascripts/bootstrap-popover.js +9 -4
  11. data/vendor/assets/javascripts/bootstrap-scrollspy.js +9 -9
  12. data/vendor/assets/javascripts/bootstrap-tab.js +2 -2
  13. data/vendor/assets/javascripts/bootstrap-tooltip.js +15 -15
  14. data/vendor/assets/javascripts/bootstrap-transition.js +2 -3
  15. data/vendor/assets/javascripts/bootstrap-typeahead.js +51 -36
  16. data/vendor/assets/javascripts/bootstrap.js +1 -0
  17. data/vendor/assets/stylesheets/_bootstrap-responsive.scss +15 -8
  18. data/vendor/assets/stylesheets/_bootstrap.scss +2 -2
  19. data/vendor/assets/stylesheets/bootstrap/_accordion.scss +3 -2
  20. data/vendor/assets/stylesheets/bootstrap/_alerts.scss +19 -10
  21. data/vendor/assets/stylesheets/bootstrap/_breadcrumbs.scss +11 -11
  22. data/vendor/assets/stylesheets/bootstrap/_button-groups.scss +94 -28
  23. data/vendor/assets/stylesheets/bootstrap/_buttons.scss +94 -54
  24. data/vendor/assets/stylesheets/bootstrap/_carousel.scss +22 -7
  25. data/vendor/assets/stylesheets/bootstrap/_close.scss +5 -3
  26. data/vendor/assets/stylesheets/bootstrap/_code.scss +8 -6
  27. data/vendor/assets/stylesheets/bootstrap/_component-animations.scss +7 -4
  28. data/vendor/assets/stylesheets/bootstrap/_dropdowns.scss +90 -17
  29. data/vendor/assets/stylesheets/bootstrap/_forms.scss +243 -90
  30. data/vendor/assets/stylesheets/bootstrap/_grid.scss +17 -2
  31. data/vendor/assets/stylesheets/bootstrap/_hero-unit.scss +4 -2
  32. data/vendor/assets/stylesheets/bootstrap/_labels-badges.scss +25 -5
  33. data/vendor/assets/stylesheets/bootstrap/_layouts.scss +1 -2
  34. data/vendor/assets/stylesheets/bootstrap/_mixins.scss +143 -134
  35. data/vendor/assets/stylesheets/bootstrap/_modals.scss +13 -6
  36. data/vendor/assets/stylesheets/bootstrap/_navbar.scss +263 -141
  37. data/vendor/assets/stylesheets/bootstrap/_navs.scss +75 -31
  38. data/vendor/assets/stylesheets/bootstrap/_pager.scss +7 -5
  39. data/vendor/assets/stylesheets/bootstrap/_pagination.scss +22 -11
  40. data/vendor/assets/stylesheets/bootstrap/_popovers.scss +101 -33
  41. data/vendor/assets/stylesheets/bootstrap/_progress-bars.scss +23 -19
  42. data/vendor/assets/stylesheets/bootstrap/_reset.scss +35 -11
  43. data/vendor/assets/stylesheets/bootstrap/_responsive-1200px-min.scss +9 -7
  44. data/vendor/assets/stylesheets/bootstrap/_responsive-767px-max.scss +103 -72
  45. data/vendor/assets/stylesheets/bootstrap/_responsive-768px-979px.scss +8 -5
  46. data/vendor/assets/stylesheets/bootstrap/_responsive-navbar.scss +26 -9
  47. data/vendor/assets/stylesheets/bootstrap/_responsive-utilities.scss +17 -15
  48. data/vendor/assets/stylesheets/bootstrap/_scaffolding.scss +26 -4
  49. data/vendor/assets/stylesheets/bootstrap/_sprites.scss +19 -9
  50. data/vendor/assets/stylesheets/bootstrap/_tables.scss +94 -23
  51. data/vendor/assets/stylesheets/bootstrap/_thumbnails.scss +10 -7
  52. data/vendor/assets/stylesheets/bootstrap/_tooltip.scss +47 -12
  53. data/vendor/assets/stylesheets/bootstrap/_type.scss +71 -89
  54. data/vendor/assets/stylesheets/bootstrap/_utilities.scss +9 -2
  55. data/vendor/assets/stylesheets/bootstrap/_variables.scss +108 -68
  56. data/vendor/assets/stylesheets/bootstrap/_wells.scss +8 -6
  57. metadata +3 -2
data/README.md CHANGED
@@ -6,9 +6,6 @@
6
6
 
7
7
  Enjoy.
8
8
 
9
- ## Updating
10
- Updating your application to a new version of `bootstrap-sass`? See our [changelog](https://github.com/thomas-mcdonald/bootstrap-sass/blob/master/CHANGELOG.md), [Bootstrap's changelog](https://github.com/twitter/bootstrap/wiki/Changelog), and this [guide to updating to Bootstrap 2.0](http://twitter.github.com/bootstrap/upgrading.html)
11
-
12
9
  ## Usage
13
10
 
14
11
  ### Rails
@@ -16,7 +13,7 @@ Updating your application to a new version of `bootstrap-sass`? See our [changel
16
13
  In your Gemfile:
17
14
 
18
15
  gem 'sass-rails', '~> 3.1'
19
- gem 'bootstrap-sass', '~> 2.0.4.2'
16
+ gem 'bootstrap-sass', '~> 2.1.0.0'
20
17
 
21
18
  #### CSS
22
19
 
@@ -95,9 +92,9 @@ Bootstrap [claims](https://github.com/twitter/bootstrap#versioning) to use SemVe
95
92
 
96
93
  ### Bundler?
97
94
 
98
- gem 'bootstrap-sass', '~> 2.0.4.0'
95
+ gem 'bootstrap-sass', '~> 2.1.0.0'
99
96
 
100
- Don't use the standard `~> 2.0.x` please. Your apps may break.
97
+ Don't use the standard `~> 2.1.x` please. Your apps may break.
101
98
 
102
99
  ## Who
103
100
  bootstrap-sass is a project by [Thomas McDonald](https://twitter.com/#!/thomasmcdonald_), with support from [other awesome people](https://github.com/thomas-mcdonald/bootstrap-sass/graphs/contributors).
@@ -0,0 +1,104 @@
1
+ /* ==========================================================
2
+ * bootstrap-affix.js v2.1.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#affix
4
+ * ==========================================================
5
+ * Copyright 2012 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.
18
+ * ========================================================== */
19
+
20
+
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
24
+
25
+
26
+ /* AFFIX CLASS DEFINITION
27
+ * ====================== */
28
+
29
+ var Affix = function (element, options) {
30
+ this.options = $.extend({}, $.fn.affix.defaults, options)
31
+ this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
32
+ this.$element = $(element)
33
+ this.checkPosition()
34
+ }
35
+
36
+ Affix.prototype.checkPosition = function () {
37
+ if (!this.$element.is(':visible')) return
38
+
39
+ var scrollHeight = $(document).height()
40
+ , scrollTop = this.$window.scrollTop()
41
+ , position = this.$element.offset()
42
+ , offset = this.options.offset
43
+ , offsetBottom = offset.bottom
44
+ , offsetTop = offset.top
45
+ , reset = 'affix affix-top affix-bottom'
46
+ , affix
47
+
48
+ if (typeof offset != 'object') offsetBottom = offsetTop = offset
49
+ if (typeof offsetTop == 'function') offsetTop = offset.top()
50
+ if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
51
+
52
+ affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
53
+ false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
54
+ 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
55
+ 'top' : false
56
+
57
+ if (this.affixed === affix) return
58
+
59
+ this.affixed = affix
60
+ this.unpin = affix == 'bottom' ? position.top - scrollTop : null
61
+
62
+ this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
63
+ }
64
+
65
+
66
+ /* AFFIX PLUGIN DEFINITION
67
+ * ======================= */
68
+
69
+ $.fn.affix = function (option) {
70
+ return this.each(function () {
71
+ var $this = $(this)
72
+ , data = $this.data('affix')
73
+ , options = typeof option == 'object' && option
74
+ if (!data) $this.data('affix', (data = new Affix(this, options)))
75
+ if (typeof option == 'string') data[option]()
76
+ })
77
+ }
78
+
79
+ $.fn.affix.Constructor = Affix
80
+
81
+ $.fn.affix.defaults = {
82
+ offset: 0
83
+ }
84
+
85
+
86
+ /* AFFIX DATA-API
87
+ * ============== */
88
+
89
+ $(window).on('load', function () {
90
+ $('[data-spy="affix"]').each(function () {
91
+ var $spy = $(this)
92
+ , data = $spy.data()
93
+
94
+ data.offset = data.offset || {}
95
+
96
+ data.offsetBottom && (data.offset.bottom = data.offsetBottom)
97
+ data.offsetTop && (data.offset.top = data.offsetTop)
98
+
99
+ $spy.affix(data)
100
+ })
101
+ })
102
+
103
+
104
+ }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================
2
- * bootstrap-alert.js v2.0.4
2
+ * bootstrap-alert.js v2.1.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#alerts
4
4
  * ==========================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -1,5 +1,5 @@
1
1
  /* ============================================================
2
- * bootstrap-button.js v2.0.4
2
+ * bootstrap-button.js v2.1.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#buttons
4
4
  * ============================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================
2
- * bootstrap-carousel.js v2.0.4
2
+ * bootstrap-carousel.js v2.1.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#carousel
4
4
  * ==========================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -46,7 +46,7 @@
46
46
  }
47
47
 
48
48
  , to: function (pos) {
49
- var $active = this.$element.find('.active')
49
+ var $active = this.$element.find('.item.active')
50
50
  , children = $active.parent().children()
51
51
  , activePos = children.index($active)
52
52
  , that = this
@@ -68,6 +68,10 @@
68
68
 
69
69
  , pause: function (e) {
70
70
  if (!e) this.paused = true
71
+ if (this.$element.find('.next, .prev').length && $.support.transition.end) {
72
+ this.$element.trigger($.support.transition.end)
73
+ this.cycle()
74
+ }
71
75
  clearInterval(this.interval)
72
76
  this.interval = null
73
77
  return this
@@ -84,13 +88,15 @@
84
88
  }
85
89
 
86
90
  , slide: function (type, next) {
87
- var $active = this.$element.find('.active')
91
+ var $active = this.$element.find('.item.active')
88
92
  , $next = next || $active[type]()
89
93
  , isCycling = this.interval
90
94
  , direction = type == 'next' ? 'left' : 'right'
91
95
  , fallback = type == 'next' ? 'first' : 'last'
92
96
  , that = this
93
- , e = $.Event('slide')
97
+ , e = $.Event('slide', {
98
+ relatedTarget: $next[0]
99
+ })
94
100
 
95
101
  this.sliding = true
96
102
 
@@ -138,9 +144,10 @@
138
144
  var $this = $(this)
139
145
  , data = $this.data('carousel')
140
146
  , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
147
+ , action = typeof option == 'string' ? option : options.slide
141
148
  if (!data) $this.data('carousel', (data = new Carousel(this, options)))
142
149
  if (typeof option == 'number') data.to(option)
143
- else if (typeof option == 'string' || (option = options.slide)) data[option]()
150
+ else if (action) data[action]()
144
151
  else if (options.interval) data.cycle()
145
152
  })
146
153
  }
@@ -1,5 +1,5 @@
1
1
  /* =============================================================
2
- * bootstrap-collapse.js v2.0.4
2
+ * bootstrap-collapse.js v2.1.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#collapse
4
4
  * =============================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -67,7 +67,7 @@
67
67
 
68
68
  this.$element[dimension](0)
69
69
  this.transition('addClass', $.Event('show'), 'shown')
70
- this.$element[dimension](this.$element[0][scroll])
70
+ $.support.transition && this.$element[dimension](this.$element[0][scroll])
71
71
  }
72
72
 
73
73
  , hide: function () {
@@ -144,12 +144,13 @@
144
144
  * ==================== */
145
145
 
146
146
  $(function () {
147
- $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
147
+ $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
148
148
  var $this = $(this), href
149
149
  , target = $this.attr('data-target')
150
150
  || e.preventDefault()
151
151
  || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
152
152
  , option = $(target).data('collapse') ? 'toggle' : $this.data()
153
+ $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
153
154
  $(target).collapse(option)
154
155
  })
155
156
  })
@@ -1,5 +1,5 @@
1
1
  /* ============================================================
2
- * bootstrap-dropdown.js v2.0.4
2
+ * bootstrap-dropdown.js v2.1.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#dropdowns
4
4
  * ============================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -26,7 +26,7 @@
26
26
  /* DROPDOWN CLASS DEFINITION
27
27
  * ========================= */
28
28
 
29
- var toggle = '[data-toggle="dropdown"]'
29
+ var toggle = '[data-toggle=dropdown]'
30
30
  , Dropdown = function (element) {
31
31
  var $el = $(element).on('click.dropdown.data-api', this.toggle)
32
32
  $('html').on('click.dropdown.data-api', function () {
@@ -41,34 +41,82 @@
41
41
  , toggle: function (e) {
42
42
  var $this = $(this)
43
43
  , $parent
44
- , selector
45
44
  , isActive
46
45
 
47
46
  if ($this.is('.disabled, :disabled')) return
48
47
 
49
- selector = $this.attr('data-target')
48
+ $parent = getParent($this)
50
49
 
51
- if (!selector) {
52
- selector = $this.attr('href')
53
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
50
+ isActive = $parent.hasClass('open')
51
+
52
+ clearMenus()
53
+
54
+ if (!isActive) {
55
+ $parent.toggleClass('open')
56
+ $this.focus()
54
57
  }
55
58
 
56
- $parent = $(selector)
57
- $parent.length || ($parent = $this.parent())
59
+ return false
60
+ }
61
+
62
+ , keydown: function (e) {
63
+ var $this
64
+ , $items
65
+ , $active
66
+ , $parent
67
+ , isActive
68
+ , index
69
+
70
+ if (!/(38|40|27)/.test(e.keyCode)) return
71
+
72
+ $this = $(this)
73
+
74
+ e.preventDefault()
75
+ e.stopPropagation()
76
+
77
+ if ($this.is('.disabled, :disabled')) return
78
+
79
+ $parent = getParent($this)
58
80
 
59
81
  isActive = $parent.hasClass('open')
60
82
 
61
- clearMenus()
83
+ if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
62
84
 
63
- if (!isActive) $parent.toggleClass('open')
85
+ $items = $('[role=menu] li:not(.divider) a', $parent)
64
86
 
65
- return false
87
+ if (!$items.length) return
88
+
89
+ index = $items.index($items.filter(':focus'))
90
+
91
+ if (e.keyCode == 38 && index > 0) index-- // up
92
+ if (e.keyCode == 40 && index < $items.length - 1) index++ // down
93
+ if (!~index) index = 0
94
+
95
+ $items
96
+ .eq(index)
97
+ .focus()
66
98
  }
67
99
 
68
100
  }
69
101
 
70
102
  function clearMenus() {
71
- $(toggle).parent().removeClass('open')
103
+ getParent($(toggle))
104
+ .removeClass('open')
105
+ }
106
+
107
+ function getParent($this) {
108
+ var selector = $this.attr('data-target')
109
+ , $parent
110
+
111
+ if (!selector) {
112
+ selector = $this.attr('href')
113
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
114
+ }
115
+
116
+ $parent = $(selector)
117
+ $parent.length || ($parent = $this.parent())
118
+
119
+ return $parent
72
120
  }
73
121
 
74
122
 
@@ -91,10 +139,12 @@
91
139
  * =================================== */
92
140
 
93
141
  $(function () {
94
- $('html').on('click.dropdown.data-api', clearMenus)
142
+ $('html')
143
+ .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
95
144
  $('body')
96
- .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
97
- .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
145
+ .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
146
+ .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
147
+ .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
98
148
  })
99
149
 
100
150
  }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* =========================================================
2
- * bootstrap-modal.js v2.0.4
2
+ * bootstrap-modal.js v2.1.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#modals
4
4
  * =========================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -26,10 +26,11 @@
26
26
  /* MODAL CLASS DEFINITION
27
27
  * ====================== */
28
28
 
29
- var Modal = function (content, options) {
29
+ var Modal = function (element, options) {
30
30
  this.options = options
31
- this.$element = $(content)
31
+ this.$element = $(element)
32
32
  .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
33
+ this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
33
34
  }
34
35
 
35
36
  Modal.prototype = {
@@ -52,8 +53,9 @@
52
53
 
53
54
  this.isShown = true
54
55
 
55
- escape.call(this)
56
- backdrop.call(this, function () {
56
+ this.escape()
57
+
58
+ this.backdrop(function () {
57
59
  var transition = $.support.transition && that.$element.hasClass('fade')
58
60
 
59
61
  if (!that.$element.parent().length) {
@@ -67,7 +69,12 @@
67
69
  that.$element[0].offsetWidth // force reflow
68
70
  }
69
71
 
70
- that.$element.addClass('in')
72
+ that.$element
73
+ .addClass('in')
74
+ .attr('aria-hidden', false)
75
+ .focus()
76
+
77
+ that.enforceFocus()
71
78
 
72
79
  transition ?
73
80
  that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
@@ -91,90 +98,98 @@
91
98
 
92
99
  $('body').removeClass('modal-open')
93
100
 
94
- escape.call(this)
101
+ this.escape()
102
+
103
+ $(document).off('focusin.modal')
95
104
 
96
- this.$element.removeClass('in')
105
+ this.$element
106
+ .removeClass('in')
107
+ .attr('aria-hidden', true)
97
108
 
98
109
  $.support.transition && this.$element.hasClass('fade') ?
99
- hideWithTransition.call(this) :
100
- hideModal.call(this)
110
+ this.hideWithTransition() :
111
+ this.hideModal()
101
112
  }
102
113
 
103
- }
104
-
105
-
106
- /* MODAL PRIVATE METHODS
107
- * ===================== */
108
-
109
- function hideWithTransition() {
110
- var that = this
111
- , timeout = setTimeout(function () {
112
- that.$element.off($.support.transition.end)
113
- hideModal.call(that)
114
- }, 500)
114
+ , enforceFocus: function () {
115
+ var that = this
116
+ $(document).on('focusin.modal', function (e) {
117
+ if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
118
+ that.$element.focus()
119
+ }
120
+ })
121
+ }
115
122
 
116
- this.$element.one($.support.transition.end, function () {
117
- clearTimeout(timeout)
118
- hideModal.call(that)
119
- })
120
- }
123
+ , escape: function () {
124
+ var that = this
125
+ if (this.isShown && this.options.keyboard) {
126
+ this.$element.on('keyup.dismiss.modal', function ( e ) {
127
+ e.which == 27 && that.hide()
128
+ })
129
+ } else if (!this.isShown) {
130
+ this.$element.off('keyup.dismiss.modal')
131
+ }
132
+ }
121
133
 
122
- function hideModal(that) {
123
- this.$element
124
- .hide()
125
- .trigger('hidden')
134
+ , hideWithTransition: function () {
135
+ var that = this
136
+ , timeout = setTimeout(function () {
137
+ that.$element.off($.support.transition.end)
138
+ that.hideModal()
139
+ }, 500)
140
+
141
+ this.$element.one($.support.transition.end, function () {
142
+ clearTimeout(timeout)
143
+ that.hideModal()
144
+ })
145
+ }
126
146
 
127
- backdrop.call(this)
128
- }
147
+ , hideModal: function (that) {
148
+ this.$element
149
+ .hide()
150
+ .trigger('hidden')
129
151
 
130
- function backdrop(callback) {
131
- var that = this
132
- , animate = this.$element.hasClass('fade') ? 'fade' : ''
152
+ this.backdrop()
153
+ }
133
154
 
134
- if (this.isShown && this.options.backdrop) {
135
- var doAnimate = $.support.transition && animate
155
+ , removeBackdrop: function () {
156
+ this.$backdrop.remove()
157
+ this.$backdrop = null
158
+ }
136
159
 
137
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
138
- .appendTo(document.body)
160
+ , backdrop: function (callback) {
161
+ var that = this
162
+ , animate = this.$element.hasClass('fade') ? 'fade' : ''
139
163
 
140
- if (this.options.backdrop != 'static') {
141
- this.$backdrop.click($.proxy(this.hide, this))
142
- }
164
+ if (this.isShown && this.options.backdrop) {
165
+ var doAnimate = $.support.transition && animate
143
166
 
144
- if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
167
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
168
+ .appendTo(document.body)
145
169
 
146
- this.$backdrop.addClass('in')
170
+ if (this.options.backdrop != 'static') {
171
+ this.$backdrop.click($.proxy(this.hide, this))
172
+ }
147
173
 
148
- doAnimate ?
149
- this.$backdrop.one($.support.transition.end, callback) :
150
- callback()
174
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
151
175
 
152
- } else if (!this.isShown && this.$backdrop) {
153
- this.$backdrop.removeClass('in')
176
+ this.$backdrop.addClass('in')
154
177
 
155
- $.support.transition && this.$element.hasClass('fade')?
156
- this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
157
- removeBackdrop.call(this)
178
+ doAnimate ?
179
+ this.$backdrop.one($.support.transition.end, callback) :
180
+ callback()
158
181
 
159
- } else if (callback) {
160
- callback()
161
- }
162
- }
182
+ } else if (!this.isShown && this.$backdrop) {
183
+ this.$backdrop.removeClass('in')
163
184
 
164
- function removeBackdrop() {
165
- this.$backdrop.remove()
166
- this.$backdrop = null
167
- }
185
+ $.support.transition && this.$element.hasClass('fade')?
186
+ this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) :
187
+ this.removeBackdrop()
168
188
 
169
- function escape() {
170
- var that = this
171
- if (this.isShown && this.options.keyboard) {
172
- $(document).on('keyup.dismiss.modal', function ( e ) {
173
- e.which == 27 && that.hide()
174
- })
175
- } else if (!this.isShown) {
176
- $(document).off('keyup.dismiss.modal')
177
- }
189
+ } else if (callback) {
190
+ callback()
191
+ }
192
+ }
178
193
  }
179
194
 
180
195
 
@@ -206,12 +221,18 @@
206
221
 
207
222
  $(function () {
208
223
  $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
209
- var $this = $(this), href
210
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
211
- , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
224
+ var $this = $(this)
225
+ , href = $this.attr('href')
226
+ , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
227
+ , option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
212
228
 
213
229
  e.preventDefault()
214
- $target.modal(option)
230
+
231
+ $target
232
+ .modal(option)
233
+ .one('hide', function () {
234
+ $this.focus()
235
+ })
215
236
  })
216
237
  })
217
238