less-rails-bootstrap 2.0.13 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. data/.gitignore +2 -1
  2. data/CHANGELOG.md +2 -2
  3. data/lib/less/rails/bootstrap/version.rb +1 -1
  4. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  5. data/vendor/assets/javascripts/twitter/bootstrap.js +1 -0
  6. data/vendor/assets/javascripts/twitter/bootstrap/affix.js +104 -0
  7. data/vendor/assets/javascripts/twitter/bootstrap/alert.js +1 -1
  8. data/vendor/assets/javascripts/twitter/bootstrap/button.js +1 -1
  9. data/vendor/assets/javascripts/twitter/bootstrap/carousel.js +12 -5
  10. data/vendor/assets/javascripts/twitter/bootstrap/collapse.js +4 -3
  11. data/vendor/assets/javascripts/twitter/bootstrap/dropdown.js +66 -16
  12. data/vendor/assets/javascripts/twitter/bootstrap/modal.js +95 -74
  13. data/vendor/assets/javascripts/twitter/bootstrap/popover.js +9 -4
  14. data/vendor/assets/javascripts/twitter/bootstrap/scrollspy.js +9 -9
  15. data/vendor/assets/javascripts/twitter/bootstrap/tab.js +2 -2
  16. data/vendor/assets/javascripts/twitter/bootstrap/tooltip.js +15 -15
  17. data/vendor/assets/javascripts/twitter/bootstrap/transition.js +2 -3
  18. data/vendor/assets/javascripts/twitter/bootstrap/typeahead.js +50 -35
  19. data/vendor/frameworks/twitter/bootstrap/accordion.less +3 -2
  20. data/vendor/frameworks/twitter/bootstrap/alerts.less +16 -9
  21. data/vendor/frameworks/twitter/bootstrap/bootstrap.less +1 -1
  22. data/vendor/frameworks/twitter/bootstrap/breadcrumbs.less +10 -10
  23. data/vendor/frameworks/twitter/bootstrap/button-groups.less +76 -23
  24. data/vendor/frameworks/twitter/bootstrap/buttons.less +85 -65
  25. data/vendor/frameworks/twitter/bootstrap/carousel.less +13 -3
  26. data/vendor/frameworks/twitter/bootstrap/close.less +4 -2
  27. data/vendor/frameworks/twitter/bootstrap/code.less +6 -5
  28. data/vendor/frameworks/twitter/bootstrap/component-animations.less +5 -2
  29. data/vendor/frameworks/twitter/bootstrap/dropdowns.less +81 -14
  30. data/vendor/frameworks/twitter/bootstrap/forms.less +100 -48
  31. data/vendor/frameworks/twitter/bootstrap/grid.less +17 -1
  32. data/vendor/frameworks/twitter/bootstrap/hero-unit.less +4 -2
  33. data/vendor/frameworks/twitter/bootstrap/labels-badges.less +19 -2
  34. data/vendor/frameworks/twitter/bootstrap/layouts.less +1 -2
  35. data/vendor/frameworks/twitter/bootstrap/mixins.less +98 -73
  36. data/vendor/frameworks/twitter/bootstrap/modals.less +9 -2
  37. data/vendor/frameworks/twitter/bootstrap/navbar.less +238 -127
  38. data/vendor/frameworks/twitter/bootstrap/navs.less +38 -17
  39. data/vendor/frameworks/twitter/bootstrap/pager.less +5 -4
  40. data/vendor/frameworks/twitter/bootstrap/pagination.less +16 -8
  41. data/vendor/frameworks/twitter/bootstrap/popovers.less +101 -33
  42. data/vendor/frameworks/twitter/bootstrap/progress-bars.less +18 -13
  43. data/vendor/frameworks/twitter/bootstrap/reset.less +6 -3
  44. data/vendor/frameworks/twitter/bootstrap/responsive-1200px-min.less +9 -7
  45. data/vendor/frameworks/twitter/bootstrap/responsive-767px-max.less +86 -68
  46. data/vendor/frameworks/twitter/bootstrap/responsive-768px-979px.less +7 -5
  47. data/vendor/frameworks/twitter/bootstrap/responsive-navbar.less +18 -5
  48. data/vendor/frameworks/twitter/bootstrap/responsive-utilities.less +17 -15
  49. data/vendor/frameworks/twitter/bootstrap/responsive.less +5 -5
  50. data/vendor/frameworks/twitter/bootstrap/scaffolding.less +26 -4
  51. data/vendor/frameworks/twitter/bootstrap/sprites.less +15 -19
  52. data/vendor/frameworks/twitter/bootstrap/tables.less +60 -11
  53. data/vendor/frameworks/twitter/bootstrap/thumbnails.less +9 -4
  54. data/vendor/frameworks/twitter/bootstrap/tooltip.less +47 -12
  55. data/vendor/frameworks/twitter/bootstrap/type.less +57 -83
  56. data/vendor/frameworks/twitter/bootstrap/utilities.less +9 -2
  57. data/vendor/frameworks/twitter/bootstrap/variables.less +100 -29
  58. data/vendor/frameworks/twitter/bootstrap/wells.less +7 -5
  59. metadata +11 -12
  60. data/vendor/frameworks/twitter/bootstrap/badges.less +0 -36
  61. data/vendor/frameworks/twitter/bootstrap/labels.less +0 -38
data/.gitignore CHANGED
@@ -3,4 +3,5 @@
3
3
  Gemfile.lock
4
4
  pkg/*
5
5
  test/dummy_app/log/*
6
- tmp/*
6
+ tmp/*
7
+ .DS_Store
data/CHANGELOG.md CHANGED
@@ -1,9 +1,9 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
- 2.0.13 - 06/07/2012
4
+ 2.1.0 - 08/21/2012
5
5
 
6
- * Update to bootstrap 2.0.4.
6
+ * Use bootstrap 2.1.0. Thanks @vickash.
7
7
 
8
8
 
9
9
  2.0.12 - 04/25/2012
@@ -1,7 +1,7 @@
1
1
  module Less
2
2
  module Rails
3
3
  module Bootstrap
4
- VERSION = "2.0.13"
4
+ VERSION = "2.1.0"
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,4 @@
1
+ //= require twitter/bootstrap/affix.js
1
2
  //= require twitter/bootstrap/alert.js
2
3
  //= require twitter/bootstrap/button.js
3
4
  //= require twitter/bootstrap/carousel.js
@@ -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', 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