sass-twitter-bootstrap 2.0.1 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/lib/sass/twitter/bootstrap/version.rb +1 -1
  2. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  3. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  4. data/vendor/assets/javascripts/twitter/bootstrap-affix.js +104 -0
  5. data/vendor/assets/javascripts/twitter/bootstrap-alert.js +28 -32
  6. data/vendor/assets/javascripts/twitter/bootstrap-button.js +29 -33
  7. data/vendor/assets/javascripts/twitter/bootstrap-carousel.js +43 -24
  8. data/vendor/assets/javascripts/twitter/bootstrap-collapse.js +50 -28
  9. data/vendor/assets/javascripts/twitter/bootstrap-dropdown.js +77 -19
  10. data/vendor/assets/javascripts/twitter/bootstrap-modal.js +113 -84
  11. data/vendor/assets/javascripts/twitter/bootstrap-popover.js +19 -11
  12. data/vendor/assets/javascripts/twitter/bootstrap-scrollspy.js +50 -24
  13. data/vendor/assets/javascripts/twitter/bootstrap-tab.js +13 -8
  14. data/vendor/assets/javascripts/twitter/bootstrap-tooltip.js +44 -39
  15. data/vendor/assets/javascripts/twitter/bootstrap-transition.js +29 -20
  16. data/vendor/assets/javascripts/twitter/bootstrap-typeahead.js +73 -44
  17. data/vendor/assets/javascripts/twitter/bootstrap.js +12 -0
  18. data/vendor/assets/stylesheets/tests/css-tests.css +1 -12
  19. data/vendor/assets/stylesheets/tests/css-tests.html +22 -125
  20. data/vendor/assets/stylesheets/tests/navbar.html +39 -38
  21. data/vendor/assets/stylesheets/twitter/_accordion.scss +8 -2
  22. data/vendor/assets/stylesheets/twitter/_alerts.scss +16 -21
  23. data/vendor/assets/stylesheets/twitter/_breadcrumbs.scss +12 -10
  24. data/vendor/assets/stylesheets/twitter/_button-groups.scss +137 -39
  25. data/vendor/assets/stylesheets/twitter/_buttons.scss +129 -81
  26. data/vendor/assets/stylesheets/twitter/_carousel.scss +13 -3
  27. data/vendor/assets/stylesheets/twitter/_close.scss +16 -3
  28. data/vendor/assets/stylesheets/twitter/_code.scss +11 -10
  29. data/vendor/assets/stylesheets/twitter/_component-animations.scss +12 -8
  30. data/vendor/assets/stylesheets/twitter/_dropdowns.scss +133 -53
  31. data/vendor/assets/stylesheets/twitter/_forms.scss +298 -170
  32. data/vendor/assets/stylesheets/twitter/_grid.scss +17 -4
  33. data/vendor/assets/stylesheets/twitter/_hero-unit.scss +7 -3
  34. data/vendor/assets/stylesheets/twitter/_labels-badges.scss +69 -0
  35. data/vendor/assets/stylesheets/twitter/_layouts.scss +2 -3
  36. data/vendor/assets/stylesheets/twitter/_mixins.scss +359 -258
  37. data/vendor/assets/stylesheets/twitter/_modals.scss +26 -12
  38. data/vendor/assets/stylesheets/twitter/_navbar.scss +318 -143
  39. data/vendor/assets/stylesheets/twitter/_navs.scss +87 -56
  40. data/vendor/assets/stylesheets/twitter/_pager.scss +16 -6
  41. data/vendor/assets/stylesheets/twitter/_pagination.scss +23 -14
  42. data/vendor/assets/stylesheets/twitter/_popovers.scss +101 -33
  43. data/vendor/assets/stylesheets/twitter/_progress-bars.scss +43 -16
  44. data/vendor/assets/stylesheets/twitter/_reset.scss +16 -6
  45. data/vendor/assets/stylesheets/twitter/_responsive-1200px-min.scss +28 -0
  46. data/vendor/assets/stylesheets/twitter/_responsive-767px-max.scss +174 -0
  47. data/vendor/assets/stylesheets/twitter/_responsive-768px-979px.scss +19 -0
  48. data/vendor/assets/stylesheets/twitter/_responsive-navbar.scss +177 -0
  49. data/vendor/assets/stylesheets/twitter/_responsive-utilities.scss +58 -0
  50. data/vendor/assets/stylesheets/twitter/_scaffolding.scss +32 -11
  51. data/vendor/assets/stylesheets/twitter/_sprites.scss +49 -14
  52. data/vendor/assets/stylesheets/twitter/_tables.scss +115 -42
  53. data/vendor/assets/stylesheets/twitter/_thumbnails.scss +23 -6
  54. data/vendor/assets/stylesheets/twitter/_tooltip.scss +47 -12
  55. data/vendor/assets/stylesheets/twitter/_type.scss +96 -93
  56. data/vendor/assets/stylesheets/twitter/_utilities.scss +24 -2
  57. data/vendor/assets/stylesheets/twitter/_variables.scss +202 -31
  58. data/vendor/assets/stylesheets/twitter/_wells.scss +17 -5
  59. data/vendor/assets/stylesheets/twitter/bootstrap.scss +3 -7
  60. data/vendor/assets/stylesheets/twitter/responsive.scss +15 -301
  61. metadata +10 -7
  62. data/vendor/assets/stylesheets/tests/buttons.html +0 -139
  63. data/vendor/assets/stylesheets/tests/forms-responsive.html +0 -71
  64. data/vendor/assets/stylesheets/tests/navbar-fixed-top.html +0 -104
  65. data/vendor/assets/stylesheets/tests/navbar-static-top.html +0 -107
  66. data/vendor/assets/stylesheets/twitter/_labels.scss +0 -32
@@ -1,5 +1,5 @@
1
1
  /* =============================================================
2
- * bootstrap-collapse.js v2.0.1
2
+ * bootstrap-collapse.js v2.1.1
3
3
  * http://twitter.github.com/bootstrap/javascript.html#collapse
4
4
  * =============================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -17,16 +17,21 @@
17
17
  * limitations under the License.
18
18
  * ============================================================ */
19
19
 
20
- !function( $ ){
21
20
 
22
- "use strict"
21
+ !function ($) {
23
22
 
24
- var Collapse = function ( element, options ) {
25
- this.$element = $(element)
23
+ "use strict"; // jshint ;_;
24
+
25
+
26
+ /* COLLAPSE PUBLIC CLASS DEFINITION
27
+ * ================================ */
28
+
29
+ var Collapse = function (element, options) {
30
+ this.$element = $(element)
26
31
  this.options = $.extend({}, $.fn.collapse.defaults, options)
27
32
 
28
- if (this.options["parent"]) {
29
- this.$parent = $(this.options["parent"])
33
+ if (this.options.parent) {
34
+ this.$parent = $(this.options.parent)
30
35
  }
31
36
 
32
37
  this.options.toggle && this.toggle()
@@ -42,31 +47,39 @@
42
47
  }
43
48
 
44
49
  , show: function () {
45
- var dimension = this.dimension()
46
- , scroll = $.camelCase(['scroll', dimension].join('-'))
47
- , actives = this.$parent && this.$parent.find('.in')
50
+ var dimension
51
+ , scroll
52
+ , actives
48
53
  , hasData
49
54
 
55
+ if (this.transitioning) return
56
+
57
+ dimension = this.dimension()
58
+ scroll = $.camelCase(['scroll', dimension].join('-'))
59
+ actives = this.$parent && this.$parent.find('> .accordion-group > .in')
60
+
50
61
  if (actives && actives.length) {
51
62
  hasData = actives.data('collapse')
63
+ if (hasData && hasData.transitioning) return
52
64
  actives.collapse('hide')
53
65
  hasData || actives.data('collapse', null)
54
66
  }
55
67
 
56
68
  this.$element[dimension](0)
57
- this.transition('addClass', 'show', 'shown')
58
- this.$element[dimension](this.$element[0][scroll])
59
-
69
+ this.transition('addClass', $.Event('show'), 'shown')
70
+ $.support.transition && this.$element[dimension](this.$element[0][scroll])
60
71
  }
61
72
 
62
73
  , hide: function () {
63
- var dimension = this.dimension()
74
+ var dimension
75
+ if (this.transitioning) return
76
+ dimension = this.dimension()
64
77
  this.reset(this.$element[dimension]())
65
- this.transition('removeClass', 'hide', 'hidden')
78
+ this.transition('removeClass', $.Event('hide'), 'hidden')
66
79
  this.$element[dimension](0)
67
80
  }
68
81
 
69
- , reset: function ( size ) {
82
+ , reset: function (size) {
70
83
  var dimension = this.dimension()
71
84
 
72
85
  this.$element
@@ -74,35 +87,43 @@
74
87
  [dimension](size || 'auto')
75
88
  [0].offsetWidth
76
89
 
77
- this.$element.addClass('collapse')
90
+ this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
91
+
92
+ return this
78
93
  }
79
94
 
80
- , transition: function ( method, startEvent, completeEvent ) {
95
+ , transition: function (method, startEvent, completeEvent) {
81
96
  var that = this
82
97
  , complete = function () {
83
- if (startEvent == 'show') that.reset()
98
+ if (startEvent.type == 'show') that.reset()
99
+ that.transitioning = 0
84
100
  that.$element.trigger(completeEvent)
85
101
  }
86
102
 
87
- this.$element
88
- .trigger(startEvent)
89
- [method]('in')
103
+ this.$element.trigger(startEvent)
104
+
105
+ if (startEvent.isDefaultPrevented()) return
106
+
107
+ this.transitioning = 1
108
+
109
+ this.$element[method]('in')
90
110
 
91
111
  $.support.transition && this.$element.hasClass('collapse') ?
92
112
  this.$element.one($.support.transition.end, complete) :
93
113
  complete()
94
- }
114
+ }
95
115
 
96
116
  , toggle: function () {
97
117
  this[this.$element.hasClass('in') ? 'hide' : 'show']()
98
- }
118
+ }
99
119
 
100
120
  }
101
121
 
102
- /* COLLAPSIBLE PLUGIN DEFINITION
122
+
123
+ /* COLLAPSIBLE PLUGIN DEFINITION
103
124
  * ============================== */
104
125
 
105
- $.fn.collapse = function ( option ) {
126
+ $.fn.collapse = function (option) {
106
127
  return this.each(function () {
107
128
  var $this = $(this)
108
129
  , data = $this.data('collapse')
@@ -123,14 +144,15 @@
123
144
  * ==================== */
124
145
 
125
146
  $(function () {
126
- $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
147
+ $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
127
148
  var $this = $(this), href
128
149
  , target = $this.attr('data-target')
129
150
  || e.preventDefault()
130
151
  || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
131
152
  , option = $(target).data('collapse') ? 'toggle' : $this.data()
153
+ $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
132
154
  $(target).collapse(option)
133
155
  })
134
156
  })
135
157
 
136
- }( window.jQuery );
158
+ }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* ============================================================
2
- * bootstrap-dropdown.js v2.0.1
2
+ * bootstrap-dropdown.js v2.1.1
3
3
  * http://twitter.github.com/bootstrap/javascript.html#dropdowns
4
4
  * ============================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -18,15 +18,16 @@
18
18
  * ============================================================ */
19
19
 
20
20
 
21
- !function( $ ){
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
22
24
 
23
- "use strict"
24
25
 
25
26
  /* DROPDOWN CLASS DEFINITION
26
27
  * ========================= */
27
28
 
28
- var toggle = '[data-toggle="dropdown"]'
29
- , Dropdown = function ( element ) {
29
+ var toggle = '[data-toggle=dropdown]'
30
+ , Dropdown = function (element) {
30
31
  var $el = $(element).on('click.dropdown.data-api', this.toggle)
31
32
  $('html').on('click.dropdown.data-api', function () {
32
33
  $el.parent().removeClass('open')
@@ -37,39 +38,92 @@
37
38
 
38
39
  constructor: Dropdown
39
40
 
40
- , toggle: function ( e ) {
41
+ , toggle: function (e) {
41
42
  var $this = $(this)
42
- , selector = $this.attr('data-target')
43
43
  , $parent
44
44
  , isActive
45
45
 
46
- if (!selector) {
47
- selector = $this.attr('href')
48
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
49
- }
46
+ if ($this.is('.disabled, :disabled')) return
50
47
 
51
- $parent = $(selector)
52
- $parent.length || ($parent = $this.parent())
48
+ $parent = getParent($this)
53
49
 
54
50
  isActive = $parent.hasClass('open')
55
51
 
56
52
  clearMenus()
57
- !isActive && $parent.toggleClass('open')
53
+
54
+ if (!isActive) {
55
+ $parent.toggleClass('open')
56
+ $this.focus()
57
+ }
58
58
 
59
59
  return false
60
60
  }
61
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)
80
+
81
+ isActive = $parent.hasClass('open')
82
+
83
+ if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
84
+
85
+ $items = $('[role=menu] li:not(.divider) a', $parent)
86
+
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()
98
+ }
99
+
62
100
  }
63
101
 
64
102
  function clearMenus() {
65
- $(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 && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
114
+ }
115
+
116
+ $parent = $(selector)
117
+ $parent.length || ($parent = $this.parent())
118
+
119
+ return $parent
66
120
  }
67
121
 
68
122
 
69
123
  /* DROPDOWN PLUGIN DEFINITION
70
124
  * ========================== */
71
125
 
72
- $.fn.dropdown = function ( option ) {
126
+ $.fn.dropdown = function (option) {
73
127
  return this.each(function () {
74
128
  var $this = $(this)
75
129
  , data = $this.data('dropdown')
@@ -85,8 +139,12 @@
85
139
  * =================================== */
86
140
 
87
141
  $(function () {
88
- $('html').on('click.dropdown.data-api', clearMenus)
89
- $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
142
+ $('html')
143
+ .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
144
+ $('body')
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)
90
148
  })
91
149
 
92
- }( window.jQuery );
150
+ }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* =========================================================
2
- * bootstrap-modal.js v2.0.1
2
+ * bootstrap-modal.js v2.1.1
3
3
  * http://twitter.github.com/bootstrap/javascript.html#modals
4
4
  * =========================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -18,17 +18,19 @@
18
18
  * ========================================================= */
19
19
 
20
20
 
21
- !function( $ ){
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
22
24
 
23
- "use strict"
24
25
 
25
26
  /* MODAL CLASS DEFINITION
26
27
  * ====================== */
27
28
 
28
- var Modal = function ( content, options ) {
29
+ var Modal = function (element, options) {
29
30
  this.options = options
30
- this.$element = $(content)
31
+ this.$element = $(element)
31
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)
32
34
  }
33
35
 
34
36
  Modal.prototype = {
@@ -41,19 +43,24 @@
41
43
 
42
44
  , show: function () {
43
45
  var that = this
46
+ , e = $.Event('show')
47
+
48
+ this.$element.trigger(e)
44
49
 
45
- if (this.isShown) return
50
+ if (this.isShown || e.isDefaultPrevented()) return
46
51
 
47
52
  $('body').addClass('modal-open')
48
53
 
49
54
  this.isShown = true
50
- this.$element.trigger('show')
51
55
 
52
- escape.call(this)
53
- backdrop.call(this, function () {
56
+ this.escape()
57
+
58
+ this.backdrop(function () {
54
59
  var transition = $.support.transition && that.$element.hasClass('fade')
55
60
 
56
- !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
61
+ if (!that.$element.parent().length) {
62
+ that.$element.appendTo(document.body) //don't move modals dom position
63
+ }
57
64
 
58
65
  that.$element
59
66
  .show()
@@ -62,7 +69,12 @@
62
69
  that.$element[0].offsetWidth // force reflow
63
70
  }
64
71
 
65
- that.$element.addClass('in')
72
+ that.$element
73
+ .addClass('in')
74
+ .attr('aria-hidden', false)
75
+ .focus()
76
+
77
+ that.enforceFocus()
66
78
 
67
79
  transition ?
68
80
  that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
@@ -71,109 +83,120 @@
71
83
  })
72
84
  }
73
85
 
74
- , hide: function ( e ) {
86
+ , hide: function (e) {
75
87
  e && e.preventDefault()
76
88
 
77
- if (!this.isShown) return
78
-
79
89
  var that = this
90
+
91
+ e = $.Event('hide')
92
+
93
+ this.$element.trigger(e)
94
+
95
+ if (!this.isShown || e.isDefaultPrevented()) return
96
+
80
97
  this.isShown = false
81
98
 
82
99
  $('body').removeClass('modal-open')
83
100
 
84
- escape.call(this)
101
+ this.escape()
102
+
103
+ $(document).off('focusin.modal')
85
104
 
86
105
  this.$element
87
- .trigger('hide')
88
106
  .removeClass('in')
107
+ .attr('aria-hidden', true)
89
108
 
90
109
  $.support.transition && this.$element.hasClass('fade') ?
91
- hideWithTransition.call(this) :
92
- hideModal.call(this)
110
+ this.hideWithTransition() :
111
+ this.hideModal()
93
112
  }
94
113
 
95
- }
96
-
97
-
98
- /* MODAL PRIVATE METHODS
99
- * ===================== */
100
-
101
- function hideWithTransition() {
102
- var that = this
103
- , timeout = setTimeout(function () {
104
- that.$element.off($.support.transition.end)
105
- hideModal.call(that)
106
- }, 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
+ }
107
122
 
108
- this.$element.one($.support.transition.end, function () {
109
- clearTimeout(timeout)
110
- hideModal.call(that)
111
- })
112
- }
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
+ }
113
133
 
114
- function hideModal( that ) {
115
- this.$element
116
- .hide()
117
- .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
+ }
118
146
 
119
- backdrop.call(this)
120
- }
147
+ , hideModal: function (that) {
148
+ this.$element
149
+ .hide()
150
+ .trigger('hidden')
121
151
 
122
- function backdrop( callback ) {
123
- var that = this
124
- , animate = this.$element.hasClass('fade') ? 'fade' : ''
152
+ this.backdrop()
153
+ }
125
154
 
126
- if (this.isShown && this.options.backdrop) {
127
- var doAnimate = $.support.transition && animate
155
+ , removeBackdrop: function () {
156
+ this.$backdrop.remove()
157
+ this.$backdrop = null
158
+ }
128
159
 
129
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
130
- .appendTo(document.body)
160
+ , backdrop: function (callback) {
161
+ var that = this
162
+ , animate = this.$element.hasClass('fade') ? 'fade' : ''
131
163
 
132
- if (this.options.backdrop != 'static') {
133
- this.$backdrop.click($.proxy(this.hide, this))
134
- }
164
+ if (this.isShown && this.options.backdrop) {
165
+ var doAnimate = $.support.transition && animate
135
166
 
136
- if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
167
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
168
+ .appendTo(document.body)
137
169
 
138
- this.$backdrop.addClass('in')
170
+ if (this.options.backdrop != 'static') {
171
+ this.$backdrop.click($.proxy(this.hide, this))
172
+ }
139
173
 
140
- doAnimate ?
141
- this.$backdrop.one($.support.transition.end, callback) :
142
- callback()
174
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
143
175
 
144
- } else if (!this.isShown && this.$backdrop) {
145
- this.$backdrop.removeClass('in')
176
+ this.$backdrop.addClass('in')
146
177
 
147
- $.support.transition && this.$element.hasClass('fade')?
148
- this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
149
- removeBackdrop.call(this)
178
+ doAnimate ?
179
+ this.$backdrop.one($.support.transition.end, callback) :
180
+ callback()
150
181
 
151
- } else if (callback) {
152
- callback()
153
- }
154
- }
182
+ } else if (!this.isShown && this.$backdrop) {
183
+ this.$backdrop.removeClass('in')
155
184
 
156
- function removeBackdrop() {
157
- this.$backdrop.remove()
158
- this.$backdrop = null
159
- }
185
+ $.support.transition && this.$element.hasClass('fade')?
186
+ this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) :
187
+ this.removeBackdrop()
160
188
 
161
- function escape() {
162
- var that = this
163
- if (this.isShown && this.options.keyboard) {
164
- $(document).on('keyup.dismiss.modal', function ( e ) {
165
- e.which == 27 && that.hide()
166
- })
167
- } else if (!this.isShown) {
168
- $(document).off('keyup.dismiss.modal')
169
- }
189
+ } else if (callback) {
190
+ callback()
191
+ }
192
+ }
170
193
  }
171
194
 
172
195
 
173
196
  /* MODAL PLUGIN DEFINITION
174
197
  * ======================= */
175
198
 
176
- $.fn.modal = function ( option ) {
199
+ $.fn.modal = function (option) {
177
200
  return this.each(function () {
178
201
  var $this = $(this)
179
202
  , data = $this.data('modal')
@@ -198,13 +221,19 @@
198
221
 
199
222
  $(function () {
200
223
  $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
201
- var $this = $(this), href
202
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
203
- , 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())
204
228
 
205
229
  e.preventDefault()
206
- $target.modal(option)
230
+
231
+ $target
232
+ .modal(option)
233
+ .one('hide', function () {
234
+ $this.focus()
235
+ })
207
236
  })
208
237
  })
209
238
 
210
- }( window.jQuery );
239
+ }(window.jQuery);