twitter-bootstrap-rails 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of twitter-bootstrap-rails might be problematic. Click here for more details.

data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .DS_Store
data/README.md CHANGED
@@ -39,7 +39,7 @@ You have to require Bootstrap LESS (bootstrap.less) in your application.css
39
39
 
40
40
  Now, you can override LESS files provided by Twitter Bootstrap
41
41
 
42
- @import "bootstrap";
42
+ @import "twitter/bootstrap";
43
43
 
44
44
  // Baseline grid
45
45
  @basefont: 13px;
@@ -117,6 +117,7 @@ Seyhun Akyürek - seyhunak [at] gmail com
117
117
  <li>Alex Behar</li>
118
118
  <li>Brandon Keene</li>
119
119
  <li>Anthony Corcutt</li>
120
+ <li>Colin Warren</li>
120
121
  </ul>
121
122
 
122
123
 
@@ -1,7 +1,7 @@
1
1
  module Twitter
2
2
  module Bootstrap
3
3
  module Rails
4
- VERSION = "1.3.1"
4
+ VERSION = "1.4.0"
5
5
  end
6
6
  end
7
7
  end
@@ -5,3 +5,4 @@
5
5
  //= require twitter/bootstrap/bootstrap-popover
6
6
  //= require twitter/bootstrap/bootstrap-scrollspy
7
7
  //= require twitter/bootstrap/bootstrap-tabs
8
+ //= require twitter/bootstrap/bootstrap-buttons
@@ -1,104 +1,113 @@
1
- /* ==========================================================
2
- * bootstrap-alerts.js v1.3.0
3
- * http://twitter.github.com/bootstrap/javascript.html#alerts
4
- * ==========================================================
5
- * Copyright 2011 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
- /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
24
- * ======================================================= */
25
-
26
- var transitionEnd
27
-
28
- $(document).ready(function () {
29
-
30
- $.support.transition = (function () {
31
- var thisBody = document.body || document.documentElement
32
- , thisStyle = thisBody.style
33
- , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
34
- return support
35
- })()
36
-
37
- // set CSS transition event type
38
- if ( $.support.transition ) {
39
- transitionEnd = "TransitionEnd"
40
- if ( $.browser.webkit ) {
41
- transitionEnd = "webkitTransitionEnd"
42
- } else if ( $.browser.mozilla ) {
43
- transitionEnd = "transitionend"
44
- } else if ( $.browser.opera ) {
45
- transitionEnd = "oTransitionEnd"
46
- }
47
- }
48
-
49
- })
50
-
51
- /* ALERT CLASS DEFINITION
52
- * ====================== */
53
-
54
- var Alert = function ( content, selector ) {
55
- this.$element = $(content)
56
- .delegate(selector || '.close', 'click', this.close)
57
- }
58
-
59
- Alert.prototype = {
60
-
61
- close: function (e) {
62
- var $element = $(this).parent('.alert-message')
63
-
64
- e && e.preventDefault()
65
- $element.removeClass('in')
66
-
67
- function removeElement () {
68
- $element.remove()
69
- }
70
-
71
- $.support.transition && $element.hasClass('fade') ?
72
- $element.bind(transitionEnd, removeElement) :
73
- removeElement()
74
- }
75
-
76
- }
77
-
78
-
79
- /* ALERT PLUGIN DEFINITION
80
- * ======================= */
81
-
82
- $.fn.alert = function ( options ) {
83
-
84
- if ( options === true ) {
85
- return this.data('alert')
86
- }
87
-
88
- return this.each(function () {
89
- var $this = $(this)
90
-
91
- if ( typeof options == 'string' ) {
92
- return $this.data('alert')[options]()
93
- }
94
-
95
- $(this).data('alert', new Alert( this ))
96
-
97
- })
98
- }
99
-
100
- $(document).ready(function () {
101
- new Alert($('body'), '.alert-message[data-alert] .close')
102
- })
103
-
1
+ /* ==========================================================
2
+ * bootstrap-alerts.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#alerts
4
+ * ==========================================================
5
+ * Copyright 2011 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"
24
+
25
+ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
26
+ * ======================================================= */
27
+
28
+ var transitionEnd
29
+
30
+ $(document).ready(function () {
31
+
32
+ $.support.transition = (function () {
33
+ var thisBody = document.body || document.documentElement
34
+ , thisStyle = thisBody.style
35
+ , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
36
+ return support
37
+ })()
38
+
39
+ // set CSS transition event type
40
+ if ( $.support.transition ) {
41
+ transitionEnd = "TransitionEnd"
42
+ if ( $.browser.webkit ) {
43
+ transitionEnd = "webkitTransitionEnd"
44
+ } else if ( $.browser.mozilla ) {
45
+ transitionEnd = "transitionend"
46
+ } else if ( $.browser.opera ) {
47
+ transitionEnd = "oTransitionEnd"
48
+ }
49
+ }
50
+
51
+ })
52
+
53
+ /* ALERT CLASS DEFINITION
54
+ * ====================== */
55
+
56
+ var Alert = function ( content, options ) {
57
+ this.settings = $.extend({}, $.fn.alert.defaults, options)
58
+ this.$element = $(content)
59
+ .delegate(this.settings.selector, 'click', this.close)
60
+ }
61
+
62
+ Alert.prototype = {
63
+
64
+ close: function (e) {
65
+ var $element = $(this).parent('.alert-message')
66
+
67
+ e && e.preventDefault()
68
+ $element.removeClass('in')
69
+
70
+ function removeElement () {
71
+ $element.remove()
72
+ }
73
+
74
+ $.support.transition && $element.hasClass('fade') ?
75
+ $element.bind(transitionEnd, removeElement) :
76
+ removeElement()
77
+ }
78
+
79
+ }
80
+
81
+
82
+ /* ALERT PLUGIN DEFINITION
83
+ * ======================= */
84
+
85
+ $.fn.alert = function ( options ) {
86
+
87
+ if ( options === true ) {
88
+ return this.data('alert')
89
+ }
90
+
91
+ return this.each(function () {
92
+ var $this = $(this)
93
+
94
+ if ( typeof options == 'string' ) {
95
+ return $this.data('alert')[options]()
96
+ }
97
+
98
+ $(this).data('alert', new Alert( this, options ))
99
+
100
+ })
101
+ }
102
+
103
+ $.fn.alert.defaults = {
104
+ selector: '.close'
105
+ }
106
+
107
+ $(document).ready(function () {
108
+ new Alert($('body'), {
109
+ selector: '.alert-message[data-alert] .close'
110
+ })
111
+ })
112
+
104
113
  }( window.jQuery || window.ender );
@@ -0,0 +1,62 @@
1
+ /* ============================================================
2
+ * bootstrap-dropdown.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#dropdown
4
+ * ============================================================
5
+ * Copyright 2011 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
+ !function( $ ){
21
+
22
+ "use strict"
23
+
24
+ function setState(el, state) {
25
+ var d = 'disabled'
26
+ , $el = $(el)
27
+ , data = $el.data()
28
+
29
+ state = state + 'Text'
30
+ data.resetText || $el.data('resetText', $el.html())
31
+
32
+ $el.html( data[state] || $.fn.button.defaults[state] )
33
+
34
+ state == 'loadingText' ?
35
+ $el.addClass(d).attr(d, d) :
36
+ $el.removeClass(d).removeAttr(d)
37
+ }
38
+
39
+ function toggle(el) {
40
+ $(el).toggleClass('active')
41
+ }
42
+
43
+ $.fn.button = function(options) {
44
+ return this.each(function () {
45
+ if (options == 'toggle') {
46
+ return toggle(this)
47
+ }
48
+ options && setState(this, options)
49
+ })
50
+ }
51
+
52
+ $.fn.button.defaults = {
53
+ loadingText: 'loading...'
54
+ }
55
+
56
+ $(function () {
57
+ $('body').delegate('.btn[data-toggle]', 'click', function () {
58
+ $(this).button('toggle')
59
+ })
60
+ })
61
+
62
+ }( window.jQuery || window.ender );
@@ -1,50 +1,55 @@
1
- /* ============================================================
2
- * bootstrap-dropdown.js v1.3.0
3
- * http://twitter.github.com/bootstrap/javascript.html#dropdown
4
- * ============================================================
5
- * Copyright 2011 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
- var d = 'a.menu, .dropdown-toggle'
24
-
25
- function clearMenus() {
26
- $(d).parent('li').removeClass('open')
27
- }
28
-
29
- $(function () {
30
- $('html').bind("click", clearMenus)
31
- $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
32
- })
33
-
34
- /* DROPDOWN PLUGIN DEFINITION
35
- * ========================== */
36
-
37
- $.fn.dropdown = function ( selector ) {
38
- return this.each(function () {
39
- $(this).delegate(selector || d, 'click', function (e) {
40
- var li = $(this).parent('li')
41
- , isActive = li.hasClass('open')
42
-
43
- clearMenus()
44
- !isActive && li.toggleClass('open')
45
- return false
46
- })
47
- })
48
- }
49
-
50
- }( window.jQuery || window.ender );
1
+ /* ============================================================
2
+ * bootstrap-dropdown.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#dropdown
4
+ * ============================================================
5
+ * Copyright 2011 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"
24
+
25
+ /* DROPDOWN PLUGIN DEFINITION
26
+ * ========================== */
27
+
28
+ $.fn.dropdown = function ( selector ) {
29
+ return this.each(function () {
30
+ $(this).delegate(selector || d, 'click', function (e) {
31
+ var li = $(this).parent('li')
32
+ , isActive = li.hasClass('open')
33
+
34
+ clearMenus()
35
+ !isActive && li.toggleClass('open')
36
+ return false
37
+ })
38
+ })
39
+ }
40
+
41
+ /* APPLY TO STANDARD DROPDOWN ELEMENTS
42
+ * =================================== */
43
+
44
+ var d = 'a.menu, .dropdown-toggle'
45
+
46
+ function clearMenus() {
47
+ $(d).parent('li').removeClass('open')
48
+ }
49
+
50
+ $(function () {
51
+ $('html').bind("click", clearMenus)
52
+ $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
53
+ })
54
+
55
+ }( window.jQuery || window.ender );
@@ -1,238 +1,260 @@
1
- /* =========================================================
2
- * bootstrap-modal.js v1.3.0
3
- * http://twitter.github.com/bootstrap/javascript.html#modal
4
- * =========================================================
5
- * Copyright 2011 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
- /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
24
- * ======================================================= */
25
-
26
- var transitionEnd
27
-
28
- $(document).ready(function () {
29
-
30
- $.support.transition = (function () {
31
- var thisBody = document.body || document.documentElement
32
- , thisStyle = thisBody.style
33
- , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
34
- return support
35
- })()
36
-
37
- // set CSS transition event type
38
- if ( $.support.transition ) {
39
- transitionEnd = "TransitionEnd"
40
- if ( $.browser.webkit ) {
41
- transitionEnd = "webkitTransitionEnd"
42
- } else if ( $.browser.mozilla ) {
43
- transitionEnd = "transitionend"
44
- } else if ( $.browser.opera ) {
45
- transitionEnd = "oTransitionEnd"
46
- }
47
- }
48
-
49
- })
50
-
51
-
52
- /* MODAL PUBLIC CLASS DEFINITION
53
- * ============================= */
54
-
55
- var Modal = function ( content, options ) {
56
- this.settings = $.extend({}, $.fn.modal.defaults)
57
- this.$element = $(content)
58
- .delegate('.close', 'click.modal', $.proxy(this.hide, this))
59
-
60
- if ( options ) {
61
- $.extend( this.settings, options )
62
-
63
- if ( options.show ) {
64
- this.show()
65
- }
66
- }
67
-
68
- return this
69
- }
70
-
71
- Modal.prototype = {
72
-
73
- toggle: function () {
74
- return this[!this.isShown ? 'show' : 'hide']()
75
- }
76
-
77
- , show: function () {
78
- var that = this
79
- this.isShown = true
80
- this.$element.trigger('show')
81
-
82
- escape.call(this)
83
- backdrop.call(this, function () {
84
- that.$element
85
- .appendTo(document.body)
86
- .show()
87
-
88
- if ($.support.transition && that.$element.hasClass('fade')) {
89
- that.$element[0].offsetWidth // force reflow
90
- }
91
-
92
- that.$element
93
- .addClass('in')
94
- .trigger('shown')
95
- })
96
-
97
- return this
98
- }
99
-
100
- , hide: function (e) {
101
- e && e.preventDefault()
102
-
103
- var that = this
104
- this.isShown = false
105
-
106
- escape.call(this)
107
-
108
- this.$element
109
- .trigger('hide')
110
- .removeClass('in')
111
-
112
- function removeElement () {
113
- that.$element
114
- .hide()
115
- .trigger('hidden')
116
-
117
- backdrop.call(that)
118
- }
119
-
120
- $.support.transition && this.$element.hasClass('fade') ?
121
- this.$element.one(transitionEnd, removeElement) :
122
- removeElement()
123
-
124
- return this
125
- }
126
-
127
- }
128
-
129
-
130
- /* MODAL PRIVATE METHODS
131
- * ===================== */
132
-
133
- function backdrop ( callback ) {
134
- var that = this
135
- , animate = this.$element.hasClass('fade') ? 'fade' : ''
136
- if ( this.isShown && this.settings.backdrop ) {
137
- var doAnimate = $.support.transition && animate
138
-
139
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
140
- .appendTo(document.body)
141
-
142
- if ( this.settings.backdrop != 'static' ) {
143
- this.$backdrop.click($.proxy(this.hide, this))
144
- }
145
-
146
- if ( doAnimate ) {
147
- this.$backdrop[0].offsetWidth // force reflow
148
- }
149
-
150
- this.$backdrop.addClass('in')
151
-
152
- doAnimate ?
153
- this.$backdrop.one(transitionEnd, callback) :
154
- callback()
155
-
156
- } else if ( !this.isShown && this.$backdrop ) {
157
- this.$backdrop.removeClass('in')
158
-
159
- function removeElement() {
160
- that.$backdrop.remove()
161
- that.$backdrop = null
162
- }
163
-
164
- $.support.transition && this.$element.hasClass('fade')?
165
- this.$backdrop.one(transitionEnd, removeElement) :
166
- removeElement()
167
- } else if ( callback ) {
168
- callback()
169
- }
170
- }
171
-
172
- function escape() {
173
- var that = this
174
- if ( this.isShown && this.settings.keyboard ) {
175
- $(document).bind('keyup.modal', function ( e ) {
176
- if ( e.which == 27 ) {
177
- that.hide()
178
- }
179
- })
180
- } else if ( !this.isShown ) {
181
- $(document).unbind('keyup.modal')
182
- }
183
- }
184
-
185
-
186
- /* MODAL PLUGIN DEFINITION
187
- * ======================= */
188
-
189
- $.fn.modal = function ( options ) {
190
- var modal = this.data('modal')
191
-
192
- if (!modal) {
193
-
194
- if (typeof options == 'string') {
195
- options = {
196
- show: /show|toggle/.test(options)
197
- }
198
- }
199
-
200
- return this.each(function () {
201
- $(this).data('modal', new Modal(this, options))
202
- })
203
- }
204
-
205
- if ( options === true ) {
206
- return modal
207
- }
208
-
209
- if ( typeof options == 'string' ) {
210
- modal[options]()
211
- } else if ( modal ) {
212
- modal.toggle()
213
- }
214
-
215
- return this
216
- }
217
-
218
- $.fn.modal.Modal = Modal
219
-
220
- $.fn.modal.defaults = {
221
- backdrop: false
222
- , keyboard: false
223
- , show: true
224
- }
225
-
226
-
227
- /* MODAL DATA- IMPLEMENTATION
228
- * ========================== */
229
-
230
- $(document).ready(function () {
231
- $('body').delegate('[data-controls-modal]', 'click', function (e) {
232
- e.preventDefault()
233
- var $this = $(this).data('show', true)
234
- $('#' + $this.attr('data-controls-modal')).modal( $this.data() )
235
- })
236
- })
237
-
238
- }( window.jQuery || window.ender );
1
+ /* =========================================================
2
+ * bootstrap-modal.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#modal
4
+ * =========================================================
5
+ * Copyright 2011 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"
24
+
25
+ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
26
+ * ======================================================= */
27
+
28
+ var transitionEnd
29
+
30
+ $(document).ready(function () {
31
+
32
+ $.support.transition = (function () {
33
+ var thisBody = document.body || document.documentElement
34
+ , thisStyle = thisBody.style
35
+ , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
36
+ return support
37
+ })()
38
+
39
+ // set CSS transition event type
40
+ if ( $.support.transition ) {
41
+ transitionEnd = "TransitionEnd"
42
+ if ( $.browser.webkit ) {
43
+ transitionEnd = "webkitTransitionEnd"
44
+ } else if ( $.browser.mozilla ) {
45
+ transitionEnd = "transitionend"
46
+ } else if ( $.browser.opera ) {
47
+ transitionEnd = "oTransitionEnd"
48
+ }
49
+ }
50
+
51
+ })
52
+
53
+
54
+ /* MODAL PUBLIC CLASS DEFINITION
55
+ * ============================= */
56
+
57
+ var Modal = function ( content, options ) {
58
+ this.settings = $.extend({}, $.fn.modal.defaults, options)
59
+ this.$element = $(content)
60
+ .delegate('.close', 'click.modal', $.proxy(this.hide, this))
61
+
62
+ if ( this.settings.show ) {
63
+ this.show()
64
+ }
65
+
66
+ return this
67
+ }
68
+
69
+ Modal.prototype = {
70
+
71
+ toggle: function () {
72
+ return this[!this.isShown ? 'show' : 'hide']()
73
+ }
74
+
75
+ , show: function () {
76
+ var that = this
77
+ this.isShown = true
78
+ this.$element.trigger('show')
79
+
80
+ escape.call(this)
81
+ backdrop.call(this, function () {
82
+ var transition = $.support.transition && that.$element.hasClass('fade')
83
+
84
+ that.$element
85
+ .appendTo(document.body)
86
+ .show()
87
+
88
+ if (transition) {
89
+ that.$element[0].offsetWidth // force reflow
90
+ }
91
+
92
+ that.$element.addClass('in')
93
+
94
+ transition ?
95
+ that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
96
+ that.$element.trigger('shown')
97
+
98
+ })
99
+
100
+ return this
101
+ }
102
+
103
+ , hide: function (e) {
104
+ e && e.preventDefault()
105
+
106
+ if ( !this.isShown ) {
107
+ return this
108
+ }
109
+
110
+ var that = this
111
+ this.isShown = false
112
+
113
+ escape.call(this)
114
+
115
+ this.$element
116
+ .trigger('hide')
117
+ .removeClass('in')
118
+
119
+ $.support.transition && this.$element.hasClass('fade') ?
120
+ hideWithTransition.call(this) :
121
+ hideModal.call(this)
122
+
123
+ return this
124
+ }
125
+
126
+ }
127
+
128
+
129
+ /* MODAL PRIVATE METHODS
130
+ * ===================== */
131
+
132
+ function hideWithTransition() {
133
+ // firefox drops transitionEnd events :{o
134
+ var that = this
135
+ , timeout = setTimeout(function () {
136
+ that.$element.unbind(transitionEnd)
137
+ hideModal.call(that)
138
+ }, 500)
139
+
140
+ this.$element.one(transitionEnd, function () {
141
+ clearTimeout(timeout)
142
+ hideModal.call(that)
143
+ })
144
+ }
145
+
146
+ function hideModal (that) {
147
+ this.$element
148
+ .hide()
149
+ .trigger('hidden')
150
+
151
+ backdrop.call(this)
152
+ }
153
+
154
+ function backdrop ( callback ) {
155
+ var that = this
156
+ , animate = this.$element.hasClass('fade') ? 'fade' : ''
157
+ if ( this.isShown && this.settings.backdrop ) {
158
+ var doAnimate = $.support.transition && animate
159
+
160
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
161
+ .appendTo(document.body)
162
+
163
+ if ( this.settings.backdrop != 'static' ) {
164
+ this.$backdrop.click($.proxy(this.hide, this))
165
+ }
166
+
167
+ if ( doAnimate ) {
168
+ this.$backdrop[0].offsetWidth // force reflow
169
+ }
170
+
171
+ this.$backdrop.addClass('in')
172
+
173
+ doAnimate ?
174
+ this.$backdrop.one(transitionEnd, callback) :
175
+ callback()
176
+
177
+ } else if ( !this.isShown && this.$backdrop ) {
178
+ this.$backdrop.removeClass('in')
179
+
180
+ $.support.transition && this.$element.hasClass('fade')?
181
+ this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
182
+ removeBackdrop.call(this)
183
+
184
+ } else if ( callback ) {
185
+ callback()
186
+ }
187
+ }
188
+
189
+ function removeBackdrop() {
190
+ this.$backdrop.remove()
191
+ this.$backdrop = null
192
+ }
193
+
194
+ function escape() {
195
+ var that = this
196
+ if ( this.isShown && this.settings.keyboard ) {
197
+ $(document).bind('keyup.modal', function ( e ) {
198
+ if ( e.which == 27 ) {
199
+ that.hide()
200
+ }
201
+ })
202
+ } else if ( !this.isShown ) {
203
+ $(document).unbind('keyup.modal')
204
+ }
205
+ }
206
+
207
+
208
+ /* MODAL PLUGIN DEFINITION
209
+ * ======================= */
210
+
211
+ $.fn.modal = function ( options ) {
212
+ var modal = this.data('modal')
213
+
214
+ if (!modal) {
215
+
216
+ if (typeof options == 'string') {
217
+ options = {
218
+ show: /show|toggle/.test(options)
219
+ }
220
+ }
221
+
222
+ return this.each(function () {
223
+ $(this).data('modal', new Modal(this, options))
224
+ })
225
+ }
226
+
227
+ if ( options === true ) {
228
+ return modal
229
+ }
230
+
231
+ if ( typeof options == 'string' ) {
232
+ modal[options]()
233
+ } else if ( modal ) {
234
+ modal.toggle()
235
+ }
236
+
237
+ return this
238
+ }
239
+
240
+ $.fn.modal.Modal = Modal
241
+
242
+ $.fn.modal.defaults = {
243
+ backdrop: false
244
+ , keyboard: false
245
+ , show: false
246
+ }
247
+
248
+
249
+ /* MODAL DATA- IMPLEMENTATION
250
+ * ========================== */
251
+
252
+ $(document).ready(function () {
253
+ $('body').delegate('[data-controls-modal]', 'click', function (e) {
254
+ e.preventDefault()
255
+ var $this = $(this).data('show', true)
256
+ $('#' + $this.attr('data-controls-modal')).modal( $this.data() )
257
+ })
258
+ })
259
+
260
+ }( window.jQuery || window.ender );