Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <jacobthornton@gmail.com>2011-12-21 06:02:47 +0400
committerJacob Thornton <jacobthornton@gmail.com>2011-12-21 06:02:47 +0400
commit1ef5fa7d6b4e50230c0c12919b0a06a9a2ac07f1 (patch)
tree72a3b02a1755096a9737451dea3030f0da65197d /js/bootstrap-modal.js
parent7df0d1c7d18a72f401094d08afa4eaa9142fe511 (diff)
giant refactor - all spec passing again...
Diffstat (limited to 'js/bootstrap-modal.js')
-rw-r--r--js/bootstrap-modal.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js
index 189bcf2acc..38f4f51a29 100644
--- a/js/bootstrap-modal.js
+++ b/js/bootstrap-modal.js
@@ -26,10 +26,9 @@
* ====================== */
var Modal = function ( content, options ) {
- this.settings = $.extend({}, $.fn.modal.defaults, options)
+ this.options = $.extend({}, $.fn.modal.defaults, options)
this.$element = $(content)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
- this.settings.show && this.show()
}
Modal.prototype = {
@@ -107,7 +106,7 @@
})
}
- function hideModal (that) {
+ function hideModal( that ) {
this.$element
.hide()
.trigger('hidden')
@@ -115,17 +114,17 @@
backdrop.call(this)
}
- function backdrop ( callback ) {
+ function backdrop( callback ) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
- if (this.isShown && this.settings.backdrop) {
+ if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
- if (this.settings.backdrop != 'static') {
+ if (this.options.backdrop != 'static') {
this.$backdrop.click($.proxy(this.hide, this))
}
@@ -156,7 +155,7 @@
function escape() {
var that = this
- if (this.isShown && this.settings.keyboard) {
+ if (this.isShown && this.options.keyboard) {
$(document).bind('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
@@ -176,6 +175,7 @@
, options = typeof option == 'object' && option
if (!data) $this.data('modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option]()
+ else if (data.options.show) data.show()
})
}
@@ -191,8 +191,8 @@
/* MODAL DATA-API
* ============== */
- $(document).ready(function () {
- $('body').delegate('[data-toggle="modal"]', 'click.modal.data-api', function ( e ) {
+ $(function () {
+ $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
var $this = $(this)
, target = $this.attr('data-target') || $this.attr('href')
, option = $(target).data('modal') ? 'toggle' : $this.data()
@@ -201,4 +201,4 @@
})
})
-}( window.jQuery || window.ender ) \ No newline at end of file
+}( window.jQuery ) \ No newline at end of file