bootstrap-jasny 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.rdoc +27 -0
  4. data/lib/bootstrap-jasny.rb +51 -0
  5. data/lib/bootstrap-jasny/compass_functions.rb +24 -0
  6. data/lib/bootstrap-jasny/engine.rb +7 -0
  7. data/lib/bootstrap-jasny/less_functions.rb +14 -0
  8. data/vendor/assets/fonts/bootstrap/iconic/iconic_fill.eot +0 -0
  9. data/vendor/assets/fonts/bootstrap/iconic/iconic_fill.otf +0 -0
  10. data/vendor/assets/fonts/bootstrap/iconic/iconic_fill.svg +475 -0
  11. data/vendor/assets/fonts/bootstrap/iconic/iconic_fill.ttf +0 -0
  12. data/vendor/assets/fonts/bootstrap/iconic/iconic_fill.woff +0 -0
  13. data/vendor/assets/fonts/bootstrap/iconic/iconic_stroke.eot +0 -0
  14. data/vendor/assets/fonts/bootstrap/iconic/iconic_stroke.otf +0 -0
  15. data/vendor/assets/fonts/bootstrap/iconic/iconic_stroke.svg +492 -0
  16. data/vendor/assets/fonts/bootstrap/iconic/iconic_stroke.ttf +0 -0
  17. data/vendor/assets/fonts/bootstrap/iconic/iconic_stroke.woff +0 -0
  18. data/vendor/assets/images/bootstrap/glyphicons-halflings-white.png +0 -0
  19. data/vendor/assets/images/bootstrap/glyphicons-halflings.png +0 -0
  20. data/vendor/assets/javascripts/bootstrap-affix.js +117 -0
  21. data/vendor/assets/javascripts/bootstrap-alert.js +99 -0
  22. data/vendor/assets/javascripts/bootstrap-button.js +105 -0
  23. data/vendor/assets/javascripts/bootstrap-carousel.js +207 -0
  24. data/vendor/assets/javascripts/bootstrap-collapse.js +167 -0
  25. data/vendor/assets/javascripts/bootstrap-dropdown.js +165 -0
  26. data/vendor/assets/javascripts/bootstrap-fileupload.js +169 -0
  27. data/vendor/assets/javascripts/bootstrap-inputmask.js +355 -0
  28. data/vendor/assets/javascripts/bootstrap-modal.js +247 -0
  29. data/vendor/assets/javascripts/bootstrap-popover.js +114 -0
  30. data/vendor/assets/javascripts/bootstrap-rowlink.js +71 -0
  31. data/vendor/assets/javascripts/bootstrap-scrollspy.js +162 -0
  32. data/vendor/assets/javascripts/bootstrap-tab.js +144 -0
  33. data/vendor/assets/javascripts/bootstrap-tooltip.js +361 -0
  34. data/vendor/assets/javascripts/bootstrap-transition.js +60 -0
  35. data/vendor/assets/javascripts/bootstrap-typeahead.js +524 -0
  36. data/vendor/assets/javascripts/bootstrap.js +21 -0
  37. data/vendor/assets/stylesheets/bootstrap-responsive.less +1 -0
  38. data/vendor/assets/stylesheets/bootstrap.less +2 -0
  39. data/vendor/assets/stylesheets/bootstrap/accordion.less +34 -0
  40. data/vendor/assets/stylesheets/bootstrap/action-areas.less +14 -0
  41. data/vendor/assets/stylesheets/bootstrap/action-links.less +57 -0
  42. data/vendor/assets/stylesheets/bootstrap/alerts.less +79 -0
  43. data/vendor/assets/stylesheets/bootstrap/bootstrap.less +63 -0
  44. data/vendor/assets/stylesheets/bootstrap/breadcrumbs.less +24 -0
  45. data/vendor/assets/stylesheets/bootstrap/button-groups.less +229 -0
  46. data/vendor/assets/stylesheets/bootstrap/buttons.less +228 -0
  47. data/vendor/assets/stylesheets/bootstrap/carousel.less +158 -0
  48. data/vendor/assets/stylesheets/bootstrap/close.less +32 -0
  49. data/vendor/assets/stylesheets/bootstrap/code.less +61 -0
  50. data/vendor/assets/stylesheets/bootstrap/component-animations.less +22 -0
  51. data/vendor/assets/stylesheets/bootstrap/dropdowns.less +237 -0
  52. data/vendor/assets/stylesheets/bootstrap/fileupload.less +105 -0
  53. data/vendor/assets/stylesheets/bootstrap/forms-uneditable.less +159 -0
  54. data/vendor/assets/stylesheets/bootstrap/forms.less +690 -0
  55. data/vendor/assets/stylesheets/bootstrap/grid.less +21 -0
  56. data/vendor/assets/stylesheets/bootstrap/hero-unit.less +25 -0
  57. data/vendor/assets/stylesheets/bootstrap/iconic.less +209 -0
  58. data/vendor/assets/stylesheets/bootstrap/jasny-bootstrap.less +31 -0
  59. data/vendor/assets/stylesheets/bootstrap/jasny-forms.less +99 -0
  60. data/vendor/assets/stylesheets/bootstrap/jasny-forms.responsive-1200px-min.less +16 -0
  61. data/vendor/assets/stylesheets/bootstrap/jasny-forms.responsive-767px-max.less +17 -0
  62. data/vendor/assets/stylesheets/bootstrap/jasny-forms.responsive-768px-979px.less +36 -0
  63. data/vendor/assets/stylesheets/bootstrap/jasny-navs-tabbable.less +148 -0
  64. data/vendor/assets/stylesheets/bootstrap/jasny-responsive.less +27 -0
  65. data/vendor/assets/stylesheets/bootstrap/labels-badges.less +84 -0
  66. data/vendor/assets/stylesheets/bootstrap/layouts-semifluid.less +11 -0
  67. data/vendor/assets/stylesheets/bootstrap/layouts-semifluid.responsive-1200px-min.less +7 -0
  68. data/vendor/assets/stylesheets/bootstrap/layouts.less +16 -0
  69. data/vendor/assets/stylesheets/bootstrap/media.less +55 -0
  70. data/vendor/assets/stylesheets/bootstrap/mixins.less +702 -0
  71. data/vendor/assets/stylesheets/bootstrap/modals.less +95 -0
  72. data/vendor/assets/stylesheets/bootstrap/navbar.less +497 -0
  73. data/vendor/assets/stylesheets/bootstrap/navs.less +409 -0
  74. data/vendor/assets/stylesheets/bootstrap/page-alert.less +23 -0
  75. data/vendor/assets/stylesheets/bootstrap/page-alert.responsive-1200px-min.less +11 -0
  76. data/vendor/assets/stylesheets/bootstrap/page-alert.responsive-767px-max.less +20 -0
  77. data/vendor/assets/stylesheets/bootstrap/pager.less +43 -0
  78. data/vendor/assets/stylesheets/bootstrap/pagination.less +123 -0
  79. data/vendor/assets/stylesheets/bootstrap/popovers.less +133 -0
  80. data/vendor/assets/stylesheets/bootstrap/progress-bars.less +122 -0
  81. data/vendor/assets/stylesheets/bootstrap/reset.less +216 -0
  82. data/vendor/assets/stylesheets/bootstrap/responsive-1200px-min.less +28 -0
  83. data/vendor/assets/stylesheets/bootstrap/responsive-767px-max.less +193 -0
  84. data/vendor/assets/stylesheets/bootstrap/responsive-768px-979px.less +19 -0
  85. data/vendor/assets/stylesheets/bootstrap/responsive-navbar.less +189 -0
  86. data/vendor/assets/stylesheets/bootstrap/responsive-row-desktop.less +23 -0
  87. data/vendor/assets/stylesheets/bootstrap/responsive-tables.less +30 -0
  88. data/vendor/assets/stylesheets/bootstrap/responsive-utilities.less +59 -0
  89. data/vendor/assets/stylesheets/bootstrap/responsive.less +48 -0
  90. data/vendor/assets/stylesheets/bootstrap/rowlink.less +20 -0
  91. data/vendor/assets/stylesheets/bootstrap/scaffolding.less +53 -0
  92. data/vendor/assets/stylesheets/bootstrap/sprites.less +197 -0
  93. data/vendor/assets/stylesheets/bootstrap/tables.less +244 -0
  94. data/vendor/assets/stylesheets/bootstrap/thumbnails.less +53 -0
  95. data/vendor/assets/stylesheets/bootstrap/tooltip.less +70 -0
  96. data/vendor/assets/stylesheets/bootstrap/type.less +247 -0
  97. data/vendor/assets/stylesheets/bootstrap/utilities.less +30 -0
  98. data/vendor/assets/stylesheets/bootstrap/variables.less +302 -0
  99. data/vendor/assets/stylesheets/bootstrap/wells.less +29 -0
  100. metadata +241 -0
@@ -0,0 +1,355 @@
1
+ /* ===========================================================
2
+ * bootstrap-inputmask.js j2
3
+ * http://twitter.github.com/bootstrap/javascript.html#tooltips
4
+ * Based on Masked Input plugin by Josh Bush (digitalbush.com)
5
+ * ===========================================================
6
+ * Copyright 2012 Jasny BV, Netherlands.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License")
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ * ========================================================== */
20
+
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
24
+
25
+ var isIphone = (window.orientation !== undefined),
26
+ isAndroid = navigator.userAgent.toLowerCase().indexOf("android") > -1
27
+
28
+
29
+ /* INPUTMASK PUBLIC CLASS DEFINITION
30
+ * ================================= */
31
+
32
+ var Inputmask = function (element, options) {
33
+ if (isAndroid) return // No support because caret positioning doesn't work on Android
34
+
35
+ this.$element = $(element)
36
+ this.options = $.extend({}, $.fn.inputmask.defaults, options)
37
+ this.mask = String(options.mask)
38
+
39
+ this.init()
40
+ this.listen()
41
+
42
+ this.checkVal() //Perform initial check for existing values
43
+ }
44
+
45
+ Inputmask.prototype = {
46
+
47
+ init: function() {
48
+ var defs = this.options.definitions
49
+ var len = this.mask.length
50
+
51
+ this.tests = []
52
+ this.partialPosition = this.mask.length
53
+ this.firstNonMaskPos = null
54
+
55
+ $.each(this.mask.split(""), $.proxy(function(i, c) {
56
+ if (c == '?') {
57
+ len--
58
+ this.partialPosition = i
59
+ } else if (defs[c]) {
60
+ this.tests.push(new RegExp(defs[c]))
61
+ if(this.firstNonMaskPos === null)
62
+ this.firstNonMaskPos = this.tests.length - 1
63
+ } else {
64
+ this.tests.push(null)
65
+ }
66
+ }, this))
67
+
68
+ this.buffer = $.map(this.mask.split(""), $.proxy(function(c, i) {
69
+ if (c != '?') return defs[c] ? this.options.placeholder : c
70
+ }, this))
71
+
72
+ this.focusText = this.$element.val()
73
+
74
+ this.$element.data("rawMaskFn", $.proxy(function() {
75
+ return $.map(this.buffer, function(c, i) {
76
+ return this.tests[i] && c != this.options.placeholder ? c : null
77
+ }).join('')
78
+ }, this))
79
+ },
80
+
81
+ listen: function() {
82
+ if (this.$element.attr("readonly")) return
83
+
84
+ var pasteEventName = (navigator.userAgent.match(/msie/i) ? 'paste' : 'input') + ".mask"
85
+
86
+ this.$element
87
+ .on("unmask", $.proxy(this.unmask, this))
88
+
89
+ .on("focus.mask", $.proxy(this.focusEvent, this))
90
+ .on("blur.mask", $.proxy(this.blurEvent, this))
91
+
92
+ .on("keydown.mask", $.proxy(this.keydownEvent, this))
93
+ .on("keypress.mask", $.proxy(this.keypressEvent, this))
94
+
95
+ .on(pasteEventName, $.proxy(this.pasteEvent, this))
96
+ },
97
+
98
+ //Helper Function for Caret positioning
99
+ caret: function(begin, end) {
100
+ if (this.$element.length === 0) return
101
+ if (typeof begin == 'number') {
102
+ end = (typeof end == 'number') ? end : begin
103
+ return this.$element.each(function() {
104
+ if (this.setSelectionRange) {
105
+ this.setSelectionRange(begin, end)
106
+ } else if (this.createTextRange) {
107
+ var range = this.createTextRange()
108
+ range.collapse(true)
109
+ range.moveEnd('character', end)
110
+ range.moveStart('character', begin)
111
+ range.select()
112
+ }
113
+ })
114
+ } else {
115
+ if (this.$element[0].setSelectionRange) {
116
+ begin = this.$element[0].selectionStart
117
+ end = this.$element[0].selectionEnd
118
+ } else if (document.selection && document.selection.createRange) {
119
+ var range = document.selection.createRange()
120
+ begin = 0 - range.duplicate().moveStart('character', -100000)
121
+ end = begin + range.text.length
122
+ }
123
+ return {
124
+ begin: begin,
125
+ end: end
126
+ }
127
+ }
128
+ },
129
+
130
+ seekNext: function(pos) {
131
+ var len = this.mask.length
132
+ while (++pos <= len && !this.tests[pos]);
133
+
134
+ return pos
135
+ },
136
+
137
+ seekPrev: function(pos) {
138
+ while (--pos >= 0 && !this.tests[pos]);
139
+
140
+ return pos
141
+ },
142
+
143
+ shiftL: function(begin,end) {
144
+ var len = this.mask.length
145
+
146
+ if(begin<0) return
147
+
148
+ for (var i = begin,j = this.seekNext(end); i < len; i++) {
149
+ if (this.tests[i]) {
150
+ if (j < len && this.tests[i].test(this.buffer[j])) {
151
+ this.buffer[i] = this.buffer[j]
152
+ this.buffer[j] = this.options.placeholder
153
+ } else
154
+ break
155
+ j = this.seekNext(j)
156
+ }
157
+ }
158
+ this.writeBuffer()
159
+ this.caret(Math.max(this.firstNonMaskPos, begin))
160
+ },
161
+
162
+ shiftR: function(pos) {
163
+ var len = this.mask.length
164
+
165
+ for (var i = pos, c = this.options.placeholder; i < len; i++) {
166
+ if (this.tests[i]) {
167
+ var j = this.seekNext(i)
168
+ var t = this.buffer[i]
169
+ this.buffer[i] = c
170
+ if (j < len && this.tests[j].test(t))
171
+ c = t
172
+ else
173
+ break
174
+ }
175
+ }
176
+ },
177
+
178
+ unmask: function() {
179
+ this.$element
180
+ .unbind(".mask")
181
+ .removeData("inputmask")
182
+ },
183
+
184
+ focusEvent: function() {
185
+ this.focusText = this.$element.val()
186
+ var len = this.mask.length
187
+ var pos = this.checkVal()
188
+ this.writeBuffer()
189
+
190
+ var that = this
191
+ var moveCaret = function() {
192
+ if (pos == len)
193
+ that.caret(0, pos)
194
+ else
195
+ that.caret(pos)
196
+ }
197
+
198
+ if ($.browser.msie)
199
+ moveCaret()
200
+ else
201
+ setTimeout(moveCaret, 0)
202
+ },
203
+
204
+ blurEvent: function() {
205
+ this.checkVal()
206
+ if (this.$element.val() != this.focusText)
207
+ this.$element.trigger('change')
208
+ },
209
+
210
+ keydownEvent: function(e) {
211
+ var k=e.which
212
+
213
+ //backspace, delete, and escape get special treatment
214
+ if (k == 8 || k == 46 || (isIphone && k == 127)) {
215
+ var pos = this.caret(),
216
+ begin = pos.begin,
217
+ end = pos.end
218
+
219
+ if (end-begin === 0) {
220
+ begin = k!=46 ? this.seekPrev(begin) : (end=this.seekNext(begin-1))
221
+ end = k==46 ? this.seekNext(end) : end
222
+ }
223
+ this.clearBuffer(begin, end)
224
+ this.shiftL(begin,end-1)
225
+
226
+ return false
227
+ } else if (k == 27) {//escape
228
+ this.$element.val(this.focusText)
229
+ this.caret(0, this.checkVal())
230
+ return false
231
+ }
232
+ },
233
+
234
+ keypressEvent: function(e) {
235
+ var len = this.mask.length
236
+
237
+ var k = e.which,
238
+ pos = this.caret()
239
+
240
+ if (e.ctrlKey || e.altKey || e.metaKey || k<32) {//Ignore
241
+ return true
242
+ } else if (k) {
243
+ if (pos.end - pos.begin !== 0) {
244
+ this.clearBuffer(pos.begin, pos.end)
245
+ this.shiftL(pos.begin, pos.end-1)
246
+ }
247
+
248
+ var p = this.seekNext(pos.begin - 1)
249
+ if (p < len) {
250
+ var c = String.fromCharCode(k)
251
+ if (this.tests[p].test(c)) {
252
+ this.shiftR(p)
253
+ this.buffer[p] = c
254
+ this.writeBuffer()
255
+ var next = this.seekNext(p)
256
+ this.caret(next)
257
+ }
258
+ }
259
+ return false
260
+ }
261
+ },
262
+
263
+ pasteEvent: function() {
264
+ var that = this
265
+
266
+ setTimeout(function() {
267
+ that.caret(that.checkVal(true))
268
+ }, 0)
269
+ },
270
+
271
+ clearBuffer: function(start, end) {
272
+ var len = this.mask.length
273
+
274
+ for (var i = start; i < end && i < len; i++) {
275
+ if (this.tests[i])
276
+ this.buffer[i] = this.options.placeholder
277
+ }
278
+ },
279
+
280
+ writeBuffer: function() {
281
+ return this.$element.val(this.buffer.join('')).val()
282
+ },
283
+
284
+ checkVal: function(allow) {
285
+ var len = this.mask.length
286
+ //try to place characters where they belong
287
+ var test = this.$element.val()
288
+ var lastMatch = -1
289
+
290
+ for (var i = 0, pos = 0; i < len; i++) {
291
+ if (this.tests[i]) {
292
+ this.buffer[i] = this.options.placeholder
293
+ while (pos++ < test.length) {
294
+ var c = test.charAt(pos - 1)
295
+ if (this.tests[i].test(c)) {
296
+ this.buffer[i] = c
297
+ lastMatch = i
298
+ break
299
+ }
300
+ }
301
+ if (pos > test.length)
302
+ break
303
+ } else if (this.buffer[i] == test.charAt(pos) && i != this.partialPosition) {
304
+ pos++
305
+ lastMatch = i
306
+ }
307
+ }
308
+ if (!allow && lastMatch + 1 < this.partialPosition) {
309
+ this.$element.val("")
310
+ this.clearBuffer(0, len)
311
+ } else if (allow || lastMatch + 1 >= this.partialPosition) {
312
+ this.writeBuffer()
313
+ if (!allow) this.$element.val(this.$element.val().substring(0, lastMatch + 1))
314
+ }
315
+ return (this.partialPosition ? i : this.firstNonMaskPos)
316
+ }
317
+ }
318
+
319
+
320
+ /* INPUTMASK PLUGIN DEFINITION
321
+ * =========================== */
322
+
323
+ $.fn.inputmask = function (options) {
324
+ return this.each(function () {
325
+ var $this = $(this)
326
+ , data = $this.data('inputmask')
327
+ if (!data) $this.data('inputmask', (data = new Inputmask(this, options)))
328
+ })
329
+ }
330
+
331
+ $.fn.inputmask.defaults = {
332
+ mask: "",
333
+ placeholder: "_",
334
+ definitions: {
335
+ '9': "[0-9]",
336
+ 'a': "[A-Za-z]",
337
+ '?': "[A-Za-z0-9]",
338
+ '*': "."
339
+ }
340
+ }
341
+
342
+ $.fn.inputmask.Constructor = Inputmask
343
+
344
+
345
+ /* INPUTMASK DATA-API
346
+ * ================== */
347
+
348
+ $(document).on('focus.inputmask.data-api', '[data-mask]', function (e) {
349
+ var $this = $(this)
350
+ if ($this.data('inputmask')) return
351
+ e.preventDefault()
352
+ $this.inputmask($this.data())
353
+ })
354
+
355
+ }(window.jQuery);
@@ -0,0 +1,247 @@
1
+ /* =========================================================
2
+ * bootstrap-modal.js v2.3.1
3
+ * http://twitter.github.com/bootstrap/javascript.html#modals
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
+ /* MODAL CLASS DEFINITION
27
+ * ====================== */
28
+
29
+ var Modal = function (element, options) {
30
+ this.options = options
31
+ this.$element = $(element)
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)
34
+ }
35
+
36
+ Modal.prototype = {
37
+
38
+ constructor: Modal
39
+
40
+ , toggle: function () {
41
+ return this[!this.isShown ? 'show' : 'hide']()
42
+ }
43
+
44
+ , show: function () {
45
+ var that = this
46
+ , e = $.Event('show')
47
+
48
+ this.$element.trigger(e)
49
+
50
+ if (this.isShown || e.isDefaultPrevented()) return
51
+
52
+ this.isShown = true
53
+
54
+ this.escape()
55
+
56
+ this.backdrop(function () {
57
+ var transition = $.support.transition && that.$element.hasClass('fade')
58
+
59
+ if (!that.$element.parent().length) {
60
+ that.$element.appendTo(document.body) //don't move modals dom position
61
+ }
62
+
63
+ that.$element.show()
64
+
65
+ if (transition) {
66
+ that.$element[0].offsetWidth // force reflow
67
+ }
68
+
69
+ that.$element
70
+ .addClass('in')
71
+ .attr('aria-hidden', false)
72
+
73
+ that.enforceFocus()
74
+
75
+ transition ?
76
+ that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
77
+ that.$element.focus().trigger('shown')
78
+
79
+ })
80
+ }
81
+
82
+ , hide: function (e) {
83
+ e && e.preventDefault()
84
+
85
+ var that = this
86
+
87
+ e = $.Event('hide')
88
+
89
+ this.$element.trigger(e)
90
+
91
+ if (!this.isShown || e.isDefaultPrevented()) return
92
+
93
+ this.isShown = false
94
+
95
+ this.escape()
96
+
97
+ $(document).off('focusin.modal')
98
+
99
+ this.$element
100
+ .removeClass('in')
101
+ .attr('aria-hidden', true)
102
+
103
+ $.support.transition && this.$element.hasClass('fade') ?
104
+ this.hideWithTransition() :
105
+ this.hideModal()
106
+ }
107
+
108
+ , enforceFocus: function () {
109
+ var that = this
110
+ $(document).on('focusin.modal', function (e) {
111
+ if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
112
+ that.$element.focus()
113
+ }
114
+ })
115
+ }
116
+
117
+ , escape: function () {
118
+ var that = this
119
+ if (this.isShown && this.options.keyboard) {
120
+ this.$element.on('keyup.dismiss.modal', function ( e ) {
121
+ e.which == 27 && that.hide()
122
+ })
123
+ } else if (!this.isShown) {
124
+ this.$element.off('keyup.dismiss.modal')
125
+ }
126
+ }
127
+
128
+ , hideWithTransition: function () {
129
+ var that = this
130
+ , timeout = setTimeout(function () {
131
+ that.$element.off($.support.transition.end)
132
+ that.hideModal()
133
+ }, 500)
134
+
135
+ this.$element.one($.support.transition.end, function () {
136
+ clearTimeout(timeout)
137
+ that.hideModal()
138
+ })
139
+ }
140
+
141
+ , hideModal: function () {
142
+ var that = this
143
+ this.$element.hide()
144
+ this.backdrop(function () {
145
+ that.removeBackdrop()
146
+ that.$element.trigger('hidden')
147
+ })
148
+ }
149
+
150
+ , removeBackdrop: function () {
151
+ this.$backdrop && this.$backdrop.remove()
152
+ this.$backdrop = null
153
+ }
154
+
155
+ , backdrop: function (callback) {
156
+ var that = this
157
+ , animate = this.$element.hasClass('fade') ? 'fade' : ''
158
+
159
+ if (this.isShown && this.options.backdrop) {
160
+ var doAnimate = $.support.transition && animate
161
+
162
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
163
+ .appendTo(document.body)
164
+
165
+ this.$backdrop.click(
166
+ this.options.backdrop == 'static' ?
167
+ $.proxy(this.$element[0].focus, this.$element[0])
168
+ : $.proxy(this.hide, this)
169
+ )
170
+
171
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
172
+
173
+ this.$backdrop.addClass('in')
174
+
175
+ if (!callback) return
176
+
177
+ doAnimate ?
178
+ this.$backdrop.one($.support.transition.end, callback) :
179
+ callback()
180
+
181
+ } else if (!this.isShown && this.$backdrop) {
182
+ this.$backdrop.removeClass('in')
183
+
184
+ $.support.transition && this.$element.hasClass('fade')?
185
+ this.$backdrop.one($.support.transition.end, callback) :
186
+ callback()
187
+
188
+ } else if (callback) {
189
+ callback()
190
+ }
191
+ }
192
+ }
193
+
194
+
195
+ /* MODAL PLUGIN DEFINITION
196
+ * ======================= */
197
+
198
+ var old = $.fn.modal
199
+
200
+ $.fn.modal = function (option) {
201
+ return this.each(function () {
202
+ var $this = $(this)
203
+ , data = $this.data('modal')
204
+ , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
205
+ if (!data) $this.data('modal', (data = new Modal(this, options)))
206
+ if (typeof option == 'string') data[option]()
207
+ else if (options.show) data.show()
208
+ })
209
+ }
210
+
211
+ $.fn.modal.defaults = {
212
+ backdrop: true
213
+ , keyboard: true
214
+ , show: true
215
+ }
216
+
217
+ $.fn.modal.Constructor = Modal
218
+
219
+
220
+ /* MODAL NO CONFLICT
221
+ * ================= */
222
+
223
+ $.fn.modal.noConflict = function () {
224
+ $.fn.modal = old
225
+ return this
226
+ }
227
+
228
+
229
+ /* MODAL DATA-API
230
+ * ============== */
231
+
232
+ $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
233
+ var $this = $(this)
234
+ , href = $this.attr('href')
235
+ , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
236
+ , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
237
+
238
+ e.preventDefault()
239
+
240
+ $target
241
+ .modal(option)
242
+ .one('hide', function () {
243
+ $this.focus()
244
+ })
245
+ })
246
+
247
+ }(window.jQuery);